function popup()
{
   x=window.open("articles/data/art52_001.shtml","popupofday","menubar=0,scrollbars=yes,toolbar=0,location=0,directories=0,status=1,copyhistory=0,width=430,height=260");
}

function browser_check(url) 
{
    if(navigator.appName == "Netscape")
    {
       if(navigator.appVersion.charAt(0) >= 4 && navigator.appVersion.charAt(2)>=5 )
      {
         location.href=url;
      }
      else
      {
         alert("You need version browser version 4.5 or higher");
      }
    }
    else
    {
         alert('Only works on Netscape');
    }
}

function dolist(your_choice)
{
   if(your_choice != "none")
   {
      window.location.href = your_choice;
   }
}

function gotolink()
{
  document.frm_abc.submit();
  //return false;
}

function gotoproduct()
{
    var Current=document.frm_shopsearch.typeofproduct.selectedIndex;

    if(document.frm_shopsearch.typeofproduct.options[Current].value != "none")
   {
       location.href=document.frm_shopsearch.typeofproduct.options[Current].value;
   }
   // return false;
}

function duedate()
{
    var checkspassed = true;
    var email = document.frm_dueemail.email.value;

    if(email == "")
   {
       checkspassed = false;
   }

   if(email.indexOf("@",0) < 0)
   {
       checkspassed = false;
   }

   if(email.indexOf(".",0) < 0)
   {
     checkspassed = false;
   }

   if(email.indexOf(" ",0) >= 0)
   {
       checkspassed = false;
   }

   var day_selected = document.frm_dueemail.duedate_day.selectedIndex;

   if(day_selected == 0)
  {
      alert('Please select due date day');
      last;
   }

   var duedate_day = document.frm_dueemail.duedate_day[day_selected].value;
   var month_selected = document.frm_dueemail.duedate_month.selectedIndex;

   if(month_selected == 0)
   {
       alert('Please select due date month');
       last;
   }

   var duedate_month = document.frm_dueemail.duedate_month[month_selected].value;
   var year_selected = document.frm_dueemail.duedate_year.selectedIndex;

   if(year_selected == 0)
   {
       alert('Please select due date year');
       last;
   }

   var duedate_year = document.frm_dueemail.duedate_year[year_selected].value;
   var url = "/duedate/add.cgi?email=" + email + "&duedate_day=" + duedate_day + "&duedate_month=" + duedate_month + "&duedate_year="+duedate_year;

   if(checkspassed)
   {
       vdue=window.open(url,"","menubar=0,toolbar=0,location=0,directories=0,status=1,copyhistory=0,width=250,height=150");
   }
   else
   {
       alert('Email address invalid!');
   }
}

function checkbabysite()
{
    var Cur=document.frm_site.babysite.selectedIndex;

    if(document.frm_site.babysite.options[Cur].value != "none")
    {
        location.href=document.frm_site.babysite.options[Cur].value;
    }
    // return false;
}

function checkcontent()
{
    var Current=document.frm_content.content.selectedIndex;

    if(document.frm_content.content.options[Current].value != "none")
    {
        location.href=document.frm_content.content.options[Current].value;
     }
     // return false;
}

function logintip()
{
     vlogintip=window.open("tip.shtml","logintipwindow","menubar=0,toolbar=0,location=0,scrollbars=no,directories=0,status=1,copyhistory=0,width=185,height=135");
}

function getCookie(name)
{
     var dcookie = document.cookie;
     var cname = name + "=";
     var clen = dcookie.length;
     var cbegin = 0;

     while (cbegin < clen)
     {
         var vbegin = cbegin + cname.length;

         if (dcookie.substring(cbegin, vbegin) == cname)
         {
             var vend = dcookie.indexOf (";",vbegin);
             if (vend == -1) vend = clen;
             return unescape(dcookie.substring(vbegin,vend));
         }

         cbegin = dcookie.indexOf(" ", cbegin) + 1;

         if (cbegin == 0) break;
      }
      return null;
}

function poll()
{
    poll=window.open("/poll/topic.shtml","","menubar=0,toolbar=0,location=0,directories=0,status=1,copyhistory=0,width=425,height=300");
}

