﻿CSStopExecution = false;
CSInit = new Array;
function CSScriptInit() {
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
	idxArray[i] = i;
CSAction2(CSInit, idxArray);
}
CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
function IsIE() { return CSAg.indexOf("MSIE") > 0;}
function CSIEStyl(s) { return document.all.tags("div")[s].style; }
function CSNSStyl(s) { return CSFindElement(s,0); }
function CSFindElement(n,ly) { if (CSBVers < 4) return document[n];
	var curDoc = ly ? ly.document : document; var elem = curDoc[n];
	if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
		elem = CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
	return elem;
}
function CSButtonReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return false; // follow link
	else return true; // follow link
}
CSIm = new Object();
function CSIShow(n,i) {
	if (document.images) {
		if (CSIm[n]) {
			var img = (!IsIE()) ? CSFindElement(n,0) : document[n];
			if (img && typeof(CSIm[n][i].src) != "undefined") {img.src = CSIm[n][i].src;}
			if(i != 0)
				self.status = CSIm[n][3];
			else
				self.status = " ";
			return true;
		}
	}
	return false;
}
function CSILoad(action) {
	im = action[1];
	if (document.images) {
		CSIm[im] = new Object();
		for (var i=2;i<5;i++) {
			if (action[i] != '') { CSIm[im][i-2] = new Image(); CSIm[im][i-2].src = action[i]; }
			else CSIm[im][i-2] = 0;
		}
		CSIm[im][3] = action[5];
	}
}
CSStopExecution = false;

function CSAction(array) { 
	return CSAction2(CSAct, array);
}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var actArray = fct[array[i]];
		var tempArray = new Array;
		for(var j=1;j<actArray.length;j++) {
			if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
				if(actArray[j][0] == "VAR") {
					tempArray[j] = CSStateArray[actArray[j][1]];
				}
				else {
					if(actArray[j][0] == "ACT") {
						tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
					}
				else
					tempArray[j] = actArray[j];
				}
			}
			else
				tempArray[j] = actArray[j];
		}			
		result = actArray[0](tempArray);
	}
	return result;
}
CSAct = new Object;

CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button',/*URL*/'media/knop1.jpg',/*URL*/'media/knop1licht.jpg',/*URL*/'media/knop1licht.jpg','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button2',/*URL*/'media/knop2.jpg',/*URL*/'media/knop2licht.jpg',/*URL*/'media/knop2licht.jpg','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button3',/*URL*/'media/knop3.jpg',/*URL*/'media/knop3licht.jpg',/*URL*/'media/knop3licht.jpg','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button4',/*URL*/'media/knop4.jpg',/*URL*/'media/knop4licht.jpg',/*URL*/'media/knop4licht.jpg','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button5',/*URL*/'media/knop5.jpg',/*URL*/'media/knop5licht.jpg',/*URL*/'media/knop5licht.jpg','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button6',/*URL*/'media/knophotel.jpg',/*URL*/'media/knophotellicht.jpg',/*URL*/'media/knophotellicht.jpg','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button7',/*URL*/'media/knoppub.jpg',/*URL*/'media/knoppublicht.jpg',/*URL*/'media/knoppublicht.jpg','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button8',/*URL*/'media/knopcol.jpg',/*URL*/'media/knopcollicht.jpg',/*URL*/'media/knopcollicht.jpg','');



var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		pre_inweving_3 = newImage('media/inweving-3.jpg');
		pre_inweving_home = newImage('media/inweving-home.jpg');
		pre_inweving = newImage('media/inweving.gif');
		pre_inweving_badstof = newImage('media/inweving-badstof.jpg');
		preloadFlag = true;
	}
}



function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


userAgent = window.navigator.userAgent;
browserVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
mustInitImg = true;
function initImgID() {var di = document.images; if (mustInitImg && di) { for (var i=0; i<di.length; i++) { if (!di[i].id) di[i].id=di[i].name; } mustInitImg = false;}}

function findElement(n,ly) {
	var d = document;
	if (browserVers < 4)		return d[n];
	if ((browserVers >= 6) && (d.getElementById)) {initImgID; return(d.getElementById(n))}; 
	var cd = ly ? ly.document : d;
	var elem = cd[n];
	if (!elem) {
		for (var i=0;i<cd.layers.length;i++) {
			elem = findElement(n,cd.layers[i]);
			if (elem) return elem;
		}
	}
	return elem;
}

