(function(){function setFocus(){
	 if(document.form1.name!="form1"){document.form1.name.focus();}
	 if(document.form1.Comment.value != ""){
	 	document.form1.chara.value = maxi - document.form1.Comment.value.length;
	}
	else{
    	document.form1.chara.value = maxi;	
 	}	
};})();

var maxi = 1000;

function clean(){
	 document.getElementById('Comment').value = "";
	 document.form1.chara.value = maxi;
	 document.form1.Comment.focus();

}

function verifyEmail(target){
  if(!target.value == ""){
     var reg = new RegExp("@");
     if (reg.test(target.value)){
	   return true;
	 } 
     else{
       alert("You need to write a valid email address!");
	   target.value = "";	
	   document.getElementById("email").focus();
	   return false;
	 }
	}  
  else{
	alert("You need to fill in the email field!");
	document.getElementById("email").focus();
    return false;
  }
}
function isEmpty(pStrText){
   var   len = pStrText.length;
   var pos;
   var vStrnewtext = "";

   for (pos=0; pos<len; pos++){
      if (pStrText.substring(pos, (pos+1)) != " "){
         vStrnewtext = vStrnewtext + pStrText.substring(pos, (pos+1));
      }
   }

   if (vStrnewtext.length > 0)
      return false;
   else
      return true;
}

function verifyEmail2(){	
	verifyEmail(document.getElementById("email"));
	if(isEmpty(document.getElementById("email").value)){		
		document.getElementById("email").focus();
		return true;
	}
	else{
		return false;
	}
//	ini.id.focus();
}
function cleanEmailField(target){	
	if(target.value.substring(0,6)=="Please"){		
		target.value = "";
		return true;
	}
	else{
		return false;	
	}	
}
function browserName(){
	 alert(navigator.appCodeName);
}
	
function VerifySize(target){
	var StrLen;
		
	if (target.length > 0){
		if ((target.value == " ")){
			target.value = "";
		}
	}
	if (target.value.length != "" ){
	  StrLen = target.value.length;
	 	if(StrLen > maxi){
			target.value = target.value.substring(0,maxi - 1);
			target.focus();
			document.form1.chara.value = StrLen;
		}
	}
		
	if(!isNaN(maxi - StrLen)){
	 document.form1.chara.value = maxi - StrLen;
	}
	else{
	 document.form1.chara.value = maxi;
	}
}
	
function count(){
 	if(document.form1.chara.value == 0){
    alert("Sorry, 1000 characters only");
   return false;
  }
}
	
function openWindow(x,y,w,h,address){//opens a new window and position it on x y dir
  var paramStr = "width=" + w + "px,height=" + h + "px,status=no,left=" + y + ",screenX="+x +",top=0";
  var myWindow = window.open(address,'help',paramStr);
}