
function change (id,state){
		//document.images[id].src='img/'+id+'_'+state+'.png';
		if(document.getElementById(id)){
			document.getElementById(id).style.backgroundColor=state;	
		} else {
			//document.test.debug.value=id+" is not an object";
		}
}

function makeEmail(addr1,addr2){
		linktext=addr1+'@'+addr2;
		document.write("<a href=" + "mail" + "to:" + linktext + ">" + linktext + "</a>");
}


function swapimg_old(id,max){
		max++;
		popo=1;
		while(popo<max){
			if(document.images['x'+popo]){
				document.images['x'+popo].src='img/banner'+popo+'_black.png';
			}
			popo++;
		}
		if(document.images['x'+id]){
			document.images['x'+id].src='img/banner'+id+'_red.png';
		}
}

function swapimg(id){
	var i=0;
	while(i<3){
		change('sidebanner'+i,'black');
		i++;
	}
	if(id>2){ 
		alert('groter dan 2 called');
	} else {
		change('sidebanner'+id,'red');
	}
	//document.test.debug.value=id;
}


forthscroll=0;
backscroll=0;

    function goforth(){
    	if(forthscroll==0){
	        $("#container").scrollTo({top:'0px',left:'+=1024px'},1000);
	        forthscroll=1;
    	    setTimeout("timeIt('forth0')",1200);
    	}
    }

    function goback(){
    	if(forthscroll==0){
	        $("#container").scrollTo('-=1024px',1000);
	        forthscroll=1;
    	    setTimeout("timeIt('forth0')",1200);
    	}
    }

	function timeIt(valu){
		//alert(valu);
		if(valu=="forth0"){
			forthscroll=0;
		}
	}

   function returno(){
        $("#container").scrollTo(0,1000);
    }

	function jumppage(cur,nr){
		curx=cur * 1024;
		tox=nr * 1024;
		diff=tox-curx;
       	if(diff>0){
       		diff="+="+diff;
       	} else {
       		diff="-="+(diff*-1);
       	}
        $("#container").scrollTo(diff,1000);	
	}

var tellerding=-1;

function fadeit(tellerding){
	document.getElementById('frame1').style.display='block';
	$("#frame1").fadeOut(1000,showframe1());
	document.getElementById('frame1').style.display='block';
}

function showframe1(){
	document.getElementById('frame1').style.display='block';
}

function flip(){
	//alert(tellerding);
	document.getElementById('frame1').style.display='block';
	tellerding++;
	if(tellerding==3){	tellerding=0;	}
	document.getElementById('frame1').innerHTML=bannerlarge[tellerding];
	document.getElementById('frame1').style.display='block';
	
	j=tellerding+1;
	if(j==3){	j=0;	}
	document.getElementById('frame2').innerHTML=bannerlarge[j];

	//document.test.vali.value=i;
	//document.test.valj.value=j;
	//document.test.debug2.value=tellerding;

	swapimg(j);
	fadeit();
}

function initheight(){
}

function OLD_initheight(){
	cheight=$("#container2").height();
	tochange="container2";
	if(cheight==null){
		cheight=480;
		tochange="container";
	}
	
	minus=318 + cheight;	
	x=$(window).height()-minus;
	y=x+cheight;

	if(x>0){
		$('#'+tochange).animate({	height: y	 }, 1, function() { });	
	}
	
}

$(window).resize(function() {
	//initheight();
});


$(document).ready(function() {	
	if(holdanimation=='yes'){ } else {
		setInterval("flip()",10000);
	}
	initheight();
	$('#container').jScrollTouch();
	
	goUitleg();
	
});

function goUitleg(){
	if($('#uitleg').length != 0){
		$('#navigatieholder').css("display","none");
		if(lan==1){
			$('#uitleg').html("<b>Klik hier voor de volgende pagina</b>");
		} else { 
			$('#uitleg').html("<b>Click here for the next page</b>");
		} 
		uitlegtimer = setTimeout("fadeUitleg()",2000);
	}
}

function fadeUitleg(){
	$('#uitleg').fadeOut('fast',function(){
		$('#navigatieholder').fadeIn();
	});
}
