// When the document loads do everything inside here ...
$(document).ready(function(){				   
	
	//homepage show -- covers for non flash browsers
	$(document).oneTime(3000, function() {
   		$("#home-page #inside-wrapper").css('visibility','visible');
   		$("#home-page #flash-holder").css('visibility','visible');
 	});
	
	//hide OTP onclick
	$("#bigflash").click(function(){
		$(this).hide();
	});
	
	//external links
	$('a[@href^="http://"]').attr("target", "_blank");		
	
	// Existing Partnerships style	
	$("dl.local_partnerships dd:odd, dl.local_partnerships2 dd:even").css('background-color','#f1f1f1');
	
	
	// timeline style	
	$("dl.timeline dd:odd").css('background-color','#f1f1f1');
	
	// myths
	//--------------------------------------------------------------------------------------------------------------------	
	//arrow for myth expanders
	$("dl.myths dt").append("<img src='images/arrows_black.gif' width='20' height='18' alt='' border='0' class='arrow' />");

	//myth collapse
	$("dl.myths dd").hide();

	$("dl.myths dt").click(function(){
		if ($(this).next().is(".hot")){
			$("dd.hot").slideToggle('fast').removeClass("hot");
			$(this).append("<img src='images/arrows_black.gif' width='20' height='18' alt='' border='0' class='arrow' />");
			}
		else{
			$("dd.hot").prev().append("<img src='images/arrows_black.gif' width='20' height='18' alt='' border='0' class='arrow' />");
			$("dd.hot").slideToggle('fast').removeClass("hot");
			$(this).children().remove();
			$(this).next().slideToggle().addClass("hot");
			}
	});
	
	//myths hover
	$("dl.myths dt").hover(
		function () {
			$(this).addClass('hover');
		}, 
		function () {
			$(this).removeClass('hover');
		}
	);
	//--------------------------------------------------------------------------------------------------------------------	
	
	// reforms
	//--------------------------------------------------------------------------------------------------------------------
	//arrow for reform expanders
	$("#reform_examples h2").append("<img src='images/arrows_black.gif' width='20' height='18' alt='' border='0' class='arrow' />");

	//reform examples collapse
	$("#reform_examples h2").next().hide();
	
	$("#reform_examples h2").click(function(){
		if ($(this).next().is(".hot")){
			$("div.hot").slideToggle('fast').removeClass("hot");
			$(this).append("<img src='images/arrows_black.gif' width='20' height='18' alt='' border='0' class='arrow' />");
			}
		else{
			$("div.hot").prev().append("<img src='images/arrows_black.gif' width='20' height='18' alt='' border='0' class='arrow' />");
			$("div.hot").slideToggle('fast').removeClass("hot");
			$(this).children().remove();
			$(this).next().slideToggle().addClass("hot");
			}
	});
	
	//reform hover
	$("#reform_examples h2").hover(
		function () {
			$(this).addClass('hover');
		}, 
		function () {
			$(this).removeClass('hover');
		}
	);
	
	//--------------------------------------------------------------------------------------------------------------------
	
	

});
