<!--

function makeArray() {
     for (i = 0; i<makeArray.arguments.length; i++)
          this[i + 1] = makeArray.arguments[i];
}

	
function showdate(){
var months = new makeArray('Jan','Feb','Mar',
    'Apr','May','Jun','July','Aug','Sep',
    'Oct','Nov','Dec');
var date = new Date();

var d  = date.getDate();
var day = (d < 10) ? '0' + d : d;
var month = date.getMonth() + 1;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
document.write(month + " " + day + " " + year);
}
 
//open new browser window
function openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) {
if(window.screen)if(isCenter)if(isCenter=="true"){
var myLeft = (screen.width-myWidth)/2;
var myTop = (screen.height-myHeight)/2;
features+=(features!='')?',':'';
features+=',left='+myLeft+',top='+myTop;
}
window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}


//Function to check contact form is filled in correctly before submitting
function CheckForm () {
	//Intialise variables
	var errorMsg = "";
	var errorMsgLong = "";
	//Check for a name
	if (document.contact.naam.value == ""){
		errorMsg += "\n- Please fill in your name";
	}
	//Check for comments
	if (document.contact.vragen.value == ""){
		errorMsg += "\n- Please type a message";
	}
	//Check for comments
	if (document.contact.email.value == ""){
		errorMsg += "\n- Please fill in your email address";
	}
	//Check for HTML tags before submitting the form	
	//if (document.contact.email.value.indexOf("@", 0) >= 0) {
	//	errorMsglong += "\n- Controleer uw email adres";
	//	}
	
	//Check for HTML tags before submitting the form	
	for (var count = 0; count <= 6; ++count){
		if ((document.contact.elements[count].value.indexOf("<", 0) >= 0) && (document.contact.elements[count].value.indexOf(">", 0) >= 0)){
			errorMsgLong += "\n- HTML is not permitted, remove HTML tags.";
		}			
	}
	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "Your message has not been sent\n";
		msg += "Please correct the following:\n";
		msg += "_________________________________________\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	}
	
	return true;
}

//Function to count the number of characters in the description text box
function DescriptionCharCount() {
	document.contact.countcharacters.value = document.contact.comments.value.length;	
}



//Function to check search form is filled in correctly before submitting 
function CheckLogin () {
	//Intialise variables
	var errorMsg = "";
	var errorMsgLong = "";
	//Check for a name
	if (document.aanlogform.u.value == ""){
		errorMsg += "\n- Please fill in your username";
	}
	//Check for a name
	if (document.aanlogform.p.value == ""){
		errorMsg += "\n- Your password cannot be empty";
	}
	//Check for HTML tags before submitting the form	
	if ((document.aanlogform.u.value.indexOf("<", 0) >= 0) && (document.aanlogform.u.value.indexOf(">", 0) >= 0)){
		errorMsgLong += "\n- HTML is not permitted, remove HTML tags.";
	}			
	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "Sorry, attempt unsuccessful\n";
		msg += "Please correct the following:\n";
		msg += "_________________________________________\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	}
	return true;
}


//Function to check signup form is filled out correctly before submitting
function CheckSignup () {

	//Intialise variables
	var errorMsg = "";
	var errorMsgLong = "";

	//Check for a name
	if (document.signup.naam.value == ""){
		errorMsg += "\n- Please Choose your Username";
	}
	//Check for email
	if (document.signup.email.value == ""){
		errorMsg += "\n- Please fill in your Email address";
	}
	//Check for basic email validity
	if (document.signup.email.value != "" && document.signup.email.value.indexOf("@", 0) < 1 ){
		errorMsgLong += "\n- Incorrect Email address!";
	}
	//Check for pass1
	if (document.signup.pass1.value == ""){
		errorMsg += "\n- Please choose a password";
	}
	//Check for pass2
	if (document.signup.pass1.value != "" && document.signup.pass2.value == ""){
		errorMsg += "\n- Please confirm your password";
	}
	//Check for name length	
	if (document.signup.naam.value.length > 0 && document.signup.naam.value.length < 6){
		errorMsgLong += "\n- Username must be at least 6 characters long";
	}
	//Check for password length	
	if (document.signup.pass1.value.length > 0 && document.signup.pass1.value.length < 6){
		errorMsgLong += "\n- A password must be at least 6 characters long";
	}
	//Check if passwords match	
	if (document.signup.pass1.value != document.signup.pass2.value){
		errorMsgLong += "\n- The passwords do not match!";
	}
	//Check for HTML tags before submitting the form	
	for (var count = 0; count <= 3; ++count){
		if ((document.signup.elements[count].value.indexOf("<", 0) >= 0) && (document.signup.elements[count].value.indexOf(">", 0) >= 0)){
			errorMsgLong += "\n- HTML is not permitted, remove HTML tags.";
		}			
	}
	//Check for spaces in all form fields
	for (var count = 0; count <= 3; ++count){
		if (document.signup.elements[count].value.indexOf(" ", 0) >= 0){
			errorMsgLong += "\n- Fields cannot contain spaces!";
		}			
	}
	
	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "Your request has not been accepted\n";
		msg += "Please correct the following:\n";
		msg += "_________________________________________\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	}
	
	return true;
}

