<!--

	var popup_win=null;
	String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

	function Trim(str) { //trim out empty space
	  var res = /^\s+/ig;
	  var ree = /\s+$/ig;
	  var out = str.replace(res,"").replace(ree,"");
	  return out;
	}
	
	  function isValid_Input(alphane){ //check whether the input is in alphanumeric format
		var numaric = Trim(alphane);
		for(var j=0; j<numaric.length; j++){
			var alphaa = numaric.charAt(j);
			var hh = alphaa.charCodeAt(0);
			//32=space "=34 %=37 '=39 (=40 )=41  ==61 ;=59 44=,
			
			if((hh >= 39 && hh <= 41) || (hh == 32) || (hh == 34) || (hh == 59) || (hh == 37) || (hh == 61)){
				return false;
			}
			else{
			}
		}
		return true;
	}
	
	function isValid_Name(str_name){ 
		var numaric = Trim(str_name);
		for(var j=0; j<numaric.length; j++){
			var alphaa = numaric.charAt(j);
			var hh = alphaa.charCodeAt(0);
			// "=34 %=37 (=40 )=41  ==61 ;=59 
			// (kk > 96 && kk<123) =a-z; (kk >= 64 && kk<91) =A-Z ; ,=44; '=39; space=32;(kk > 47 && kk<58)=0-9
			if((hh > 96 && hh < 123) || (hh >= 64 && hh < 91) || hh == 44 || hh == 39 || hh == 32 || (hh > 47 && hh<58)){
				//do nothing
			} else {
				 return false;
			}
		}
		return true;
	}

	function alphanumeric(theStrg){	//check valid text field
		var letters = "FALSE";			
 		var numbers = "FALSE";
		var alpnum = theStrg;
		
		for(var j=0; j<alpnum.length; j++){
	  		var alpnumeach = alpnum.charAt(j);
	  		var kk = alpnumeach.charCodeAt(0);
			//(kk > 47 && kk<58)=0-9 ; (kk >= 64 && kk<91) =A-Z ; (kk > 96 && kk<123) =a-z ; 
			 
			if((kk > 47 && kk<58) || (kk >= 64 && kk<91) || (kk > 96 && kk<123)){
			//if((kk >= 39 && kk <= 41) || (kk == 34) || (kk == 37)){
				if(((kk > 96 && kk<123) || (kk >= 64 && kk<91)) && letters == "FALSE"){ letters = "TRUE"; }
				if((kk > 47 && kk<58) && numbers == "FALSE"){ numbers = "TRUE"; }
			} else {
				return false;
			}
		}

		if(letters != "TRUE" || numbers != "TRUE"){
			return false;
		}
 		return true;
	}

	
	function isFieldEmpty(aTextField){   //check if field empty
	    var fieldres = false;
		var origlen = aTextField.length;
		var re = /\s/g; //Match any white space including space, tab, form-feed, etc. 
		RegExp.multiline = true; // IE support
		var str = aTextField.replace(re, "");
		var replacelen = str.length;
		//alert(aTextField);
		//alert(str);|| (origlen > replacelen)
		if ((replacelen==0) || (str==null) ) {
		fieldres = true;
		} else {  fieldres = false;  }
		return fieldres;
	}
		
	function isEmailAddr(email) {
  		var result = false;
  		var theStr = new String(email);
  		var index = theStr.indexOf("@");
  		if (index > 0) {
    		var pindex = theStr.indexOf(".",index);
    		if ((pindex > index+1) && (theStr.length > pindex+1))
    		result = true;
  		}
	 	return result;
	}
		
	function isNumeric(string){ //check if numeric
		var valid = "+012345678.9";
   		var strChar;
   		var result = true;

   		//if (string.length < 7) return false;
		for (i = 0; i < string.length && result == true; i++)
   		{
   			strChar = string.charAt(i);
   			if (valid.indexOf(strChar) == -1)
   			{
   				result = false;
   			}
   		}
   		return result;
	}
	
	function allDigits(str){ //check if number
		return inValidCharSet(str,"0123456789");
	}
	
	function inValidCharSet(str,charset){
		var result = true;
		for (var i=0;i<str.length;i++){
			if (charset.indexOf(str.substr(i,1))<0){
				result = false;
				break;
			}
		}
		return result;
	}     
	
	function isPhoneNumber(string){ //check if phone number
		var valid = "0123456789-+";
   		var strChar;
   		var result = true;
		var re = /\s/g; //Match any white space including space, tab, form-feed, etc. 
		var string = string.replace(re, "");

   		if (string.length < 6) return false;
		for (i = 0; i < string.length && result == true; i++)
   		{
   			strChar = string.charAt(i);
   			if (valid.indexOf(strChar) == -1)
   			{
   				result = false;
   			}
   		}
   		return result;
	}
	
	 
	function DisableEnableForm(xForm,xHow){ //disable all field in one form
  		objElems = xForm.elements;
		for(i=0;i<objElems.length;i++){
		  objElems[i].disabled = xHow;
		}
	}

	function remoteLocation(loc,theWidth,theHeight){ //popup window
		remote = window.open('','TheRemote','toolbar=0,scrollbars=yes,width='+theWidth+',height='+theHeight+',resizable=yes,statusbar=0');
		//remote.moveTo(15,50);
		if (remote != null){
		  if (remote.opener == null)
			  remote.opener = self;
			remote.location.href = loc;
		} else {
		  self.close();
		}
	}
	
	//more advance popup windows
	function popWindow(target_url, win_name, width, height, scroll, resize, position_mode, bringfront){
		if(position_mode=="random"){
			LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-width)):100;
			TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-height)-75)):100;
		}
		if(position_mode=="center"){
			LeftPosition=(screen.width)?(screen.width-width)/2:100;
			TopPosition=(screen.height)?(screen.height-height)/2:100;
		}
		else 
			if((position_mode!="center" && position_mode!="random") || position_mode==null){
				LeftPosition=190;
				TopPosition=20
			}
		settings='width='+width+',height='+height+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+resize;
		popup_win=window.open(target_url, win_name, settings);
		if(bringfront=="1")	popup_win.focus();
	}

	function reloadparent(){ 
		window.opener.history.go(0);
		window.moveTo(125,0);
  	}
  function reloadcurrent(){ 
		window.location.reload();
  	}
  
  function scrollto(){
  	window.moveTo(125,0);
  }
  
  function textCounter(field, countfield, maxlimit) {
		if (field.value.length > maxlimit) {
    		field.value = field.value.substring(0, maxlimit);
    	}
		else{
			countfield.value = maxlimit - field.value.length;
		}
  	}

//-->