 

	function submitform()

	{

	   if(document.FrmRegi.fstname.value=="")

			{

			  alert ("Please Enter Name .");

			  document.FrmRegi.fstname.focus();

			 //return

			

		

		} else if (document.FrmRegi.eid.value=="") {

			alert ("Please enter your Email Address.");

			document.FrmRegi.eid.focus();

				} else if(!echeck(document.FrmRegi.eid.value))

		{

			return

			//return

		/*} else if (document.FrmRegi.ContactPref.value=="SelectPref"){

			alert ("Please enter your Preference of contact.");*/

		//return

	

		/*} else if (document.FrmRegi.jobtitle.value=="") {

			alert ("Please enter your Job Title.");

			document.FrmRegi.jobtitle.focus();*/

			//return

			

				} else if (document.FrmRegi.phone.value=="") {

			alert ("Please enter your phone Number.");

			document.FrmRegi.phone.focus();

			//return

			

		} else if (document.FrmRegi.country.value=="SelectCountry"){

			alert ("Please select your Country.");

		//return

			} else if (document.FrmRegi.address.value=="") {

			alert ("Please enter your Address.");

			document.FrmRegi.address.focus();

			//return

		  } else if (document.FrmRegi.comments.value=="") {

			alert ("Please enter Comments.");

			document.FrmRegi.comments.focus();		

			//return

		}else if (document.FrmRegi.captcha1.value!=document.FrmRegi.usercaptcha1.value) {

			alert ("Please enter the correct code.");

			document.FrmRegi.usercaptcha1.focus();		

			//return

		}else {
			
			document.FrmRegi.submit();

		}

	}

	

	function echeck(str) {

	

			var at="@"

			var dot="."

			var comma=","

			var lat=str.indexOf(at)

			var lstr=str.length

			var ldot=str.indexOf(dot)

			if (str.indexOf(at)==-1){

			   alert("Please enter a vaild Email Address.")

			   return false

			}

	

			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==(lstr-1)){

			   alert("Please enter a vaild Email Address.")

			   return false

			}

			

			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==(lstr-1)){

				alert("Please enter a vaild Email Address.")

				return false

			}

	

			 if (str.indexOf(at,(lat+1))!=-1){

				alert("Please enter a vaild Email Address.")

				return false

			 }

			  

			if (str.indexOf(comma)!=-1){

				alert("Please enter a vaild Email Address.")

				return false

			 }

	

			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

				alert("Please enter a vaild Email Address.")

				return false

			 }

	

			 if (str.indexOf(dot,(lat+2))==-1){

				alert("Please enter a vaild Email Address.")

				return false

			 }

			 

			 if (str.substring(lstr-1,lstr-0)==dot){

				alert("Please enter a vaild Email Address.")

				return false

			 }

			 

			if (str.substring(lstr-1,lstr-0)==at){

				alert("Please enter a vaild Email Address.")

				return false

			 } 

			

			 if (str.indexOf(" ")!=-1){

				alert("Please enter a vaild Email Address.")

				return false

			 }

			 return true					

		}

		

		

		





function getErrorMessage(strName, strMessage){

	return "<tr class='js_error'><td align='right'><b>" + strName + ":&nbsp;&nbsp;</b></td> <td><font class='error_isbn'>" + strMessage + "</font></td></tr>";

}



function getRequiredErrorMessage(strName){

	return getErrorMessage(strName, "This value cannot be empty.");

}



function getMinLengthErrorMessage(strName, strValue, intMinLength){

	return getErrorMessage(strName, "This value must be at least " + intMinLength.toString() + " characters (currently " + strValue.length + " characters).");

}



function getMaxLengthErrorMessage(strName, strValue, intMaxLength){

	return getErrorMessage(strName, "This value can be no greater than " + intMaxLength.toString() + " characters (currently " + strValue.length + " characters).");

}



function getInvalidFileExtMessage(strName, strExts){

	return getErrorMessage(strName, "The file must have one of the allowed extentions (" + strExts + ").");

}



function isEmpty(str){

	var regEx = /\w+/;



	return !regEx.test(str);

}



