<!--
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 SubmitPg(strValue) {

    document.getElementById('LoginActionHidden').value = strValue;
 	return true;
}
function NewWindow(href) {
	// Open a popup window
	window.open(href, "", "height=305, width=540, left=10, top=10, menubar=no, toolbar=no, status=no, scrollbars=yes, fullscreen=no, resizable=yes");
	return false;
}





function LoginSubmit(strValue)
{


 if (typeof(Page_ClientValidate) == 'function')
    {
      Page_ClientValidate();
      if (Page_IsValid)
         {
		 document.getElementById('LoginActionHidden').value = strValue;
		 return true;
		 }
		 else
		 {
		 document.getElementById('phlHint').style.display = "none";
		 }
    } 
}

function ContinueSubmit(strValue)
{
  //var RegExPattern = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
  var month = document.getElementById('ChildBirthMonth').value - 1;
  var day = document.getElementById('ChildBirthDay').value;
  var year = document.getElementById('ChildBirthYear').value;
  var dteDate;
  dteDate=new Date(year,month,day);
  var datevalid = ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()));
  var TodaysDate=new Date();

 if (document.getElementById('ChildBirthMonth').value == 0 || document.getElementById('ChildBirthDay').value == 0 || document.getElementById('ChildBirthYear').value == 0 || !datevalid)
 {
   Page_ClientValidate();
   document.getElementById('lblUserInstructions').innerHTML = "Please enter <b>Date of Birth</b> or <b>Expected Delivery Date</b> for your youngest child.";
  
    return false;
 }
 else
 { //else part when date is proper.
 
     // if(datevalid && (getQueryString('HHB')=="HHB" || getQueryString('hhb')=="hhb")) //dates are proper and login baby site
      //{
         var PastYearDate=new Date();
         var Pastyear = PastYearDate.getFullYear() - 3;
         var mon = PastYearDate.getMonth() ;
         var dy = PastYearDate.getDate();
         PastYearDate.setFullYear(Pastyear,mon,dy);
         
         var NextYearDate=new Date();
         var Nextyear = NextYearDate.getFullYear() + 1;
         mon = NextYearDate.getMonth() ;
         dy = NextYearDate.getDate();
         NextYearDate.setFullYear(Nextyear,mon,dy);
         
         if(Date.parse(dteDate.toDateString())  < Date.parse(PastYearDate.toDateString()))
         {
            Page_ClientValidate();
            document.getElementById('lblUserInstructions').innerHTML = "<b>Child Birth Date</b> Cannot Be older than three years from current date.";
            return false;      
         }
         
        /* else
         {
            document.getElementById('lblUserInstructions').innerHTML = "";
            if (typeof(Page_ClientValidate) == 'function')
            {
              Page_ClientValidate();
              if (Page_IsValid)
              {
                document.getElementById('LoginActionHidden').value = strValue;
                 return true;
              }
            } 
         }*/
     // }//dates are proper and login baby site - HHB ends
        
    //  else if(datevalid && (getQueryString('HHP')=="HHP" || getQueryString('hhp')=="hhp"))//dates are proper and login preg site
      //{

        else if(Date.parse(dteDate.toDateString())  >= Date.parse(NextYearDate.toDateString()))
         {
            Page_ClientValidate();
            document.getElementById('lblUserInstructions').innerHTML = "<b>Child Due Date</b> Cannot Be more than one year from current date.";
            return false;      
         }
         
        /* else if(Math.abs((Date.parse(dteDate.toDateString())- Date.parse(TodaysDate.toDateString()))/7/86400000)  > 43)
         {  
            Page_ClientValidate();   
            
            if (Page_IsValid)
            {
            
                returnstatus=confirm("Are you sure you have entered a correct due date?");
                if(returnstatus==false)
                {
                    return false;
                }
                else
                {
                        document.getElementById('lblUserInstructions').innerHTML = "";
                        if (typeof(Page_ClientValidate) == 'function')
                        {
                          Page_ClientValidate();
                          if (Page_IsValid)
                          {
                            document.getElementById('LoginActionHidden').value = strValue;
                             return true;
                          }
                        } 
                }//confirm else
            }
            return false; 
        // }*/
         else
         {
            document.getElementById('lblUserInstructions').innerHTML = "";
            if (typeof(Page_ClientValidate) == 'function')
            {
              Page_ClientValidate();
              if (Page_IsValid)
              {
                document.getElementById('LoginActionHidden').value = strValue;
                 return true;
              }
            } 
         }
      //}//dates are proper and login from preg site ends
  }//else part when dates are proper
} 

