initHttpRequest();

function searchBlur(obj,label) {

 if (obj.value.length == 0) {
		obj.value = label;
 }

}

function initHttpRequest() {
	try {
		httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (oc) {
			httpRequest = null;
		}
	}
	if(!httpRequest && typeof XMLHttpRequest != "undefined") {httpRequest= new XMLHttpRequest();}
	if(!httpRequest) {alert('Nem támogatott böngésző!');return false;}
}
//////

//////
function processRequest() {
	if (httpRequest.readyState == 4) {
		if(httpRequest.status == 200) {
			var contentXML = httpRequest.responseXML.getElementsByTagName("content")[0];
			var contentText = contentXML.childNodes[0].nodeValue;
			return contentText;
		} else {
			alert("Error loading page\n"+ httpRequest.status +":"+ httpRequest.statusText);
		}
	}
}
//////


//////
function getContent(params) {
	var params;

	document.getElementById("loading").style.display = "block";
	document.getElementById('body').style.cursor = 'wait';

	if (params) location.href=location.pathname+'#'+params;

	document.getElementById('page').value = params;

	var url = host+'getContent.php'+params;
	httpRequest.open("GET",url,true);
	httpRequest.onreadystatechange = function() {
		try {
			if (content = processRequest()) {
				if (content != 'undefined') {
					document.getElementById("centerContent").innerHTML = content;

					var title = document.getElementById("hiddenTitle").innerHTML;

					var matchTag = /<(?:.|\s)*?>/g;
					title = title.replace(matchTag, "");
					document.title = 'Sőregi tortadíszítés - '+title;

					urchinTracker();

				}
			}
		} catch (e) {/* err02 */}
	};
	httpRequest.send(null);

}
//////


//////
function setImage(ID) {
	var ID;
	url = 'getImageProps.php?id='+ID;
	httpRequest.open("GET",url,true);
	httpRequest.onreadystatechange = function() {
		try {
			if (content = processRequest()) {
				if (content != 'undefined') document.getElementById("termekImageCntr").innerHTML = content;
			}
		} catch (e) {/* err02 */}
	};
	httpRequest.send(null);

}
//////



/////
function onLoadComplete() {
	document.getElementById("loading").style.display = "none";
	document.getElementById('body').style.cursor = 'default';
}
/////




//////
function insertCart(ID) {
	var ID;
	var num = document.getElementById("tcv_"+ID).value;

	//alert(num);

}
//////



/////
function clearSearchText(obj,label) {
	if (obj.value == label) {
		obj.value = '';
	}
}
/////

/////
function checkSend() {

	var s1 = document.getElementById('s1').value;
	var a = document.getElementById('keresesIN');
	if (a.value == s1) {
		a.value = '';
	}
}
/////


//////
function openKatMenu() {
	document.getElementById('katMenu').style.display = 'block';
	document.getElementById('mainMenu').style.display = 'none';
}
function closeKatMenu() {
	document.getElementById('katMenu').style.display = 'none';
	document.getElementById('mainMenu').style.display = 'block';
}
/////


/////
function openSzamlazasiCimCntr() {


	var s2 = document.getElementById('s2').value;

	document.getElementById("szamlazasiCimCntr").style.display = "block";
	document.getElementById("szmlazasiCimLink").href = "javascript:closeSzamlazasiCimCntr()";
	document.getElementById("szmlazasiCimLink").innerHTML = '&laquo; '+s2;

}
/////

/////
function closeSzamlazasiCimCntr() {

	var s3 = document.getElementById('s3').value;

	document.getElementById("szamlazasiCimCntr").style.display = "none";
	document.getElementById("szmlazasiCimLink").href = "javascript:openSzamlazasiCimCntr()";
	document.getElementById("szmlazasiCimLink").innerHTML = s3+' &raquo;';

}
/////




/////
function addToCart(id) {
	var id;
	var db = document.getElementById('db_'+id).value;

	document.getElementById('cart').style.display = 'block';

	var url = host+'addToCart.php?id='+id+'&db='+db;
	httpRequest.open("GET",url,true);
	httpRequest.onreadystatechange = function() {
		try {
			if (content = processRequest()) {
				if (content != 'undefined') {
					document.getElementById("cartCntr").innerHTML = content;
					document.getElementById('kosarOsszesen').innerHTML = document.getElementById('kosarOsszesenH').value;
				}
			}
		} catch (e) {/* err02 */}
	};
	httpRequest.send(null);


}
/////


/////
function delFromCart(id) {
	var id;

	var url = host+'addToCart.php?id='+id+'&m=1';
	httpRequest.open("GET",url,true);
	httpRequest.onreadystatechange = function() {
		try {
			if (content = processRequest()) {
				if (content != 'undefined') {
					document.getElementById("cartCntr").innerHTML = content;
					document.getElementById('kosarOsszesen').innerHTML = document.getElementById('kosarOsszesenH').value;
				}
			}
		} catch (e) {/* err02 */}
	};
	httpRequest.send(null);

}
/////


/////
function notLogged() {

	var s4 = document.getElementById('s4').value;

	alert(s4);//Tisztelt felhasználó!\n\nTermék rendeléshez be kell jelentkeznie, ehhez regisztráció szükséges.\nEzt megteheti baloldat a regisztráció menüpont alatt.
	//getContent('?id=11');
	location.href =  location.pathname + document.getElementById('page').value;

}
/////


/////
function hideCart() {
	
	document.getElementById('cart').style.display = 'none';
	location.href = location.pathname + document.getElementById('page').value;

}
/////


////
function errorMsg(n) {
	var n;
	var s5 = document.getElementById('s5').value;
	var str = s5.replace('xxx',n);
	alert(str);//'Tisztelt látogató! \n\n Ebből a termékből maximum '+n+' darab rendelhető egyszerre!'
}
////


////
function rendeles() {

	getContent('?id=18&r=1');

}
////

////
function onlineshop() {

	document.getElementById('mainMenu').style.display = 'none';
	document.getElementById('katMenu').style.display = 'block';
	getContent('?id=4');

}
///

function kezdolap() {

	document.getElementById('mainMenu').style.display = 'block';
	document.getElementById('katMenu').style.display = 'none';
	getContent('?id=2');

}



/////
function displayElement(id) {
	var obj = document.getElementById('lItem_'+id);
	//var ih = document.getElementById('ih_'+id).value;
	if (obj.style.display == 'none') {
		//document.getElementById('iItem_'+id).height = 1;
		obj.style.display = 'table-row';
		//ex3 = new Animator().addSubject(new NumericalStyleSubject($('iItem_'+id), 'height',1, ih));
		//ex3.toggle();
	} else {
		obj.style.display = 'none';
	}

}
/////