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.state.value)) {
	document.reginfo.state.focus();
    alert("Sorry Please Confirm your State/Province/Region is correct!");
	return false;
  }
  
  if(checkspace(document.reginfo.postcode.value)) {
	document.reginfo.postcode.focus();
    alert("Sorry Please Confirm your ZIP/Postal Code is correct!");
	return false;
  }
  
  if(checkspace(document.reginfo.phone.value)) {
	document.reginfo.phone.focus();
    alert("Sorry Please Confirm your Phone Number is correct!");
	return false;
  }  

  
}


function loginjs()
{

if(checkspace(document.form2.username.value)) {
	document.form2.username.focus();
    alert("Sorry Please Confirm your username is correct!");
	return false;
  }
  
  if(checkspace(document.form2.password.value)) {
	document.form2.password.focus();
    alert("Sorry Please Confirm your password is correct!");
	return false;
  }
  
}

function regjs_guest()
{


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.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.ADDRESS1.value)) {
	document.reginfo.ADDRESS1.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.SATE.value)) {
	document.reginfo.SATE.focus();
    alert("Sorry Please Confirm your State/Province/Region is correct!");
	return false;
  }
  
  if(checkspace(document.reginfo.ZIPCODE.value)) {
	document.reginfo.ZIPCODE.focus();
    alert("Sorry Please Confirm your ZIP/Postal Code is correct!");
	return false;
  }
  
  if(checkspace(document.reginfo.PHONE.value)) {
	document.reginfo.PHONE.focus();
    alert("Sorry Please Confirm your Phone Number is correct!");
	return false;
  }  

  
}


function newjs()
{


if(document.form1.username.value.length!=0)
  {
    if (document.form1.username.value.charAt(0)=="." ||        
         document.form1.username.value.charAt(0)=="@"||       
         document.form1.username.value.indexOf('@', 0) == -1 || 
         document.form1.username.value.indexOf('.', 0) == -1 || 
         document.form1.username.value.lastIndexOf("@")==document.form1.username.value.length-1 || 
         document.form1.username.value.lastIndexOf(".")==document.form1.username.value.length-1)
     {
      alert("Sorry Please Confirm your Email is correct!");
      document.form1.username.focus();
      return false;
      }
   }
 else
  {
   alert("Sorry Please Confirm your Email is correct!");
   document.form1.username.focus();
   return false;
   }


  
}


function passjs()
{
	

  if(checkspace(document.reginfo.password0.value)) {
	document.reginfo.password0.focus();
    alert("Sorry Please Confirm your Current Password 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;
  }


  
}

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.phone.value)) {
	document.finfo.phone.focus();
    alert("Sorry Please Confirm your Phone is correct!");
	return false;
  }
