function Validate()
{

    if(document.getElementById("Name").value=="")
    {
        alert("Please write your name.");
        document.getElementById("Name").focus();
        return false;
    }
   
   if(document.getElementById("cbo_Country").value=="")
    {
        alert("Please Select Country Name.");
        document.getElementById("cbo_Country").focus();
        return false;
    }
    if(document.getElementById("CityResidence").value=="")
    {
        alert("Please write your city residence.");
        document.getElementById("CityResidence").focus();
        return false;
    }
    if(document.getElementById("HDptDateDDMMYY").value=="")
    {
        alert("Please write your departure date.");
		showCalender("H","D");
        //document.getElementById("HDptDateDDMMYY").focus();
        return false;
    }
     if(document.getElementById("Email").value=="")
    {
        alert("Please write your email.");
        document.getElementById("Email").focus();
        return false;
    }
    
//	if(emailCheck(document.getElementById("Email").value)!=true)
//	{
//		return false;
//	}
	
	if(echeck(document.getElementById("Email").value)!=true)
	{
		return false;
	}
	
	if(document.getElementById("Phone").value=="")
    {
        alert("Please write your Phone Number.");
        document.getElementById("Phone").focus();
        return false;
    }
	if(document.getElementById("ContactDetail").value=="")
    {
        alert("Please write your ContactDetail.");
        document.getElementById("ContactDetail").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 keyRestrict(e, validchars) 
//        {
//            var key='', keychar='';
//            key = getKeyCode(e);alert(key);
//            if (key == null) return true;
//            keychar = String.fromCharCode(key);
//            keychar = keychar.toLowerCase();
//            validchars = validchars.toLowerCase();

//            if (validchars.indexOf(keychar) != -1)
//             return true;
//            if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27)
//             return true;

//            return false;
//        }      


/*
function emailCheck (emailStr)
{
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null)
	{
		alert("Email address seems incorrect (check @ and .'s)");
		document.EnquiryForm.Email.focus();
		return false;
	}
	return true;
}

*/




function checkfields(event,in_id,validation_type) 
{
	var key = null;
	if (window.event) 
	{key = window.event.keyCode; //ie
	}
	else if (event.which)
	 {key = event.which;  //Mozilla,Safari
	 }
	if (key != null) 
	{//alert(validation_type);
	    if(validation_type=='str')
	    {
	        if ((key  > 64 && key  < 91) || (key  > 96 && key  < 123) || (key==32))
	        {event.returnValue = true;}
	        else
	        {
	        document.getElementById(in_id).value="";
	        event.returnValue = false;
	        }
        }
	    if(validation_type=='num')
	    {//alert(key);
	        if ((key >= 48 && key <= 57) || (key >= 96 && key <= 105) || (key==32) ||(key==107))
	        {event.returnValue = true;}
	        else
	        {
	        document.getElementById(in_id).value="";
	        event.returnValue = false;
	        }
	    }
	}
}
	/*
	var key = null;
	if (window.event) 
	{
		//ie
		key = window.event.keyCode;
	}
	 else if (event.which)
	 {
		//Mozilla,Safari
		key = event.which;
	 }

	if (key != null) 
	{
		if(validation_type=='str')
		{
		
			if ((key  > 64 && key  < 91) || (key  > 96 && key  < 123)) 
			{
			event.returnValue = true; 
			} 
			else 
		{
			document.getElementById(in_id).value="";
			event.returnValue = false;
			
		}
			
	}
		if(validation_type=='num')
		{
			if (key >= 48 && key <= 57)	 
			{
				event.returnValue = true; 
			} 
			else 
			{
				document.getElementById(in_id).value="";
				event.returnValue = false;
			}
			
		}
		

	}
	*/




function UperCase(Textboxid)
{
var txtval=Textboxid
var abc
abc=document.getElementById(txtval).value.toUpperCase()
document.getElementById(txtval).value=document.getElementById(txtval).value.toUpperCase()
}

