// JavaScript Document
var where = false;

var C     = false;
var placed = 'http://www1.peak.am/';
// var placed = 'http://localhost/cff/';
function loadData(url, areaid, name,noteLoad) {

	if(name == null)
		name = "";
	if(url == null)
		return;
	if(noteLoad == null)
		C = areaid;
	else
		C = noteLoad

        url.replace("&amp;","&")
		if(areaid != null){

                document.getElementById(C).innerHTML = "<span >Loading "+name+"...</span>";
		}

	     if (window.XMLHttpRequest) { // Mozilla, Safari,...

			xmlDoc = new XMLHttpRequest();

			if (xmlDoc.overrideMimeType) {
                xmlDoc.overrideMimeType('text/xml');
			}

        } else if (window.ActiveXObject) { // IE
            try {
                xmlDoc = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

	 if (!xmlDoc) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }

	url =url + (url.indexOf("?")==-1?"?":"&")+"time="+(new Date()).getTime();
	where = areaid;
        xmlDoc.onreadystatechange = alertContents;
		xmlDoc.open( 'GET', url, true );
		xmlDoc.send(null);
		document.getElementById(C).innerHTML = "";


}

    function alertContents() {

        if (xmlDoc.readyState == 4) {
            if (xmlDoc.status == 200) {
                document.getElementById(where).innerHTML = xmlDoc.responseText;
            } else {
                alert('There was a problem with the request.');
            }
        }

    }


function getList(selObj){

	district = selObj.options[selObj.selectedIndex].value;
	url     = placed+'admin/ide_map_list.php?district='+district+'';
	loadData(url, 'place1', 'map');

}

function getListDistricts(selObj,Chdist){

	district = selObj.options[selObj.selectedIndex].value;
	url     = placed+'ide_districts_list.php?district='+district+'&Chdist='+Chdist+'';
	loadData(url, 'place_dist', 'Район');

}


function hideBedRomms(selObj){

	type = selObj.options[selObj.selectedIndex].value;
	Obj2 = document.getElementById('bed');
	if (type >= 7 && type <= 9 || type >= 18 && type <= 21)
		Obj2.style.visibility="hidden";
	else
		Obj2.style.visibility="visible";
	
}

function getListExists(district,zone_id){

	url = placed+'admin/ide_map_list.php?district='+district+'&zone='+zone_id;
	loadData(url, 'place1', 'map');

}

function bookmark(item_id){

		url = placed+'do_bookmark.php?item_id='+item_id;
		loadData(url, 'bk'+item_id, 'map');
}




