
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
// CUSTOM FUNCTIONS  - - - - - - - - - - - - - - - - - - - - - - - - - - >

 function update_btn_state(){
 	
	var loc_str = document.location.toString();
	
		// At Home															  
		
		if(loc_str.indexOf("at_home")!=-1){
				document.getElementById('btn_at_home').src = 'images/site_nav/btn_header_at_home_over.jpg';
			}
		if(loc_str.indexOf("at_home_civil_rights")!=-1){
				document.getElementById('btn_rights').src = 'images/site_nav/btn_at_home_civil_rights_over.jpg';
			}
		if(loc_str.indexOf("at_home_communication")!=-1){
				document.getElementById('btn_communication').src = 'images/site_nav/btn_at_home_communication_over.jpg';
			}
		if(loc_str.indexOf("at_home_family")!=-1){
				document.getElementById('btn_family').src = 'images/site_nav/btn_at_home_family_over.jpg';
			}
		if(loc_str.indexOf("at_home_war_production")!=-1){
				document.getElementById('btn_war_prod').src = 'images/site_nav/btn_at_home_war_prod_over.jpg';
			}
	
		// At War															  
		
		if(loc_str.indexOf("at_war")!=-1){
				document.getElementById('btn_at_war').src = 'images/site_nav/btn_header_at_war_over.jpg';
			}
		if(loc_str.indexOf("at_war_infantry")!=-1){
				document.getElementById('btn_war_infantry').src = 'images/site_nav/btn_at_war_infantry_over.jpg';
			}
		if(loc_str.indexOf("at_war_battle")!=-1){
				document.getElementById('btn_battle').src = 'images/site_nav/btn_at_war_face_battle_over.jpg';
			}
		if(loc_str.indexOf("at_war_timeline")!=-1){
				document.getElementById('btn_timeline').src = 'images/site_nav/btn_at_war_timeline_over.jpg';
			}
		if(loc_str.indexOf("at_war_democracy")!=-1){
				document.getElementById('btn_democracy').src = 'images/site_nav/btn_at_war_democracy_over.jpg';
			}
		
		// THE WITNESSES															  
		
		if(loc_str.indexOf("the_witnesses")!=-1){
				document.getElementById('btn_witnesses').src = 'images/site_nav/btn_header_the_witnesses_over.jpg';
			}
		if(loc_str.indexOf("the_witnesses_homefront")!=-1){
				document.getElementById('btn_homefront').src = 'images/site_nav/btn_witnesses_homefront_over.jpg';
			}
		if(loc_str.indexOf("the_witnesses_warfront")!=-1){
				document.getElementById('btn_warfront').src = 'images/site_nav/btn_witnesses_warfront_over.jpg';
			}
		if(loc_str.indexOf("the_witnesses_towns")!=-1){
				document.getElementById('btn_towns').src = 'images/site_nav/btn_witnesses_fourtowns_over.jpg';
			}
		

		// Search & Explore													  
		
		if(loc_str.indexOf("search.")!=-1 && loc_str.indexOf("edu_search_explore")==-1){
				document.getElementById('btn_search_explore').src = 'images/site_nav/btn_header_search_explore_over.jpg';
				document.getElementById('btn_themes_topics').src = 'images/site_nav/btns_search_themes_over.jpg';
			}
		if(loc_str.indexOf("search_")!=-1 && loc_str.indexOf("edu_search_explore")==-1){
				document.getElementById('btn_search_explore').src = 'images/site_nav/btn_header_search_explore_over.jpg';
				document.getElementById('btn_themes_topics').src = 'images/site_nav/btns_search_themes_over.jpg';
			}
		if(loc_str.indexOf("media_gallery")!=-1 && loc_str.indexOf("edu_search_explore")==-1){
				document.getElementById('btn_search_explore').src = 'images/site_nav/btn_header_search_explore_over.jpg';
				document.getElementById('btn_media_gallery').src = 'images/site_nav/btns_search_gallery_over.jpg';
			}
		if(loc_str.indexOf("favorites.")!=-1 && loc_str.indexOf("edu_search_explore")==-1){
				document.getElementById('btn_search_explore').src = 'images/site_nav/btn_header_search_explore_over.jpg';
				document.getElementById('btn_favorites').src = 'images/site_nav/btns_search_favorites_over.jpg';
			}

		// About the Series													  
		
		if(loc_str.indexOf("about_letter_from_producers")!=-1){
				document.getElementById('about_letter_from_producers').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_ken_burns")!=-1){
				document.getElementById('about_ken_burns_bio').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_lynn_novick")!=-1){
				document.getElementById('about_lynn_novick_bio').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_geoffrey_c_ward_bio")!=-1){
				document.getElementById('about_geoffrey_c_ward_bio').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_sarah_botstein_bio")!=-1){
				document.getElementById('about_sarah_botstein_bio').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_production_credits")!=-1){
				document.getElementById('about_production_credits').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_site_credits")!=-1){
				document.getElementById('about_site_credits').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_music")!=-1){
				document.getElementById('about_music').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_making_the_war")!=-1){
				document.getElementById('about_making_the_war').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_episode_guide")!=-1){
				document.getElementById('about_episode_guide').className = 'about_nav_active';
			}
		if(loc_str.indexOf("about_shop_for_the_war")!=-1){
				document.getElementById('about_shop_for_the_war').className = 'about_nav_active';
			}
		if(loc_str.indexOf("broadcast_schedule")!=-1){
				document.getElementById('broadcast_schedule').className = 'about_nav_active';
			}
		if(loc_str.indexOf("wallpapers")!=-1){
				document.getElementById('wallpapers').className = 'about_nav_active';
			}

		// Episode Guide													  
		
		if(loc_str.indexOf("about_episode_guide_01")!=-1){
				document.getElementById('about_episode_guide_01').className = 'episode_nav_active';
			}
		if(loc_str.indexOf("about_episode_guide_02")!=-1){
				document.getElementById('about_episode_guide_02').className = 'episode_nav_active';
			}
		if(loc_str.indexOf("about_episode_guide_03")!=-1){
				document.getElementById('about_episode_guide_03').className = 'episode_nav_active';
			}
		if(loc_str.indexOf("about_episode_guide_04")!=-1){
				document.getElementById('about_episode_guide_04').className = 'episode_nav_active';
			}
		if(loc_str.indexOf("about_episode_guide_05")!=-1){
				document.getElementById('about_episode_guide_05').className = 'episode_nav_active';
			}
		if(loc_str.indexOf("about_episode_guide_06")!=-1){
				document.getElementById('about_episode_guide_06').className = 'episode_nav_active';
			}
		if(loc_str.indexOf("about_episode_guide_07")!=-1){
				document.getElementById('about_episode_guide_07').className = 'episode_nav_active';
			}

		// For Educators													  
		
		if(loc_str.indexOf("edu_overview")!=-1){
				document.getElementById('edu_overview').className = 'edu_nav_active';
			}
		if(loc_str.indexOf("edu_lesson_plan")!=-1){
				document.getElementById('edu_lesson_plan').className = 'edu_nav_active';
			}
		if(loc_str.indexOf("edu_snapshot")!=-1){
				document.getElementById('edu_snapshot').className = 'edu_nav_active';
			}
		if(loc_str.indexOf("edu_video")!=-1){
				document.getElementById('edu_video').className = 'edu_nav_active';
			}
		if(loc_str.indexOf("edu_search_explore")!=-1){
				document.getElementById('edu_search_explore').className = 'edu_nav_active';
			}
		if(loc_str.indexOf("edu_power_of_story")!=-1){
				document.getElementById('edu_power_of_story').className = 'edu_nav_active';
			}

	}

