var Site = {

	start : function(){
		Site.homepagebanner ();
		Site.bannertips ();
		Site.catimg_hover();
	},

	
	homepagebanner : function() {
		
		var divs = $$(['kb', 'nhe', 'bg']);
		divs.each(function(div){
			var links = $(div.id + 'banner');
			div.setStyle('display', 'none');
			
			// set first banner to display
			$('kb').setStyle('display', 'block');			
			
			var ulid = $$('#kb_banner_ul a');
			
			// remove current styles
			ulid.each(function (e) {
				e.addEvent('click', function () {
					ulid.removeClass('cur_kb');
					this.addClass('cur_kb');
				});
			});	
			
			
			links.addEvent('click', function(e){
					
				e = new Event(e);
				divs.each(function(other){

					if (other != div) other.setStyle('display', 'none');
					
					
				});
				//div.setStyle('display', (div.getStyle('display') == 'block') ? 'none' : 'block');
				div.setStyle('display', 'block');
				e.stop();
				
				
				
			});
		});	
		
	},
	
	bannertips : function(){
		
		var Tips2 = new Tips($$('.kb_tip'), {
			initialize:function(){
				this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
			},
			onShow: function(toolTip) {
				this.fx.start(1);
			},
			onHide: function(toolTip) {
				this.fx.start(0);
			},
			fixed: true,
			offsets: {'x': 10, 'y': -90}
		});
		
		var Tips3 = new Tips($$('.kb_tip_sh'), {
			initialize:function(){
				this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
			},
			onShow: function(toolTip) {
				this.fx.start(1);
			},
			onHide: function(toolTip) {
				this.fx.start(0);
			},
			fixed: true,
			offsets: {'x': 10, 'y': -103}
		});

	},
	
	fadeinbilly : function (){
		var billyimg = $('welcomeflash');
		
		billyimg.addClass('subwel');
		billyimg.setHTML('');
		billyimg.setStyle('opacity', 0);
		//billyimg.setHTML('<img src="../../img/graphics/billy_welcome.png" class="billy" id=""/>')
		billyimg.style.display = 'block';
		billyimg.effect('opacity').start(0,1);
		
		$('billydiv').setStyle('display','block');
		billyimg.setStyle('display','none');

		//Cookie.set('flashviewed', 'true', {duration: 365}); // save this for 1 year

		
	},
	
	fadeinbilly_list : function (parent_id){
		var billyimg = $('introflash');
		
		billyimg.setHTML('');
		billyimg.setStyle('opacity', 0);
		//billyimg.setHTML('<img src="../../img/graphics/billy_welcome.png" class="billy" id=""/>')
		billyimg.style.display = 'block';
		billyimg.effect('opacity').start(0,1);
		
		$('billydiv_list').setStyle('display','block');
		billyimg.setStyle('display','none');

		//Cookie.set('flashviewed_list_'+parent_id, 'true', {duration: 365}); // save this for 1 year

		
	},
	
	splashfade : function () {
			
		var box = $('box');
		var fx = box.effects({duration: 1000, transition: Fx.Transitions.Quart.easeOut});
		 
		fx.start({
			'width': 1000,
			'height': getHeight()
		}).chain(function(){

				top.location.href = web_address+'content/pages/index.asp';
				
				//new Ajax("redirect.asp", {
					//method: 'get',
					//update: $('bodybox')
				//}).request();		*/			
				
		});		
		
	},
	
	
	catimg_hover : function(){
	
		$$('.cat_img').each(function(item){
									 
			var idarray=item.id.split("_");
			var itemid = idarray[1];
									 
		
			item.addEvent('mouseover', function(e) {
											
				$('a_'+itemid).addClass('a_hover');
				$('span_'+itemid).addClass('span_hover');
					
			});
			
			item.addEvent('mouseout', function(e) {
											
				$('a_'+itemid).removeClass('a_hover');
				$('span_'+itemid).removeClass('span_hover');
				
			});
		
		});
	
	}

	

	
	
};

window.addEvent('load', Site.start);