/**************************The ajax navigation function***********************************
**************copy right By Joseph Siengo -- email siengoj@gmail.com***********************
*******************************************************************************************/
var un_img= new Array(  'over_view',
						'consumables',
						'tech_specs');

function current(pass){// the function that changes the navigation color
	for(var i=0;i<3;i++){
		if (un_img[i]==pass){
			document.getElementById(pass).src="../images/curr_"+pass+".gif";
		}else{
			document.getElementById(un_img[i]).src="../images/"+un_img[i]+".gif";
		}
	}
}

/*************************************************************************************************
--------------------------The ajax function in the product details tab--------------------------
*************************************************************************************************/
function mtl(one){
var mimi;
try {
mimi= new XMLHttpRequest;
}
catch(err){
	try{
		mimi=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(err)
	{
	try{
		mimi= new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(err){
	 
	 }
	}
}
var url='../includes/products/ajax.php?'+one;
mimi.onreadystatechange=function(){
if(mimi.readyState==4){
document.getElementById('ajax').innerHTML=mimi.responseText;
}else{
document.getElementById('ajax').innerHTML="<div id='left'  style='height:40px;'><span style='padding-left:100px;'>Loading </span></div>  <div id='right' style='height:40px; ' ><span><img src='../images/wait.gif' style='float:left;'  /> </span></div>"
	}
}
mimi.open('GET',url,true);
mimi.send(null);
}
/*************************************************************************************************
--------------------------The ajax function in the repair form page--------------------------
*************************************************************************************************/
function contact_us(){
var mimi;
try {
mimi= new XMLHttpRequest;
}
catch(err){
	try{
		mimi=new ActiveXObject('Msxml2.XMLHTTP');
	}
	catch(err)
	{
	try{
		mimi=new ActiveXObject('Microsoft.XMLHTTP')
	}
	catch(err){
	 //alert("error")
	 }
	}
}

/*************************************************************************************************
---------------------------Getting values for Field names for personal details--------------------
**************************************************************************************************/

var fname=document.repair.fname.value;
var lname=document.repair.lname.value;
var address=document.repair.address.value;
var email=document.repair.email.value;
var phone=document.repair.phone.value;
var company=document.repair.company.value;


/*************************************************************************************************
---------------------------Getting values for Field names for Product details--------------------
**************************************************************************************************/

var type=document.repair.type.value;
var make=document.repair.make.value;
var model=document.repair.model.value;
var comment=document.repair.comment.value;


//var lname=document.repair.lname.value;
/*"type="+type+"&make="+make+"&model="+model+"&comment=+"comment;*/
//alert (fname+company);
var personal ="fname="+fname+"&lname="+lname+"&address="+address+"&email="+email+"&phone="+phone+"&company="+company;
var product="&type="+type+"&make="+make+"&model="+model+"&comment="+comment/**/;
var contact="../includes/forms/contact.php";
var params= personal + product;
mimi.open('POST', contact, true);

mimi.onreadystatechange=function(){
	if(mimi.readyState==4){
		if(mimi.status==200){
			document.getElementById('repair').innerHTML=mimi.responseText;
		}
		}else{
			document.getElementById('repair').innerHTML="<b>Loading</b><img src='../images/wait.gif'/>";
		}
	
}
//Send the proper header information along with the request
mimi.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
mimi.setRequestHeader("Content-length", params.length);
/*mimi.setRequestHeader("Connection", "close");*/

mimi.send(params);
}
