$(document).ready(function(){

	/* Showing Corporate/Government tab first */
		$("div.corporate").attr("id","active");
	
	/* Showing Corporate/Government tab first */
		$("ul#vertical_selection li#corporate").addClass("selected");
	/* Showing first role tab */	
		$("li.tab_1 links").attr("id","active");
		
	/* Selected role tab */	
		$("li.tab_1").addClass('active_tab');
		
	/* Preselected News, Shows, and Awards */	
		$("ul.box li").addClass("box_hidden");
		$("li.corporate_box").removeClass("box_hidden");
		
	/* "Vertical" buttons behaviour */
		$("a.corporate").bind("click", 
			function(){
				$("ul#vertical_selection li").removeClass("selected");
				$("ul#vertical_selection li#corporate").addClass("selected");
				$("div#active").attr("id","hidden");
				$("div.corporate").attr("id","active");
				$("ul.box li").addClass("box_hidden");
				$("li.corporate_box").removeClass("box_hidden");
				
});
					
		$("a.education").bind("click", 
			function(){
				$("ul#vertical_selection li").removeClass("selected");
				$("ul#vertical_selection li#education").addClass("selected");
				$("div#active").attr("id","hidden");
				$("div.education").attr("id","active");
				$("ul.box li").addClass("box_hidden");
				$("li.education_box").removeClass("box_hidden");
					});
					
		$("a.government").bind("click", 
			function(){
				$("ul#vertical_selection li").removeClass("selected");
				$("ul#vertical_selection li#government").addClass("selected");
				$("div#active").attr("id","hidden");
				$("div.government").attr("id","active");
				$("ul.box li").addClass("box_hidden");
				$("li.government_box").removeClass("box_hidden");
					});
										
		$("a.hospitality").bind("click", 
			function(){
				$("ul#vertical_selection li").removeClass("selected");
				$("ul#vertical_selection li#hospitality").addClass("selected");
				$("div#active").attr("id","hidden");
				$("div.hospitality").attr("id","active");
				$("ul.box li").addClass("box_hidden");
				$("li.hospitality_box").removeClass("box_hidden");
					});
					
		$("a.library").bind("click", 
			function(){
				$("ul#vertical_selection li").removeClass("selected");
				$("ul#vertical_selection li#library").addClass("selected");
				$("div#active").attr("id","hidden");
				$("div.library").attr("id","active");
				$("ul.box li").addClass("box_hidden");
				$("li.library_box").removeClass("box_hidden");
						
		$("a.homeuser").bind("click", 
			function(){
				$("ul#vertical_selection li").removeClass("selected");
				$("ul#vertical_selection li#homeuser").addClass("selected");
				$("div#active").attr("id","hidden");
				$("div.homeuser").attr("id","active");
				$("ul.box li").addClass("box_hidden");
				$("li.homeuser_box").removeClass("box_hidden");
					});				});
					
	/* End "Vertical" buttons behaviour */
	
	/* "Roles" tabs behaviour*/
		$("a#tab_1").bind("click", 
			function(){
				$("ul.roles_tabs li").removeClass('active_tab');
				$("li.tab_1").addClass('active_tab');
				$("div.links").attr("id","tab_hidden");
				$("div.tab_1").attr("id","tab_active");
					});
		$("a#tab_2").bind("click", 
			function(){
				$("ul.roles_tabs li").removeClass('active_tab');
				$("li.tab_2").addClass('active_tab');
				$("div.links").attr("id","tab_hidden");
				$("div.tab_2").attr("id","active");
					});
				
		$("a#tab_3").bind("click", 
			function(){
				$("ul.roles_tabs li").removeClass('active_tab');
				$("li.tab_3").addClass('active_tab');
				$("div.links").attr("id","tab_hidden");
				$("div.tab_3").attr("id","tab_active");
					});
		$("a#tab_4").bind("click", 
			function(){
				$("ul.roles_tabs li").removeClass('active_tab');
				$("li.tab_4").addClass('active_tab');
				$("div.links").attr("id","tab_hidden");
				$("div.tab_4").attr("id","tab_active");
					});
		$("a#tab_5").bind("click", 
			function(){
				$("ul.roles_tabs li").removeClass('active_tab');
				$("li.tab_5").addClass('active_tab');
				$("div.links").attr("id","tab_hidden");
				$("div.tab_5").attr("id","tab_active");
					});
	/* End "Roles" tabs behaviour*/
});


