
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 contactUs()
{
	var ContactUs = window.open(SITE_BASE+'contact.php', 'contactus_popup', 'scrollbars=yes,width=429,height=600');
	ContactUs.focus();
}

function Login()
{
	var Login = window.open(SITE_BASE+'start_login.php', 'login_popup', 'scrollbars=yes,width=429,height=600');
	Login.focus();
}

function pgLinks()
{
	var PGLinks = window.open(SITE_BASE+'pg_links.php', 'pglinks_popup', 'scrollbars=yes,width=445,height=600');
	PGLinks.focus();
}

function search()
{
	var Search = window.open(SITE_BASE+'search.php', 'search_popup', 'scrollbars=yes,width=445,height=600');
	Search.focus();
}

function sendToFriend()
{
	var SendToFriend = window.open(SITE_BASE+'sendtofriend.php?link=' + URLencode(window.location.href), 'sendtofriend_popup', 'scrollbars=yes,width=445,height=600');
	SendToFriend.focus();
}

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 = SITE_BASE+'helpmechoose1.php';
			break;
		case 1:
			if (Direction == -1) {
				document.helpmechooseform.action = SITE_BASE+'helpmechoose0.php';
			} else {
				fount = false;
				for(i = 0; i < 7; i++)
				if (document.helpmechooseform.used_product[i].checked == true) {
					fount = true;
					break;
				} 
				if (!fount) {
					alert("Please select the product you have used during your last period !");
					return;
				} 
			} 
			break;
		case 2:
			if (Direction == -1) {
				document.helpmechooseform.action = SITE_BASE+'helpmechoose1.php';
			} 
			break;
		case 3:
			if (Direction == -1) {
				document.helpmechooseform.action = SITE_BASE+'helpmechoose2.php';
			} else {
				fount = false;
				for(i = 0; i < 4; i++)
				if (document.helpmechooseform.weartime[i].checked == true) {
					fount = true;
					break;
				} 
				if (!fount) {
					alert("Please select an answer for question 1 !");
					return;
				}
				if (document.helpmechooseform.applicator[0].checked == false && document.helpmechooseform.applicator[1].checked == false) {
					alert("Please select an answer for question 2 !");
					return;
				} 				
				if (document.helpmechooseform.isfull[0].checked == false && document.helpmechooseform.isfull[1].checked == false) {
					alert("Please select an answer for question 3 !");
					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 4 !");
					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();
}