
function Swap(imgId,onOff){
	var navImg = document.getElementById(imgId);
    if(onOff == "on"){
        navImg.src = navImg.src.replace("off","on");
    }else if(onOff == "off"){
        navImg.src = navImg.src.replace("on","off");
    }
}
        
//' Pops up a new window at the upper left of screen
function PopIt(page, widthVal, heightVal){ 
    var newWnd = window.open( page, 'popupWindow', 'status,resizable,scrollbars,width=' + widthVal + ',height=' + heightVal + ',left=' + screen.availLeft + ',top=' + screen.availTop + '', true ); 
    newWnd.focus(); 
}

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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 controlprefix = "";
  var headEl = document.getElementsByTagName("HEAD");
  controlprefix = headEl[0].id + "";
  controlprefix = controlprefix.replace("Head1","") + "Navigation1_";
  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(controlprefix + a[i]))!=null){
    
    document.MM_sr[j++]=x; 
    
        x.oSrc=x.src;         
        x.src=x.oSrc.replace("_off","_on");
    
   }
}
function MM_swapImageSubNav() { //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; 
    
        x.oSrc=x.src;         
        x.src=x.oSrc.replace("_off","_on");
    
   }
}
function ShowDivViaQueryString(url,divId){
   location.href=url + "?id=" + divId;
}
function ShowDiv(divId){
   var TempDiv = document.getElementById(divId);
   if(TempDiv.style.display=="none"){
        TempDiv.style.display="block";
   }
}

function HideDiv(divId){
   var TempDiv = document.getElementById(divId);
   if(TempDiv.style.display=="block"){
        TempDiv.style.display="none";
   }
}

function ShowHideAnswer(divId){
   var TempDiv = document.getElementById("Answer" + divId);
   if(TempDiv.style.display=="none"){
        TempDiv.style.display="block";
   }else{
        TempDiv.style.display="none";
   }
}
 function ShowContent(){
 SetUpMenus();
		document.getElementById("PackagedPage").style.display="block";
		
            //document.getElementById("UnderConstruction").style.display="block";
        }
        
 function Validate(){
	var frm = document.forms["ContactForm"];
	var errorMsg = "";
	if(frm.elements["name"].value==""){
		errorMsg += "Please enter your name.\n";
	}
	if(frm.elements["email"].value=="" || (frm.elements["email"].value.indexOf("@")==-1 ||frm.elements["email"].value.indexOf(".")==-1)){
		errorMsg += "Please enter a valid email address.\n";
	}
	if(errorMsg != ""){
		alert(errorMsg);
		return false;
	}
	
 }


function GoToPage(url)
{

    window.location.href=url;
}

//Swap images of the image buttons.
function SwapImage(controlId,imageUrl)
{ 
  
     var control=document.getElementById(controlId);
    
    if (control)
    {
        control.src=imageUrl;
        
    }
}
function ApplyCssClass(controlId,cssClass)
{
     var control=document.getElementById(controlId);
    
    if (control && cssClass!="")
    {
        control.className=cssClass;
    }
}

function ShowNewsletterArchive(controlId)
{ popupOff();
   // alert(controlId);
    var divJan=document.getElementById('divJan');
    var divFeb=document.getElementById('divFeb');
    var divMarch=document.getElementById('divMarch');
    var divApril=document.getElementById('divApril');
    var divMay=document.getElementById('divMay');
    var divJune=document.getElementById('divJune');
    var divJuly=document.getElementById('divJuly');
    var divAug=document.getElementById('divAug');
    var divSep=document.getElementById('divSep');
    var divOct=document.getElementById('divOct');
    var divNov=document.getElementById('divNov');
    var divDec=document.getElementById('divDec');
    
    divJan.className="InvisibleArchive";
    divFeb.className="InvisibleArchive";
    divMarch.className="InvisibleArchive";
    divApril.className="InvisibleArchive";
    divMay.className="InvisibleArchive";
    divJune.className="InvisibleArchive";
    divJuly.className="InvisibleArchive";
    divAug.className="InvisibleArchive";
    divSep.className="InvisibleArchive";
    divOct.className="InvisibleArchive";
    divNov.className="InvisibleArchive";
    divDec.className="InvisibleArchive";
    
    
    var aJan=document.getElementById('aJan');
    var aFeb=document.getElementById('aFeb');
    var aMarch=document.getElementById('aMarch');
    var aApril=document.getElementById('aApril');
    var aMay=document.getElementById('aMay');
    var aJune=document.getElementById('aJune');
    var aJuly=document.getElementById('aJuly');
    var aAug=document.getElementById('aAug');
    var aSep=document.getElementById('aSep');
    var aOct=document.getElementById('aOct');
    var aNov=document.getElementById('aNov');
    var aDec=document.getElementById('aDec');
    
     aJan.className="";
     aFeb.className="";
     aMarch.className="";
     aApril.className="";
     aMay.className="";
     aJune.className="";
     aJuly.className="";
     aAug.className="";
     aSep.className="";
     aOct.className="";
     aNov.className=""; 
     aDec.className="";
    
    switch(controlId)
    {
    case "divJan":
        divJan.className="VisibleArchive";
        aJan.className="SelectedMonth";
        break;
     case "divFeb":
        divFeb.className="VisibleArchive";
         aFeb.className="SelectedMonth";
        break;
     case "divMarch":
        divMarch.className="VisibleArchive";
         aMarch.className="SelectedMonth";
        break;
     case "divApril":
         divApril.className="VisibleArchive";
          aApril.className="SelectedMonth";
        break;
     case "divMay":
        divMay.className="VisibleArchive";
         aMay.className="SelectedMonth";
        break;
     case "divJune":
        divJune.className="VisibleArchive";
         aJune.className="SelectedMonth";
        break;
     case "divJuly":
        divJuly.className="VisibleArchive";
         aJuly.className="SelectedMonth";
        break;
     case "divAug":
        divAug.className="VisibleArchive";
         aAug.className="SelectedMonth";
        break;
     case "divSep":
        divSep.className="VisibleArchive";
         aSep.className="SelectedMonth";
        break;
     case "divOct":
        divOct.className="VisibleArchive";
        aOct.className="SelectedMonth";
        break;
     case "divNov":
        divNov.className="VisibleArchive";
        aNov.className="SelectedMonth";
        break;
     case "divDec":
        divDec.className="VisibleArchive";
        aDec.className="SelectedMonth";
        break;
    }
}