*/
if(checkspace(document.finfo.content.value)) {
	document.finfo.content.focus();
    alert("Sorry Please Confirm your Message 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)
{
a=eval("wh"+ow)
if(a.style.display=="none")
{
eval ( "wh" + ow +".style.display=\"\";")
}
else
{
eval("wh" + ow +".style.display=\"none\" ;")
}

}

function trshow(obj){
if (obj.style.display=='none')
 {obj.style.display='';}
else
 {obj.style.display='none';}
}

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;
	}


  var   nowdate=new   Date();   
  var   nowyear=nowdate.getYear();   
    
  function   xc_show(text) 
  { 	 			
      if (document.all&&document.readyState=="complete")  
      {   
      document.all.xc_point.style.display="none";
      document.all.xc_point.innerHTML="<div vAlign=center>"+text+"</div>";   
      document.all.xc_point.style.pixelLeft=event.clientX+document.body.scrollLeft;   
      document.all.xc_point.style.pixelTop=event.clientY+document.body.scrollTop+10; 

     // document.all.xc_point.style.offsetLeft = event.clientX;   
     // document.all.xc_point.style.offsetTop = event.clientY;         

			document.all.xc_point.style.visibility="visible"; 
			document.all.xc_point.style.display="block";
      }    
      
  }   
    
  document.write(   
"<div id=\"xc_point\" style=\"position:absolute;visibility:hidden; display:none  padding:3px;border:1px  solid  #CCCCCC; background-color:#FFFFFF; width:180px; Height:60px; left:77; top:96px; z-index:10;\" ></div>");   
      

    
  function   xc_hide()   
  {       	  
    if (document.all)  { 
      document.all.xc_point.style.visibility="hidden"; 
      document.all.xc_point.style.display="none";  
    }    
  } 



function fixpic2(Obj)
{var thisvalue=0;
//argument[0]-Obj,[1]-width,[2]-height;
var Objwidth=Objheight=142;
var ObjOrgwidth=Obj.width,ObjOrgheight=Obj.height;
if(arguments.length>1){Objwidth=arguments[1];}
if(arguments.length>2){Objheight=arguments[2];}
var wscale=ObjOrgwidth/Objwidth;
var hscale=ObjOrgheight/Objheight;
	if(wscale>1){
		if(wscale>hscale){Obj.style.width=Objwidth.toString()+'px';Obj.style.height=parseInt(ObjOrgheight/wscale).toString()+'px';}
		else{Obj.style.height=Objheight.toString()+'px';Obj.style.width=parseInt(ObjOrgwidth/hscale).toString()+'px';}
	}
	else{
		if(hscale>1){
			if(hscale>wscale){Obj.style.height=Objheight.toString()+'px';Obj.style.width=parseInt(ObjOrgwidth/hscale).toString()+'px';}
			else{Obj.style.width=Objwidth.toString()+'px';Obj.style.height=parseInt(ObjOrgheight/wscale).toString()+'px';}
		}
	}
}

var flag=false;
function fixpic(ImgD){
var image=new Image();
image.src=ImgD.src;
var iwidth=iheight=110;
if(arguments.length>1){iwidth=arguments[1];}
if(arguments.length>2){iheight=arguments[2];}
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= iwidth/iheight){
if(image.width>iwidth){ 
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
ImgD.alt=image.width+"X"+image.height;
}
else{
if(image.height>iheight){ 
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
ImgD.alt=image.width+"X"+image.height;
}
}
}

function ReQueryString(qname,qvalue){
var qstrings=location.search,lpath=location.pathname,qx;
if(qstrings){
if(typeof(qname[0])=='undefined'){qx = qstrings.search(new RegExp("[?&]"+qname+"=[^&]*&?"));
if(qx==-1){qstrings+= '&' + qname + '=' + qvalue;}
else{qstrings=qstrings.replace(new RegExp("([?&])"+qname+"=[^&]*(&?)"),"$1"+qname+"="+qvalue+"$2");}
}
else{if(qname.length==qvalue.length){for(var i=0;i<qname.length;i++){
qx = qstrings.search(new RegExp("[?&]"+qname[i]+"=[^&]*&?"));
if(qx==-1){qstrings+= '&' + qname[i] + '=' + qvalue[i];}
else{qstrings=qstrings.replace(new RegExp("([?&])"+qname[i]+"=[^&]*(&?)"),"$1"+qname[i]+"="+qvalue[i]+"$2");}
}}qstrings='?' + qstrings.substr(1);}
}
else{if(typeof(qname[0])=='undefined')qstrings = '?' + qname+'='+qvalue;
else{qstrings='';for(var i=0;i<qname.length;i++){qstrings+= '&' + qname[i] + '=' + qvalue[i];}qstrings='?' + qstrings.substr(1);}}
return lpath + qstrings;
}
function QueryString(item)
{
       var sValue=location.search.match(new RegExp("[?&]"+item+"=([^&]*)(&?)","i")) 
       return sValue?sValue[1]:sValue
}

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 GoUrl(url,querystring,_form){
	if(_form=="" || _form==null){_form="_self";}
	var xwin = new FormRequest("GET",url,false,_form);
	if(querystring.substring(0,1)=="?"){
	querystring=querystring.substring(1,querystring.length);}
    xwin.send(querystring);
}
function GoUrl2(urlwithquerystring,_form){
	if(_form=="" || _form==null){_form="_self";}
	var url="",querystring="",uwq=urlwithquerystring.split("?");
	url=uwq[0];
	if(uwq.length>1)querystring=uwq[1];
	var xwin = new FormRequest("GET",url,false,_form);
	if(querystring.substring(0,1)=="?"){
	querystring=querystring.substring(1,querystring.length);}
    xwin.send(querystring);
}
function $() {
  var elements = new Array();
  
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1) 
      return element;
      
    elements.push(element);
  }
  
  return elements;
}