
<!--
var popupHandle;

function popup(picUrlString, windowWidth, windowHeight)
{

  // always close the old one , so only one at a time is open
  if(popupHandle || popupHandle!=null)
  {
    if (!popupHandle.closed) popupHandle.close();
  }
  popupHandle=null;

  // create a feature string for the popup
  var x=(screen.width-windowWidth)/2
  var y=(screen.height-windowHeight)/2
  var featureString = "toolbar=no,scrollbars=no,resizable=no"
  featureString = ',left='+x + ',top='+y
  featureString += ',width='+windowWidth+',height='+windowHeight

  // open the popup
  popupHandle = window.open( "/image.php?windowWidth="+windowWidth+"&windowHeight="+windowHeight+"&picUrlString="+picUrlString ,"popup",featureString)
  return popupHandle;

}

function winclose()
{
  if (window.popupHandle!=null && !window.popupHandle.closed)
  {
    window.popupHandle.close();
    }
}

function doNothing(){} // does nothing but required by JavaScript in this case
//-->





//file: browse.php, search.php
function openWin(url, width, height, bars)
{
	if (bars == 1)
        	var win = window.open(url,'_blank','resizable=no,scrollbars=yes,status=no,directories=no,toolbar=no,menubar=no,width='+width+',height='+height);
	else
		var win = window.open(url,'_blank','resizable=no,scrollbars=no, status=no,directories=no,toolbar=no,menubar=no,width='+width+',height='+height);
}

//file: register.php
function check_order_form()	//checks the form for valid inputs
{
	
	var reg_form = document.forms.registration;
	var email_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var password_exp = /^[a-zA-Z]\w{5,9}$/;

	if(reg_form.email.value == '')
	{
		alert("Your email address is invalid.");
		reg_form.email.focus();
		return false;
	}
	else if(!email_exp.test(reg_form.email.value))	//email address is NOT in a proper form
	{
		alert("Your email address is invalid.");
		reg_form.email.focus();
		return false;
	}
	else if(reg_form.first_name.value == '')
	{	
		alert("Your first name is invalid.");
		reg_form.first_name.focus();
		return false;
	}
	else if(reg_form.last_name.value == '')
	{
		alert("Your last name is invalid.");
		reg_form.last_name.focus();
		return false;
	}
	else if(reg_form.street.value == '')
	{
		alert("Your street address is invalid.");
		reg_form.street.focus();
		return false;
	}
	else if(reg_form.city.value == '')
	{
		alert("Your city is invalid.");
		reg_form.city.focus();
		return false;
	}
	else if(reg_form.state.value == '' || reg_form.state.value.length < 2)
	{
		alert("Your state is invalid.");
		reg_form.state.focus();
		return false;
	}

	else if(reg_form.zipcode.value == '' || reg_form.zipcode.value.length < 5)
	{
		alert("Your zip code is invalid.");
		reg_form.zipcode.focus();
		return false;
	}
	else if(isNaN(reg_form.zipcode.value))
	{
		alert("Your zip code is invalid.");
		reg_form.zipcode.focus();
		reg_form.zipcode.select();
		return false;
	}
	else if(reg_form.phone_num.value == '' || reg_form.phone_num.value.length < 10)
	{
		alert("Your phone number is invalid.");
		return false;
	}
	else if(isNaN(reg_form.phone_num.value))
	{
		alert("Your phone number is invalid");
		return false;
	}
	else
		return true;
}

//file: checkout.php
function check_checkoutform()
{
	var cform = document.forms.credit_form;

	if(cform.credit_card.value.length < 16 || isNaN(cform.credit_card.value))
	{
		alert("The credit card number is not valid");
		cform.credit_card.focus();
		cform.credit_card.select();
		return false;
	}
	else if(cform.exp_date.value.length < 4 || isNaN(cform.exp_date.value))
	{
		alert("The expiration date is not valid");
		cform.exp_date.focus();
		cform.exp_date.select();
		return false;
	}
	else if(cform.exp_date.value.substring(0,2) < 1 || cform.exp_date.value.substring(0,2) > 12)
	{
		alert("The month of the expirationg date is not valid");
		cform.exp_date.focus();
		return false;
	}
	return true;
}

//file: cart.php
function check_cart()
{
	var cart = document.forms[0];
	for(var i = 0; i < cart.length; i++)
	{
		if((isNaN(cart[i].value) && cart[i].type == 'text' && cart[i+1].checked != true) || (!isNaN(cart[i].value) && ((cart[i].value<0) ||(cart[i].value!=Math.floor(cart[i].value)))))
		{
			alert("One of the quantities is invalid!");
			return false;
		}
		if(cart[i].type == 'checkbox' && cart[i].checked == true){
			cart[i-1].value = 0;
		}
	}
	return true;
}
function checkout()
{
	if(check_cart()){
		window.location = "payment.php";
	}
	else{
		window.location = "index.php";
	}
}

//file: myaccount.php
function check_address()
{
	var form = document.forms.address;
	if(form.Street.value == '')
	{
		alert("Please complete the street address");
		return false;
	}
	else if(form.City.value == '')
	{
		alert("Please complete the city address");
		return false;
	}
	else if(form.ZipCode.value == '')
	{
		alert("Please complete the zip code");
		return false;
	}
	else if(isNaN(form.ZipCode.value))
	{
		alert("The zipcode entered is invalid");
		return false;
	}
	return true;
}
function check_password()
{
	var form = document.forms.password;
	var password_exp = /^[a-zA-Z]\w{5,9}$/;

	if(form.old_password.value == '')
	{
		alert("Please type your old password");
		return false;
	}
	else if(form.new_password1.value == '')
	{
		alert("Please type your new password");
		return false;
	}
	else if(!password_exp.test(form.new_password1.value))
	{
		alert("The new password must be a length from 6-10, starting with a letter, and can only contain letters, numbers, and underscores");
		return false;
	}
	else if(form.new_password2.value == '')
	{
		alert("Please re-type your new password");
		return false;
	}
	else if(form.new_password1.value != form.new_password2.value)
	{
		alert("Please make sure your new password has been re-typed exactly");
		return false;
	}
	return true;
}
function displayContent( div_name ){
		var div_itens = new Array( 'help', 'vaginalbirth', 'postpartum', 'uterus', 'internal', 'havoc' );
		var i;
		
		div = document.getElementById( div_name );
		if( div.className == 'hideContent' ){
			document.getElementById( div_name ).className = 'showContent';
		}else{
			document.getElementById( div_name ).className = 'hideContent';
		}
		
		for( i=0; i < div_itens.length; i++ ){
			if( String( div_name ) != String( div_itens[i] ) ){
				document.getElementById( div_itens[i] ).className = 'hideContent';
			}
		}
}