var email_regex = /^(([^<>;()[\]\\.,;:@"]+(\.[^<>()[\]\\.,;:@"]+)*)|(".+"))@((([a-z]([-a-z0-9]*[a-z0-9])?)|(#[0-9]+)|(\[((([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\.){3}(([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\]))\.)*(([a-z]([-a-z0-9]*[a-z0-9])?)|(#[0-9]+)|(\[((([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\.){3}(([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\]))$/
var date_regex = /^(?:[01]?[0-9]|2[0-9](?!\/0?2)|2(?:[0-8]|9(?=\/(?:0?2\/\d{2}0[48]|[2468][048]|[13579][26])))|(?:3(?:0|1(?=\/(?:0?[13578]|1[02]))))(?!\/0?2))\/(?:0?[1-9]|1[0-2])\/(?:\d{4})$/
var time_regex = /^(([0-9])|([0-1][0-9])|([2][0-3])):(([0-9])|([0-5][0-9]))$/

function checkSignup(theForm) {
	if (theForm.rName.value == "" || theForm.rName.value == "-enter name here-") {
		alert("Please enter a value for the \"Name\" field.");
		theForm.rName.focus();
		return false;
	}
	
	if (theForm.rEmail.value == "" || email_regex.test(theForm.rEmail.value) == false) {
		alert("You must provide a valid e-mail address, please try again");
		theForm.rEmail.focus();
		return false;
	}

	return true;
}

function checkDevelop(theValue) {
	var arrValue = theValue.split("|")
	if (arrValue[2] == "develop") {
		window.location.href = '../pages/develop_main.asp?content_area=3&develop_id=' + arrValue[0];
	} else {
		window.location.href = '../pages/develop.asp?content_area=2&county_id=' + arrValue[1];
	}
}

function theflash(movie, width, height) 
{
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '">');
    document.writeln('<param name="movie" value="' + movie + '">');
	document.writeln('<param name="quality" value="high" />');
	document.writeln('<param name="menu" value="false">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('<embed src="' + movie + '" width="' + width + '" height="' + height + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed>');
    document.writeln('</object>');
}

//Set Cookie Function
function setCookie(name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape(value) + 
	((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
	((path == null) ? "" : "; path=" + path) +
	((domain == null) ? "" : "; domain=" + domain) +
	((secure == null) ? "" : "; secure");
}

function open_window(fileName, windowName, windowWidth, windowHeight, scrollbars, resizable) {
	window.open(fileName, windowName, 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=' + scrollbars + ', resizable=' + resizable + ', left=' + centre(windowWidth, screen.availWidth) + ', top=' + centre(windowHeight, screen.availHeight) + ', width=' + windowWidth + ', height=' + windowHeight);
}

function centre(size,area) {
	return (area/2)-(size/2);
}

function returnNumbers(field) {
	var regex = /^[0-9+\.]*$/;
    if (!regex.test(field.value)) {
       field.value = field.value.replace(/[^0-9+\.]/g,"");
	}
}


