﻿//teaser animation
	//timer setting
	var tXS=1500;
	//sets animation to start
	var aniNum="start";
	var usAgent=navigator.userAgent;
	//alert()
	
//setting side navigation height and width
function sideNavBG(){
	
	//get width and height for side navigation
	if(!document.all){
		//for none ie browsers
		var navHeight=jQuery("#blackBoxContainer").css('height');
		var navWidth=jQuery("#blackBoxContainer").css('width');
	}else{
		//for ie's needed version
		navHeight=jQuery('#blackBoxContainer').height()+'px';//get height
		navWidth=jQuery('#blackBoxContainer').width()+'px';//get width
	}
	
	jQuery("#blackBoxTransparency").css({height:navHeight});
	jQuery("#blackBoxColor").css({height:navHeight});
	
	}

//homepage navigation animation
function dropNavBG(){
		if(!document.all)
		jQuery("#NavCapper").animate({height:"76px"},tXS);
		else
		if(usAgent.indexOf("MSIE 6")==-1){
			jQuery("#NavCapper").animate({height:"74px"},tXS);
			}else{
		jQuery("#NavCapper").animate({height:"78px"},tXS);}
	}

//for resizing navigation topper if window is resized
function adjustNavBG(){
		jQuery("#NavCapper").css({width:jQuery(window).width()});
	}


	
	function animateBoxold(){
		
		//set array length
		if(aniNum=="start"){
			aniNum=jQuery('.animateIt').length;
		}
		
			if(!document.all){
				//for all browsers other then ie
				gWidth=jQuery('.animateIt:eq('+aniNum+')').css('width');//get width
			}else{
				//for ie's needed version
				gWidth=jQuery('.animateIt:eq('+aniNum+')').width()+'px';//get width
			}

		//animate it
		jQuery('.animateIt div.cBackground:eq('+aniNum+')').animate({width:gWidth, marginLeft: "0px"},tXS);
		jQuery('.animateIt div.wBackground:eq('+aniNum+')').animate({width:"0px"},tXS);
		if(aniNum>=0){
			aniNum--;
			setTimeout("animateBox()",tXS);
		}else{
			//end animations
			}
		//alert(aniNum)
	}
	
	function animateBox(){
		
		
		
		if(jQuery('.wideTease .animateIt div.cBackground')){
			jQuery('.wideTease .animateIt div.cBackground').animate({width:"488px", marginLeft: "0px"},tXS);
			
		}
		
		if(jQuery('.wideTease2 .TeaseTitle.animateIt div.cBackground')){
			jQuery('.wideTease2 .animateIt div.cBackground').animate({width:"720px", marginLeft: "0px"},tXS);
			}
		
		
		jQuery('.animateIt div.cBackground').not('.wideTease .animateIt div.cBackground').not('.wideTease2 .TeaseTitle.animateIt div.cBackground').animate({width:"240px", marginLeft: "0px"},tXS);//if(!jQuery('.wideTease2 .TeaseTitle')){}
		
		
		
		
		jQuery('.animateIt div.wBackground').animate({width:"0px"},tXS);	
	}
	
	function getE(){
	//alert(jQuery('.animateIt').length)
	//jQuery('.commen div:odd').css({color:"red"});
	//loop over properly clasnamed items
		for(i=0;i<jQuery('.animateIt').length;i++){
			if(!document.all){
				//for all browsers other then ie
				gHeight=jQuery('.animateIt:eq('+i+')').css('height');//get height
				gWidth=jQuery('.animateIt:eq('+i+')').css('width');//get width
			}else{
				//for ie's needed version
				gHeight=jQuery('.animateIt:eq('+i+')').height()+'px';//get height
				gWidth=jQuery('.animateIt:eq('+i+')').width()+'px';//get width
				
			}
			
			//set width and height of the div so background is right on
			jQuery('.animateIt div.wBackground:eq('+i+')').css({height:gHeight, width:gWidth, opacity:.60,display:'block'});
			//position color overlay
			jQuery('.animateIt div.cBackground:eq('+i+')').css({marginLeft:gWidth, height:gHeight })
			
		}
		//loop over regular boxes and transparent them
		//alert(jQuery('.defaultColor').length)  .defaultColor div.innerContent
		for(j=0;j<jQuery('.defaultColor').length;j++){
			if(!document.all){
				//for all browsers other then ie
				gHeight=jQuery('.defaultColor:eq('+j+')').css('height');//get height
				gWidth=jQuery('.defaultColor:eq('+j+')').css('width');//get width
			}else{
				//for ie's needed version
				gHeight=jQuery('.defaultColor:eq('+j+')').height()+'px';//get height
				gWidth=jQuery('.defaultColor:eq('+j+')').width()+'px';//get width
				
			}
			//set width and height of the div so background is right on
			jQuery('.defaultColor div.wBackground:eq('+j+')').css({height:gHeight, width:gWidth, opacity:.60,display:'block'});
			jQuery('.defaultColor').hover(function(){
				jQuery(this).find('div.wBackground').animate({opacity:.75}, 1000);//.css({opacity:.95})
				
				}, function(){
						jQuery(this).find('div.wBackground').animate({opacity:.60}, 1000);//.css({opacity:.65});
					})
			
			/*jQuery('.animateIt').hover(function(){
				jQuery(this).find('div.wBackground').animate({opacity:.70}, 500);//.css({opacity:.95})
				
				}, function(){
						jQuery(this).find('div.wBackground').animate({opacity:.60}, 500);//.css({opacity:.65});
					})*/
			
			jQuery('.defaultColor:eq('+j+')').css({background:'none'});
			jQuery('.defaultColor div.innerContent:eq('+j+')').css({background:'none',position:'relative',zIndex:20});
			}
		
		//setTimeout("animateBox()",tXS);
		animateBox();
		
		if(setMainNavDrop==true){
			//set time out for top nav to start
			//setTmoutLvl=tXS;
			//alert(tXS+" "+setTmoutLvl)
			//setTimeout("dropNavBG()",setTmoutLvl);
			dropNavBG()
		}
	}
	
	
	function addScroll(){
			//test for top of page
			osTop=jQuery(window).scrollTop();
			//if top of page--show if not hide		
			if(osTop==0){
				jQuery('#colorImgBg').animate({opacity:1},70);
			}else{
				jQuery('#colorImgBg').animate({opacity:0},270);
			}

		}
		
		
	function lineUp(){
	
		osLft=jQuery('#blackBoxContainer').offset().left+230;
		osTop=jQuery('#blackBoxContainer').offset().top;
		osHeight=jQuery('#blackBoxContainer').height();
		setLftSide=10;
		
		if(usAgent.indexOf("MSIE 6")==-1){
			jQuery("#colorImgBg").css({height:osHeight+'px', width:osLft+'px', left:setLftSide+'px', opacity:0,display:'block'});
			jQuery("#colorImgBg").scrollTo( {top:osTop+'px', left:setLftSide+'px'}, 0 );
			//
			jQuery("#colorImgBg").animate({opacity:1},tXS);
		}

	}

