var ajaxloader = '<img src="images/ajax-loader.gif" alt="Processing">';

function login_licensee()
{
	$.ajax({
		type: "POST",
		url: $('#BASE').val()+"ajax_functions.php",
		data: "email="+$('#email').val()+"&password="+$('#password').val()+"&action=login",
		cache: false,
		async: false,
		success: function(result) {
			if(result == "1")
				window.location.href=$('#BASE').val()+'licensee/index.php';
			else
				alert('Invalid Login Details');
		},
		error: function(result) {
			alert("some error occured, please try again later");
		}
	});
	
	return false;
}



function phone_consultation()
{
	var name = $('#name').val();
	var email = $('#email').val();
	var telephone = $('#telephone').val();
	var city = $('#city').val();
	var state = $('#state').val();
	
	$('#ajaxloader').html(ajaxloader);
	$.ajax({
		type: "POST",
		url: $('#BASE').val()+"ajax_functions.php",
		data: "name="+name+"&email="+email+"&telephone="+telephone+"&city="+city+"&state="+state+"&action=consultation",
		cache: false,
		async: false,
		success: function(result) {
			window.location.href=codeurl+'thanks';
		},
		error: function(result) {
			alert("some error occured, please try again later");
		}
	});
	
	return false;
}

function getCities(state)
{
	$.ajax({
	  type: "POST",
	  url: $('#BASE').val()+"ajax_functions.php",
	  data: "action=getcities&state="+state,
	  cache: false,
	  success: function(html){
		$("#load_cities").html(html);
	  }
	});
}

function selectHouse(id)
{
	$('#product_id').val(id);
}

function validateOrderForm1()
{
	var pid = $('#product_id').val();
	var date = $('#date').val();
	
	if(pid == 0 || pid == '')
	{
		alert("Select Product");
		return false;
	}
	return true;
}

function selecthousefn(obj)
{
	$('.select_house').removeClass('select_house');
	obj.setAttribute('class','select_house');
}
