

OKAZII.zone = function (){

}

OKAZII.zone.show = function (strZone){
	document.getElementById("zone_"+strZone).style.display = '';
}

OKAZII.zone.hide = function (strZone){
	document.getElementById("zone_"+strZone).style.display = 'none';
}

OKAZII.zone.loadSkin = function (strZone){
	
	callbackLoadSkin = function (response){
		if (response.responseText != ''){
			OKAZII.utils.loadCssFile(response.responseText)
		}
	}
	
	var cb = new Array('ZoneController','getSkin');
	var params = new Array();
		params[0] = strZone;
	var rpc = new Array(cb,params);
	new Ajax.Request ('/rpc/', {
		method: 'post',
		onSuccess: callbackLoadSkin,
		onFailure: null,
		parameters: 'rpc='+rpc.toJSON()});
	return false; 
}

OKAZII.zone.loadDatasources = function (strZone){
	callbackLoadDatasources = function (response){
		if (response.responseText != ''){
			eval(response.responseText);
		}
	}
	var cb = new Array('ZoneController', 'getDatasources');
	var params = new Array();
		params[0] = strZone;
	var rpc = new Array(cb,params);
	new Ajax.Request ('/rpc/', {
		method: 'post',
		onSuccess: callbackLoadDatasources,
		onFailure: null,
		parameters: 'rpc='+rpc.toJSON()});
	return true;
}

OKAZII.zone.loadZoneContainer = function (strZone){
	callbackLoadZoneContainer = function (response){
		if (response.responseText != ''){
			document.getElementById('zone_'+strZone).innerHTML = response.responseText;
		}
		OKAZII.zone.loadDatasources(strZone);
	}
	
	var cb = new Array('ZoneController', 'getZoneContainer');
	var params = new Array();
		params[0] = strZone;
	var rpc = new Array(cb,params);
	new Ajax.Request ('/rpc/', {
		method: 'post',
		onSuccess: callbackLoadZoneContainer,
		onFailure: null,
		parameters: 'rpc='+rpc.toJSON()});
	return true;
}

OKAZII.zone.changeTitle = function (strNewTitle, strNewUrl){
	var objElem = document.getElementById('zone_titlu');
	objElem.href=strNewUrl;
	objElem.innerHTML = strNewTitle;
	return true;
}

OKAZII.zone.showBubble = function (strLiId){
	var objLi = document.getElementById(strLiId);
	var objDisable = document.getElementsByClassName('li_zone_auction_active');
	if (objDisable[0] != null){
		objDisable[0].setAttribute('class', 'li_zone_auction');
	}
	objLi.setAttribute('class', 'li_zone_auction_active');
	return true;
}

OKAZII.zone.init = function (strZone){
	if (strStaticPath == null) {
		strStaticPath = './';
	}
	OKAZII.zone.loadSkin(strZone);
	OKAZII.utils.loadJsFile(strStaticPath + "js/www/zone/common.js");
	OKAZII.utils.loadJsFile(strStaticPath + "js/www/zone/"+strZone+"/load.js");
	OKAZII.zone.loadZoneContainer(strZone);
}
