
function checkMail(email)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(document.contactusform.email.value))
		return false;
	else
		return "- Invalid E-mail address.\n";
} 

function isValidDate(day, month, year)
{
	month--;
	var dteDate = new Date(year, month, day);
	return ((day == dteDate.getDate()) && (month == dteDate.getMonth()) && (year == dteDate.getFullYear()));
} 

function IsEmpty(state) {
   if ((state.value.length==0) ||
   (state.value==null)) {
      return true;
   }
   else { return false; }
}	

	 
	 
function askIris()
{
	f = document.AskIrisForm;

	if (!isValidDate(f.birth_dd[f.birth_dd.selectedIndex].value, f.birth_mm[f.birth_mm.selectedIndex].value, f.birth_yy[f.birth_yy.selectedIndex].value)) {
		alert("Please enter a valid birthdate!");
		return;
	} 
	
	if (IsEmpty(f.state)) {
			alert("Please select State");
			return ;
		} 

	var AskIris = window.open('', 'askiris_popup', 'scrollbars=yes,width=445,height=650');
	if (AskIris.opener == null) AskIris.opener = window;
	f.submit();
	AskIris.focus();
} 

function SendToFriend()
{
	f = document.SendToFriendForm;

	if (!isValidDate(f.birth_dd[f.birth_dd.selectedIndex].value, f.birth_mm[f.birth_mm.selectedIndex].value, f.birth_yy[f.birth_yy.selectedIndex].value)) {
		alert("Please enter a valid birthdate!");
		return;
	} 
	
	if (IsEmpty(f.state)) {
			alert("Please select State");
			return ;
		} 

	var AskIris = window.open('', 'askiris_popup', 'scrollbars=yes,width=445,height=650');
	if (AskIris.opener == null) AskIris.opener = window;
	f.submit();
	AskIris.focus();
} 

function askIrisBio()
{
	var AskIrisBio = window.open('askirisbio.php', 'askirisbio_popup', 'scrollbars=yes,width=445,height=370');
	AskIrisBio.focus();
}

function aboutTampax()
{
	var AboutTampax = window.open('abouttampax.php', 'abouttampax_popup', 'scrollbars=yes,width=445,height=600');
	AboutTampax.focus();
} 

function contactUs()
{
	var ContactUs = window.open('contactus.php', 'contactus_popup', 'scrollbars=yes,width=445,height=600');
	ContactUs.focus();
}

function pgLinks()
{
	var PGLinks = window.open('pg_links.php', 'pglinks_popup', 'scrollbars=yes,width=445,height=600');
	PGLinks.focus();
}

function search()
{
	var Search = window.open('search.php', 'search_popup', 'scrollbars=yes,width=445,height=600');
	Search.focus();
}

function sendToFriend()
{
	var SendToFriend = window.open('sendtofriend.php?link=' + URLencode(window.location.href), 'sendtofriend_popup', 'scrollbars=yes,width=445,height=600');
	SendToFriend.focus();
}

function productChooser1(CurrentStep, Direction)
{
	switch (CurrentStep) {
		case 0:
			if (document.helpmechooseform.period_started[0].checked == false && document.helpmechooseform.period_started[1].checked == false && document.helpmechooseform.period_started[2].checked == false) {
				alert("Please select one of the options!");
				return;
			} 
			document.helpmechooseform.action = 'helpmechoose1.php';
			break;
		case 1:
			if (Direction == -1) {
				document.helpmechooseform.action = 'helpmechoose0.php';
			} else {
				if (document.helpmechooseform.applicator[0].checked == false && document.helpmechooseform.applicator[1].checked == false) {
					alert("Please select the preferred tampon applicator !");
					return;
				} 
			} 
			break;
			case 2:
			if (Direction == -1) {
				document.helpmechooseform.action = 'helpmechoose1.php';
			} else {
				if (document.helpmechooseform.scented[0].checked == false && document.helpmechooseform.scented[1].checked == false) {
					alert("Please select the preferred tampon type !");
					return;
				} 
			} 
			break;
		case 3:
			if (Direction == -1) {
				document.helpmechooseform.action = 'helpmechoose2.php';
			} 
			break;
		case 4:
			if (Direction == -1) {
				document.helpmechooseform.action = 'helpmechoose3.php';
			} else {
				found = false;
				for(i = 0; i < 4; i++)
				if (document.helpmechooseform.weartime[i].checked == true) {
					found = true;
					break;
				} 
				if (!found) {
					alert("Please select an answer for question 1 !");
					return;
				} 
				if (document.helpmechooseform.isfull[0].checked == false && document.helpmechooseform.isfull[1].checked == false) {
					alert("Please select an answer for question 2 !");
					return;
				} 
				if (document.helpmechooseform.leaks[0].checked == false && document.helpmechooseform.leaks[1].checked == false && document.helpmechooseform.leaks[2].checked == false) {
					alert("Please select an answer for question 3 !");
					return;
				} 
				break;
			} 
	} 

	document.helpmechooseform.submit();
} 