/* Rotating Banner*/
var Current = 0;
var Total = 0;
var Duration = 3000;
var intInterval = 0;
var Go = 1;
var IsPause = false;

$(document).ready(function() {	
	$("div#slideshow_controls ul li a#1").css("color", "#ffffff");// - assign color to starting slide thumbnail
	
	Total = $(".slides").children().size() -1;
		
	intInterval = setInterval(Loop, Duration);
	
});

function Switch(){
	clearInterval(intInterval);
	intInterval = setInterval(Loop, Duration);
	Loop();
}

function Loop(){
	if(Go == 1){
		Current == Total ? Current = 0 : Current++;
	} else {
		Current == 0 ? Current = Total : Current--;
	}
		
	$("#welcome_message").find(".slide").each(function(i) { 
		if(i == Current){
			
			$(this).animate({ opacity: 'show' }, 0);
			
			if(i === 0){
				$("div#slideshow_controls ul li a").css("color", "#666666");
				$("div#slideshow_controls ul li a#1").css("color", "#ffffff");
				}else if(i === 1){		
						$("div#slideshow_controls ul li a").css("color", "#666666");
						$("div#slideshow_controls ul li a#2").css("color", "#ffffff");
						}else if(i === 2){
								$("div#slideshow_controls ul li a").css("color", "#666666");
								$("div#slideshow_controls ul li a#3").css("color", "#ffffff");
								}
		} else {
			$(this).animate({ opacity: 'hide'}, 0);
		}
		
	});
}


/*End Rotating Banner*/

/* Counter for the banner*/
$(document).ready(function(){
	
	$("#slideshow_controls ul li a#1").click(function(){
	$("div.slide").animate({ opacity: 'hide' }, 0);		
	$("div.1").animate({ opacity: 'show' }, 0);
	$("#slideshow_controls ul li a").css('color', '#666666');
	$("#slideshow_controls ul li a#1").css('color', '#ffffff');
	});
	
	$("#slideshow_controls ul li a#2").click(function(){
	$("div.slide").animate({ opacity: 'hide' }, 0);	
	$("div.2").animate({ opacity: 'show' }, 0);
	$("#slideshow_controls ul li a").css('color', '#666666');
	$("#slideshow_controls ul li a#2").css('color', '#ffffff');
	
	});
	
	$("#slideshow_controls ul li a#3").click(function(){
	$("div.slide").animate({ opacity: 'hide' }, 0);	
	$("div.3").animate({ opacity: 'show' }, 0);
	$("#slideshow_controls ul li a").css('color', '#666666');
	$("#slideshow_controls ul li a#3").css('color', '#ffffff');
	
	});
	
})/* END Counter for the banner*/



/*Accordion*/
$("#firstpane h3.acc_head").click(function()
{
    $(this).next("div.acc_body").slideToggle(300).siblings("div.acc_body").slideUp("slow");
    
    
});
$(document).ready(function(){
			$("h3#acc1.acc_head").toggle(
			function(){
				$("img#ar1.arrow").attr("src", "../../images/up.png");
			}, 
			function(){$("img.arrow").attr("src", "../../images/down.png")});
			$("h3#acc2.acc_head").toggle(
			function(){
				$("img#ar2.arrow").attr("src", "../../images/up.png");
			}, 
			function(){$("img.arrow").attr("src", "../../images/down.png")});
			$("h3#acc3.acc_head").toggle(
			function(){
				$("img#ar3.arrow").attr("src", "../../images/up.png");
			}, 
			function(){$("img.arrow").attr("src", "../../images/down.png")});
		});

