/* POPUPS */
var pp_inner_width = 396;
var pp_inner_height = 427;
var pp_x = (screen.availWidth / 2) - (pp_inner_width / 2);
var pp_y = (screen.availHeight / 2) - (c_height / 2) + 0;
function openPopup(popup_url, f_width, f_height) {
	
	ZHPOPUP = window.open(popup_url, "ZHPOPUP", "width="+f_width+",height="+f_height+",scrollbars=yes,resizable=yes");
	if(browser.ie) pp_y_offset = c_height - (f_height + 29);
	else pp_y_offset = c_height - ZHPOPUP.outerHeight;
	ZHPOPUP.moveTo(pp_x, pp_y + pp_y_offset);
	ZHPOPUP.focus();

	/*ZHPOPUP = window.open(popup_url, "ZHPOPUP", "width="+pp_inner_width+",height="+pp_inner_height+",scrollbars=yes,resizable=yes");
	if(browser.ie) pp_y_offset = c_height - (pp_inner_height + 29);
	else pp_y_offset = c_height - ZHPOPUP.outerHeight;
	ZHPOPUP.moveTo(pp_x+150, pp_y + pp_y_offset);
	ZHPOPUP.focus();*/
}

function openPopupLeoHelp(popup_url, f_width, f_height) {
	
	LEOHELPPOPUP = window.open(popup_url, "LEOHELPPOPUP", "width="+f_width+",height="+f_height+",scrollbars=yes,resizable=yes");
	if(browser.ie) pp_y_offset = c_height - (f_height + 29);
	else pp_y_offset = c_height - LEOHELPPOPUP.outerHeight;
	LEOHELPPOPUP.moveTo(pp_x + 30, pp_y + pp_y_offset-30);
	LEOHELPPOPUP.focus();

	/*ZHPOPUP = window.open(popup_url, "LEOHELPPOPUP", "width="+pp_inner_width+",height="+pp_inner_height+",scrollbars=yes,resizable=yes");
	if(browser.ie) pp_y_offset = c_height - (pp_inner_height + 29);
	else pp_y_offset = c_height - LEOHELPPOPUP.outerHeight;
	LEOHELPPOPUP.moveTo(pp_x + 30, pp_y + pp_y_offset-30);
	LEOHELPPOPUP.focus();*/
}

function closePopup(obj) {
	obj.close();
	obj.opener.focus();	
}

function startSearch(obj) {

	if (obj.document.forms[0].Vorschlag.value == "")
   {
      alert ("Bitte geben Sie einen Suchbegriff ein! Vielen Dank.");
      return false;
   }

	obj.close();
	obj.opener.focus();	
	var url;
	url  = opener.location.pathname;
	url += "?search=" + obj.document.getElementsByName("search")[0].value;
	
	if(obj.document.getElementsByName("search")[0].value != "" && obj.document.getElementsByName("Vorschlag")[0].value != ""){
		url += " ";
	}

	if(obj.document.getElementsByName("Vorschlag")[0].value != ""){
		url += escape(obj.document.getElementsByName("Vorschlag")[0].value);
	}
	

	if (obj.document.getElementsByName("isCat")[0].value == "1") {
		url += "&ThemeID=" + obj.document.getElementsByName("ThemeID")[0].value;
		url += "&ThemeHandle=" + obj.document.getElementsByName("ThemeHandle")[0].value;	
	}

	opener.location.href = url;

//opener.location.href = opener.location.pathname +"?Vorschlag=" + encodeURI(obj.document.getElementsByName("Vorschlag")[0].value + "&search=" + obj.document.getElementsByName("search")[0].value);
//opener.location.href = opener.location.pathname +"?Vorschlag="  + obj.document.getElementsByName("Vorschlag")[0].value;
}

function startFuzzyKeywordSearch(obj, fuzzyKeyword) {

	obj.close();
	obj.opener.focus();	
	var url;
	url  = opener.location.pathname;
	url += "?search=" + fuzzyKeyword;
	
	if(obj.document.getElementsByName("search")[0].value != "" && obj.document.getElementsByName("Vorschlag")[0].value != ""){
		url += " ";
	}

	if(obj.document.getElementsByName("Vorschlag")[0].value != ""){
		url += escape(obj.document.getElementsByName("Vorschlag")[0].value);
	}
	

	if (obj.document.getElementsByName("isCat")[0].value == "1") {
		url += "&ThemeID=" + obj.document.getElementsByName("ThemeID")[0].value;
		url += "&ThemeHandle=" + obj.document.getElementsByName("ThemeHandle")[0].value;	
	}

	opener.location.href = url;

}


/* URLs IN EXTERNAL WINDOW */
//var ZH_EXTWIN;
function openURL(url, width, height) {
	w = width ? width : 700;
	h = height ? height : 500;
//	if(ZH_EXTWIN) ZH_EXTWIN.close();
	var ZH_EXTWIN = window.open(url, "ZH_EXTWIN", "width=640,height=400,toolbar,status,location,menubar,resizable,scrollbars");
/*
	if(browser.ns) {
		ZH_EXTWIN.outerWidth = w;
		ZH_EXTWIN.outerHeight = h;
	} else {
		ZH_EXTWIN.resizeTo(w, h);
	}
	x = (screen.availWidth / 2) - (w / 2);
	y = (screen.availHeight / 2) - (h / 2);
	ZH_EXTWIN.moveTo(x, y);
	ZH_EXTWIN.document.location.href = url;
*/
	ZH_EXTWIN.focus();
}

/* DUMMY WINDOW */
function openDummy() {
	url = "dummy.html";
	if(document.location.href.indexOf('/search/') > -1) url = "../dummy.html";
	DUMMY = window.open(url, "DUMMY", "width=640,height=400,toolbar,status,location,menubar,resizable");
}

