function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

function regMatch(obj,reg)
	{
	  obj.value=reg.test(obj.value)? obj.value.match(reg,obj.value):'0';
	}

//reg.asp


function regjs()
{
 
   
    if(checkspace(document.reginfo.password.value) || document.reginfo.password.value.length < 6) {
	document.reginfo.password.focus();
    alert("Sorry Please Confirm your Password is correct!");
	return false;
  }
    if(document.reginfo.password.value != document.reginfo.password1.value) {
	document.reginfo.password.focus();
	document.reginfo.password.value = '';
	document.reginfo.password1.value = '';
    alert("Sorry Please Confirm your Password is correct!");
	return false;
  }


if(checkspace(document.reginfo.firstname.value)) {
	document.reginfo.firstname.focus();
    alert("Sorry Please Confirm your firstname is correct!");
	return false;
  }
  if(checkspace(document.reginfo.lastname.value)) {
	document.reginfo.lastname.focus();
    alert("Sorry Please Confirm your lastname is correct!");
	return false;
  }

  if(checkspace(document.reginfo.address.value)) {
	document.reginfo.address.focus();
    alert("Sorry Please Confirm your address line 1 is correct!");
	return false;
  }

  if(checkspace(document.reginfo.city.value)) {
	document.reginfo.city.focus();
    alert("Sorry Please Confirm your city is correct!");
	return false;
  }

  if(checkspace(document.reginfo.postcode.value)) {
	document.reginfo.postcode.focus();
    alert("Sorry Please Confirm your post code/zip code is correct!");
	return false;
  }

  if(checkspace(document.reginfo.country.value)) {
	document.reginfo.country.focus();
    alert("Sorry Please Confirm your country is correct!");
	return false;
  }
  
}

function feedbackjs()
{
   if(checkspace(document.finfo.firstname.value)) {
	document.finfo.firstname.focus();
    alert("Sorry Please Confirm your firstname is correct!");
	return false;
  }

   if(checkspace(document.finfo.lastname.value)) {
	document.finfo.lastname.focus();
    alert("Sorry Please Confirm your lastname is correct!");
	return false;
  }
  
if(document.finfo.email.value.length!=0)
  {
    if (document.finfo.email.value.charAt(0)=="." ||        
         document.finfo.email.value.charAt(0)=="@"||       
         document.finfo.email.value.indexOf('@', 0) == -1 || 
         document.finfo.email.value.indexOf('.', 0) == -1 || 
         document.finfo.email.value.lastIndexOf("@")==document.finfo.email.value.length-1 || 
         document.finfo.email.value.lastIndexOf(".")==document.finfo.email.value.length-1)
     {
      alert("Sorry Please Confirm your Email is correct!");
      document.finfo.email.focus();
      return false;
      }
   }
 else
  {
   alert("Sorry Please Confirm your Email is correct!");
   document.finfo.email.focus();
   return false;
   }

if(checkspace(document.finfo.title.value)) {
	document.finfo.title.focus();
    alert("Sorry Please Confirm your title is correct!");
	return false;
  }

}

