function getxmlhttp()
{
	var xmlHttp = false;
	if (window.XMLHttpRequest)
	{
		// If IE7, Mozilla, Safari, etc: Use native object
		var xmlHttp = new XMLHttpRequest();
	}else
	{
		if (window.ActiveXObject)
		{
			// ...otherwise, use the ActiveX control for IE5.x and IE6
			var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function process_ajax(phpPage,getOrPost,forchange)
{
	xmlhttp = getxmlhttp();
	if(getOrPost == "get")
	{		
		xmlhttp.open("GET",phpPage);
		xmlhttp.onreadystatechange = function()
		{		
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
			{
				document.getElementById('changelogin').innerHTML = xmlhttp.responseText;
				process_ajax2('actions.php?action=changebox','get','changedashboard');
			}
		}
		xmlhttp.send(null);
	}
}
function process_ajax2(phpPage,getOrPost,forchange)
{
	xmlhttp = getxmlhttp();
	if(getOrPost == "get")
	{		
		xmlhttp.open("GET",phpPage);
		xmlhttp.onreadystatechange = function()
		{		
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
			{
				document.getElementById('changedashboard').innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
}
function process_ajax3(phpPage,getOrPost,forchange)
{
	xmlhttp = getxmlhttp();
	if(getOrPost == "get")
	{		
		xmlhttp.open("GET",phpPage);
		xmlhttp.onreadystatechange = function()
		{		
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
			{
				document.getElementById('defautlresult').innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
}
function process_delete(phpPage,getOrPost,id)
{
	xmlhttp = getxmlhttp();
	if(getOrPost == "get")
	{		
		xmlhttp.open("GET",phpPage);
		xmlhttp.onreadystatechange = function()
		{		
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
			{
					$('#div'+id).fadeOut().slideUp();
			}
		}
		xmlhttp.send(null);
	}
}
function checkForm()
{ if(document.getElementById('textfield3').value.length==0 || document.getElementById('textfield3').value == "Search Part Name"){
	if(document.getElementById('select').value =='make'){
		alert("Please Enter Make Name Here");	
		document.getElementById('textfield3').focus();
		return false;
	}else 	if(document.getElementById('select').value =='model'){
		alert("Please Enter Model Name Here");	
		document.getElementById('textfield3').focus();
		return false;
	}
	return false;
	}
return true;
}
function checkForm2()
{ 
	if(document.getElementById('textfieldreg').value.length==0)
	{	
		alert("Please Enter Registration Number Here");	
		document.getElementById('textfieldreg').focus();
		return false;
	}
return true;
}
function blank_regno()
{
	var field = document.getElementById('textfieldreg');
	if(field.value == "Search Registration Number")
	{
		field.value = "";
	}	
}

function retain_regno()
{
	var field = document.getElementById('textfieldreg');
	if(field.value == '')
	{
		field.value = "Search Registration Number";
	}
}

function blank_pname()
{
	var field = document.getElementById('textfield3');
	if(field.value == "Search Part Name")
	{
		field.value = "";
	}	
}

function retain_pname()
{
	var field = document.getElementById('textfield3');
	if(field.value == '')
	{
		field.value = "Search Part Name";
	}
}

function setPage(url)
{
	$('#cars-for-sale').fadeOut(700, function(){
		$('#cars-for-sale').load(url);
		$('#cars-for-sale').fadeIn(700);
		
	});
	
	
}
