function setVideoSize(wat) {
 switch(wat) {
  case "16:9":
// alert("ATEST:"+wat+":"+document.getElementById("blokvideo"));
	document.getElementById("blokvideo").style.height = "386px";
	document.getElementById("swfholder").style.height = "360px";
	break;
  case "4:3":
// alert("BTEST:"+wat+":"+document.getElementById("blokvideo"));
	document.getElementById("blokvideo").style.height = "506px";
	document.getElementById("swfholder").style.height = "480px";
	break;
  default:
// alert("CTEST:"+wat);
	alert("Onbekend:"+wat);
	return "FOUT";
 }
 return "ok";
}



function twitterBack(wat) {
 wat-=5;
 return twitterRequest(wat);
}
function twitterNext(wat) {
 wat+=5;
 return twitterRequest(wat);
}

function twitterRequest(wat) {
	var req = new Request.HTML({url:'ajax/tweets.php?nf='+wat, 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('twitholder').set('text', '');
			//Inject the new DOM elements into the results div.
			$('twitholder').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('twitholder').set('text', 'The request failed.');
		}
	});
	req.send();
	return false;
}
	

function getTrailer(wat) {
 return trailerRequest(wat);
}

function trailerRequest(wat) {
	var req = new Request.HTML({evalScripts:true, url:'ajax/trailers_v2.php?id='+wat, 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('swfholder').set('text', '');
			//Inject the new DOM elements into the results div.

			$('swfholder').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('swfholder').set('text', 'The request failed.');
		}
	});
	req.send();
	return false;
}


var curfilmid="";
var curstadid="";
var curtheaterid="";

function getFilm(filmid, bbsm) {
	curfilmid=filmid;
	var req = new Request.HTML({evalScripts:true, url:'ajax/belbios.php?filmid='+curfilmid+'&stadid='+curstadid+'&theaterid='+curtheaterid+'&sm='+bbsm, 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('belbiosselector').set('text', '');
			//Inject the new DOM elements into the results div.

			$('belbiosselector').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('belbiosselector').set('text', 'The request failed.');
		}
	});
	req.send();
}

function getStad(stadid, bbsm) {
	curstadid=stadid;
	var req = new Request.HTML({evalScripts:true, url:'ajax/belbios.php?filmid='+curfilmid+'&stadid='+curstadid+'&theaterid='+curtheaterid+'&sm='+bbsm, 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('belbiosselector').set('text', '');
			//Inject the new DOM elements into the results div.

			$('belbiosselector').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('belbiosselector').set('text', 'The request failed.');
		}
	});
	req.send();
}


function getTheater(theaterid, bbsm) {
	curtheaterid=theaterid;
	var req = new Request.HTML({evalScripts:true, url:'ajax/belbios.php?filmid='+curfilmid+'&stadid='+curstadid+'&theaterid='+curtheaterid+'&sm='+bbsm, 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('belbiosselector').set('text', '');
			//Inject the new DOM elements into the results div.

			$('belbiosselector').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('belbiosselector').set('text', 'The request failed.');
		}
	});
	req.send();
}

function showReserveer(wat) {
 if (document.getElementById("reserveerknop")) document.getElementById("reserveerknop").style.display = "block";
}














function pageBack(divid, page, wat) {
 wat-=5;
 return pageRequest(divid, page, wat);
}
function pageNext(divid, page, wat) {
 wat+=5;
 return pageRequest(divid, page, wat);
}

function pageRequest(divid, page, wat) {
	var req = new Request.HTML({evalScripts:true, url:'ajax/'+page+'?nf='+wat, 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$(divid).set('text', '');
			//Inject the new DOM elements into the results div.
			$(divid).adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$(divid).set('text', 'The request failed.');
		}
	});
	req.send();
//	scroll(0,0);
	return false;
}


function kaart(w, tid, datum, tijd, fid) {
 url = "belbiostransactie.php?movieID="+fid+"&cinemaID="+tid+"&performanceDate="+datum+"&performanceTime="+tijd+"&delivery=email,SMS";
 if (w=="R") {
  url+="&service=anonymousAndReservationConfirm";
  belbios_reserveer(url);
 }
 if (w=="K") {
  url+="&service=selling";
  belbios_koop(url);
 }
}


function reserveer() {
 var myScript = new Asset.javascript('http://ras.belbios.nl/b2b/belbios.js.php?username=afilm', {
    id: 'myScript', 
    onload: function(){

	var voldatum=document.getElementById("datumtijd").value;
	var datum=voldatum.substr(0, 10);
	var tijd=voldatum.substr(11, 5);
        kaart("R", curtheaterid, datum, tijd, curfilmid);
    },
    onerror: function(){
        alert('Er kan geen verbinding met de Belbios server tot stand worden gebracht. Probeer te reserveren via www.belbios.nl of bel met 0900-9363.'); 
    }
 });


}


function gaNaar(link){	
 if(link == 1)
	$('persretail').src = "http://oud.a-film.nl/theatrical_lm.php";
 if(link == 2)
	$('persretail').src = "http://oud.a-film.nl/sellthru_lm.php";
}


function trackURL(url) {
 if (pageTracker) {
  pageTracker._trackPageview(url); 
 }
}

