<!--

function wpop(winopen) {
var winw = 300;
var winh = 350;
var winl = (screen.width - winw) / 2;
var wint = (screen.height - winh) / 2;
wintarget = window.open(winopen,"terms","top=" + wint + ",left=" + winl + ",status=no,resizable=no,height=" + winh + ",width=" + winw + ",toolbar=no,menubar=no,location=no,scrollbars=yes");
if (parseInt(navigator.appVersion) >= 4) { wintarget.window.focus(); }
}

function validateQTY()
{
	var num = "0123456789";
	var form = document.forms["basketfrm"];
	var max = form.itemcount.value;
	var txt;
	for (i = 1; i<=max; i++){
		txt = eval("form.quantity_" + i);
		if (checkparameters(txt.value,num) == false){
			alert("The value entered as the quantity must be numeric (0-9).");
			txt.focus();
			return false;
		}
	}
	return true;
}

function chk(frmElement,errMsg) {
	if (trim(frmElement.value)=="") {
	 alert (errMsg);
	 frmElement.focus;
	 return false;
	}
	else return true;
}

function trim(str) {
	if (str=="") return ""
	var str0=new Array(' ','\t','\n').toString()
	if (str0.indexOf(str.charAt(0))!=-1) return trim(str.slice(1))
	if (str0.indexOf(str.charAt(str.length-1))==-1) return str
	return trim(str.slice(0,str.length-1))
}

function isemail(str) {
	var pt1,pt2,address,re
	address=str.split("@");
	if (address.length==2) {
		pt1 = address[0];
		pt2 = address[1];
  		if (pt2.split(".").length>1) {
			if (pt1.split(" ").length==1 && pt2.split(" ").length==1) {
				return true;
			}
			return false;
		}
		return false;
	}
	return false;
}

function checkparameters(str,matchstr) {
	var cnt;
	for (cnt = 1; cnt <= str.length; cnt++){
		if (matchstr.split(str.charAt(cnt-1)).length==1){
			return false;
		}
	}
	return true;
}

function validate() {
	var telnum = "0123456789()- +";

// invoice details	
	if (trim(d('sender').value) == "") {
		alert("Please enter your email address.");
		d('sender').focus();
		return false;
	}
	if (isemail(d('sender').value) == false) {
		alert("Your email address appears to be entered incorrectly. Please re-check.");
		d('sender').focus();
		return false;
	}
	if (trim(d('sender').value).indexOf('@mail.ru') > 0){
		alert("Your email address appears to be invalid. Please re-enter.");
		return false;
	}
	if (trim(d('message').value) == "") {
		alert("Please enter a domain name.");
		d('message').focus();
		return false;
	}
	if (d('agreement').checked == false){
		alert("Please agree to the terms and conditions of registration by checking the checkbox. Thank you.");	
		return false;
	}
	alert("We are about to process your referral. This process may take a few moments. Please do not refresh the page or click 'back' on your browser during this time. Thank you.")
	return true;
}

function cvalidate() {
	var telnum = "0123456789()- +";

// invoice details	
	if (trim(d('sender').value) == "") {
		alert("Please enter your email address.");
		d('sender').focus();
		return false;
	}
	if (isemail(d('sender').value) == false) {
		alert("Your email address appears to be entered incorrectly. Please re-check.");
		d('sender').focus();
		return false;
	}
	if (trim(d('sender').value).indexOf('@mail.ru') > 0){
		alert("Your email address appears to be invalid. Please re-enter.");
		return false;
	}
	if (trim(d('message').value) == "") {
		alert("Please enter some message content.");
		d('message').focus();
		return false;
	}
	alert("We are about to process your referral. This process may take a few moments. Please do not refresh the page or click 'back' on your browser during this time. Thank you.")
	return true;
}
//-->