var resized = "false";
var pop = null;

function contact() {
	var str = "mailto:"
	str += "contact";
	str += String.fromCharCode(8 * 8);
	str += "letterpix";
	str += ".";
	str += "com";
	document.location = str;
	return;
}

function duolijstWissel(lijst, selectnaam, enkelekeuze) {
	var van, vanlijst;
	var naar, naarlijst;
	var naam = selectnaam.split("_");
	var naarjalijst = false;
	

	if (naam[1] == "nee") {
		naarjalijst = true;
		vanlijst = document.forms[lijst].elements[naam[0] + "_nee"];
		naarlijst = document.forms[lijst].elements[naam[0]];
	} else {
		vanlijst = document.forms[lijst].elements[naam[0]];
		naarlijst = document.forms[lijst].elements[naam[0] + "_nee"];
	}

	//eerst nieuwe element uit vanlijst weghalen en parkeren in optXXX
	idx = vanlijst.selectedIndex;
	var opttxt = vanlijst.options[idx].text;
	var optval = vanlijst.options[idx].value;
	verwijderUitSelectOptions(vanlijst.options, idx);

	if ((enkelekeuze == "true") && (naarjalijst) && (naarlijst.options.length > 0)) { // element uit jalijst halen en in vanlijst terugstoppen
		voegInInSelectOptions(vanlijst.options, naarlijst.options[0].text, naarlijst.options[0].value);
		verwijderUitSelectOptions(naarlijst.options, 0);
	}

 	voegInInSelectOptions(naarlijst.options, opttxt, optval);

}

function sluitPop() {
	if (pop !=null) {
		if (navigator.platform != "MacPPC") { //stomme mac wil geen close-operatie ondersteunen
			pop.close();
			pop = null;
		}
	}
}

function openPop(titel) {
	var w = 550;
	var h = 100;
	var x = (screen.availWidth / 2)- (w / 2);
	var y = (screen.availHeight /2) - (h / 2); 
	var features = "screenX=" + x + ",screenY=" + y + ",width=" + w + ",height=" + h;
	features = features + ",dependent=yes,directories=no,menubar=no,titlebar=no,toolbar=no,scrollbars=no,resizable=no,location=no,status=no";
	if (pop != null) {
		pop.close();
		pop = null;
	}

	pop = window.open("","pop",features);
	pop.moveTo(x,y);

	pop.document.write("<html><head>");
	pop.document.write("<title>");
	pop.document.write(titel);
	pop.document.write("</title><style>");
	pop.document.write("body {color: #000088; font-size: 12px; font-weight: normal; font-family: Verdana, Lucida, Arial, Helvetica, sans-serif;} input {font-size: 12px; font-family: Verdana, Arial; height: 22px;}</style>");
	pop.document.write("</style><script language='Javascript'>function website(url){window.open(url,'extra','menubar=no,scrollbars=yes,resizable=yes,status=no,width=780,height=540');}</script></head><body bgcolor='#FFFFFF'>");
}

function naarPag(pagina) {
	var elementen = pagina.split(";");
	setHidden("letterpix", "forward", elementen[0]);
	if (elementen.length > 1) setHidden("letterpix", "rubriek", elementen[1]);
	document.forms["letterpix"].submit();
}

function getItemwaarde(formulier, element) {
    return document.forms[formulier].elements[element];
}

function naarTaal(taal) {
    setHidden("letterpix", "taal", ((taal * 1) + 100000));
    document.forms["letterpix"].submit();
}

function prepareerSubmit(formulier, element, waarde) {
	setHidden(formulier, element, waarde);
	elms = document.forms[formulier].elements;
	for (i = 0; i < elms.length; i++) {
		if ((elms[i].type == "select-one") || (elms[i].type == "select-multiple")) {
			len = elms[i].name.length;
			if ((len > 7) && (elms[i].name.substring(0,7) == "dlijst-") && (elms[i].name.substring(len - 4, len) != "_nee")) {
				for (j = 0; j < elms[i].options.length; j++) elms[i].options[j].selected = true;
			} 
		}
	}
} 

function resizeBrowser() {
	if (resized = "false") {
	 	if ((navigator.platform != "MacPPC") || (navigator.appName != "Microsoft Internet Explorer")) {
			h = Math.min(768, screen.availHeight);
			w = Math.min(1024, screen.availWidth);
			x = Math.floor((screen.availWidth - w) / 2);
			y = Math.floor((screen.availHeight - h) / 2);
			window.moveTo(x,y);
			window.resizeTo(w,h);
		}
		resized = "true";
	}
}

function setForward(formulier, waarde) {
	document.forms[formulier].elements["forward"].value = waarde;
}

function setHidden(formulier, element, waarde) {
	document.forms[formulier].elements[element].value = waarde;
}

function verwijderUitSelectOptions(sopt, idx) {
	for (i = idx; i < sopt.length - 1; i++) {
		sopt[i] = new Option(sopt[i + 1].text, sopt[i + 1].value);
	}
	sopt[sopt.length - 1] = null;
}

function voegInInSelectOptions(sopt, tekst, waarde) {
	sopt[sopt.length] = new Option("dummy","dummy");
	idx = sopt.length - 2;
	while ((idx >= 0) && (sopt[idx].text > tekst)) {
		sopt[idx + 1] = new Option(sopt[idx].text, sopt[idx].value);
		idx--;
	}
	sopt[idx + 1] = new Option(tekst, waarde);
}

function website(url){
	window.open(url,"extra","menubar=no,scrollbars=yes,resizable=yes,status=no,width=780,height=540");
}

function pdfvenster(url){
	window.open(url,"LetterKunst","menubar=no,scrollbars=yes,location=no,toolbar=no,status=no,resizable=yes,width=780,height=540");
}

function getSet(reeksnaam, interval, intervallengte) {
	lijst.runInterval(reeksnaam, interval, intervallengte);
}


