initHttpRequest();

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("rightContent").innerHTML = content;
			}
		} 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) {
	var obj;
	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").style.display = 'block';
					document.getElementById("cartCntr").innerHTML = content;
					//document.getElementById('kosarOsszesen').innerHTML = document.getElementById('kosarOsszesenH').value;
				}
			}
		} catch (e) {/* err02 */}
	};
	httpRequest.send(null);


}
/////


function closeBasket() {

	document.getElementById("cartCntr").innerHTML = '';
	document.getElementById("cartCntr").style.display = 'none';

}


function closeNotLoggedMsg() {

	document.getElementById("cartCntr").innerHTML = '';
	document.getElementById("cartCntr").style.display = 'none';

}


/////
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;

	var HTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100" height="110" id="menu" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="templates/flash/head.swf" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#999999" /><embed src="templates/flash/head.swf" menu="false" quality="high" wmode="transparent" bgcolor="#999999" width="100" height="110" name="menu" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object><br><center>'+s4+'</center>';

	document.getElementById("cartCntr").style.display = 'block';
	document.getElementById("cartCntr").innerHTML = HTML;
	//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;
		if (browser == 'ie') {obj.style.display = 'block';}
		else {obj.style.display = 'table-row';}
		//ex3 = new Animator().addSubject(new NumericalStyleSubject($('iItem_'+id), 'height',1, ih));
		//ex3.toggle();
	} else {
		obj.style.display = 'none';
	}

}
/////









///////
function openCartOkMsg() {
	alert('Ok');
}

