function openWin(pagename,w,h){
	sw=screen.availWidth;
	sh=screen.availHeight;
	tp=(sh-h)/2;
	lf=(sw-w)/2;
	microsite_window=window.open(pagename,'microsite_window','toolbar=no,location=no,borders=no,directories=no,status=no,menubar=no,scrollbars=yes,top='+tp+',left='+lf+',resizable=no,width='+w+',height='+h)
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById('wrapper').getElementsByTagName('span');
		if(el.style.display == 'none'){
			for (var i=0; i<ar.length; ++i){
				ar[i].style.display = 'none';
			}
			el.style.display = 'block';
		}else{
			el.style.display = 'none';
		}
	}
}
////////////////////////////
var Infotxt="";
function test(obj,msg){
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	if (regex.test(obj.value)){
		return true;
	}else{
		alert(Infotxt+msg);
		obj.focus();
		return false;
	}
}
function checkint(obj,msg){
	if(isNaN(obj.value)){
		alert(Infotxt+msg);
		obj.focus();
		return false;
	}
}
function confirmPassword(obj,obj1,msg){
	if(obj.value!=obj1.value){
		alert(Infotxt+msg);
		obj1.focus();
		return false;
	}
}
function checkempty(obj,msg){
	if(obj.value==""){
		alert(Infotxt+msg);
		obj.focus();
		return false;
	}
}
function checkzero(obj,msg){
	if(obj.value==0){
		alert(Infotxt+msg);
		obj.focus();
		return false;
	}
}
////////////////////////////
function chkNL(){
	if(test(document.frmnewsletter.email,"Information: Enter Your Valid Email Address")==false) return false;
	return true;
}
function ShowDetail(ttl,artn,descp,prc,fil,pid){
	document.getElementById("tdtitle").innerHTML=ttl;
	document.getElementById("tdartno").innerHTML="ITEM CODE "+artn;
	document.getElementById("tddescp").innerHTML=descp;
	document.getElementById("tdprice").innerHTML="PRICE "+prc;
	document.images.limg.src=fil;
	document.frmCart.pid.value=pid;
}
function chkLogin(){
	if (test(document.frmLogin.usname,"Information - Enter Email as Username")==false) return false;
	if (checkempty(document.frmLogin.paswrd,"Information - Enter Password")==false) return false;
}
function CheckUserLogin1(){
	if (test(document.frmUserLogin1.usname,"Information - Enter Email as Username")==false) return false;
	if (checkempty(document.frmUserLogin1.paswrd,"Information - Enter Password")==false) return false;
}
function chkFP(){
	if (test(document.frmfp.usname,"Information - Enter Valid Email Address")==false) return false;
}
function chkAddCart(){
	if (checkempty(document.frmAdd.qty,"Information - Enter Quantity")==false) return false;
	if (checkzero(document.frmAdd.qty,"Information - Enter Quantity Greater than 0")==false) return false;
	if (checkint(document.frmAdd.qty,"Information - Enter Quantity in Digits")==false) return false;
}
function CheckRegUser(){
	if (test(document.frmReg.email,"Information - Enter Your Valid Email")==false) return false;
	if (checkempty(document.frmReg.password,"Information - Enter Password")==false) return false;
	if (checkempty(document.frmReg.repassword,"Information - Enter Confirm Password")==false) return false;
	if (confirmPassword(document.frmReg.password,document.frmReg.repassword,"Information - Password and Confirm Password must be same")==false) return false;
	if (checkempty(document.frmReg.fname,"Information - Enter First Name")==false) return false;
	if (checkempty(document.frmReg.lname,"Information - Enter Last Name")==false) return false;
	if (checkempty(document.frmReg.address,"Information - Enter Address")==false) return false;
	if (checkempty(document.frmReg.country,"Information - Select Country")==false) return false;
	if (checkempty(document.frmReg.cstate,"Information - Enter State")==false) return false;
	if (checkempty(document.frmReg.city,"Information - Enter City")==false) return false;
	if (checkempty(document.frmReg.zcode,"Information - Enter Zi/Post Code")==false) return false;
	if (checkempty(document.frmReg.phone,"Information - Enter Phone Number")==false) return false;
}
function CheckUpdUser(){
	if (checkempty(document.frmUpd.password,"Information - Enter Password")==false) return false;
	if (checkempty(document.frmUpd.repassword,"Information - Enter Confirm Password")==false) return false;
	if (confirmPassword(document.frmUpd.password,document.frmUpd.repassword,"Information - Password and Confirm Password must be same")==false) return false;
	if (checkempty(document.frmUpd.fname,"Information - Enter First Name")==false) return false;
	if (checkempty(document.frmUpd.lname,"Information - Enter Last Name")==false) return false;
	if (checkempty(document.frmUpd.address,"Information - Enter Address")==false) return false;
	if (checkempty(document.frmUpd.country,"Information - Select Country")==false) return false;
	if (checkempty(document.frmUpd.cstate,"Information - Enter State")==false) return false;
	if (checkempty(document.frmUpd.city,"Information - Enter City")==false) return false;
	if (checkempty(document.frmUpd.zcode,"Information - Enter Zi/Post Code")==false) return false;
	if (checkempty(document.frmUpd.phone,"Information - Enter Phone Number")==false) return false;
}
function chkInq(){
	if (checkempty(document.frmSend.contactperson,"Information - Enter Contact Person")==false) return false;
	if (checkempty(document.frmUpd.companyname,"Information - Enter Company Name")==false) return false;
	if (checkempty(document.frmUpd.email,"Information - Enter Valid Email Address")==false) return false;
	if (checkempty(document.frmUpd.comments,"Information - Enter Comments")==false) return false;
}
////////////////////////////
function doSubmit(stat){
	document.frmActions.act.value=stat;
	document.frmActions.submit();
}
////////////////////////////
