// JavaScript Document
var message="Welcome to www.laboratory-products.com";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
//alert(message);
//document.oncontextmenu=new Function("return false")

function valid_length(field, field_length) {
	if(field>field_length) 	{	return false; }
	return true;
}

function valid_date(day, month, year) {
	hostingDay=day.value;
	hostingMonth=month.value;
	hostingYear=year.value;
	
	if(hostingMonth==4 || hostingMonth==6 || hostingMonth==9 || hostingMonth==11) {
		if(hostingDay==31)	{	return false; }
	} else if(hostingMonth==2) {
		if((hostingYear%4)==0) {
			if(hostingDay>29) {		return false;	}
		} else {
			if(hostingDay>28) {		return false;	}
		}
	}
	return true;
}

function valid_digit(number) {
	var regExp=/^[\d]+$/
	if((number.length>0) && regExp.test(number)==false) {
		return false;
	}
	return true
}

function openNewsletter(val) {
	var param="newletter.php?param="+val;
	window.open(param,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=440,height=410');
}

function CheckEmail(frm) {
email = frm.Email.value
AtPos = email.indexOf("@")
StopPos = email.lastIndexOf(".")

Message = ""

if (email == "") {
Message = "Not a valid Email address" + "\n"
}

if (AtPos == -1 || StopPos == -1) {
Message = "Not a valid email address"
}

if (StopPos < AtPos) {
Message = "Not a valid email address"
}

if (StopPos - AtPos == 1) {
Message = "Not a valid email address"
} 

if(Message.length==0){
	//frm.action="newsletter.php?mail="+Email.value;
	//alert(frm.action);
	//frm.submit();
	openNewsletter(frm.Email.value);
}else {
	alert(Message);
}
}
// This function is used for paging
function submitPage(val) {
	location.href=val.value;
}
