jQuery.noConflict();

var numBanners;
var rotationTimer;
function rotateBillboard(){
					
	var lastBoard = "banner"+numBanners;
					
	if(jQuery(".active").attr("id")==lastBoard){
		jQuery("#bannerNav a").eq(0).click();
	}
	else{
		jQuery(".activeBoard").next('a').click();	
	}
	rotationTimer = setTimeout("rotateBillboard()",5000);
}


jQuery(document).ready(function(){
				  

			// BILLBOARD
				
				 numBanners = jQuery('.billboard').size();
				

			//create the buttons if there is more than one billboard
				
				if (numBanners>1){
				var theLinks = "";
				
				for (var i=1;i<=numBanners;i++){
					
					theLinks = theLinks + '<a href="#" rel="banner'+i+'"></a>';
					
					
				}
				theLinks = theLinks + '<br clear="all"/>';
				jQuery("#bannerNav").html(theLinks);
				jQuery("#bannerNav a").eq(0).addClass("activeBoard");
				
				var navWidth = numBanners*26;
				navWidth = navWidth + "px";
				
				jQuery("#bannerNav").css({"width":navWidth})
				
				}
				
				
				
				
				jQuery("#bannerNav a").click(function(){
					
					var loadBanner = "#"+jQuery(this).attr("rel");
					
					if(jQuery(loadBanner).hasClass('active')){
						return false;
					}
					else{
						jQuery(".active").fadeOut("fast",function(){
							jQuery(".active").removeClass('active');
							
							jQuery(loadBanner).addClass('active').fadeIn("fast");								 
															 
						});
						jQuery(".activeBoard").removeClass("activeBoard")
						jQuery(this).addClass("activeBoard");
						clearTimeout(rotationTimer);
						return false;
					}
												 
				})
				
				rotationTimer = setTimeout("rotateBillboard()",5000);				
				
				
				/////////////Sign In Trigger////////////
				
				/*jQuery("#signInTrigger").click(function(){
					jQuery(this).toggleClass("open");						   
					jQuery("#infopanel_loggedout.infoPanel").slideToggle(300)
				})*/
				
				
				/////////////Select Country ////////////
				jQuery('#locale_selector').css("display","block").attr('id', 'countryList');
				jQuery("#countryList li:first").eq(0).click(function(){
							
							if(jQuery("#footer #countryList li.hideable").is(':visible')){
								
								jQuery("#footer #countryList").animate({"height":"18px","top":"6px"},80,function(){
											jQuery("#footer #countryList li.hideable").hide();})
							}
							else{
							jQuery("#footer #countryList li.hideable").show();
							jQuery("#footer #countryList").animate({"height":"288px","top":"-264px"},80)
							}
							//jQuery("#footer #countryList li.hideable").slideUp(300)
							return false;
													   
				})
				
})