  function PopUp(url,wsize,hsize,resize)
  {
    window.open(url, 'childwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width='+wsize+',height='+hsize+',resizable='+resize);
  }

  function WinOpen(url,wsize,hsize,resize)
  {
     window.open(url, 'childwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width='+wsize+',height='+hsize+',resizable='+resize)
  }

  function openWinView(url)
  {
    winview=window.open(url, 'winview', 'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,resizable=yes,width=600,height=500,scrollbars=yes');
    winview.focus();
  }

  function changeButton(myImage)
  {

    re=/On\.gif/;

    found=re.exec(myImage.src);

    if  (found == 'On.gif')
    {
      re = /On\.gif/;
      newSrc=myImage.src.replace(re,'Off.gif');
      myImage.src=newSrc;
    }else{
      re = /Off\.gif/;
      newSrc=myImage.src.replace(re,'On.gif');
      myImage.src=newSrc;
    }

  }
  function RUSure()
  {
    if(confirm("Are you sure you want to\nclear the entire form?"))
    {
      document.registration.reset();
    }
    else
    {
      return;
    }
  }
	function isValidString(num) {
		var string="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@_-.";
		if (string.indexOf(num)!=-1){return true;}	
		return false;
	}

	function LTrim(str){
		if (str==null){return null;}
		for(var i=0;str.charAt(i)==" ";i++);
		return str.substring(i,str.length);
	}
	
	function checkUserName(value)
	{
		var str = LTrim(value);
		if(str.length > 5 && str.length < 51)
		{
			for(var i=0;i<str.length;i++){
				if(!isValidString(str.charAt(i))){
					alert("Please enter valid User Name. It can contain following \n a-z, A-Z, 0-9 and @ - _ .");				
					return false;
				}
			}
		} else {
			alert("User Name must be 6 to 120 characters long.");
			return false;
		}
		return true;
	}

	function checkPassword(str)
	{
		//var str = LTrim(value);
		if(str.length > 5 && str.length < 51)
		{
			for(var i=0;i<str.length;i++){
				if(!isValidString(str.charAt(i))){
					alert("Please enter valid Password. It can contain following \n a-z, A-Z, 0-9 and @ - _ .");				
					return false;
				}
			}
		} else {
			alert("Password must be 6 to 17 characters long.");
			return false;
		}
		return true;
	}

	function checkPhoneNumber(value)
	{
		for(var i=0;i<value.length;i++){
			if(!isValidPhoneNumber(value.charAt(i))){
				alert("Please enter valid PhoneNumber. It can contain following \n 0-9 and +()-");				
				return false;
			}
		}
		return true;
	}
	function isValidPhoneNumber(num) {
		var string="1234567890()+- ";
		if (string.indexOf(num)!=-1){return true;}	
		return false;
	}

	function checkEmail(fieldValue) {		
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(fieldValue)){		
			return (false)
		} else {
			return (true)
		}
	}

	function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)

		if(checkEmail(str)) {
			alert("Please enter a valid E-mail ID")
		    return false
		}
		if (str.indexOf(at)==-1){
		   alert("Please enter a valid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter a valid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter a valid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter a valid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter a valid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter a valid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please enter a valid E-mail ID")
		    return false
		 }

 		 return true					
	}

	function isValidNumber(num) {
		var string="1234567890";
		if (string.indexOf(num)!=-1){return true;}	
		return false;
	}