function checkblank()
{
    if(document.meaning.namemeaning.value == "")
   {
      alert('Please enter a babyname to find the meaning');
      return false;
   }
}

function gotoCONTRIBUTOR()
{
    var Current=document.contributor_sec.contributor.selectedIndex;
     location.href=document.contributor_sec.contributor.options[Current].value;
     return false;
}

function gotoPARTNER()
{
    var Current=document.partner_channels.channels.selectedIndex;
    location.href=document.partner_channels.channels.options[Current].value;
    return false;
}

function checkbabyclub()
{
    var Current=document.frm_babyclub.babyclubs.selectedIndex;
    if(document.frm_babyclub.babyclubs.options[Current].value != "none")
    {
        location.href=document.frm_babyclub.babyclubs.options[Current].value;
    }
    // return false;
}

function gotoURL()
{
    var Current=document.expectingparents.expecting.selectedIndex;
    if(document.expectingparents.expecting.options[Current].value != "none")
    {
       location.href=document.expectingparents.expecting.options[Current].value;
       //return false;
    }
}

function gototools()
{
    var Current=document.frm_tools.list.selectedIndex;
    location.href=document.frm_tools.list.options[Current].value;
    return false;
}

function forgot()
{
    vforgot=window.open("/registration/forgotpassword.htm","","menubar=0,toolbar=0,location=0,directories=0,status=1,copyhistory=0,width=345,height=260");
}

function relogin()
{
    vrelogin=window.open("/loginagain.shtml","","menubar=0,toolbar=0,location=0,directories=0,status=1,copyhistory=0,width=345,height=160");
}

function check()
{
    if (document.babysearch.babyname.value.indexOf("@",0) >= 0)
    {
        alert('Your search contains invalid characters');
        return false;
    }

    if(document.babysearch.babyname.value == "")
    {
        alert('Please enter a babyname to search on');
        return false;
    }
}

function validate()
{
    if(document.frm_login.login.value=="")
    {
        alert('ERROR! Please enter your login');
        return false;
    }

    if(document.frm_login.login.value.indexOf(" ",0) >= 0)
    {
        alert('Your login cannot contain spaces');
        return false;
    }

    if(document.frm_login.password.value == "")
    {
        alert('Please enter a password');
        return false;
    }

    if(document.frm_login.password.value.indexOf(" ",0) >= 0)
    {
        alert('Your password cannot contain spaces');
        return false;
    }
    return true;
}

function dologin()
{
    if(validate())
    {
       var url = '/login.cgi?login='+document.frm_login.login.value + '&password=' +       document.frm_login.password.value;

       //if(document.frm_login.remember.checked)
       //{
       //url = url + "&remember=y";
       //}
       vlogin=window.open(url,"loginwindow","menubar=0,toolbar=0,location=0,scrollbars=yes,directories=0,status=1,copyhistory=0,width=200,height=225");
    }
}

function babyday()
{
    x=window.open("/babyoftheday/babyoftheday2.cgi","babyoftheday","menubar=0,toolbar=0,location=0,directories=0,status=1,copyhistory=0,width=230,height=310");
}

function checkpoll()
{
    for(i=0;i<document.frm_poll.choice.length;i++)
    {
         if(document.frm_poll.choice[i].checked)
         {
             return true;
          }
    }

    alert('You must select atleast one!');
    return false;
}

function search_blank()
{
    if(document.frm_search.search.value == "" || document.frm_search.search.value == " " || document.frm_search.search.value == "search articles")
    {
       alert('Please enter a keyword to search on');
       return false;
    }
}
function email_validate(form_id,email) {
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   var address = document.forms[form_id].elements[email].value;
		   if(reg.test(address) == false) {
			  alert('Invalid Email Address');
			  return false;
		   }
       }
function checkblank()
    {
       if(document.frm_pigs.name.value=="")
       {
          alert("Please enter name!");
          document.frm_pigs.name.focus();
          return false;
       }
	   if(document.frm_pigs.interests.selectedIndex == 0)
       {
          alert("Please select your interests!");
          return false;
       }
	   if(document.frm_pigs.email.value=="")
       {
          alert("Please enter email address!");
          return false;
       }
	  if(document.frm_pigs.email.value!="")
       {
          return email_validate('frm_pigs','email')
       }
	   
	}