function changeImagesArray(array) {
	if (preloadFlag == true) {
		var d = document; var img;
		for (i=0;i<array.length;i+=2) {
			img = null; var n = array[i];
			if (d.images) {
				if (d.layers) {img = findElement(n,0);}
				else {img = d.images[n];}
			}
			if (!img && d.getElementById) {img = d.getElementById(n);}
			if (!img && d.getElementsByName) {
				var elms = d.getElementsByName(n);
				if (elms) {
					for (j=0;j<elms.length;j++) {
						if (elms[j].src) {img = elms[j]; break;}
					}
				}
			}
			if (img) {img.src = array[i+1];}
		}
	}
}


function changeImages() {
	changeImagesArray(changeImages.arguments);
}

function checkForm(){

	if(document.mailer.Achternaam.value=="")	{ 
		alert ("Gelieve uw naam in te vullen!");
		document.mailer.Achternaam.focus();
		return false;
	}	
	
	if( document.mailer.Achternaam.value.length <2  )	{
		alert ("Uw naam moet meer dan 1 karakter bevatten!");
		document.mailer.Achternaam.focus();
		return false;
	}
	
	if(document.mailer.bedrijf.value=="")	{ 
		alert ("Gelieve uw bedrijsnaam in te geven!");
		document.mailer.bedrijf.focus();
		return false;
	}
	
	if(document.mailer.Activiteit.value=="")	{ 
		alert ("Gelieve uw activiteit in te geven!");
		document.mailer.Activiteit.focus();
		return false;
	}
	
	if( document.mailer.Activiteit.value.length <2  )	{
		alert ("Uw activiteit moet meer dan 1 karakter bevatten!");
		document.mailer.Activiteit.focus();
		return false;
	}
	
	if(document.mailer.Straatnaam.value=="")	{
		alert ("Gelieve uw straat in te vullen!");
		document.mailer.Straatnaam.focus();
		return false;
	}
	
	if(document.mailer.Postcode.value=="") {
		alert ("Gelieve uw postcode in te geven!");
		document.mailer.Postcode.focus();
		return false;
	}
	
	if(!document.mailer.Postcode.value.match(/^[0-9]{3,}$/)) { 
    	alert('Gelieve uw postcode in cijfers in te vullen!');
		document.mailer.Postcode.focus();
		return false;
	}		
	if(document.mailer.Woonplaats.value=="") {
		alert ("Gelieve uw woonplaats in te geven!");
		document.mailer.Woonplaats.focus();
		return false;
	}	
	if( document.mailer.Woonplaats.value.length <2  )	{
		alert ("Uw woonplaats moet meer dan 1 karakter bevatten!");
		document.mailer.Woonplaats.focus();
		return false;
	}
		if(document.mailer.Land.value=="") {
		alert ("Gelieve uw land in te geven!");
		document.mailer.Land.focus();
		return false;
	}

		if (document.mailer.bus.value=="")	{
		alert ("Gelieve uw e-mail adres in te vullen");
		document.mailer.bus.focus();
		return false
	}
	    if (!document.mailer.bus.value.match(/^[A-Za-z0-9_\.-]{1,}@([A-Za-z0-9_\.-]+){2,}\.([A-Za-z]{2,})$/)){
        alert ("Gelieve een correct email adres in te geven!");
        document.mailer.bus.focus();
        return false;	
	}
		if(document.mailer.Tel.value=="")	{
		alert ("Gelieve een telefoonnummer in te geven!");
		document.mailer.Tel.focus();
		return false;
	}
	
	if( document.mailer.Tel.value.length <6  )	{
		alert ("uw telefoonnr moet meer dan 6 karakters bevatten!");
		document.mailer.Tel.focus();
		return false;
	}
	if(document.mailer.Publiciteit.checked == false && document.mailer.Hotellinnen.checked == false && document.mailer.CollectieInfo.checked == false && document.mailer.TKlinnen.checked == false ){
		alert("Gelieve een topic te selecteren, waarover U informatie wenst");
		document.mailer.Publiciteit.focus();
		return false;
	}
	
	return true;
}
	
	
	
function infomail(myInfo,myWidth,myHeight) {
infoWindow = window.open(myInfo,'MaesTextiles','height=' + myHeight + ',width=' + myWidth + 
',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
infoWindow.resizeTo(myWidth,myHeight);
infoWindow.focus();
}
