// JavaScript Document

 
 
function toggleLayer(whichLayer)

{

if (document.getElementById)

{

// this is the way the standards work

var style2 = document.getElementById(whichLayer).style;

style2.display = style2.display? "":"block";

}

else if (document.all)

{

// this is the way old msie versions work

var style2 = document.all[whichLayer].style;

style2.display = style2.display? "":"block";

}

else if (document.layers)

{

// this is the way nn4 works

var style2 = document.layers[whichLayer].style;

style2.display = style2.display? "":"block";

}

}



function toggleLayerCity(whichLayer)

{

if (document.getElementById)

{

// this is the way the standards work

var style2 = document.getElementById(whichLayer).style;

if(style2.display == 'none')

style2.display = style2.display? "":"block";

else

style2.display = style2.display? "":"none";

}

else if (document.all)

{

// this is the way old msie versions work

var style2 = document.all[whichLayer].style;

style2.display = style2.display? "":"block";

}

else if (document.layers)

{

// this is the way nn4 works

var style2 = document.layers[whichLayer].style;

style2.display = style2.display? "":"block";

}

}


jQuery(document).ready(function($){
/*	$('.menu-header ul li:last-child > a').css('background', 'url("http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-right.gif") no-repeat right top transparent');
	$('.menu-header ul li > ul > li > a').css('background', 'none');
	$('.menu-header ul li > ul > li > a').hover(
	  function () {
		$(this).css("background", '#ccc');
	  },
	  function () {
		$(this).css("background", 'inherit');
	  }
	);	*/
	//$('.menu-header ul li:last-child').css('border', 'none');
	$('#menu2 td > a.current-page-ancestor').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg.gif) repeat-x 0 -38px');	
	$('#menu2 td.first > a.current-page-ancestor').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-left.gif) no-repeat left bottom');
	$('#menu2 td.last > a.current-page-ancestor').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-right.gif) no-repeat right bottom');
	$('#menu2 td > a.current-menu-item').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg.gif) repeat-x 0 -38px');	
	$('#menu2 td.first > a.current-menu-item').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-left.gif) no-repeat left bottom');
	$('#menu2 td.last > a.current-menu-item').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-right.gif) no-repeat right bottom');	
/*	$('.menu-header ul li:first-child.current-page-ancestor > a').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-left.gif) bottom left no-repeat');
	$('.menu-header ul li.current-page-ancestor > a').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-left.gif) bottom center no-repeat');	
	$('.menu-header ul li:first-child.current-page-ancestor > a').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-left.gif) bottom left no-repeat');
	$('.menu-header ul li:last-child.current-page-ancestor > a').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-right.gif) bottom right no-repeat');	
	$('.menu-header #menu-main-nav > li.current-menu-item > a').css('background', 'url(http://'+ document.domain +'/wp-content/themes/citiesofmigration/images/navbg-left.gif) bottom center no-repeat');
	$('#access ul.menu > li:last-child').css({'width' : '131px', 'text-align' : 'center'});
	$('#access ul.menu > li:last-child > ul li').css({'text-align' : 'left'});*/
	
	


/* Spotlight Accordion */
	
	//Set default open/close settings
	$('.spotlight_container').hide(); //Hide/close all containers
	$('.spotlight_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
	
	//On Click
	$('.spotlight_trigger').click(function(){
		if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
			$('.spotlight_trigger').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
			$(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
		}
		return false; //Prevent the browser jump to the link anchor
	});



/* Sidebar Tabs */
		
	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	


/* Mayors on Migration */
		
	$('#mayorsonmigration').tinycarousel({duration: 300});
	$('#home-slider').tinycarousel({ pager: true, controls: false, controls: false, interval: true, intervaltime: 8000 });
	
});


