var xmlHttp

function showHint(url,tab)
{

xmlHttp=GetXmlHttpObject()
function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById(tab).style.display="";
document.getElementById(tab).innerHTML=xmlHttp.responseText;
}
}

if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

} 



function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
function showHintParent(url,tab)
{	
xmlHttp=GetXmlHttpObject()
function stateChanged1()
{ 

if (xmlHttp.readyState==4)
{ 

//alert(tab);
//document.getElementById(tab).style.display="";
//alert(xmlHttp.responseText);
window.parent.document.getElementById(tab).innerHTML=xmlHttp.responseText;
}
}

if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlHttp.onreadystatechange=stateChanged1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

} 
// double showhint with double param list 
function showHintMenu(url1,tab1,url2,tab2){	
	xmlHttp=GetXmlHttpObject()
	function stateChanged()	{ 
		if (xmlHttp.readyState==4){ 
			document.getElementById(tab1).style.display="";
			document.getElementById(tab1).innerHTML=xmlHttp.responseText;
			showHint(url2,tab2);
		}
	}
	if (xmlHttp==null){
	  	alert ("Your browser does not support AJAX!");
	  	return;
  	} 

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url1,true);
	xmlHttp.send(null);
} 

// double showhint + grid setposition 
function showHintMenuGrid(url1,tab1,url2,tab2,gcid){	
	xmlHttp=GetXmlHttpObject()
	function stateChanged()	{ 
		if (xmlHttp.readyState==4){ 
			document.getElementById(tab1).style.display="";
			document.getElementById(tab1).innerHTML=xmlHttp.responseText;
			showHintGrid(url2,tab2,gcid);
		}
	}
	if (xmlHttp==null){
	  	alert ("Your browser does not support AJAX!");
	  	return;
  	} 

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url1,true);
	xmlHttp.send(null);
} 