//Function to check form is filled in correctly before submitting
function CheckGbForm () {
	//Intialise variables
	var errorMsg = "";
	var errorMsgLong = "";
	//Check for a name
	if (document.frmSignGuestBook.name.value == ""){
		errorMsg += "\n- Please fill in your name";
	}
	//Check for comments
	if (document.frmSignGuestBook.comments.value == ""){
		errorMsg += "\n- Write a message";
	}
	//Check the description length before submiting the form	
	if (document.frmSignGuestBook.comments.value.length > 1000){
		errorMsgLong += "\n- Your message is " + document.frmSignGuestBook.comments.value.length + " characters too long";
	}
	//Check the word length before submitting
	words = document.frmSignGuestBook.comments.value.split(' ');
	for (var loop = 0; loop <= words.length - 1; ++loop){
		if (words[loop].length >= 50){
		errorMsgLong += "\n- A word " + words[loop] + " exceeds the 50 character maximum";
		}	
	}	
	//Check for HTML tags before submitting the form	
	for (var count = 0; count <= 5; ++count){
		if ((document.frmSignGuestBook.elements[count].value.indexOf("<", 0) >= 0) && (document.frmSignGuestBook.elements[count].value.indexOf(">", 0) >= 0)){
			errorMsgLong += "\n- HTML is not permitted, please remove the HTML code";
		}			
	}
	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "Your message has not yet been added\n";
		msg += "Correct the following problems and try again:\n";
		msg += "_________________________________________\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	}
	
	return true;
}

//Function to check signup form is filled out correctly before submitting
function CheckReForm () {

	//Intialise variables
	var errorMsg = "";
	var errorMsgLong = "";

	//Check for a name
	if (document.postit.name.value == ""){
		errorMsg += "\n- Please enter your name";
	}
	//Check for message
	if (document.postit.comments.value == ""){
		errorMsg += "\n- Please write a message";
	}
	//Check for HTML tags before submitting the form	
	for (var count = 0; count <= 3; ++count){
		if ((document.postit.elements[count].value.indexOf("<", 0) >= 0) && (document.postit.elements[count].value.indexOf(">", 0) >= 0)){
			errorMsgLong += "\n- HTML is not permitted, remove HTML tags.";
		}			
	}
	
	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "Your request has not been accepted\n";
		msg += "Please correct the following:\n";
		msg += "_________________________________________\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	}
	
	return true;
}


//Function to count the number of characters in the description text box
function DescriptionCharCount() {
	document.frmSignGuestBook.countcharacters.value = document.frmSignGuestBook.comments.value.length;	
}

//Function to add the code to the message for the smileys
function AddSmileyIcon(iconCode) {	
		document.frmSignGuestBook.comments.value += iconCode + " ";
		document.frmSignGuestBook.comments.focus();
}

//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}




// autofocus functie wordt hier geladen -->
    function placeFocus(z) {
      if (document.forms.length > 0) {
         var field = document.forms[0];
           for (i = 0; i < field.length; i++) {
             if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
                  document.forms[0].elements[z].focus();
               break;
         	 }
      	   }
   	 }
}