function OpenTab(tabImageId)
{
    
   var url=window.location.href.toLowerCase();
   if (url.indexOf('#multimedia')>0)
   {
        SwitchTab(tabImageId); 
   }
   
   
}

function SwitchTab(tabImageId)
{

     var imageLocation='/Images/tabs/';
     var tabTalkKit=document.getElementById('imgTalkKitTab');
     var tabMultimedia=document.getElementById('imgMultimediaTab');
     
     var divTalkKit=document.getElementById('divTalkKit');
     var divMultimedia=document.getElementById('divMultimedia');
    
     
     if (tabTalkKit==null || tabMultimedia==null )
     {
        return;
     }
    
     switch(tabImageId)
     {
        case "imgTalkKitTab" :
             tabTalkKit.src=imageLocation + 'talk_kit_tab_on.gif';
             tabMultimedia.src=imageLocation + 'tools_multi_tab_off.gif';
             divTalkKit.className="VisibleBlock";
             divMultimedia.className="InvisibleBlock";
            break;
            
        case "imgMultimediaTab" :
              tabTalkKit.src=imageLocation  + 'talk_kit_tab_off.gif';
             tabMultimedia.src=imageLocation + 'tools_multi_tab_on.gif';
             divTalkKit.className="InvisibleBlock";
             divMultimedia.className="VisibleBlock";
            break;
     }
}



function ToggleExpand(controlId,expandIconId,tdExpandedTitle)
{
	popupOff();
	var control=document.getElementById(controlId);
    var expandControl=document.getElementById(expandIconId);
    var tdExpandedTitle=document.getElementById(tdExpandedTitle);

	if (control)
	{ 
			if (currentOpenDiv)
			{
			    if (currentOpenDiv!=control)
			    {
				    currentOpenDiv.className="Collapsed"; 
				    currentExpandedArticleTitle.className="CollapsedArticleTitle";
				      
				    if (currentExpandControl)
				    {
				        currentExpandControl.src="/images/icons/expand_closed.gif";
				    }
				}
			}
			
			if (control.className=="Collapsed")
			{
			    control.className="Expanded";
			    expandControl.src="/images/icons/expand_open.gif";
			    tdExpandedTitle.className="ExpandedArticleTitle";
			}
			else
			{
			    control.className="Collapsed"; 
			    expandControl.src="/images/icons/expand_closed.gif";
			    tdExpandedTitle.className="CollapsedArticleTitle";
			}
			
			currentOpenDiv=control;
			currentExpandControl=expandControl;
			currentExpandedArticleTitle=tdExpandedTitle;
	
	}
}

function CloseStory(controlId,expandIconId,tdExpandedTitle)
{
    popupOff();
    var control=document.getElementById(controlId);
    var expandControl=document.getElementById(expandIconId);
     var tdExpandedTitleControl=document.getElementById(tdExpandedTitle);
    
         control.className="Collapsed"; 
         expandControl.src="/images/icons/expand_closed.gif";
         tdExpandedTitleControl.className="CollapsedArticleTitle";
         
    	currentOpenDiv="";
	    currentExpandControl="";
	    currentExpandedArticleTitle="";
	    
	    if (currentOpenHowToSayScenario)
	    {
	        
			
			currentOpenHowToSayScenario.className="Collapsed"; 
			currentHowToSayScenarioPointer.src="/images/icons/blueArrow_closed.gif";
			tdExpandedTitleControl.className="CollapsedArticleTitle";
			
			 currentOpenHowToSayScenario="";
			currentHowToSayScenarioPointer="";
			
		}
}