function stepjs()
{
if(checkspace(document.stepinfo.firstname.value)) {
	document.stepinfo.firstname.focus();
    alert("Sorry Please Confirm your firstname is correct!");
	return false;
  }
  if(checkspace(document.stepinfo.lastname.value)) {
	document.stepinfo.lastname.focus();
    alert("Sorry Please Confirm your lastname is correct!");
	return false;
  }

if(document.stepinfo.email.value.length!=0)
  {
    if (document.stepinfo.email.value.charAt(0)=="." ||        
         document.stepinfo.email.value.charAt(0)=="@"||       
         document.stepinfo.email.value.indexOf('@', 0) == -1 || 
         document.stepinfo.email.value.indexOf('.', 0) == -1 || 
         document.stepinfo.email.value.lastIndexOf("@")==document.stepinfo.email.value.length-1 || 
         document.stepinfo.email.value.lastIndexOf(".")==document.stepinfo.email.value.length-1)
     {
      alert("Sorry Please Confirm your Email is correct!");
      document.stepinfo.email.focus();
      return false;
      }
   }
 else
  {
   alert("Sorry Please Confirm your Email is correct!");
   document.stepinfo.email.focus();
   return false;
   }

if(checkspace(document.stepinfo.call.value)) {
	document.stepinfo.call.focus();
    alert("Sorry Please Confirm your call is correct!");
	return false;
  }
  if(checkspace(document.stepinfo.contact.value)) {
	document.stepinfo.contact.focus();
    alert("Sorry Please Confirm your contact is correct!");
	return false;
  }
  if(checkspace(document.stepinfo.country.value)) {
	document.stepinfo.country.focus();
    alert("Sorry Please Confirm your country is correct!");
	return false;
  }
  if(checkspace(document.stepinfo.province.value)) {
	document.stepinfo.province.focus();
    alert("Sorry Please Confirm your province is correct!");
	return false;
  }
  if(checkspace(document.stepinfo.city.value)) {
	document.stepinfo.city.focus();
    alert("Sorry Please Confirm your city is correct!");
	return false;
  }
  if(checkspace(document.stepinfo.address.value)) {
	document.stepinfo.address.focus();
    alert("Sorry Please Confirm your address is correct!");
	return false;
  }
  if(checkspace(document.stepinfo.postcode.value)) {
	document.stepinfo.postcode.focus();
    alert("Sorry Please Confirm your postcode is correct!");
	return false;
  }
    if(document.stepinfo.remarks.value.length > 200 ) {
	document.stepinfo.remarks.focus();
    alert("Not more than 200 characters!");
	return false;
  }

}

function formpassjs()
{
    if(document.formpass.password.value != document.formpass.password1.value) {
	document.formpass.password.focus();
	document.formpass.password.value = '';
	document.formpass.password1.value = '';
    alert("Sorry Please Confirm your Password is correct!");
	return false;
  }
}

function forminfojs()
{
if(checkspace(document.forminfo.firstname.value)) {
	document.forminfo.firstname.focus();
    alert("Sorry Please Confirm your firstname is correct!");
	return false;
  }
  if(checkspace(document.forminfo.lastname.value)) {
	document.forminfo.lastname.focus();
    alert("Sorry Please Confirm your lastname is correct!");
	return false;
  }

if(document.forminfo.email.value.length!=0)
  {
    if (document.forminfo.email.value.charAt(0)=="." ||        
         document.forminfo.email.value.charAt(0)=="@"||       
         document.forminfo.email.value.indexOf('@', 0) == -1 || 
         document.forminfo.email.value.indexOf('.', 0) == -1 || 
         document.forminfo.email.value.lastIndexOf("@")==document.forminfo.email.value.length-1 || 
         document.forminfo.email.value.lastIndexOf(".")==document.forminfo.email.value.length-1)
     {
      alert("Sorry Please Confirm your Email is correct!");
      document.forminfo.email.focus();
      return false;
      }
   }
 else
  {
   alert("Sorry Please Confirm your Email is correct!");
   document.forminfo.email.focus();
   return false;
   }
  
}

function messageaddjs()
{
   if(checkspace(document.messageadd.title.value)) {
	document.messageadd.title.focus();
    alert("Sorry Please Confirm your title is correct!");
	return false;
  }

   if(document.messageadd.content.value.length > 400 ) {
	document.messageadd.content.focus();
    alert("Not more than 400 characters!");
	return false;
  }
}

function getpassjs1()
{
	if(checkspace(document.formgetpass1.userid.value)) {
	document.formgetpass1.userid.focus();
    alert("Sorry Please Confirm your userid is correct!");
	return false;
  }

}
function getpassjs2()
{
	if(checkspace(document.formgetpass2.Answer.value)) {
	document.formgetpass2.Answer.focus();
    alert("Sorry Please Confirm your Answer is correct!");
	return false;
  }

}
function getpassjs3()
{
	if(checkspace(document.formgetpass3.password.value)) {
	document.formgetpass3.password.focus();
    alert("Sorry Please Confirm your password is correct!");
	return false;
  }
    if(document.formgetpass3.password.value != document.formgetpass3.password1.value) {
	document.formgetpass3.password.focus();
	document.formgetpass3.password.value = '';
	document.formgetpass3.password1.value = '';
    alert("Sorry Please Confirm your Password is correct!");
	return false;
  }

}