function check_back(){
		if(history.length<=1){
			document.getElementById('btn_back').style.display = 'none';
		}
	};
	
	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
// IMAGES TO PRELOAD     - - - - - - - - - - - - - - - - - - - - - - - - >

MM_preloadImages(	'images/site_nav/btn_at_war_infantry_over.jpg',
				 	'images/site_nav/btn_at_war_face_battle_over.jpg',
					'images/site_nav/btn_at_war_timeline_over.jpg',
					'images/site_nav/btn_at_war_democracy_over.jpg',
					'images/site_nav/btn_witnesses_homefront_over.jpg',
					'images/site_nav/btn_witnesses_warfront_over.jpg',
					'images/site_nav/btn_witnesses_fourtowns_over.jpg',
					'images/site_nav/btn_top_about_over.jpg',
					'images/site_nav/btn_top_resources_over.jpg',
					'images/site_nav/btn_top_vethist_over.jpg',
					'images/site_nav/btn_top_educators_over.jpg',
					'images/site_nav/btn_top_purchase_over.jpg',
					'images/site_nav/btn_top_contact_over.jpg'
					)




// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
// MACROMEDIA FUNCTIONS  - - - - - - - - - - - - - - - - - - - - - - - - >

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
	}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
	}
	


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
// MISC FUNCTIONS  - - - - - - - - - - - - - - - - - - - - - - - - - - - >
	
function VideoPopUp(vid_id){
	
	
        var url = "video_popup_"+vid_id+".htm";
		
		
		
        var a="toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=525";
        if (navigator.appName.indexOf("Microsoft")>=0) a+=",left=50,top=50";
        else a+=",screenX=50,screenY=50";
        if( floater != null )
                if( floater.closed == false )
                        floater.close();
                        var floater = null;
        floater=window.open(url,"videopreview",a);
        floater.focus();
}

	

	
	

