// --- Copyright (c) 2003 Bluemedia - www.bluemedia.at ----------------------
// --- To receive the right to license this code to use on your site the  ---
// --- original code must be received from bluemedia (media@bluechip.at). ---
// --- License is granted if you use the original code and only if this   ---
// --- entire copyright notice is included, and you link from the page on ---
// --- which the code is used to Bluemedia - http://www.bluemedia.at  -------
// --- By Ronald Edermayr 06.11.2003 ----------------------------------------
// --- Code: Edermayr Ronald ------------------------------------------------

function decodeMail(encodedEmail) {
	var args = decodeMail.arguments;
	var email = "";
	for (i=0; i < encodedEmail.length; i+=2) {
		var letter = "";
		letter = encodedEmail.charAt(i) + encodedEmail.charAt(i+1)
		email += String.fromCharCode(parseInt(letter,16));
	}
	var label = typeof(args[1]) == "undefined" ? email : args[1];
	document.write('<a href="mailto:' + email + '">' + label + '</a>');
}

function newsletter_win() {
	args = newsletter_win.arguments;
	var lang = typeof(args[0]) == "undefined" ? "de" : args[0];
	window.open('http://www.mailability.de/grubhof/optin.php','newsletter_win','width=400,height=450,scrollbars=yes');
}

function bookingwindow(lang) {
	switch(lang) {
		case 'en':
			lang = 'u';
			break;
		case 'nl':
			lang = 'h';
			break;
		default:
			lang = 'a';
			break;
	}
	window.open('http://www.secureholiday.net/info.asp?nc=3419&mp=794&lg=' + lang,'booking_win','width=760,height=450,scrollbars=yes');
}

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function popupopen () {
	var titles = Array("Detailansicht","detailed view","Detail");
	var lang = getCookie('lang');
	lang = lang == null ? 0 : lang - 1;
	
	var args = popupopen.arguments;
	var name   = typeof(args[0]) == "undefined" ? "images/spacer.gif" : args[0];
	var width  = typeof(args[1]) == "undefined" ? 100 : args[1];
	var height = typeof(args[2]) == "undefined" ? 100 : args[2];
	var title  = typeof(args[3]) == "undefined" || args[3] == ''  ? titles[lang] : args[3];
	var wname  = typeof(args[4]) == "undefined" || args[4] == '' ? "win" : args[4];
	var leftpos= typeof(args[5]) == "undefined" ? false : args[5];
	var toppos = typeof(args[6]) == "undefined" ? false : args[6];
	var closes = typeof(args[7]) == "undefined" ? true : false;
	var printable = typeof(args[8]) == "undefined" ? false : true;
	
	if (!leftpos || !toppos) {
		var leftpos = (screen.height - height)/2;
		var toppos  = (screen.width - width)/2;
	}
	
	if (!printable) {
		win = window.open("","" + wname + "","width=" + width + ",height=" + height + ",left=" + toppos + ",top=" + leftpos);
	}else{
		win = window.open("","" + wname + "","width=" + width + ",height=" + (height + 24) + ",left=" + toppos + ",top=" + leftpos);
	}
	win.document.open();
	win.document.write('<html><head><title>' + title + '</title><link rel="stylesheet" type="text/css" href="styles_wi.css"><meta http-equiv="imagetoolbar" content="no"></head>');
	if (closes) {
		win.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close();">'); 
	}else{
		win.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">'); 
	}
	win.document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td align="center">');

	if (name.substr(name.length - 3, 3) == "swf") {
		win.document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + width + '" height="' + height + '">');
		win.document.write('<param name="movie" value="' + name + '">');
		win.document.write('<param name="quality" value="high">');
		win.document.write('<param name="quality" value="high">');
		win.document.write('<param name="menu" value="false">');
		win.document.write('<embed src="' + name + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
		win.document.write('</object>');
	}else{
		var alt = (title != "Details") ? title : "";
		win.document.write('<img src="' + name + '" width="' + width + '" height="' + height + '" alt="' + alt + '">'); 
	}
	
	win.document.write('</td></tr>');
	if (printable) win.document.write('<tr class="back01"><td align="right" height="20"><a href="javascript:self.print();"><img src="images/page_button_print.gif" border="0" hspace="5"></a></td></tr>');
	win.document.write('</table></body></html>');
	win.document.close();
	win.focus();
}

function popuppage() {
	var args	= popuppage.arguments;
	var url		= typeof(args[0]) == "undefined" ? "index.htm" : args[0];
	var width	= typeof(args[1]) == "undefined" ? 100 : args[1];
	var height	= typeof(args[2]) == "undefined" ? 100 : args[2];
	var	features= typeof(args[3]) == "undefined" || args[3] == '' ? 'scrollbars=yes' : args[3];
	var name	= typeof(args[4]) == "undefined" ? '' : args[4];
	if (features != '') features = "," + features;
	window.open(url,name,'width=' + width + ', height=' + height + features);
}