ie = navigator.userAgent.indexOf("MSIE") != -1;
iever = "0";
if (ie) {
iever = navigator.userAgent.indexOf("MSIE");
iever = navigator.userAgent.substring(iever+5, iever+6);
}
linktotal = 0;
highlighted = -1;
openedbox = "";
hiddenbox = "";
func = "";
values = new Array();
valuesid = new Array();
var to;
lastchar = "";
editwidth = 0;
cto = 0;
function htmltranslate(x) {
for (t = 0; t < transl.length; t++) {
p = transl[t].split("|");
while (x.indexOf(p[1]) != -1) x = x.replace(p[1], p[0]);
}
return x;
}
function trim(t) {
while (t.substring(0,1) == " ") t = t.substring(1, t.length);
while (t.substring(t.length - 1, t.length) == " ") t = t.substring(0, t.length - 1);
return t;
}
// used to fill textfields
function use(t) {
var re = /<\S[^><]*>/g
var re2 = /#/g
// alert(t);
t = htmltranslate(t);
if (t.length > 0) {
e = t.split(",");
links = "";
values.length = e.length;
for (i = 0; i < e.length; i++) {
s = unescape(e[i]).split("|");
link = "" + s[1].replace(re2, "") + "
\n";
v = s[1].split("#");
values[i] = v[0].replace(re, "");
valuesid[i] = s[0];
links += link;
}
minwidth = document.getElementById("mydropdown").offsetWidth;
document.getElementById("mydropdown").innerHTML = links;
for (i = 0; i < e.length; i++) {
w = document.getElementById("l" + i).offsetWidth
if (w > editwidth) editwidth = w;
}
for (i = 0; i < e.length; i++) {
document.getElementById("l"+i).style.width = Math.max(minwidth, editwidth) + "px";
}
document.getElementById("mydropdown").style.width = Math.max(minwidth, (editwidth + 2)) + "px";
document.getElementById("mydropdown").style.visibility = "visible";
dropdowns(1);
linktotal = e.length;
} else {
nolinks();
}
wait_icons = new Array("hotelwait", "filewait", "regionwait", "subregionwait", "citywait", "reiswait");
for (i=0; i 0) {
e = t.split("|");
x_alert(unescape(e[1]));
document.getElementById(e[0]).focus();
document.getElementById(e[0]).select();
}
}
function selectcontent(t) {
try {
window.clearTimeout(cto);
} catch(e) {}
openedbox.value = values[t];
openedbox.focus();
hiddenbox.value = valuesid[t];
nolinks();
// if (func != "") eval(func);
try { eval(func) } catch(err) {}
}
function nolinks() {
dropdowns(0);
document.getElementById("mydropdown").style.visibility = "hidden";
document.getElementById("mydropdown").innerHTML = "";
linktotal = 0;
highlighted = -1;
}
function nolinks2() {
window.setTimeout("nolinks()", 250);
}
function keycatch() {
if (ie) c = event.keyCode;
else c = 0;
up = false;
down = false;
if (c == 38) { if (highlighted > 0) highlight(highlighted-1); }
else if (c == 40) { if (highlighted + 1 < linktotal) highlight(highlighted + 1); }
else if (c == 13) { if (highlighted >= 0) selectcontent(highlighted); }
else if (c == 27) { nolinks(); }
else { highlighted = -1; }
}
function highlight(n) {
if (highlighted > -1) document.getElementById("l" + highlighted).className = "mout";
document.getElementById("l" + n).className = "mover";
highlighted = n;
}
function old_dropdowns(x) {
if (ie && iever < 7) {
o = document.getElementsByTagName('select');
for (dd = 0; dd < o.length; dd++) {
//o[dd].style.visibility = (x == 1 ? "hidden" : "visible");
o[dd].style.display = (x == 1 ? "none" : "inline");
}
}
}
function dropdowns(x) {
mdd = document.getElementById("mydropdown");
mdda = getpos("mydropdown");
if (ie && iever < 7) {
o = document.getElementsByTagName('select');
for (dd = 0; dd < o.length; dd++) {
if (o[dd].id == "") o[dd].id = "ajax_auto_hide_dropdown_" + dd;
o_id = o[dd].id;
do_nothing = false;
tempEl = document.getElementById(o_id).offsetParent;
while (tempEl != null && tempEl != undefined) {
if (tempEl.tagName.toLowerCase() == "div" && tempEl.style.visibility == "hidden") {
document.getElementById(o_id).style.visibility = "hidden";
do_nothing = true;
break;
}
tempEl = tempEl.offsetParent;
}
if (!do_nothing) {
a = getpos(o_id);
ajax_show_select = true;
if (a[0] > mdda[0] + mdd.offsetWidth) ajax_show_select = false;
if (a[1] > mdda[1] + mdd.offsetHeight) ajax_show_select = false;
if (a[0] + document.getElementById(o_id).offsetWidth < mdda[0]) ajax_show_select = false;
if (a[1] + document.getElementById(o_id).offsetHeight < mdda[1]) ajax_show_select = false;
if (ajax_show_select || x==0) o[dd].style.visibility = (x == 1 ? "hidden" : "visible");
}
}
}
}
// aanbiedingen: find hotel and fill hidden field
function autofill(obj, obj2, taal) {
if (ie) c = event.keyCode;
else c = 0;
if (c != 13 && c != 38 && c != 40) {
lastchar = c;
var argv = autofill.arguments;
var argc = autofill.arguments.length;
var extra_par = "";
if (argc > 2) {
for (i = 2; i < argc; i++) {
extra_par += ", '" + argv[i] + "'";
}
}
if (to) window.clearTimeout(to);
to = window.setTimeout("realautofill('" + obj.id + "', '" + obj2 + "', '" + taal + "'" + extra_par + ")", 200);
}
}
function realautofill(obj, obj2, taal) {
obj = document.getElementById(obj);
v = trim(obj.value);
if (v != "" && document.getElementById("hotelwait") != undefined) document.getElementById("hotelwait").src="/img/icon_loading.gif";
try {
if (v != "" && document.getElementById("hotelwait" + cur_hoteldiv) != undefined) document.getElementById("hotelwait" + cur_hoteldiv).src="/img/icon_loading.gif";
} catch(e) {}
a = getpos(obj.name);
l = a[0];
document.getElementById("mydropdown").style.width = obj.offsetWidth + "px";
document.getElementById("mydropdown").style.top = (a[1] + 20) + "px";
document.getElementById("mydropdown").style.left = l + "px";
openedbox = obj;
hiddenbox = document.getElementById(obj2);
//func = 'edithotel()';
if (v != "") {
geturl("/includes/aanbiedingen/lookup.php?lookup=" + escape(v) + "&taal=" + taal + "&random=" + new Date().getTime(), 'use');
} else nolinks();
}
// find hotel and fill hidden field
function autofill2(obj, obj2, taal) {
if (ie) c = event.keyCode;
else c = 0;
if (c != 13 && c != 38 && c != 40) {
lastchar = c;
var argv = autofill2.arguments;
var argc = autofill2.arguments.length;
var extra_par = "";
if (argc > 2) {
for (i = 2; i < argc; i++) {
extra_par += ", '" + argv[i] + "'";
}
}
if (to) window.clearTimeout(to);
to = window.setTimeout("realautofill2('" + obj.id + "', '" + obj2 + "', '" + taal + "'" + extra_par + ")", 200);
}
}
function realautofill2(obj, obj2, taal) {
obj = document.getElementById(obj);
v = trim(obj.value);
if (v != "" && document.getElementById("hotelwait") != undefined) document.getElementById("hotelwait").src="/img/icon_loading.gif";
try {
if (v != "" && document.getElementById("hotelwait" + cur_hoteldiv) != undefined) document.getElementById("hotelwait" + cur_hoteldiv).src="/img/icon_loading.gif";
} catch(e) {}
var argv = realautofill2.arguments;
var argc = realautofill2.arguments.length;
a = getpos(obj.name);
l = a[0];
document.getElementById("mydropdown").style.width = obj.offsetWidth + "px";
document.getElementById("mydropdown").style.top = (a[1] + 20) + "px";
document.getElementById("mydropdown").style.left = l + "px";
openedbox = obj;
hiddenbox = document.getElementById(obj2);
extra = "";
for (i = 3; i < argc; i++) {
extra += "&" + argv[i];
}
//func = 'edithotel()';
if (v != "") {
geturl("/includes/hotels/lookup.php?lookup=" + escape(v) + extra + "&taal=" + taal + "&random=" + new Date().getTime(), 'use');
} else nolinks();
}
// find city and fill hidden field
function autofill3(obj, obj2, taal) {
if (ie) c = event.keyCode;
else c = 0;
if (c != 13 && c != 38 && c != 40) {
lastchar = c;
var argv = autofill3.arguments;
var argc = autofill3.arguments.length;
var extra_par = "";
if (argc > 2) {
for (i = 2; i < argc; i++) {
extra_par += ", '" + argv[i] + "'";
}
}
if (to) window.clearTimeout(to);
to = window.setTimeout("realautofill3('" + obj.id + "', '" + obj2 + "', '" + taal + "'" + extra_par + ")", 200);
}
}
function realautofill3(obj, obj2, taal) {
obj = document.getElementById(obj);
v = trim(obj.value);
if (v != "" && document.getElementById("citywait") != undefined) document.getElementById("citywait").src="/img/icon_loading.gif";
var argv = realautofill3.arguments;
var argc = realautofill3.arguments.length;
a = getpos(obj.name);
l = a[0];
document.getElementById("mydropdown").style.width = obj.offsetWidth + "px";
document.getElementById("mydropdown").style.top = (a[1] + 20) + "px";
document.getElementById("mydropdown").style.left = l + "px";
openedbox = obj;
hiddenbox = document.getElementById(obj2);
extra = "";
for (i = 3; i < argc; i++) {
extra += "&" + argv[i];
}
//func = 'edithotel()';
if (v != "") {
geturl("/includes/citytrips/lookup.php?lookup=" + escape(v) + extra + "&taal=" + taal + "&random=" + new Date().getTime(), 'use');
} else nolinks();
}
// update hotels dropdown op de caractere-voordelen zoekpagina
function update_hotels(frm, icon, taal) {
document.getElementById(icon + "wait").src = "/img/icon_loading.gif";
with (frm) {
lookup = "countrycode=" + escape(countrycode.options[countrycode.selectedIndex].value);
if (region.selectedIndex != 0) lookup += "®ion=" + escape(region.options[region.selectedIndex].value);
if (city.selectedIndex != 0) lookup += "&city=" + escape(city.options[city.selectedIndex].value);
}
openedbox = frm.hotelid;
geturl("/includes/aanbiedingen/lookup.php?" + lookup + "&taal=" + taal + "&random=" + new Date().getTime(), 'update_hotel_dropdown');
}
function update_hotel_dropdown(t) {
openedbox.length = 1;
if (t.length > 0) {
s = t.split("||&&||");
for (i = 0; i < s.length; i++) {
s1 = s[i].split("|&|");
openedbox.options[i+1] = new Option(unescape(s1[1]), s1[0]);
}
}
openedbox.selectedIndex = 0;
wait_icons = new Array("countrywait", "regionwait", "citywait");
for (i=0; i