<!--

function checktext(str,errmsg)
{
	var checkspc=1;
	if(str.value.length==0)
	{
		alert('Please Enter Your '+errmsg);
		str.focus();
		return false;
	}
	for(i=0;i<str.value.length;i++)
		if(str.value.charAt(i)  != " ")
		{
			checkspc=0; break;
		}
	if(checkspc==1)	
	{
		alert('Please Enter Your '+errmsg);
		str.select();
		str.focus();
		return false;
	} 
	return true;
}
function checkspace(str,errmsg)
{
	if(str.value.length==0)
	{
		alert('Please Enter Your'+errmsg);
		str.focus();
		return false;
	}
	for(i=0;i<str.value.length;i++)
		if(str.value.charAt(i) == " ")
		{
			alert('Please do not enter spaces in field '+errmsg);
			str.select();
			str.focus();
			return false;
		}
	return true;
}
function checkdigit(str,errmsg)
{
	digits = "0123456789.";

	if (str.value.length==0) 
	{
		alert('Please Enter Your '+errmsg);
		str.focus();
		return false;
	}
	for (var i = 0; i < str.value.length; i++) 
	{
		var ch = str.value.charAt(i);
		var a = digits.indexOf(ch);
		if (a == -1)
		{
			alert('Please Enter Your '+errmsg);
			str.select();
			str.focus();
			return (false);
		}
	}
	return(true);
}

function checkdigit1(str,errmsg)
{
	digits = "0123456789";

	for (var i = 0; i < str.value.length; i++) 
	{
		var ch = str.value.charAt(i);
		var a = digits.indexOf(ch);
		if (a == -1)
		{
			alert('Please Enter Your '+errmsg);
			str.select();
			str.focus();
			return (false);
		}
	}
	return(true);
}


function checknum(str,errmsg)
{
	if(str.value.length==0)
	{
		alert('Please enter your  '+errmsg);
		str.focus();
		return false;
	}
	if(isNaN(str.value))
	{
		alert(errmsg+' must be numeric');
		str.select();
		str.focus();
		return false;
	}
	return true;
}

function checknum1(str,errmsg)
{
	if(isNaN(str.value))
	{
		alert(errmsg+' must be numeric');
		str.select();
		str.focus();
		return false;
	}
	return true;
}
/*
function checkmail(str,errmsg)
{
	flag=0;
if(str.value.length!=0)
{
	if(str.value.indexOf("@") < 1)
	 {
		flag=1;
	 }
	else if(str.value.indexOf(".") < 1)
    {
 		flag=1;
	 }
	else if(str.value.indexOf(" ") != -1)
	 {
   		flag=1;
	 } 
	else if(str.value.indexOf("@")+1 >= str.value.indexOf("."))
	 {
		flag=1;
	 } 
		else if(str.value.indexOf(".") == str.value.length-1)
	 {
   		flag=1;
	 } 
	 if (flag==1)
	 {
		alert('Please Enter valid '+errmsg+ ' Address ');
		str.select();
		str.focus();
		return false;
 	 }  
}
	 return true;
}
*/
function checkmail(str,errmsg)
{
	if ((str.value==null)||(str.value=="")){
		alert("Please Enter your Email ID");
		str.focus();
		return false;
	}
	if (echeck(str.value)==false){
		str.value="";
		str.focus();
		return false;
	}
	return true
}



function checkpass(str1,errmsg1,str2,errmsg2)
{
	if ( str1.value != str2.value )
	{
		alert('You have entered different values in '+errmsg1);
		str1.select();
		str1.focus();
		return false;
	}	
	return true;
}
function checkcombo(str,errmsg)
{
	if(str.selectedIndex <=0 )
	{
		alert('Please Enter Your '+errmsg);
		str.focus();
		return false;
	}
	return true;
}
function checkint(str,errmsg)
{
	if( str.value>2147483647 || str.value<0 )
	{
		alert('Invalid '+errmsg);
		str.select();
		str.focus();
		return false;
	}
	return true;
}


// -->

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}
function popupmenu(choice,wt,ht,tp,lt)
{ 
  var winOpts="toolbars=no,scrollbars=yes,resize=yes,width="+wt+",height="+ht+",top="+tp+",left="+lt+",location=no,directories=no";
  confirmWin=window.open(choice,'theconfirmWin',winOpts);

}
function popupbox(choice,wt,ht,tp,lt)
{ 
  var winOpts="toolbars=no,scrollbars=no,resize=no,statusbar=no,width="+wt+",height="+ht+",top="+tp+",left="+lt+",location=no,directories=no";
  confirmWin=window.open(choice,'theconfirmBox',winOpts);
}
// -->

