function submitform(Form) {	
	//alert(Form);
var mob=document.deccan.mobile.value.charAt(0);

//FIRST NAME
if((Form.name.value=="") || (Form.name.value==" Name*")) {
alert("Please enter your name!");
Form.name.select();
return false;
}
else if(containsdigit(Form.name.value))
{
alert("Please enter your name in alphabets!");
Form.name.select();
return false;
}
else if(containswrong(Form.name.value))
{
alert("Your name contains junk!");
Form.name.select();
return false;
}

//E-MAIL
else if((Form.email.value=="") || (Form.email.value=="")){
alert("Please enter email!");
Form.email.select();
return false;
}
else if((Form.email.value!="") && (validateemailv2(Form.email.value)==false)){
alert("Please enter valid email!");
Form.email.select();
return false;
}

//MOBILE
else if((Form.mobile.value=="") || (Form.mobile.value=="Mobile No.")){
alert("Please enter your 10 digit mobile number");
Form.mobile.select();
return false;
}
else if(((Form.mobile.value.length!=10) || (containsalpha(Form.mobile.value)==true) || (containswrong(Form.mobile.value)==true)) && ((Form.mobile.value!="")))
{
alert("Please check your mobile number!");
Form.mobile.select();
return false;
}

else if((mob!="9") && (mob!="8") && (mob!="7"))
{
alert("Please provide us your correct mobile number!");
Form.mobile.select();
return false;
}

//DOJ
else if (!isDate(Form.doj.value)){
	Form.doj.focus();
	return false;
}


//Origin
else if(Form.origin.value=="-1"){
alert("Kindly select the origin!");
Form.origin.focus();
return false;
}
else if(Form.origin.selectedIndex==0){
alert("Kindly select the origin!");
Form.origin.focus();
return false;
} 

//Destination
else if(Form.destination.value=="-1"){
alert("Kindly select the destination!");
Form.destination.focus();
return false;
}
else if(Form.destination.selectedIndex==0){
alert("Kindly select the destination!");
Form.destination.focus();
return false;
} 


//else {
//Form.submit();
//}
return true;

}

/** DD/MM/YYYY
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=2010;
var maxYear=2020;

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++){
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   }
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)

	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter your Date of Journey in dd/mm/yyyy format")
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false;
	}
return true
}




function containsdigit(param)
{
mystrLen = param.length;
for(i=0;i<mystrLen;i++)
{
if((param.charAt(i)=="0") || (param.charAt(i)=="1") || (param.charAt(i)=="2") || (param.charAt(i)=="3") || (param.charAt(i)=="4") || (param.charAt(i)=="5") || (param.charAt(i)=="6") || (param.charAt(i)=="7") || (param.charAt(i)=="8") || (param.charAt(i)=="9"))
{
return true;
}
}
return false;
}

function cityother(){
if(document.etios.city.value=="Other"){
document.etios.other_city.disabled = false;
}
else{
document.etios.other_city.disabled = true;
}

} // end of function cityother

function containswrong(param){
strLen1 = param.length;

for(i=0;i<strLen1;i++)
{
if((param.charAt(i)==";") || (param.charAt(i)=="=") || (param.charAt(i)=="+") || (param.charAt(i)=="*") || (param.charAt(i)=="#") || (param.charAt(i)=="$") || (param.charAt(i)=="%") || (param.charAt(i)=="^") || (param.charAt(i)=="?") || (param.charAt(i)=="@")||(param.charAt(i)=="/") || (param.charAt(i)=="<") || (param.charAt(i)==">")|| (param.charAt(i)=="-") || (param.charAt(i)=="~"))
{
return true;
}
}
return false;
}


function validateemailv2(email){
var splitted = email.match("^(.+)@(.+)$");
if(splitted == null) return false;
if(splitted[1] != null )
{
var regexp_user=/^\"?[\w-_\.]*\"?$/;
if(splitted[1].match(regexp_user) == null) return false;
}
if(splitted[2] != null)
{
var regexp_domain=/^[\w-\.]*\.[a-za-z]{2,4}$/;
if(splitted[2].match(regexp_domain) == null)
{
var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
if(splitted[2].match(regexp_ip) == null) return false;
}
return true;
}
return false;
}


function containsalpha(param){
strLen = param.length;

for(i=0;i<strLen;i++)
{
if((param.charAt(i)<"0") || (param.charAt(i)>"9"))
{
return true;
}
}
return false;

}

function onlyNumbers(evt)
{
	var e = event || evt; // for trans-browser compatibility
	var charCode = e.which || e.keyCode;

	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;

	return true;

}



// tracking the Enter Keypress Event
function keypress(event) {
    
    var Ucode=event.keyCode? event.keyCode : event.charCode
    if (Ucode == 13)
    {
        //write the code for submit
        submitform(document.getElementById('ing'));
    }
}

