// JavaScript Document
//====================== Ajax function =========================
function createRequestObject() 
{
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer")
	{
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }
	else
	{
        ro = new XMLHttpRequest();
    }
    return ro;
}
var http = createRequestObject();
//--------------------------------------------------------------
function sndReq(action) 
{
	document.getElementById("content").innerHTML="<div id='waitmsg'>انتظر قليلاً.....</div>";
    http.open('post', 'processcat.php?action='+action);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse()
{
	if(http.readyState == 4)
	{
        var response = http.responseText;
		document.getElementById("content").innerHTML=response;
     }
}
//===================function area===========================
function sndReqarea(a) 
{
	document.getElementById('area').options.length = 0;
	document.getElementById('area').options[0] = new Option("تحميل ..."," 0");
	http.open('post','getarea.php?city='+a);
	http.onreadystatechange = handleResponsearea;
    http.send(null);
}
//===============================
function handleResponsearea() 
{
	if(http.readyState == 4){
    var response = http.responseText;
	document.getElementById("area1").innerHTML='<select id="area" name="area" class="text">'+response+'</select>';
		
    }

}
//====================admin area ==========================
function sndReqarea1(a) 
{
	document.getElementById("area").innerHTML="<option>تحميل ...</option>";
	http.open('post','../getarea.php?city='+a);
	http.onreadystatechange = handleResponsearea1;
    http.send(null);
}
//===============================
function handleResponsearea1() 
{
	if(http.readyState == 4){
    var response = http.responseText;
	document.getElementById("area1").innerHTML='<select id="area" name="aid" class="text">'+response+'</select>';
		
    }

}

function sndReqarea2(a) 
{
	document.getElementById("area").innerHTML="<option>تحميل ...</option>";
	http.open('post','getarea.php?city='+a);
	http.onreadystatechange = handleResponsearea2;
    http.send(null);
}
//===============================
function handleResponsearea2() 
{
	if(http.readyState == 4){
    var response = http.responseText;
	document.getElementById("area1").innerHTML='<select id="area" name="area" class="text">'+response+'</select>';
		
    }

}

//=====================showparts===========================

function doit(i)
{
	str="de"+i;
	str1="img"+i;
	if(document.getElementById(str).style.display=='block')
	{
		document.getElementById(str).style.display='none';
		document.getElementById(str1).src='images/blue_f.gif';
	}
	else
	{
		document.getElementById(str).style.display='block';
		document.getElementById(str1).src='images/blue_uf.gif';
	}
}
function showdiv()
{
        con=document.getElementById("addarea").innerHTML;
		document.getElementById("slide").style.display='block';
		document.getElementById('myid').value=document.getElementById('city').value;
}
function hiddiv()
{
		document.getElementById("slide").style.display='none';
		document.getElementById('addarea').innerHTML=con;
		document.getElementById('areaname').value='';
}

