function fnDetails()
{
	//alert("test");
      if(document.frmMain.name.value==""){
		alert("Enter Your Name");
		document.frmMain.name.focus();
		return false;
	}
	
	if(document.frmMain.email.value==""){
		alert("Enter your Email Address")
		document.frmMain.email.focus()
		return false;
	}
	if (!fnEmail(document.frmMain.email)){
		return false;
	}
	if(document.frmMain.phone.value==""){
		alert("Enter Your Phone Number");
		document.frmMain.phone.focus();
		return false;
	}
	
	/*if(!isInteger(document.frmMain.phone.value)){

			alert("Phone Number should be Number.");

			document.frmMain.phone.focus();

			return false;

			}*/
	
	

	/*if(document.frmMain.address1.value==""){
		alert("Enter Address");
		document.frmMain.address1.focus();
		return false;
	}*/

	if(document.frmMain.city.value==""){
		alert("Enter City");
		document.frmMain.city.focus();
		return false;
	}
	

	/*if(document.frmMain.zip.value==""){
		alert("Enter Zipcode");
		document.frmMain.zip.focus();
		return false;
	}
	if(!isInteger(document.frmMain.zip.value)){

			alert("Zipcode should be Number.");

			document.frmMain.zip.focus();

			return false;

			}
	
	if(document.frmMain.state.value==""){
		alert("Enter State");
		document.frmMain.state.focus();
		return false;
	}*/

	if(document.frmMain.month.value==""){
		alert("Selelct Month");
		document.frmMain.month.focus();
		return false;
	}

	if(document.frmMain.day.value==""){
		alert("Selelct Date");
		document.frmMain.day.focus();
		return false;
	}
	if(document.frmMain.year.value==""){
		alert("Selelct Year");
		document.frmMain.year.focus();
		return false;
	}

	if(document.frmMain.time.value==""){
		alert("Select Request Time");
		document.frmMain.time.focus();
		return false;
	}
	if(document.frmMain.time1.value==""){
		alert("Select AM or PM");
		document.frmMain.time1.focus();
		return false;
	}
	/*if(!isInteger(document.frmMain.time.value)){

			alert("Time should be Number.");

			document.frmMain.time.focus();

			return false;

			}*/

	if(document.frmMain.comments.value==""){
		alert("Enter Comments");
		document.frmMain.comments.focus();
		return false;
	}
	
	
	 
	
	if(document.frmMain.vcode.value==""){
				alert("Please Enter Verification Code");
				document.frmMain.vcode.focus();
				return false;
			}
			if(document.frmMain.vcode.value!=""){
				var x = RemoteRequestObject();
					var vcode = document.frmMain.vcode.value;
					var url = "verification-test.php?vcode="+vcode;
				
					x.open("GET",url,true);
					x.onreadystatechange=function()
					{
						
						if(x.readyState == 4 && x.status == 200)
						{
							
							var r = x.responseText;
							
						if(r.indexOf("+OK") == 0)
							{	
								//alert(r);
								document.frmMain.submit()
								return true;
							}
							else
							{
								//alert("test "+r);
								if(r.indexOf("1") == 0) {
								alert("Enter correct verification code");
								document.frmMain.vcode.focus();
								document.frmMain.vcode.value="";
								} 
						
							}
						}
					};
					x.send(null);
					return false;
			}	
		
		
  return true;
}
/////////////////////////  Image Verification start here ///////////////////////////

	

function RemoteRequestObject()
 {
 	var A = false;
 	
 	try
 	{
 		A = new ActiveXObject("Msxml2.XMLHTTP");
 	}
 	catch(e)
 	{
 		try
 		{
 			A = new ActiveXObject("Microsoft.XMLHTTP");
 		}
 		catch(err)
 		{
 			A = false;
 		}
 	}
 	
 	if(!A && typeof(XMLHttpRequest) != 'undefined')
 		A = new XMLHttpRequest();
 		
 	return A;
 }



function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		// prevents caching of URLString
		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;
						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}

/////////////////////////  Image Verification End here ///////////////////////////
function isInteger(val) {

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

			if (!isDigit(val.charAt(i))) {

				return false; }

		     }

		    return true;

}

function isDigit(num) {

    		var string="1234567890";

	

		if(string.indexOf(num) != -1) {

			return true; 

			}

		return false;

}
function fnEmail(txtEmail)
{

 if(txtEmail.value != "")
  {
  
   var intLen=txtEmail.value.length
   var blnFlag=0
  
   if(txtEmail.value.charAt(0)== "@" || txtEmail.value.charAt(0)==".")
    {
     alert("Invalid Email Address ")
     txtEmail.focus()
     return false
    }
   
   if(txtEmail.value.charAt(intLen-1)== "@" || txtEmail.value.charAt(intLen-1)== ".")
    {
     alert("Invalid Email Address ")
     txtEmail.focus()
     return false
    }
 
   for(var i=0; i<intLen; i++)
    {
     if(txtEmail.value.charAt(i)=="@")
      {
       blnFlag=blnFlag + 1
      }
    }
  
  if(blnFlag>=0 && blnFlag<1 || blnFlag >1)
    {
     alert("Invalid Email Address ")
     txtEmail.focus()
     return false
    }  
    
  strSplit=(txtEmail.value).split("@")
		intSptLen=strSplit[1].length
		var intCnt=0
		for(var j=0;j<intSptLen;j++)
		{
			if (strSplit[1].charAt(j)==".")
			{
				intCnt=intCnt+1
			}
		}
		if (intCnt<=0)
		{
			alert("Invalid E-Mail Address")
			txtEmail.focus()
			return false
		}   
return true;
  
  }

}