$(document).ready(
		function ResizeBoxes(){
	
			var Box1 = $("div#box1.content_footer_boxes").height();
			var Box2 = $("div#box2.content_footer_boxes").height();
			var Box3 = $("div#box3.content_footer_boxes").height();
		
			if(Box1 >= Box2 && Box1 >= Box3){
				$("div#box2.content_footer_boxes").height(Box1);
				$("div#box3.content_footer_boxes").height(Box1);
				$("a").bind("click", function(){
					var Box1 = $("div#box1.content_footer_boxes").height();
					var Box2 = $("div#box2.content_footer_boxes").height();
					var Box3 = $("div#box3.content_footer_boxes").height();
					$("div#box2.content_footer_boxes").height(Box1);
					$("div#box3.content_footer_boxes").height(Box1);
				}); 
			}else if(Box2 > Box1 && Box2 > Box3){
				$("div#box1.content_footer_boxes").height(Box2);
				$("div#box3.content_footer_boxes").height(Box2);
					$("a").bind("click", function(){
						var Box1 = $("div#box1.content_footer_boxes").height();
						var Box2 = $("div#box2.content_footer_boxes").height();
						var Box3 = $("div#box3.content_footer_boxes").height();
						$("div#box1.content_footer_boxes").height(Box2);
						$("div#box3.content_footer_boxes").height(Box2);
					}); 
			}else{
				$("div#box1.content_footer_boxes").height(Box3);
				$("div#box2.content_footer_boxes").height(Box3);
					$("a").bind("click", function(){
						var Box1 = $("div#box1.content_footer_boxes").height();
						var Box2 = $("div#box2.content_footer_boxes").height();
						var Box3 = $("div#box3.content_footer_boxes").height();
						$("div#box1.content_footer_boxes").height(Box3);
						$("div#box2.content_footer_boxes").height(Box3);
					}); 
			}
	});
	
	
	$(document).ready(function(){
 	   var H = $("div#column_wrapper").height();
 	  	$("div#left_col").height(H+10);
  	 	$("div.evaluate").height(H+20);
  	 	$("div#right_col").height(H+20);
  	  	$("a").bind("click", function(){
     	var H = $("div#column_wrapper").height();
        $("div#left_col").height(H+10);
    	$("div.evaluate").height(H+20);
       	 });    
	});

$(document).ready(function(){
		var SideBarHeight = $("#sidebar_right").height(); 
		var ContentHeight = $("#main_content-left_col").height();
		
		
		if(SideBarHeight < ContentHeight){
		
				$("#sidebar_right").height(ContentHeight+20);
				$("#product_content").height(ContentHeight+20);
				
				$("a#tab_2, a#tab_3").bind("click", function(){
						
					$("#main_content-left_col_footer").css("margin-top", 170+"px");
					var ContentHeight = $("#main_content-left_col").height();
					$("#sidebar_right").height(ContentHeight+20);
					$("#product_content").height(ContentHeight+20);		
				});
				
				$("a#tab_1").bind("click", function(){
						
					$("#main_content-left_col_footer").css("margin-top", 20+"px");
					var ContentHeight = $("#main_content-left_col").height();
					$("#sidebar_right").height(ContentHeight+20);
					$("#product_content").height(ContentHeight+20);		
				});
				
			}else if(SideBarHeight > ContentHeight){
			
				$("#product_content").height(SideBarHeight+20);
				$("#sidebar_right").height(SideBarHeight+20);
				
				$("a").bind("click", function(){
						var ContentHeight = $("#main_content-left_col").height();
						$("#main_content-left_col").height(SideBarHeight +20 );
						$("#product_content").height(SideBarHeight +20);
				});
			}
			
	
		});
