/* Copyright 2008., Croatiaknjiga d.o.o. */


function ajaxObject() {
	var aModul = null;
	if (window.XMLHttpRequest) {
		aModul = new XMLHttpRequest();
	}	else if (window.ActiveXObject) {
		var aVer = new Array("MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "MICROSOFT.XMLHTTP");
		for (var inx = 0; inx < aVer.length; inx++) {
			try {
				aModul = new ActiveXObject(aVer[inx]);
			} catch(e) {}
		}
	}
	this.ajaxModul = aModul;
	if (aModul == null) this.error = true
	else this.error = false;

	this.get = function(urlPath, fCallbackMethod) {
		var aModul = this.ajaxModul;
		if (aModul != undefined && aModul != null && typeof(aModul) == "object") {
			aModul.open("GET", urlPath, true);
			aModul.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-2");
			aModul.onreadystatechange = fCallbackMethod;
			aModul.send(null);
		} else {
			throw new Error("XMLHTTP Ajax not supported!");
		}
	}
	
	this.post = function(urlPath, urlParm, fCallbackMethod) {
		var aModul = this.ajaxModul;
		if (aModul != undefined && aModul != null && typeof(aModul)) {
			aModul.open("POST", urlPath, true);
			aModul.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			aModul.onreadystatechange = fCallbackMethod;
			aModul.send(urlParm);
		} else {
			throw new Error("XMLHTTP Ajax not supported!");
		}
	}
}

/*
function ajaxCheckReadyState() {
	var aModul = <ajax object>.ajaxModul;
	if (aModul.readyState == 0) {
		// Uninitialized  - We have created our AJAX object but haven't opened it yet. //
	}
	if (aModul.readyState == 1) {
		// Loading - We have called open but haven't yet sent the request. //
	}
	if (aModul.readyState == 2) {
		// Loaded - We have sent the request. //
	}
	if (aModul.readyState == 3) {
		// Interactive - A partial response has been received. //
	}
	if (aModul.readyState == 4 && (ajaxModul.status == 200 || window.location.href.indexOf("http") == -1)) {
		// Complete - A complete response has been received and the connection has been closed.  <objId.responseText> is filled with loaded content. //
	}
}
*/

var aSiteContent = new ajaxObject();
var aSiteBanner = new ajaxObject();
var aSiteBasket = new ajaxObject();