//Function to check SAMPLE form is filled in correctly before submitting
function CheckSampleForm () {

	//Intialise variables
	var errorMsg = "";

	//Check for a category
	if (document.tempform.Category.value == "Please Select...."){
		errorMsg += "\n- No Category selected";
	}
	
	//Check for subcategory
	//if (document.tempform.CB_1.value == ""){
	//	errorMsg += "\n- No Subcategory selected";
	//}
	//Check for mainmaterial
	if (document.tempform.MainMat.value == "Please Select...."){
		errorMsg += "\n- No Mainmaterial selected";
	}
	//Check for manufacturer
	if (document.tempform.Manufacturer.value == "Please Select...."){
		errorMsg += "\n- No Manufacturer selected";
	}
	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "There were problems with your submission:\n";
		msg += "_________________________________________\n";
		
		errorMsg += alert(msg + errorMsg + "\n");
		return false;
	}
	
	return true;
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { 
  db=window.open(theURL,winName,features);
  db.focus();
}

//Begin
function checkdate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
datefield.select();
alert("That date is invalid.  Please try again.");
datefield.focus();
return false;
}
else {
return true;
   }
}

function chkdate(objName) {
var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
strDate = datefield.value;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
}
else {
datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
}
return true;
}

function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}

//  End -->

function ShowCal(objName)
{
	var strReturn;
	var datefield = objName;
	strReturn=window.showModalDialog('frm_calendar.asp','SelectEndDate','status:false;dialogWidth=200px;dialogLeft:260;dialogTop:230;dialogHeight:155px;help:no;unadorned:yes;status:no;scroll:no;');
	if (strReturn != null) {
		document.NewSO[datefield].value=strReturn;
		}
}
//-->

function ShowProgress(PID)
{
  strAppVersion = navigator.appVersion;
  if (document.MyForm.FILE1.value != "" )
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "status:false;dialogWidth=370px;dialogLeft:260;dialogTop:220;dialogHeight:100px;help:no;unadorned:no;status:no;scroll:no";
      window.showModalDialog('bar.asp?PID=' + PID + '&b=IE',null,winstyle);
    }
    else
    {
      window.open('bar.asp?PID=' + PID + '&b=NN','','width=370,height=100', true);
    }
  //document.MyForm.SUBMIT.disabled=false;
  }
  return true;
}


function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

//countdown timer function
function CD_UD(s,id)
{CD_OBJS[id].innerHTML=s};
function CD_T(id,e)
{var n=new Date();var p=1E3-n.getMilliseconds();setTimeout("CD_T('"+id+"',"+e+")",p);CD_D(+n,id,e)};
function CD_D(n,id,e)
{var ms=e-n;if(ms<=0) ms*=-1;var d=Math.floor(ms/864E5);ms-=d*864E5;var h=Math.floor(ms/36E5);ms-=h*36E5;var m=Math.floor(ms/6E4);ms-=m*6E4;var s=Math.floor(ms/1E3);CD_UD(d+" day"+(d==1?" ":"s ")+CD_ZP(h)+"h "+CD_ZP(m)+"m "+CD_ZP(s)+"s",id)};
function CD_ZP(i)
{return(i<10?"0"+i:i)};
function CD_Init()
{var pref="countdown";var objH=1;if(document.getElementById||document.all){for(var i=1;objH;++i){var id=pref+i;objH=document.getElementById?document.getElementById(id):document.all[id];if(objH&&(typeof objH.innerHTML)!='undefined'){var s=objH.innerHTML;var dt=new Date(s);if(!isNaN(dt)){CD_OBJS[id]=objH;CD_T(id,dt.valueOf());if(objH.style){objH.style.visibility="visible"}}else {objH.innerHTML=s+"<a href=\"http://andrewu.co.uk/clj/countdown/\" title=\"Countdown Error:Invalid date format used,check documentation (see link)\">*</a>"}}}}};var CD_OBJS=new Object();if(window.attachEvent){window.attachEvent('onload',CD_Init)}else if(window.addEventListener){window.addEventListener("load",CD_Init,false)}else {window.onload=CD_Init};




window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  if (screen.width == '800'){
  	setActiveStyleSheet('Lightweight');
	}
  else{
  setActiveStyleSheet(title);
  }
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

