var xmlHttp
function openURL(link) { 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Vas browser ne podrzava AJAX tehnologiju")
	return
	} 
	var url=link
	xmlHttp.onreadystatechange=stateChangedx
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedx() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("ajaxCenter").innerHTML=xmlHttp.responseText 
	} 
} 

function showSubscribe() { 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Vas browser ne podrzava AJAX tehnologiju")
	return
	} 
	var url="subscribe.php"

	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("subscribe").innerHTML=xmlHttp.responseText 
	} 
} 
function showSubCategoriesInSelectBox(parent_cat_id) { 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Vas browser ne podrzava AJAX tehnologiju")
	return
	} 
	var url="logic.php?act=showSubCategoriesInSelectBox&parent="+parent_cat_id;

	xmlHttp.onreadystatechange=stateChangedSubCat
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function showProductsInSelectBox(category_id) { 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Vas browser ne podrzava AJAX tehnologiju")
	return
	} 
	var url="logic.php?act=showProductsInSelectBox&category_id="+category_id;

	xmlHttp.onreadystatechange=stateChangedProducts
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function showProductById(id_product)
{
 	location.href='start.php?page_id=22&id_product='+id_product;
	return
}
function hideSubscribe() { 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Vas browser ne podrzava AJAX tehnologiju")
	return
	} 
	var url="empty.php"

	xmlHttp.onreadystatechange=stateChanged2
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged2() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("subscribe").innerHTML=xmlHttp.responseText 
	} 
} 

function stateChangedSubCat() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("subCategorySelectBox").innerHTML=xmlHttp.responseText 
	} 
} 

function stateChangedProducts() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("productsSelectBox").innerHTML=xmlHttp.responseText 
	} 
} 
function stateChanged2() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("subscribe").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
}


function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}


