// JavaScript Document
var ertek = new Array();
function ajaxObj()
{
	this.SetFormValue = SetFormValue;
	this.alertSetValue = alertSetValue;
	this.SetSession = SetSession;
	this.alertSetSession = alertSetSession;
	this.SetIndex = SetIndex;
	this.alertSetIndex = alertSetIndex;
	this.SetVariable = SetVariable;
	this.alertSetVariable = alertSetVariable;
	this.GetValue = GetValue;
}

function SetFormValue(method,url,param,form,element)
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	var link = url + param;
	xmlHttp.onreadystatechange = function() { alertSetValue(xmlHttp,param,form,element); };
	xmlHttp.open(method,link,true);
	xmlHttp.send(null);
}

function alertSetValue(http_request,prm,frm,el) 
{
	if (http_request.readyState == 4) 
	{
		
			//ertek[prm] = http_request.responseText;
			if (frm || el)
			{
				var elem = document.getElementsById(el);
				elem.innerHTML = prm;
			}
			alert(el);
		}
		else 
		{
			alert('Valami gond van a kéréssel.');
		}
	
}

function SetSession(method,url,param, p2)
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	var link = url + param;
	    
	xmlHttp.onreadystatechange = function() { alertSetSession(xmlHttp, url, param, p2); };
	xmlHttp.open(method,link,true);
	xmlHttp.send('');
	
}

function alertSetSession(http_request, url, param, p2) 
{   
	if (http_request.readyState == 4 )
	{
//		if (http_request.status == 200) 
		//{
			
			//	{
				//alert('oké.'+param);
				//}
			    
				if (p2)  {
				//alert('oké.');
				window.location.href = 'makehtml.php?oldal='+p2;
		       // window.location.href = p2;
		         
		        }
		        else
		        window.location.href = 'index.php';
		//} 
	/*	else 
		{
			alert('Valami gond van a kéréssel.'+url+'-'+param);
		}*/
	}
}
function SetVasar(method,url,param, p2)
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	var link = url + param;
	    
	xmlHttp.onreadystatechange = function() { alertSetVasar(xmlHttp, url, param, p2); };
	xmlHttp.open(method,link,true);
	xmlHttp.send('');
	
}

function alertSetVasar(http_request, url, param, p2) 
{   alert(http_request.responseText);
	if (http_request.readyState == 4 )
	{
//		if (http_request.status == 200) 
		//{
			
			//	{
				alert(http_request.responseText);
				//}
			    
				if (p2)  {
				//alert('oké.');
				window.location.href = 'makehtml.php?oldal='+p2;
				
		        window.location.href = p2;
		         
		        }
		        else
		        window.location.href = 'index.php';
		//} 
	/*	else 
		{
			alert('Valami gond van a kéréssel.'+url+'-'+param);
		}*/
	}
}

function SetIndex(method,url,param)
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	var link = url + param;
	    
	xmlHttp.onreadystatechange = function() { alertSetSession(xmlHttp, url, param, p2); };
	xmlHttp.open(method,link,true);
	xmlHttp.send('');
	
}

function alertSetIndex(http_request, url, param) 
{   
	if (http_request.readyState == 4 )
	{
				//alert('oké.');
	}
}

function SetVariable(method,url,param)
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	var link = url + param;
	
	xmlHttp.onreadystatechange = function() { alertSetVariable(xmlHttp, url, param); };
	xmlHttp.open(method,link,true);
	xmlHttp.send('');
	
}
window2=null;
function alertSetVariable(http_request, url, param) 
{   
	if (http_request.readyState == 4 || http_request.readyState == 0)
	{
		if (http_request.status == 200) 
		{
		        nyit('padlo/oldalelemek.php','','width=640,height=480,resizable=auto,scrollbars=yes,toolbar=no,location=no,directories=no,status=yes,dependent');
		} 
		else 
		{
			alert('Valami gond van a kéréssel.'+url+'-'+param);
		}
	}
}

function GetValue(param) 
{
	return ertek[param];
}