// showhint+ grid
function showHintGrid(url,tab,gcid)
{
	//alert('url='+url+' tab='+tab+' pid='+gcid);
	//alert(document.getElementById(tab));
	xmlHttp=GetXmlHttpObject()
	function stateChanged()	{ 
		if (xmlHttp.readyState==4){ 
			document.getElementById(tab).style.display="";
			document.getElementById(tab).innerHTML=xmlHttp.responseText;
			setgridsize(gcid);
			fejlecrepoz(gcid);
		}
	}
	if (xmlHttp==null){
	  	alert ("Your browser does not support AJAX!");
	  	return;
  	} 

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 
//ak
function showHintGridParent(url,tab,gcid){	
	xmlHttp=GetXmlHttpObject()
	function stateChanged()	{ 
		if (xmlHttp.readyState==4){ 
			window.parent.document.getElementById(tab).style.display="";
			window.parent.document.getElementById(tab).innerHTML=xmlHttp.responseText;
			setgridsizeParent(gcid);
		}
	}
	if (xmlHttp==null){
	  	alert ("Your browser does not support AJAX!");
	  	return;
  	} 

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
// showhint+ grid +closewindow
function showHintGridClose(url,tab,gcid){	
	xmlHttp=GetXmlHttpObject()
	function stateChanged()	{ 
		if (xmlHttp.readyState==4){ 
			alert('1tab ='+tab+'  pid='+gcid+'  url='+url);
			document.getElementById(tab).style.display="";
			alert('2tab ='+tab+'  pid='+gcid+'  url='+url);
			document.getElementById(tab).innerHTML=xmlHttp.responseText;
			setgridsize(gcid);
			alert('3tab ='+tab+'  pid='+gcid+'  url='+url);
			close_window('new',1);
		}
	}
	if (xmlHttp==null){
	  	alert ("Your browser does not support AJAX!");
	  	return;
  	} 

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

// showhint+ at deleteing tabs
function showHintDel(url,tab,tid1,tid2){	
	xmlHttp=GetXmlHttpObject()
	function stateChanged()	{ 
		if (xmlHttp.readyState==4){ 
			document.getElementById(tab).style.display="";
			document.getElementById(tab).innerHTML=xmlHttp.responseText;
			var dtid = tid2+document.getElementById(tid1).innerHTML;
//			alert (dtid);
//			document.getElementById(dtid).setAttribute("style","display:''; visibility:'visible'; height:645px; overflow:hidden;");
			document.getElementById(dtid).style.display='';
			document.getElementById(dtid).style.visibility='visible';
			document.getElementById(dtid).height='645px;';
		}
	}
	if (xmlHttp==null){
	  	alert ("Your browser does not support AJAX!");
	  	return;
  	} 

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function showHintPost(url,params,tab)
{

	xmlHttp=GetXmlHttpObject()
	function stateChanged() 
	{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById(tab).style.display="";
	document.getElementById(tab).innerHTML=xmlHttp.responseText;
	}
	else{
		document.getElementById(tab).innerHTML="Loading please wait...";
	}
	}
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.send(params);	
} 

function HintPost(url,params)
{
	
xmlHttp=GetXmlHttpObject()


if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 


xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);

xmlHttp.send(params);

} 


function Hint(url)
{	
	xmlHttp=GetXmlHttpObject()
	function stateChanged1()
	{ 
	
	}
	
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	xmlHttp.onreadystatechange=stateChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 


var timeOutRefresh = false;
function pf(){
		//alert('aa');
		//alert(window.parent.document.getElementById('szuro_text_1_0').value);
		//window.parent.document.getElementById('szuro_text_1_0').value="tesz";
		if(timeOutRefresh)
			close_window('new',1);			
		else
			setTimeout('pf()',100);
}

var attachments = new Array;
var xmlHttpa;

function ajaxsearch(url,div,pgid)
{
	var at = new Array;
	var obj = document.getElementById(div);
	
	aktindex = attachments.length;
	attachmentindex = attachments.length;
	
	xmlHttpa=GetXmlHttpObject()
	function stateChanged1()
	{
		if (xmlHttp.readyState==4)
		{
			s = xmlHttpa.responseText;
			//alert(s);
			if(xmlHttpa.responseText!="0"){
				at=explode(";",s);
				for(i=0;i<at.length-1;i++){
						vane = 0;
						for(k=0;k<attachments.length;k++){
								if(attachments[k]==at[i])
									vane =1;
						}
						if(vane==0){
							aktindex++;
							attachments[aktindex]=at[i];
						}
				}
				//alert (attachments);
				
				if(attachments)			
				{
					for(j=attachmentindex;j<attachments.length;j++){
						//alert(attachments[j]);
						if(attachments[j]){
							/*newDiv = document.createElement("DIV");
							//newDiv.innerHTML=attachments[j];
							newDiv.setAttribute("class","attachmentDiv");
							newDiv.setAttribute("id","attachment_"+j);							

							obj.appendChild(newDiv);
							
							atNewDiv = document.createElement("DIV");
							atNewDiv.setAttribute("style","float:left; width:500px;");*/
							
							newDiv = document.createElement("OPTION");
							newDiv.innerHTML=attachments[j];
							newDiv.setAttribute("value",attachments[j]);
							newDiv.setAttribute("id",attachments[j]+"_"+pgid);
							obj.appendChild(newDiv);
							
						}
					}
				}	
				
				return true;
			}
			return false;
		}
	}
	
	if (xmlHttpa==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	xmlHttpa.onreadystatechange=stateChanged1;
	xmlHttpa.open("GET",url,true);
	xmlHttpa.send(null);
}

     
 function pausems(millis_)   
 {  
         date = new Date();  
         var curDate = null;  
           
         do { var curDate = new Date(); }  
         while(curDate-date < millis_);  
 } 

/*function kesleltet()
{
	//alert('kesleltetes');	
	if (document.getElementById('fizetes_tip_id').value=='')
							{
									alert('<?php echo $def_hiba_kotelezomezo ?>');
							}
							else
							{								
								sendRequest('modul/fizetes_tipusa/fizetes_tip_save.php','fizetes_tip_insert','div_fizetes_tipinsert','')
							}
}*/