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.username.value)) {
	document.reginfo.username.focus();
    alert("Sorry Please Confirm your username is correct!");
	return false;
  }
 
    if(checkspace(document.reginfo.username.value) || document.reginfo.username.value.length < 4) {
	document.reginfo.username.focus();
    alert("Sorry Please Confirm your username is correct!");
	return false;
  }
    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.question.value)) {
//	document.reginfo.question.focus();
//    alert("Sorry Please Confirm your question is correct!");
//	return false;
//  }
  
//  if(checkspace(document.reginfo.answer.value)) {
//	document.reginfo.answer.focus();
//    alert("Sorry Please Confirm your Answer 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(document.reginfo.email.value.length!=0)
  {
    if (document.reginfo.email.value.charAt(0)=="." ||        
         document.reginfo.email.value.charAt(0)=="@"||       
         document.reginfo.email.value.indexOf('@', 0) == -1 || 
         document.reginfo.email.value.indexOf('.', 0) == -1 || 
         document.reginfo.email.value.lastIndexOf("@")==document.reginfo.email.value.length-1 || 
         document.reginfo.email.value.lastIndexOf(".")==document.reginfo.email.value.length-1)
     {
      alert("Sorry Please Confirm your Email is correct!");
      document.reginfo.email.focus();
      return false;
      }
   }
 else
  {
   alert("Sorry Please Confirm your Email is correct!");
   document.reginfo.email.focus();
   return false;
   }
   
   if(checkspace(document.reginfo.call.value)) {
	document.reginfo.call.focus();
    alert("Sorry Please Confirm your Telephone is correct!");
	return false;
  }
  
}