function productChooser(CurrentStep, Direction)
{
	switch (CurrentStep) {
		case 0:
			if (document.helpmechooseform.period_started[0].checked == false && document.helpmechooseform.period_started[1].checked == false && document.helpmechooseform.period_started[2].checked == false) {
				alert("Please select one of the options!");
				return;
			} 
			document.helpmechooseform.action = 'helpmechoose1.php';
			break;
		case 1:
			if (Direction == -1) {
				document.helpmechooseform.action = 'helpmechoose0.php';
			} else {
				if (document.helpmechooseform.applicator[0].checked == false && document.helpmechooseform.applicator[1].checked == false) {
					alert("Please select the preferred tampon applicator !");
					return;
				} 
				if (document.helpmechooseform.scented[0].checked == false && document.helpmechooseform.scented[1].checked == false) {
					alert("Please select the preferred tampon type !");
					return;
				} 
			} 
			break;
		case 2:
			if (Direction == -1) {
				document.helpmechooseform.action = 'helpmechoose1.php';
			} 
			break;
		case 3:
			if (Direction == -1) {
				document.helpmechooseform.action = 'helpmechoose2.php';
			} else {
				found = false;
				for(i = 0; i < 4; i++)
				if (document.helpmechooseform.weartime[i].checked == true) {
					found = true;
					break;
				} 
				if (!found) {
					alert("Please select an answer for question 1 !");
					return;
				} 
				if (document.helpmechooseform.isfull[0].checked == false && document.helpmechooseform.isfull[1].checked == false) {
					alert("Please select an answer for question 2 !");
					return;
				} 
				if (document.helpmechooseform.leaks[0].checked == false && document.helpmechooseform.leaks[1].checked == false && document.helpmechooseform.leaks[2].checked == false) {
					alert("Please select an answer for question 3 !");
					return;
				} 
				break;
			} 
	} 

	document.helpmechooseform.submit();
} 

function checkAantal(aantal)
{
	val = parseInt(aantal);
	if (isNaN(val))
		return 0;
	if (val <= 0)
		return 0;
	return val;
} 
function validate()
{
	with (document.myform) {
		if (refDag.selectedIndex == 0) {
			alert("Please select a Day");
			return false;
		} 
		if (refMaand.selectedIndex == 0) {
			alert("Please select a Month");
			return false;
		} 
		if (refJaar.selectedIndex == 0) {
			alert("Please select a Year");
			return false;
		} 
		if (duration.selectedIndex == 0) {
			alert("Please select number of days for your period");
			return false;
		} 
		if (cyclus.selectedIndex == 0) {
			alert("Please select number of days for your cyclus");
			return false;
		} /*
		days = checkAantal(cyclus.value);
		if ((days <= 10) || (days >= 80)) {
			alert("Please select a cyclus (11 - 80 days)");
			return false;
		} */
	} 
	return true;
} 
function mySubmit()
{
	if (validate()) document.myform.submit();
} 

function validate1()
{
	with (document.myform) {
		if (zoekJaar.selectedIndex == 0) {
			alert("Please select a year");
			return false;
		} 
		if (zoekMaand.selectedIndex == 0) {
			alert("Please select a month");
			return false;
		} 
		return true;
	} 
} 
function mySubmit1()
{
	if (validate1()) document.myform.submit();
}