function addmailjs()
{
if(document.addmailinfo.email.value.length!=0)
  {
    if (document.addmailinfo.email.value.charAt(0)=="." ||        
         document.addmailinfo.email.value.charAt(0)=="@"||       
         document.addmailinfo.email.value.indexOf('@', 0) == -1 || 
         document.addmailinfo.email.value.indexOf('.', 0) == -1 || 
         document.addmailinfo.email.value.lastIndexOf("@")==document.addmailinfo.email.value.length-1 || 
         document.addmailinfo.email.value.lastIndexOf(".")==document.addmailinfo.email.value.length-1)
     {
      alert("Sorry Please Confirm your Email is correct!");
      document.addmailinfo.email.focus();
      return false;
      }
   }
 else
  {
   alert("Sorry Please Confirm your Email is correct!");
   document.addmailinfo.email.focus();
   return false;
   }
}

function DrawImage(ImgD,FitWidth,FitHeight){
	var image=new Image();     
	image.src=ImgD.src;     
	if(image.width>0 && image.height>0){
		if(image.width/image.height>= FitWidth/FitHeight){             
  			if(image.width>FitWidth){                 
  				ImgD.width=FitWidth;                 
  				ImgD.height=(image.height*FitWidth)/image.width;             
  			}
  			else
  			{                 
  				ImgD.width=image.width;                 
  				ImgD.height=image.height;             
  			}         
  		} 
  		else
  		{             
  			if(image.height>FitHeight)
  			{                 
  				ImgD.height=FitHeight;                 
  				ImgD.width=(image.width*FitHeight)/image.height;             
  			}
  			else
  			{                 
  				ImgD.width=image.width;                 
  				ImgD.height=image.height;             
  			}         
  		}     
	} 
}

function onewh(ow)
{
	var pz_class = getCookie("pz_class_cookies");
	
	if (pz_class!=null)
	{
		var arr_class = pz_class.split(",");
		var s = arr_class.length;		
	}
	else
	{
		var arr_class = "";
		var s = 0;
	}
	var wh = "";
	var pz_class1 = "";
	var flag = 0;
	a=eval("wh"+ow);
	if(a.style.display=="none")
	{
		eval ( "wh" + ow +".style.display=\"\";");
		for(i=0;i<s-1;i++){
			if (arr_class[i]==ow)
			{
				flag = 1;
			}
			else
			{
				pz_class1 = pz_class1+arr_class[i]+",";
			}
		}
		pz_class1 = pz_class1+ow+",";
		setCookie("pz_class_cookies", pz_class1);
	}
	else
	{
		for(i=1;i<=s-1;i++){
			if (arr_class[i-1]!=ow)
			{
				pz_class1 = pz_class1+ow+",";
			}
		}
		setCookie("pz_class_cookies", pz_class1);
		eval("wh" + ow +".style.display=\"none\" ;");
	}

}

function getclass1()
{
	var pz_class = getCookie("pz_class_cookies");
	alert(pz_class);
}

function getclass(wh)
{
	var pz_class = getCookie("pz_class_cookies");
	var flag = 0;
	if (pz_class!= null)
	{
		var arr_class = pz_class.split(",");
		var s = arr_class.length;		
		
	}
	else
	{
		var arr_class = "";
		var s = 0;
	}
	
	for(i=0;i<s-1;i++){
		if (arr_class[i]==wh)
		{
			flag = 1;
		}
	}
	return flag;
}

function clearclass()
{
	setCookie("pz_class_cookies", "");
	alert("ok");

}

function time()
{
var mydate=new Date()
var year=mydate.getYear()
var month=mydate.getMonth()+1
var date=mydate.getDate()
var day=mydate.getDay()
var hours=mydate.getHours()
var minute=mydate.getMinutes()
var second=mydate.getSeconds()
var str=month+" "+date+" "+year+" "+((hours<10)? "0":"")+hours+((minute<10)? ":0":":")+minute+((second<10)? ":0":":")+second
dd.innerHTML=str
setTimeout("time()",1000)
}


function getck(sname,acookie)
{
	for(var i=0;i<acookie.length;i++){
		var arr=acookie[i].split("=");
		if(sname==arr[0]){
			if(arr.length>1)
			return unescape(arr[1]);
		else
			return "no login";
		}
	}
	return "no login";
}

	function changeImage(imageUrl)
	{
		if (document.images.middleImage)
			document.images.middleImage.src = imageUrl;
	}

