var whichlink=0
var whichimage=0

function slideit(){
blenddelay=(ie)? document.images.slide.filters[0].duration*1000 : 0
if (!document.images) return
if (ie) document.images.slide.filters[0].apply()
document.images.slide.src=imageholder[whichimage].src
if (ie) document.images.slide.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
setTimeout("slideit()",slidespeed+blenddelay)
}

var xmlhttp

function execFunction(url)
{
xmlhttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  }
else
  {
  alert("Your browser does not support XMLHTTP.")
  }
}

function state_Change()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
  if (xmlhttp.status==200)
  {
	if (xmlhttp.responseText=="LoggedOff")
	{
		document.getElementById('LoggedOn').style.display="none";
		document.getElementById('LogOn').style.display="inline";
	}
	else
	{
		document.getElementById('LoggedOn').style.display="inline";
		document.getElementById('AficionadoName').innerHTML=xmlhttp.responseText;
		document.getElementById('LogOn').style.display="none";
	}
  }
  else
  {
  alert("Problem retrieving data:" + xmlhttp.statusText)
  }
  }
}


function logoutAficionado() {
	execFunction("logoutAficionado.asp")
	deleteCookie();
}

var newwindow=0 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
if (newwindow)
window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
}


function StartMeUp (filename) {Player.URL = "mp3/"+filename+".mp3";}
function ShutMeDown () {Player.controls.stop();}
function newImage(arg) {if (document.images) {rslt = new Image(); rslt.src = arg; return rslt;}}
function changeImages() {if (document.images && (preloadFlag == true)) {for (var i=0; i<changeImages.arguments.length; i+=2) {imageStr = document[changeImages.arguments[i]].src.substr(document[changeImages.arguments[i]].src.length-8);document[changeImages.arguments[i]].src = changeImages.arguments[i+1];}}}
function preloadImages() {
if (document.images) 
{
	s = newImage("img/s.gif");
	preloadFlag = true;
}
}
function email(name, domain, suffix, text)
{
   var address = name + "\u0040" + domain + "." + suffix;
   var url = "mailto:" + address;

   if( ! text )
   {
      text = address;
   }

   document.write("<a href=\"" + url + "\">" + text + "</a>");
}
var preloadFlag = false;

function getWindowHeight() {var windowHeight=0;if (typeof(window.innerHeight)=='number') {windowHeight=window.innerHeight;}else {if (document.documentElement&&document.documentElement.clientHeight) {windowHeight=document.documentElement.clientHeight;}else {if (document.body&&document.body.clientHeight) {windowHeight=document.body.clientHeight;}}}return windowHeight;}
function resizeDiv() {
var minHeight = 200;
var correctionValue = 350;
wHeight = getWindowHeight();
newHeight = wHeight-correctionValue;
if (newHeight<=minHeight) newHeight = minHeight;
document.getElementById("content").style.height = newHeight;
document.getElementById("leftcol_bottom").style.height = newHeight;

if (document.getElementById("leftcol_bottom").style.height<document.getElementById("content").clientHeight)
{document.getElementById("leftcol_bottom").style.height = document.getElementById("content").clientHeight}
}


function swapMessage(id) {

if (document.getElementById("msgShort_"+id).style.display=="none")
{
	document.getElementById("msgComplete_"+id).style.display="none";
	document.getElementById("msgShort_"+id).style.display="block";
	document.getElementById("img_"+id).src="img/plus.gif";
}
else
{
	document.getElementById("msgComplete_"+id).style.display="block";
	document.getElementById("msgShort_"+id).style.display="none";
	document.getElementById("img_"+id).src="img/min.gif";
}

}


function checkMsgForm(tobject){

	var required = Array("email","name","message");
	var descr = Array("Email adres","Naam","Bericht");
	var errormsg = "Vul alsjeblieft de volgende velden in:\n";
	var l_Msg = errormsg.length;
	for (var i = 0; i < required.length; i++){
		var obj = tobject.elements[required[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					errormsg += " - " + descr[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					errormsg += " - " + descr[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value=="naam" || obj.value == "" || obj.value == null){
					errormsg += " - " + descr[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					errormsg += " - " + descr[i] + "\n";
				}
			}
		}
	}

	if (errormsg.length == l_Msg){
		return true; //checkemailMsgForm(tobject);
	}else{
		alert(errormsg);
		return false;
	}
}


var testresults
function checkemailMsgForm(tobject){
var str=tobject.email.value;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Vul alsjeblieft een geldig email adres in!\nJe email adres wordt niet bewaard of op de website geplaatst\nDeze wordt alleen gebruikt om eventueel rechtstreeks\neen reactie aan je te kunnen sturen.")
testresults=false
}
return (testresults)
}

function checkScreen() {
if (screen.width<810) {
document.getElementById("mainimage").style.width="65%";
document.getElementById("content").style.width="65%";

}
}
