// if(document.getElementById){alert("wel id");};
var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);
function getRef(id)
{
 if (isDOM) return document.getElementById(id);
 if (isIE4) return document.all[id];
 if (isNS4) return document.layers[id];
}
function getSty(id){
 // return (isNS4 ? getRef(id) : getRef(id).style);
// if(isNS4) {return getRef(id);}else{return  getRef(id).style;}

 return document.getElementById(id).style;
}


function movieObj(){	
	
	this.width = "320";
	this.height = "240";
	
	this.size = 'small';
	
	
	this.formSize = 'big';

	this.selectedForm = '';
	
	this.hidSpos =  Array(580,50);
	this.hidBpos =  Array(580,80);
	
	this.formVisibSmallXpos = 203;
	this.formVisibSmallYpos =32;
	this.formHidSmallXpos =580;
	this.formHidSmallYpos =  32; 
	
	
this.getTimeOf = getlengthOf;
this.counter = countTime;


// video methode
this.changebig = changeBig;
this.changesize =changeSize;
this.replaceelement = replaceElement;

// forms methode
this.formhidplace =formHidPlace;
this.formvisibleplace = formVisiblePlace;
this.sendforwardform = sendForwardForm;
this.embeddedform = embeddedForm;
this.moveelement = moveElement;
this.formchangesize = formChangeSize;

this.playit = PlayIt;
this.stopit = StopIt;
this.showbillboard= showBillboard;
this.showfragment = showFragment;
}


 var showBillboardIs = "";
var lastActiveMenu = "empty";


function showBillboard(act){
	videoObj.stopit();
	var anObj=document.movie1;

	if(act == 'hide'){
	
		setTimeout(function(){getSty('naarDeBalie').left = 500 +"px";anObj.width = 426; anObj.height = 336;},200);	// anObj.SetRectangle('0,0,450,338');
		videoObj.playit();
		}
		
	if(act == 'show'){
	
	setTimeout(function(){anObj.width = 190;anObj.height = 336;getSty('naarDeBalie').left = 204 +"px";},200);	// anObj.SetRectangle('0,0,220,354')}
	
	}
	showBillboardIs = act;
	
//	getRef('ing').innerHTML= "titelStatus = " +titelStatus + "  showBillboardIs = " + showBillboardIs + "  lastActiveMenu =" + lastActiveMenu ;

}	


function changeSize(size){
if(size == 's'){ this.changesmall()}else{ this.changebig()}; 
if(size == 'b'){ this.changebig()}

} 
var cont = 256;
function	changecontroller(){
			var anObj=document.movie1;
if (cont == 256 ){anObj.height = 240;}else{anObj.height = 256;}
 cont = anObj.height;
}


function	changeBig(){

			this.formSize = 'small';
			var anObj=document.movie1;			
			this.stopit();
		
			//  change the place and size of the FORMS when the video become big
			this.formchangesize();
			this.replaceelement();
		//		getSty('player').top = 35+'px';
		//		getSty('player').left = 2+'px';
				getSty('player').width = 426+'px';
				getSty('player').height = 336+'px';
				anObj.width =426; 
				anObj.height = 336;

				this.size = 'big'; 
				this.playit();		
	
		//		setTimeout(function(){anObj.SetRectangle('0,0,450,338')},100);	
}

function getlengthOf(){			//		change the timestamp to 00:00:00 Movtij
	var Ob=document.movie1;
	var Movtijd=Ob.GetDuration() 
		var	Sec =Math.floor(Movtijd/600);
		if (Sec >= 3600){
			h= Math.floor(Sec/3600);
			if (h<=9){h = "0"+h;}
		}else
			{ h= "00";}
		var Sec_h = Sec-(h*3600);
		var	minn= Math.floor(Sec_h/60);
		Sec = Sec - ((h*3600)+(minn*60));
		if (Sec <= 9){Sec ="0"+Sec;};

		 minn=((minn < 1) ? "00" : Math.floor(minn));
		if (minn <= 9){minn ="0"+minn;};
//		var tijd="["+h+":"+minn+":"+Sec+"]";
		var tijd=" "+h+":"+minn+":"+Sec+" ";
		document.getElementById('uren').innerHTML =tijd;
		// return tijd;
}


function gettijdOf(){ 
		Ob=document.movie1;
		var tijd=document.movie1.GetDuration();
		 document.getElementById("uren").innerHTML=tijd;
		 alert(tijd);
}

