
function getServerName() // Get Server USRL
{
	var str = window.location.protocol + '//' + window.location.hostname;
	return str;
}

function createXHR()  // Create XmlHttpObject for Ajax
{
    var request = false;
        try {
            request = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch (err2) {
            try {
                request = new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch (err3) {
		try {
			request = new XMLHttpRequest();
		}
		catch (err1) 
		{
			request = false;
		}
            }
        }
    return request;
}



function Get_Error_Modem() // Sened Number Error And Requst Description
{
	var xmlHttp = createXHR();  // Call Create XmlHttp
	
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
	{
		xmlHttp = new XMLHttpRequest();
	}

	document.getElementById("Result").style.display = 'none';
	document.getElementById("Loading").style.display = 'block';
	var name =document.getElementById("Error_NO").value;
//	alert(getServerName());
	var sURL = "http://www.graphnet.ir/Scripts/custom_modem_error.php?MER_NUM="+name;
	xmlHttp.open("GET",sURL,true);
	xmlHttp.send(null);
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			document.getElementById("Loading").style.display = 'none';
			document.getElementById("Result").style.display = 'block';
			document.getElementById("Result").innerHTML = xmlHttp.responseText;
		}
	}

}

function Set_Page(item) // Set Page File In Middle Body Of Index File PHP
{

	var xmlHttp = createXHR();  // Call Create XmlHttp
	
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
	{
		xmlHttp = new XMLHttpRequest();
	}

	document.getElementById("middle_body").style.display = 'none';
	document.getElementById("Loading_bar").style.display = 'block';
	
	var sURL = getServerName() + "/Set_Page.php?p=1&Item="+item;
	
	xmlHttp.open("GET",sURL,true);
	xmlHttp.send(null);
	xmlHttp.onreadystatechange = function()
	{
		//alert("Test");
		if(xmlHttp.readyState == 4)
		{
			document.getElementById("Loading_bar").style.display = 'none';
			document.getElementById("middle_body").style.display = 'block';
			document.getElementById("middle_body").innerHTML = xmlHttp.responseText;
		}
	}
}

function Download(item) // Set Page File In Middle Body Of Index File PHP
{

	var xmlHttp = createXHR();  // Call Create XmlHttp
	
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
	{
		xmlHttp = new XMLHttpRequest();
	}

/*	document.getElementById("middle_body").style.display = 'none';
	document.getElementById("Loading_bar").style.display = 'block';*/
	
	var sURL = getServerName() + "/Set_Page.php?p=1&Item="+item;
	
	xmlHttp.open("GET",sURL,true);
	xmlHttp.send(null);
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
		/*	document.getElementById("Loading_bar").style.display = 'none';
			document.getElementById("middle_body").style.display = 'block';
			document.getElementById("middle_body").innerHTML = xmlHttp.responseText;*/
		}
	}
}
function loading_banner(SHOW,PICTURE)
{
	document.getElementById('Set_Picture').src = 'images/20-1.gif';		
	document.getElementById('Set_Picture').src = 'Scripts/load_banner.php?SHOW=' + SHOW + '&picture=' + PICTURE
}