function ToggleExpandTTTScenarios(controlId,pointerId,tdAgeGroupId)
{
    popupOff();
    var control=document.getElementById(controlId);
    var expandControl=document.getElementById(pointerId);
    var AgeGroupTitle=document.getElementById(tdAgeGroupId);
    
    
    if (control)
	{ 
			if (currentOpenHowToSayScenario)
			{
			    if (currentOpenHowToSayScenario!=control)
			    {
				    currentOpenHowToSayScenario.className="Collapsed"; 
				    
				    if (currentHowToSayScenarioPointer)
				    {
				        currentHowToSayScenarioPointer.src="/images/icons/blueArrow_closed.gif";
				    }
				     if (cureentOpenHowToSayTitle)
				    {
				        cureentOpenHowToSayTitle.className="AgeGroup";
				    }
				}
			}
			
			if (control.className=="Collapsed")
			{
			    control.className="Expanded";
			    expandControl.src="/images/icons/blueArrow_opened.gif";
			    AgeGroupTitle.className="AgeGroupExpanded";
			}
			else
			{
			    control.className="Collapsed"; 
			    expandControl.src="/images/icons/blueArrow_closed.gif";
			    AgeGroupTitle.className="AgeGroup";
			}
			
			
			currentOpenHowToSayScenario=control;
			currentHowToSayScenarioPointer=expandControl;
	        cureentOpenHowToSayTitle=AgeGroupTitle;
	}
	
}


function ToggleExpandPodcastItems(controlId,pointerId,tdAgeGroupId)
{
    popupOff();
    var control=document.getElementById(controlId);
    var expandControl=document.getElementById(pointerId);
    var AgeGroupTitle=document.getElementById(tdAgeGroupId);
   
    if (control)
	{ 
			if (currentOpenPodcastItem)
			{
			    if (currentOpenPodcastItem!=control)
			    {
			        
				    currentOpenPodcastItem.className="Collapsed"; 
				    
				    if (currentPodcastItemPointer)
				    {
				        currentPodcastItemPointer.src="/images/icons/blueArrow_closed.gif";
				    }
				    if (cureentOpenPodcastTitle)
				    {
				        cureentOpenPodcastTitle.className="AgeGroup";
				    }
				    
				    
				   
				}
			}
			
			    if (control.className=="Collapsed")
			    {
			      
			        
			        control.className="Expanded";
			        expandControl.src="/images/icons/blueArrow_opened.gif";
			        AgeGroupTitle.className="AgeGroupExpanded";
			        
			        switch(controlId)
			        {
			            case 'divEducate' :
			                 urchinTracker( 'ParentTalkKit/ToolsAndMultiMedia/Podcast_Educate');
			                break;
			            case 'divCommunicate' : 
			                 urchinTracker( 'ParentTalkKit/ToolsAndMultiMedia/Podcast_Communicate');
			                break;
			            case 'divSafeguard':
			                 urchinTracker( 'ParentTalkKit/ToolsAndMultiMedia/Podcast_Safeguard');
			                break; 
			        }
			      
			     
			    }
			    else
			    {   
			       
			        control.className="Collapsed"; 
			        expandControl.src="/images/icons/blueArrow_closed.gif";
			        AgeGroupTitle.className="AgeGroup";
			        
			    }
    			
			   
			currentOpenPodcastItem=control;
			currentPodcastItemPointer=expandControl;
	        cureentOpenPodcastTitle=AgeGroupTitle;
	}
	
}

function ClosePodcastItem(controlId,expandIconId,tdExpandedTitle)
{
    popupOff();
    var control=document.getElementById(controlId);
    var expandControl=document.getElementById(expandIconId);
     var tdExpandedTitleControl=document.getElementById(tdExpandedTitle);
    
         control.className="Collapsed"; 
         expandControl.src="/images/icons/expand_closed.gif";
         tdExpandedTitleControl.className="AgeGroup";
         
    	currentOpenDiv="";
	    currentExpandControl="";
	    currentExpandedArticleTitle="";
	    
	    if (currentOpenPodcastItem)
	    {
	        
			
			currentOpenPodcastItem.className="Collapsed"; 
			currentPodcastItemPointer.src="/images/icons/blueArrow_closed.gif";
			tdExpandedTitleControl.className="AgeGroup";
			
			 currentOpenPodcastItem="";
			currentPodcastItemPointer="";
			
		}
}



function CustomUrchinTracker(url)
{
 popupOff();
  //alert(url);
  //  urchinTracker(url );    
}

function OpenEnewsletterPopup()
{
    var url = "/Popups/eNewsletter.aspx";
   window.open (url,"EnewsletterSignup","menubar=0,resizable=1,width=350,height=250"); 
}

