﻿var xmlHttp
var loadstatustext="<p dir=rtl><FONT face=\"Tahoma\" size=\"2\"> لطفا کمی صبر کنید ... </FONT><img src='images/loading.gif'/></p>"

function showHint(str,no)
{
if (str.length==0)
{ 
document.getElementById("gridHint").innerHTML=""
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
//var url="http://www.irportfolio.com/gethintnerkh.aspx"
var url="../gethintnerkh.aspx"
url=url+"?q="+str+"&n="+no
document.getElementById("gridHint").innerHTML=loadstatustext
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("gridHint").innerHTML=xmlHttp.responseText 
} 
} 
///////////////////////////
function showReport(str,params,cd)
{

if (str.length==0)
{ 
document.getElementById("tableHint").innerHTML=""
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url=str
if (params != "")
{
url = url + "?" + params + "=" + encodeURIComponent(cd)
}
document.getElementById("tableHint").innerHTML=loadstatustext
xmlHttp.onreadystatechange=stateChangedReport 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChangedReport() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("tableHint").innerHTML=xmlHttp.responseText 
} 
}
// ------------------------------------------------------------ // 
//function showNAarchive(str,ds,de,cd,word)
// ------------------------------------- //
function showReportNA(str,params,wr,ds,de,cd)
{

if (str.length==0)
{ 
document.getElementById("archiveHint").innerHTML=""
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url = str
if (params != "")
{
url=url+"?"+params+"=" + encodeURIComponent(wr)+"&ds=" +encodeURIComponent(ds)+"&de=" +encodeURIComponent(de)+"&cd=" +encodeURIComponent(cd)
}
document.getElementById("archiveHint").innerHTML=loadstatustext
xmlHttp.onreadystatechange=stateChangedReportNA
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChangedReportNA() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("archiveHint").innerHTML=xmlHttp.responseText 
} 
} 
// -------------------------------------------------------------- //
//function showReportNCH(str,ds,de,cd)
// -------------------------------- //
function showReportNCH(str,params,ds,de,cd)
{

if (str.length==0)
	{ 
		document.getElementById("NerkhChHint").innerHTML=""
		return
	}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
var url = str
if (cd != "")
{
	url= url + "?" + params + "=" + encodeURIComponent(ds)+ "&dateE=" + encodeURIComponent(de) + "&cCode=" + encodeURIComponent(cd)
}
document.getElementById("NerkhChHint").innerHTML = loadstatustext
xmlHttp.onreadystatechange = stateChangedReportCH
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChangedReportCH() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			document.getElementById("NerkhChHint").innerHTML = xmlHttp.responseText 
		} 
} 
// ----------------------------------------------------------------------------- //
function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
