var xmlDocFce;
var xmlDocString;

function MainSelectionMO(o) {
	if (o.className != "selected")
		o.style.textDecoration = "none";
}
function MainSelectionMT(o) {
	if (o.className != "selected")
		o.style.textDecoration = "underline";
}
function SetHomePage(page) {
	if (navigator.appName != 'Netscape') {
		document.body.style.behavior='url(#default#homepage)'; 
		document.body.setHomePage(page); 
		return false; 
	} else 
		return true; 
}
function getID(name) {
	return document.getElementById(name);
}
function OpenSendByEmailWindow(path) {
	if (path.indexOf("path") <=0)
		path = path + "&path=" + location.href;
	window.open(path, "sendByEmail", "location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,height=250px,width=320px");
}
function OpenPrintWindow(path) {
	window.open(path, "printIt", "location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no");
}
function MainSelection(id) {
	loadXMLDoc("SelectionNomenklatury.ashx?id=" + id, "MainSelection2");
}
function loadXMLDoc(url, fce) {
	xmlDocFce = fce;
	
	req = false;
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
    
	if (req) {
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send("");
	}
}
function processReqChange() {
	if (req.readyState == 4) {
		if (req.status == 200) {
			eval(xmlDocFce + "(req.responseText);");
		} else {
			alert("There was a problem retrieving the data:\n" + req.statusText);
		}
	}
}
function MainSelection2(text) {
	document.getElementById("selectionInnerTd").innerHTML = text;
}
function MainSelectionChange(index) {
	for (var i=0; i < 3; i++) 
	{
		document.getElementById("tableMainSelection").rows[0].cells[i].className = (i == index ? "selected" : "unselected");
	}
}
function SelectionReality(lang) {
	//document.getElementById("selectionInnerTd").innerHTML = "<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='font-weight:bold;'>Tato stranka se pripravuje.</font><br/><br/>";
	document.getElementById("selectionInnerTd").innerHTML = "<iframe width=\"425\" height=\"420\" frameborder=\"0\" scrolling=\"no\" src=\"http://reality.tvujdum.cz/pro_bydleni/zakazky_hledani.aspx?lang=" + lang + "\"></iframe>";
}
function SelectionProdukt() {
	var q = "";
	if (getID("tabSelectionProdukt") != null) {
		q = "?";
		var col = getID("tabSelectionProdukt").getElementsByTagName("select");
		for (var i=0; i < col.length; i++) {
			if (col[i].value != "")
				q += "&" + col[i].id + "=" + col[i].value;
		}
	}
	loadXMLDoc("SelectionProdukt.ashx" + q, "SelectionProdukt2");
}
function SelectionProdukt2(text) {
	document.getElementById("selectionInnerTd").innerHTML = text;
}
function Anketa(id81,id82,s) {
	xmlDocString = s;
	loadXMLDoc("Anketa.ashx?id81=" + id81 + "&id82=" + id82 + "&s=" + s, "Anketa2");
}
function Anketa2(text) {
	document.getElementById("anketa" + xmlDocString).innerHTML = text;
}