//feedback.asp
function feedbackjs()
{
   if(checkspace(document.finfo.name.value)) {
	document.finfo.name.focus();
    alert("Sorry Please Confirm your name 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.content.value)) {
	document.finfo.content.focus();
    alert("Sorry Please Confirm your content is correct!");
	return false;
  }

}

//step.asp
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 FormRequest(_method,_url,_async,_target){
	var oThis = this;
	var value = null;
	var text = null;
	
	var _form = document.getElementById("myAjaxRequestForm");
	if(_form){
		_form.removeNode(true);
	}
	
	_form = document.createElement("form");
	document.body.appendChild(_form);
	
	_form.method = _method;
	_form.action = _url;
	_form.target = _target;
	
	currentRequest = oThis;
	//input
	this.setParameter = function(name,value) {
		var _input = document.createElement("input");
		_input.name=name;
		_input.value=value;
		_input.type="hidden";
		_form.appendChild(_input);
	}
		
	//url
	this.send = function(v){
		if(v==null || v==""){
			_form.submit();

		}else{
			var parts = v.split('&');
			for(var i=0;i<parts.length;i++){
				var part = parts[i].split('=');
				var name = part[0];
				var value = part[1];
				var _input = document.createElement("input");
				_input.name=name;
				_input.value=value;
				_input.type="hidden";
				_form.appendChild(_input);
			}
			_form.submit();
		}
	}

}

function GoForm(url,querystring,_form)
{var r = new FormRequest("POST",url,false,_form);
if(_form=="" || _form==null){_form="_self";}
if(querystring.substring(0,1)=="?"){
querystring=querystring.substring(1,querystring.length);}
var tmpValues = querystring.split("&");
for(var i = 0; i < tmpValues.length; i++)
{
var tmpValue = tmpValues[i].split("=");
r.setParameter(tmpValue[0],tmpValue[1])
}
r.send("");}
function isdefined(varname){
	if(typeof(varname)=='undefined'){
	return false;}
	else{
	return true;}
}
function province_slt(){
var province_list=Array('Please select','Afghanistan','Albania','Algeria','American Samoa','Andorra','Angola','Anguilla','Antarctica','Antigua and Barbuda','Argentina','Armenia','Aruba','Australia','Austria','Azerbaijan','Bahamas','Bahrain','Bangladesh','Barbados','Belarus','Belgium','Belize','Benin','Bermuda','Bhutan','Bolivia','Bosnia and Herzegowina','Botswana','Bouvet Island','Brazil','British Indian Ocean Territory','Brunei Darussalam','Bulgaria','Burkina Faso','Burundi','Cambodia','Cameroon','Canada','Cape Verde','Cayman Islands','Central African Republic','Chad','Chile','China','Christmas Island','Cocos (Keeling) Islands','Colombia','Comoros','Congo','Cook Islands','Costa Rica','Cote D\'Ivoire','Croatia','Cuba','Cyprus','Czech Republic','Denmark','Djibouti','Dominica','Dominican Republic','East Timor','Ecuador','Egypt','El Salvador','Equatorial Guinea','Eritrea','Estonia','Ethiopia','Falkland Islands (Malvinas)','Faroe Islands','Fiji','Finland','France','France, Metropolitan','French Guiana','French Polynesia','French Southern Territories','Gabon','Gambia','Georgia','Germany','Ghana','Gibraltar','Greece','Greenland','Grenada','Guadeloupe','Guam','Guatemala','Guinea','Guinea-bissau','Guyana','Haiti','Heard and Mc Donald Islands','Honduras','Hong Kong','Hungary','Iceland','India','Indonesia','Iran (Islamic Republic of)','Iraq','Ireland','Israel','Italy','Jamaica','Japan','Jordan','Kazakhstan','Kenya','Kiribati','Korea, Democratic People\'s Republic of','Korea, Republic of','Kuwait','Kyrgyzstan','Lao People\'s Democratic Republic','Latvia','Lebanon','Lesotho','Liberia','Libyan Arab Jamahiriya','Liechtenstein','Lithuania','Luxembourg','Macau','Macedonia, The Former Yugoslav Republic of','Madagascar','Malawi','Malaysia','Maldives','Mali','Malta','Marshall Islands','Martinique','Mauritania','Mauritius','Mayotte','Mexico','Micronesia, Federated States of','Moldova, Republic of','Monaco','Mongolia','Montserrat','Morocco','Mozambique','Myanmar','Namibia','Nauru','Nepal','Netherlands','Netherlands Antilles','New Caledonia','New Zealand','Nicaragua','Niger','Nigeria','Niue','Norfolk Island','Northern Mariana Islands','Norway','Oman','Pakistan','Palau','Panama','Papua New Guinea','Paraguay','Peru','Philippines','Pitcairn','Poland','Portugal','Puerto Rico','Qatar','Reunion','Romania','Russian Federation','Rwanda','Saint Kitts and Nevis','Saint Lucia','Saint Vincent and the Grenadines','Samoa','San Marino','Sao Tome and Principe','Saudi Arabia','Senegal','Seychelles','Sierra Leone','Singapore','Slovakia (Slovak Republic)','Slovenia','Solomon Islands','Somalia','South Africa','South Georgia and the South Sandwich Islands','Spain','Sri Lanka','St. Helena','St. Pierre and Miquelon','Sudan','Suriname','Svalbard and Jan Mayen Islands','Swaziland','Sweden','Switzerland','Syrian Arab Republic','Taiwan','Tajikistan','Tanzania, United Republic of','Thailand','Togo','Tokelau','Tonga','Trinidad and Tobago','Tunisia','Turkey','Turkmenistan','Turks and Caicos Islands','Tuvalu','Uganda','Ukraine','United Arab Emirates','United Kingdom','United States','United States Minor Outlying Islands','Uruguay','Uzbekistan','Vanuatu','Vatican City State (Holy See)','Venezuela','Viet Nam','Virgin Islands (British)','Virgin Islands (U.S.)','Wallis and Futuna Islands','Western Sahara','Yemen','Yugoslavia','Zaire','Zambia','Zimbabwe');
var x=arguments,idname,name;
idname=name=='province_select';
//0=idname,1=value(1=id,2=text),2=defalut,3=name
var ostr='';
ostr+='<select size="1"';
if(isdefined(x[0])){idname=x[0];}
ostr+=' id="' + idname +'"';
if(isdefined(x[5])){name=x[3];}
else{name=idname;}
ostr+=' name="' + name + '"';
ostr+='>\n'
for(var i=0;i<province_list.length;i++){
		ostr+='<option'
		if(isdefined(x[2])){if(province_list[i].toString()==x[2].toString())ostr+=' selected';}
		if(isdefined(x[1])){switch(parseInt(x[1])){
			case 1:
			ostr+=' value="' + i+1 + '"';
			break;
			default:
			ostr+=' value="' + province_list[i] + '"';
			break;
			}
		}
	ostr+='>' + province_list[i] + '</option>\n';
	}
ostr+='</select>\n'
document.write(ostr);
}

//Product_view.asp
function revewsjs()
{
if(document.pform.email.value.length!=0)
  {
    if (document.pform.email.value.charAt(0)=="." ||        
         document.pform.email.value.charAt(0)=="@"||       
         document.pform.email.value.indexOf('@', 0) == -1 || 
         document.pform.email.value.indexOf('.', 0) == -1 || 
         document.pform.email.value.lastIndexOf("@")==document.pform.email.value.length-1 || 
         document.pform.email.value.lastIndexOf(".")==document.pform.email.value.length-1)
     {
      alert("Sorry Please Confirm your Email is correct!");
      document.pform.email.focus();
      return false;
      }
   }
 else
  {
   alert("Sorry Please Confirm your Email is correct!");
   document.pform.email.focus();
   return false;
   }
   
   if(checkspace(document.pform.content.value)) {
	document.pform.content.focus();
    alert("Sorry Please Confirm your content is correct!");
	return false;
  }
}

//product_view.asp
function showsubmenu(sid)  
{  
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")  
{  
eval("submenu" + sid + ".style.display=\"\";");
}  
else  
{  
eval("submenu" + sid + ".style.display=\"none\";"); 
}
}  