function windowSC(){
	osLft=jQuery('#blackBoxContainer').offset().left+230;
	jQuery("#colorImgBg").css({width:osLft+'px'});
}
	
	//window.onload=function(){}
	
	window.onresize=function(){
		adjustNavBG();
		windowSC();
	}
	
	jQuery(window).scroll(function () {
		addScroll()						   
	})
	
	
// Advocacy Map Light box

	function closeLB(){
		jQuery("#advacyMapLB").remove();
		}
		
	function launchLB(){
			//alert(this.getAttribute('href'))
			jQuery('body').prepend('<div id="advacyMapLB"><div id="opLayer"></div><div class="c" style="width:798px;height:625px;margin:0px auto 0px auto;"><a href="javascript:viod(0)" onclick="closeLB()" ><img src="/common/images/template/gallery_close.gif" alt="close" /></a><iframe scrolling="no" src="'+this.getAttribute('href')+'"  frameborder="0" allowtransparency="true" ></iframe></div></div>');
			jQuery("#advacyMapLB iframe").css({width:'798px',height:'625px',margin:'30px auto 0px auto'});
			jQuery("#advacyMapLB").css({width:jQuery(window).width(),height:jQuery(window).height()});
			jQuery("#advacyMapLB #opLayer").css({width:jQuery(window).width(),height:jQuery(window).height(),opacity:.5});
			return false;
			
			
		}	
		
		function launchLB2(){
			//alert(this.getAttribute('href'))
			jQuery('body').prepend('<div id="advacyMapLB"><div id="opLayer"></div><div class="c" style="width:798px;height:625px;margin:0px auto 0px auto;"><a href="javascript:viod(0)" onclick="closeLB()" ><img src="/common/images/template/gallery_close.gif" alt="close" /></a><iframe scrolling="no" src="/common/flash/advocacy_map/index.html"  frameborder="0" allowtransparency="true" ></iframe></div></div>');
			jQuery("#advacyMapLB iframe").css({width:'798px',height:'625px',margin:'30px auto 0px auto'});
			jQuery("#advacyMapLB").css({width:jQuery(window).width(),height:jQuery(window).height()});
			jQuery("#advacyMapLB #opLayer").css({width:jQuery(window).width(),height:jQuery(window).height(),opacity:.5});
			
			
		}
		
		function determiner(links){
			
				if(links=="/common/flash/advocacy_map/index.html"){
						launchLB2();
					}else{
						window.location=links;
						}
			}
		
	jQuery(document).ready(function(){
		jQuery('a.advocacyLinkMap').bind('click', launchLB);
	
							   })
