
function JumpToIt(frm) 
{
    var newPage = frm.selLink.options[frm.selLink.selectedIndex].value
    if (newPage != "None") {
        location.href=newPage
    }
}

function stripBlanks(Source)
{
 	var newString;
	var i;
	var j;
	var blank;
	blank = " ";
	newString = "";
	aString = Source;	
	for (i=0; i<aString.length; i++)
	{ 
		if (aString.charAt(i) != blank && aString.charCodeAt(i)!= 13 && aString.charCodeAt(i) != 10 )
		{
			break;
		}
	}
	for (j=aString.length-1; j>=0; j--)
	{
		if (aString.charAt(j) != blank   && aString.charCodeAt(j)!= 13 && aString.charCodeAt(j) != 10 )
		{
				break;
		}
	}
	for(k=i;k<=j;k++)
	{
		newString += aString.charAt(k);
	}	
	return newString;	
}
function PhoneNumberCheck(Field)
{
	var strTmp = Field.value;  	
	var intBlankOccurance = 0;
	var intHypenOccurance = 0;
	var strAlertMsg;
	var valid = "1234567890 -()" ;
	var temp;
	
	for (var i=0; i<strTmp.length; i++)
	{
		temp = ""+ strTmp.substring(i, i+1);
				
		if (valid.indexOf(temp) == -1) 
		{
			return false;
			break;
		}
	}
		return true;   	
}

function emailCheck(email)
{
	var intI=1;
	var intCounter=0;
	strEmail=email.value;
	var strEmailLength = strEmail.length;
	var check =1;
	 if (email.value == '')	
	 {
	 	alert('Please enter an E-mail ID.');
	 	email.focus();
	 	check = 0; 
	 	return check;
	 }
	 // look for @
	 while ((intI < strEmailLength) && (strEmail.charAt(intI) != "@"))
	 { intI++ }
	 if ((intI >= strEmailLength) || (strEmail.charAt(intI) != "@"))
	 {
	 	//alert('E-mail ID should be of the form - name@company.com or name@company.co.country. Please try again.');
	 //	email.focus();
	 	check = 0; 
	 	return check;
	 }
	 
	else intI += 2;
    // look for .
    while ((intI < strEmailLength) && (strEmail.charAt(intI) != "."))
	{ intI++     }
	// there must be at least one character after the .
    diff=strEmailLength - intI;
	if ((intI >= strEmailLength - 1) || (strEmail.charAt(intI) != ".")) 
	{
	   // alert('E-mail ID should be of the form - name@company.com or name@company.co.country. Please try again.');
    	//email.focus();
	    check = 0; 
		return check;
	}
	
	//checking for two continuous "."
	 
	 for(i=0; i < strEmailLength; i++)
	 {
	    if(strEmail.charAt(i) == ".")
	    {
	   	if(strEmail.charAt(i+1) == ".")
	   	{
	   		//alert('E-mail ID should be of the form - name@company.com or name@company.co.country. Please try again.');
	   	//	email.focus();
	   		check = 0; 
	   		return check;
	   	}
	   }
	}
	 
	 
	var valid1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@._0123456789-';
    var temp1;
	var fieldx=email.value;
	for (var intI=0; intI <fieldx.length; intI++) 
	{
		temp1 = "" + fieldx.substring(intI, intI+1);
	    if(temp1 == "@")
		{
			intCounter=intCounter+1;
		}
		if (valid1.indexOf(temp1) == "-1")
		{
		//	alert("E-mail ID should be of the form - name@company.com or name@company.co.country. Please try again.");
		//	email.focus();
			check = 0; 
	 		return check;
		}
	}
	var strSourceField = email.value;
	var blnNumCheckStatus = true;
	var intDectot  = 0;
	var intDecpos  = 0;
	var strValidchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@._0123456789-";
	for(var intDecCount=0; intDecCount<strSourceField.length;intDecCount++) 
	{
		if(strSourceField.charAt(intDecCount)=='@') 
		{
			intDectot++;
			intDecpos = (intDecCount+1);
		}
		if (intDectot>1)
		{
			blnNumCheckStatus = false;
		}
	}
	if(blnNumCheckStatus==false)
	{
		//alert("E-mail ID should be of the form - name@company.com or name@company.co.country. Please try again.");
		//email.focus();
		return blnNumCheckStatus;
	}
	if ((email.value.length < 6) || (email.value.length > 80))
	{
		//alert("E-mail ID should be of the form - name@company.com or name@company.co.country. Please try again.");
		//email.focus();
		check = 0; 
	 //	return check;
	}
	var invalid = " "; // Invalid character is a space
	if (email.value.indexOf(invalid) > -1) 
	{
	//	alert("E-mail ID should be of the form - name@company.com or name@company.co.country. Please try again.");
	//	email.focus();
		check = 0; 
		return check;
	}
	var strSourceField = email.value;
	var blnNumCheckStatus = true;
	var intDectot  = 0;
	var intDecpos  = 0;
	var strValidchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@._0123456789-";
	for(var intDecCount=0; intDecCount<strSourceField.length;intDecCount++) 
	{
		if(strSourceField.charAt(intDecCount)=='@') 
		{
			intDectot++;
			intDecpos = (intDecCount+1);
		}
		if (intDectot>1)
		{
			blnNumCheckStatus = false;
		}
	}
	if(blnNumCheckStatus==false)
	{
		//alert("E-mail ID should be of the form - name@company.com or name@company.co.country. Please try again. ");
		//email.focus();
		return blnNumCheckStatus;
	}
	
	return check;
}
