  function show_hide(ISID){
      if ((document.getElementById(ISID).style.display == 'none'))
      {
        document.getElementById(ISID).style.display = 'inline';
      } else {
        document.getElementById(ISID).style.display = 'none';
      }

  }

function checkCoupon() {
      if (document.couponform.coupon.value=="") {
         alert("You must enter a coupon code before submitting");
         return false;
      }
   }

function checkName() {
      if (document.valid.strSearch1.value=="") {
         alert("You must have a value to search for entered before submitting");
         return false;
      }
   }



function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=500,left = 20,top = 20');");
}



function mailpage()
{
  mail_str = "mailto:?subject= A Great Gift Idea From The Baby's Gallerie";
  mail_str += "&body= I saw this at The Baby's Gallerie (www.thebabysgallerie.com) and thought I would recommend it to you. ";
  mail_str += "Check it out here: " + location.href;
  location.href = mail_str;
}


function show_hide(ISID){
      if ((document.getElementById(ISID).style.display == 'none'))
      {
        document.getElementById(ISID).style.display = 'inline';
      } else {
        document.getElementById(ISID).style.display = 'none';
      }

  }


function val_form ( )
{
    valid = true;
    if ( document.valform.email.value == "" )
    {
        alert ( "Please fill in your Email." );
        document.valform.email.focus();
        return false;
    }
    if ( document.valform.fname.value == "" )
    {
        alert ( "Please fill in your first name." );
        document.valform.fname.focus();
        return false;
    }
    if ( document.valform.lname.value == "" )
    {
        alert ( "Please fill in your last name." );
        document.valform.lname.focus();
        return false;
    }
    if ( document.valform.add1.value == "" )
    {
        alert ( "Please fill in address line 1." );
        document.valform.add1.focus();
        return false;
    }
    if ( document.valform.city.value == "" )
    {
        alert ( "Please fill in your city." );
        document.valform.city.focus();
        return false;
    }
    if ( document.valform.zip.value == "" )
    {
        alert ( "Please fill in your zip." );
        document.valform.zip.focus();
        return false;
    }

}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address Format")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address Format")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address Format")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address Format")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address Format")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address Format")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address Format")
		    return false
		 }

 		 return true
	}


function ValidateForm(){
	var emailID=document.valform.email

	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please make sure you have entered a valid email address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }



