function ReturnList() {
	opacity('storybox',100, 0 ,10);
	setTimeout("opacity('main',10, 100 ,10)",100);
	setTimeout("opacity('mainpage',10, 100 ,10)",100);
	document.getElementById('storybox').style.display="none";

}

function getstory(id){ 
	
	xmlHttp2=GetXmlHttpObject2()
	if (xmlHttp2==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
       
	
	var url="story.php"
	url=url+"?id="+id;
	
	xmlHttp2.onreadystatechange=stateChanged2
	xmlHttp2.open("GET",url,true)
	xmlHttp2.send(null)
	}
	function stateChanged2() 
	{ 
		
		
	if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
	 {       
		 opacity('main',100, 10 ,30);
		 opacity('mainpage',100, 10 ,30);
		 document.getElementById('storybox').innerHTML=xmlHttp2.responseText;
		 document.getElementById('storybox').style.display="inline";
		 setTimeout("opacity('storybox',0, 100 ,100)",200);
		 
		// document.getElementById('storybox').style.display="inline";
	         
	 } 
	}function GetXmlHttpObject2()
	{
	var xmlHttp2=null;
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp2=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 //Internet Explorer
	 try
	  {
	  xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	 catch (e)
	  {
	  xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	 }
	return xmlHttp2;
	}
	
	
	


function checkForm(){
	var mesg='';
		if(document.forms['datum'].datum.value==''){
		mesg=mesg+'Geen datum gekozen\n';
		}
		if(document.forms['datum'].cat.value==''){
		mesg=mesg+'Geen categorie gekozen\n';
		}
		if(document.forms['datum'].aut.value=='' && document.forms['datum'].search.value==''){
		mesg=mesg+'Geen auteur gekozen\n';
		}
		if(!document.forms['datum'].aut.value=='' && !document.forms['datum'].search.value==''){
		mesg=mesg+'Er kan niet op twee auteurs worden gezocht\n';
		}
		
		if(mesg==''){
			GetResults();
		} else {
			alert(mesg);
		}
}

function GetResults()
	
	{ 
		
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	
	var url="getresults.php"
	url=url+"?datum="+document.forms['datum'].datum.value;
	url=url+"&cat="+document.forms['datum'].cat.value;
	url=url+"&aut="+document.forms['datum'].aut.value;
	url=url+"&search="+document.forms['datum'].search.value;
	
	
	
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
	function stateChanged() 
	{ 
		if (xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1)
	 { 
	 document.getElementById('loader').style.display="inline";
	 } 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById('loader').style.display="none";
	 //document.getElementById('printbutton').style.display="inline";
	 document.getElementById('content').innerHTML=xmlHttp.responseText;
	 } 
	}function GetXmlHttpObject()
	{
	var xmlHttp=null;
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 //Internet Explorer
	 try
	  {
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	 catch (e)
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	 }
	return xmlHttp;
	}
	
	function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
			
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
			
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec, value) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
		document.getElementById("v"+id).value= value;
	} else {
		opacity(id, 100, 0, millisec);
		document.getElementById("v"+id).value= 0;
	}
}


function HideOthers() {
	
	var aDivs = document.body.getElementsByTagName("IMG");
    for (var j=0;j<=aDivs.length;j++) {
                changeOpac(100, j);
	        }
     
}

		



        


function blendimage(divid, imageid, imagefile, millisec) {
	
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}






function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}

function RunFlashBanner()
{
   document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
document.write('<param name="wmode" value="transparent">          \n');
document.write('<param name="movie" value="fpbanner.swf" />  \n');
document.write('<param name="quality" value="high" />     \n');
document.write('<embed src="fpbanner.swf" quality="high" wmode="transparent" width="653" height="225" name="fpbanner" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
document.write('</object>\n');
}

function RunFlashSS()
{
   document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
document.write('<param name="wmode" value="transparent">          \n');
document.write('<param name="movie" value="slide.swf?clickTAG=http://www.autosposa.nl/index.php?pid=trouwauto" />  \n');
document.write('<param name="quality" value="high" />     \n');
document.write('<embed src="slide.swf" quality="high" wmode="transparent" width="260" height="170" name="slide" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
document.write('</object>\n');
}