function countTime(){			//		change the timestamp to 00:00:00 ....  runTime	

		var Ob=document.movie1;
		var	Movtijd=Ob.GetTime(); 
		var	Sec=Math.floor(Movtijd/600);
		var	minn= Math.floor(Sec/60);
		var	h= " " + "00:";
		
		if(minn >= 60 && minn <= 119) {h = " 01:";
									minn = Math.floor(minn - 60);
									Sec = Sec - 3600;
									}
		if(minn >= 120 && minn <= 179) {h = " 02:";
									minn = Math.floor(minn - 120);
									Sec = Sec - 7200;
									}
		if(minn >= 180 && minn <= 239) {h = " 03:";
									minn = Math.floor(minn - 180);
									Sec = Sec - 10800;
									}
		if(minn < 10 && minn > 0) {minn= "0"+ Math.floor(minn)};
		var	Sec=Sec-(minn*60)
			Sec=((Sec < 10) ? ":0" : ":")+Sec ;	
minn=((minn < 1) ? "00" :minn);	
		var	runtime= " " + h + minn+Sec;
		var aa = 
		document.getElementById('boordcounter').innerHTML =runtime;
		passToOther(Movtijd); //	it use for interaction between the video slider and anchor links 
		clock = setTimeout('countTime()',1000);
}
function settijdTo(star){
		var Ob=document.movie1;
	//	videoObj.stopit();
	//a =eval(star);  alert("strat time = "+a+" en eind time = "+eind);
		Ob.SetTime(star); 
//		videoObj.playit();
}


// -----------      -------------
var titelStatus = "show";
var auShowTite;
var showtitelfirst;
var v_interval= 3000;


function titelSlideShow(stat){
		if(stat == "show"){moveElement('movie_titel', 7, 1, 90);}
			else{moveElement('movie_titel', 7, -40, 100);}
		titelStatus = stat;
}

function autoShowTitel(){
		if(titelStatus == "show"){	titelSlideShow("hide");clearTimeout(auShowTite);  v_interval= 20000;} 
		else{ 
				titelSlideShow("show"); clearTimeout(auShowTite);  v_interval= 5000;}	
	
	auShowTite = setTimeout(function(){autoShowTitel()},v_interval);
}


function goToBalie(){ // with this you go to the balie player to watch de video
var url = 'http://www.debalie.nl/player/playmovie_v2.jsp?';
var movieid = 'movieid='+gup('movieid');
if(currentAnker != null){var videofragmentsid = "&videofragmentsid="+ currentAnker}else{var videofragmentsid =''};

// alert( url+movieid+videofragmentsid );

  window.parent.location.href= url+movieid+videofragmentsid;
}

var titeShort = "";
var descriptionShort = "";

function titelLength(){ // 

//	var bb = i.toString();
			var titelLang = getRef('eventtitel').innerHTML ;

			var description = getRef('pro_description').innerHTML ;
				
				var titelLangLength = titelLang.length; 
				var descriptionLength = description.length; 
 if( descriptionLength >= 145){descriptionShort =description.substr(0,146) + "...";}else{descriptionShort = description};
			
			if( titelLangLength >= 45){titelLang =titelLang.substr(0,40) + "...";};
			if( titelLangLength >= 32){getRef('eventtitel').className = "heading3redBo";getRef('eventdatum').className = "dattttum";}else{getRef('eventtitel').className = "heading2redBo";};
//					document.getElementById('eventtitel').innerHTML= titeShort;
  					document.getElementById('pro_description').innerHTML= descriptionShort;
//	alert (titelLang + "  hoeveel leters =  " + titelLangLength +"  titeShort =  " + titeShort );

 if(!ankers[0]){getRef('sprekers').innerHTML = "<div align='center' class='tekstg' <br><br><br><br> Deze video moet<br> nog geedit worden.</div>"};

}



function inIt(){
	checkSize();

	videoObj = new movieObj();
	whichOne();			//	make 3 array for. in, out and length, if ankers array exist.
 	writeAnkers();		//	write the fragments as a list in "list_Deelnemers"
 	eventHandler();		//	connect al links and ... to de fragments
	_formForwardButtons();
	_formEmbedButtons();
//	M_changeVisible('alleMovies');
 	setTimeout(function(){runMovie()},1400); 


//	var x = window.screenX = 1 ;
//	var y = window.screenY = 1;
}

function PlayIt(){var anObj=document.movie1;anObj.Play();}

function StopIt() {var anObj=document.movie1;anObj.Stop();}

function close_window() {window.close();}



