// JavaScript Document

function submitorderform()
{
	var msgflag = 0
	var msg = ""
	if (document.getElementById('name').value == "")
	{
		msg = msg + "Please Enter Your Name \n"
		msgflag = msgflag + 1	
	}
	if (document.getElementById('address').value == "")
	{
		msg = msg + "Please Enter Your Address \n"
		msgflag = msgflag + 1	
	}
	if (document.getElementById('contactno').value == "")
	{
		msg = msg + "Please Enter Your Contact No \n"
		msgflag = msgflag + 1	
	}
	/*if (document.getElementById('contantno').value == "")
	{
		msg = msg + "Please Enter Contact No \n"
		msgflag = msgflag + 1
	}*/
	var emailID=document.getElementById('email')
	if ((emailID.value==null)||(emailID.value==""))
	{
		msg = msg + "Please Enter your Email ID \n"
		msgflag = msgflag + 1
	}
	if (echeck(emailID.value)==false)
	{
		emailID.value=""
		msg = msg + "Invalid E-mail ID \n"
		msgflag = msgflag + 1
	}
	if (msgflag != 0)
	{
		alert(msg)
	}
	else
	{
		var requestparameter
		merchantownerid = "200805141000002"
		opmode = "DOM"
		country = "IND"
		currency = "INR"
		amount = "2500";
		merchorderno = document.getElementById('orderno').value 
		otherdtl = document.getElementById('comments').value
		succURL = "http://www.talentfromhome.com/success.asp"
		failURL = "http://www.talentfromhome.com//failed.asp"
		collaboratorid = "TOML"
		
		requestparameter = merchantownerid + "|" + opmode + "|" + country + "|" + currency + "|" + amount + "|" + merchorderno + "|" + otherdtl + "|" + succURL + "|" + failURL + "|" + collaboratorid
		url = "check_out.asp?requestparameter=" + requestparameter
		window.location = url
	}
}

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){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}