function isValidPattern_Email(str){

	var regEx = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/i;

	

	return regEx.test(str);

}



function isValidPattern_URL(str){

	var regEx = new RegExp("^(http|https|ftp)://", "i");

	

	return regEx.test(str);

}



function isValidPattern_WebsiteURL(str){

	var regEx = new RegExp("^(http|https)://", "i");

	

	return regEx.test(str);

}



function isValidPattern_LoginName(str){

	var regEx = /^\S{6,25}$/i;

	

	return regEx.test(str);

}



function isValidPattern_Password(str){

	var regEx = /^\S{6,15}$/i;

	

	return regEx.test(str);

}



function isValidPattern_Decimal(str){

	var regEx = /(^\d+$)|(^\d+\.\d{0,2}$)/;

	

	return regEx.test(str);

}



function isValidPattern_Digits(str){

	var regEx = new RegExp("[^0-9]","ig");



	return !regEx.test(str);

}



function isValidPattern_InterNatnPhnNo(strPhone){

	s = stripCharsInBag(strPhone,validWorldPhoneChars);

	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);

}



/*********************US/Canada Zip Code Validations**************************/

function isValidPattern_ZipCode(str){

	regEx = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);

	

	return regEx.test(str);

}

/*****************************************************************************/



/*********************International Phone Number Validation*******************/

// Declaring required variables

var digits = "0123456789";

// non-digit characters which are allowed in phone numbers

var phoneNumberDelimiters = "()- ";

// characters which are allowed in international phone numbers

// (a leading + is OK)

var validWorldPhoneChars = phoneNumberDelimiters + "+";

// Minimum no of digits in an international phone no.

var minDigitsInIPhoneNumber = 10;



function isValidPattern_PhoneNo(str){

	// Declaring required variables

	var digits = "0123456789";

	// non-digit characters which are allowed in phone numbers

	var phoneNumberDelimiters = "()- =?\\\"!+~@#$%^&*_[]{}\|;:'<>,./";

	// characters which are allowed in international phone numbers

	// (a leading + is OK)

	var validWorldPhoneChars = phoneNumberDelimiters + "+";

	// Minimum no of digits in an international phone no.

	var minDigitsInIPhoneNumber = 1;



	str = stripCharsInBag(str,validWorldPhoneChars);

	

	return (isValidPattern_Digits(str) && str.length >= minDigitsInIPhoneNumber);

}



function isValidPattern_Digits(str){

	var regEx = new RegExp("[^0-9]","ig");



	return !regEx.test(str);

}



function isInteger(s)

{   var i;

    for (i = 0; i < s.length; i++)

    {   

        // Check that current character is number.

        var c = s.charAt(i);

        if (((c < "0") || (c > "9"))) return false;

    }

    // All characters are numbers.

    return true;

}



function stripCharsInBag(s, bag)

{   var i;

    var returnString = "";

    // Search through string's characters one by one.

    // If character is not in bag, append to returnString.

    for (i = 0; i < s.length; i++)

    {   

        // Check that current character isn't whitespace.

        var c = s.charAt(i);

        if (bag.indexOf(c) == -1) returnString += c;

    }

    return returnString;

}



function isRadioButtonSelected(strGroupName){

	var colButtons = document.getElementsByName(strGroupName);



	for(i = 0; i < colButtons.length; i++){

		if(colButtons[i].checked == true){

			return true;

		}

	}

	

	return false;

}



function getMultipleSelVal(ID) {

    var result = '';

    for (var i = 0; i < $(ID).length; i++) {

        if ($(ID).options[i].selected) {

            result += $(ID).options[i].value + ",";

        }

    }

    return result;

}

/*****************************************************************************/



/************************Show Validation Errors********************************/

function showValidationErrors(strErrors){

	$('divErrors').style.display = "block";

	$('divFailures').innerHTML = "<table>" + strErrors + "</table>";

}



function hideValidationErrors(){

	$('divErrors').style.display = "none";

	$('divFailures').innerHTML = "";

}

/**********************************************************************/