function ValidateDOB()
{
if (document.getElementById('ChildBirthMonth').value == 0 || document.getElementById('ChildBirthDay').value == 0 || document.getElementById('ChildBirthYear').value == 0)
 {
    document.getElementById('lblUserInstructions').innerHTML = "Please enter Date of Birth or Expected Delivery Date for your youngest child.";
    document.getElementById('Img9').style.display = "block"; 
    
 }
 else
 {
    document.getElementById('lblUserInstructions').innerHTML = "";
    document.getElementById('Img9').style.display = "none"; 
 }

}

function Login(strValue)
{
  
           document.getElementById('LoginActionHidden').value = strValue;
           return true;
     
}



function SignUp(strValue)
{
  
           document.getElementById('LoginActionHidden').value = strValue;
           return true;
     
}

function HintSubmit(strValue)
{


           document.getElementById('LoginActionHidden').value = strValue;
           return true;
       
          
//         if (document.getElementById('txtEmailAddress').value == "")
//         {//         document.getElementById('LoginActionHidden').value = strValue;
//       	 document.getElementById('lblError').style.display = "block";
//       	 document.getElementById('lblError').innerHTML = "Email Address is Required";
//       	 
//       	 document.getElementById('valrfEmailAddress').style.display = "block";
//       	 document.getElementById('valrfEmailAddress').innerHTML = "<IMG id=imgErrorEA alt=\"Email Address is Required.\" src=\"images/error.gif\">";
//         return false;
// 	     }	
// 	     else
// 	     {
// 	     var x = document.getElementById('txtEmailAddress').value;
//	     var filter  = /^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$/;
// 	     if (!filter.test(x)) 
//           {
//      document.getElementById('LoginActionHidden').value = strValue;
//        
//          document.getElementById('lblError').style.display = "block";
//       	 document.getElementById('lblError').innerHTML = "Valid Email Address is Required";
//       	 document.getElementById('valrfEmailAddress').style.display = "block";
//       	 document.getElementById('valrfEmailAddress').innerHTML = "<IMG id=imgErrorEA alt=\"Valid Email Address is Required.\" src=\"images/error.gif\">";
//	         return false;
//	       }
//	     else
// 	     {
// 	     return true;
// 	     }
// 	     }
}

function Submit(strValue)
{
 var month = document.getElementById('BirthMonth').value - 1;
  var day = document.getElementById('BirthDay').value;
  var year = document.getElementById('BirthYear').value;
  var dteDate;
  dteDate=new Date(year,month,day);
  var datevalid = ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()));
      if (!(document.getElementById('BirthMonth').value == 0) || !(document.getElementById('BirthMonth').value == 0) || !(document.getElementById('BirthMonth').value == 0))
      {
       if (!datevalid)
       {
      Page_ClientValidate();
      document.getElementById('lblDetailError').innerHTML = "Please enter a valid <b>Date of Birth</b>.";
      return false;
       }
       else
      {
        document.getElementById('lblDetailError').innerHTML = "";
           if (typeof(Page_ClientValidate) == 'function')
               {
                 Page_ClientValidate();
              if (Page_IsValid)
                  {
                   document.getElementById('lblDetailError').innerHTML = "";
	               	 document.getElementById('LoginActionHidden').value = strValue;
	            	 return true;
		                 }
	             	 }
	     	}
      }
      else
      {
        document.getElementById('lblDetailError').innerHTML = "";
           if (typeof(Page_ClientValidate) == 'function')
               {
                 Page_ClientValidate();
              if (Page_IsValid)
                  {
                   document.getElementById('lblDetailError').innerHTML = "";
	               	 document.getElementById('LoginActionHidden').value = strValue;
	            	 return true;
		                 }
	             	 }
	     	}
	   
    
}


function OpenPrintDoc(){
	// based on the selected value of the radio, we go to the location
    if (document.frmCollectorCards.radiobutton[0].value == "set1" && document.frmCollectorCards.radiobutton[0].checked)
	{
		window.open('CTcards_set1.pdf');
	} 
	else if (document.frmCollectorCards.radiobutton[1].value == "set2" && document.frmCollectorCards.radiobutton[1].checked) 
	{
		window.open('CTcards_set2.pdf');
	} else {
		alert("Please select which set you'd like.");
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function getQueryString(iKey)
{


var qsParm = new Array();
var query = window.location.search.substring(1);

var parms = query.split('&');
for (var i=0; i<parms.length; i++)
{
    var pos = parms[i].indexOf('=');
    if (pos > 0) 
    {
    var key = parms[i].substring(0,pos);
    var val = parms[i].substring(pos+1);
    //qsParm[key] = val;
    
    if(key=="sitecode" && val==iKey)
    {
        return val;
    }
    }
}

} 

//-->
