//VIDEO PLAYER

function VideoPlayer(){
    this.target = "videoview";
    this.targetTab = "videotab";
    this.flvUrl ="";
    this.htmlContent ="";
}
// aangeroepen wanneer detailwindow geladen wordt:
   VideoPlayer.prototype.Init = function(flv_url) {
   document.getElementById(this.targetTab).style.display='block';
   this.flvUrl = flv_url;
   this.htmlContent="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"528\" height=\"380\" id=\"mediaPlayer\" align=\"middle\"><param name=FlashVars VALUE=\"mediaVar=" + this.flvUrl + "\"><param name=\"movie\" value=\"common/flash/mediaPlayer.swf\" /><param name=\"menu\" value=\"false\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"common/flash/mediaPlayer.swf\" FlashVars=\"mediaVar=" + this.flvUrl + "\" menu=\"false\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"528\" height=\"380\" name=\"mediaPlayer\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
}
// aangeroepen wanneer op een andere tab geklikt wordt:
VideoPlayer.prototype.Unload = function(){
    document.getElementById(this.target).innerHTML ="";
}
// aangeropen wanneer op de videotab geklikt wordt:
VideoPlayer.prototype.Load = function(){
    document.getElementById(this.target).innerHTML = this.htmlContent;
}


QualisVideoPlayer = new VideoPlayer();

//EINDE VIDEO PLAYER



function loadMedium(img,title,text){
	document.getElementById('imageview').innerHTML = "<img src=\""+img+"\" title=\""+title+"\"/><br/><div id='imageviewlabel'><b>"+title+"</b><br/>"+text+"<\/div>";
}

//IMAGE OBJECT
function ImageObject(imagebig, imagesmall, imagetitle, imagetext, imagemedium){
	this.imagebig = imagebig;
	this.imagesmall = imagesmall;
	this.imagetitle = imagetitle;
	this.imagetext = imagetext;
	this.imagemedium = imagemedium;
	}
	

//IMAGE OBJECT LIST
function ImageObjectList(){

	this.list =[];
	}
ImageObjectList.prototype.AddImageObject = function(imageObject) {
    this.list[this.list.length] = imageObject;
	}

ImageObjectList.prototype.LoadHtml = function(target) {
   
	for( var a = 0; a < this.list.length; a++ ) 
	{
		//this.list[a].getHtml();
	    //Vul de thumbs	
	    document.getElementById('detailwindowsidescroll').innerHTML += "<div onclick=\"loadMedium('"+this.list[a].imagemedium+"','"+this.list[a].imagetitle+"','"+this.list[a].imagetext+"')\" class=\"detailthumb\"><img src=\""+this.list[a].imagesmall+"\" title=\""+this.list[a].imagetitle+"\" /><\/div>";
	}
	//laad de eerste
	loadMedium(this.list[0].imagemedium,this.list[0].imagetitle,this.list[0].imagetext);
	}

//IMAGE OBJECT TO FLASH
function getImageObject() {
    //alert("getImageObject");
    //alert (thisMovie("flashShow"));
	thisMovie("flashShow").returnImageObject(QualisImageObjectList);
	
}

//SLIDESHOW OBJECT
function SlideShow(targ){
    this.target = targ;
    //alert(this.target);
}
SlideShow.prototype.Start = function() {

bigImagesArray = new Array();
bigImagesString ="";
slideShowSpeed = 4000; //milliseconds!

for( var a = 0; a < QualisImageObjectList.list.length; a++ ) {
    bigImagesArray.push(QualisImageObjectList.list[a].imagebig);
    }
    bigImagesString = bigImagesArray.join(",");

   //alert(this.target);
   divTarget = document.getElementById(this.target);
   divTarget.style.display = 'block';
   flashstring = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"100%\" height=\"100%\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"FlashVars\" value=\"slideShowSpeed="+slideShowSpeed+"&bigImages="+bigImagesString+"\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"movie\" value=\"common/flash/flashShowFullscreen.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"common/flash/flashShowFullscreen.swf\" FlashVars=\"bigImages="+bigImagesString+"&slideShowSpeed="+slideShowSpeed+"\" wmode=\"transparent\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100%\" height=\"100%\" id=\"flashShow\" name=\"flashShow\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
   divTarget.innerHTML = flashstring;

   document.getElementById("container").style.display ="none";
   document.getElementById("detailwindowcontainer").style.display ="none";
   document.getElementById("banner01").style.display="none";
   document.getElementById("banner02").style.display="none";
   document.getElementById("banner03").style.display="none";
   document.getElementById("mapnavwrap").style.display="none";

}

SlideShow.prototype.StartMakelaar = function(){

   bigImagesArray = new Array();
   bigImagesString ="";
   for( var a = 0; a < MakelaarImageObjectList.list.length; a++ ) {
        bigImagesArray.push(MakelaarImageObjectList.list[a].imagebig);
        }
    bigImagesString = bigImagesArray.join(",");

    //bigImagesString  ="Pictures/Objectbeelden/01514_01.jpg,Pictures/Objectbeelden/01514_02.jpg,Pictures/Objectbeelden/01514_03.jpg,Pictures/Objectbeelden/01514_04.jpg,";
    flashstring = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"100%\" height=\"100%\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"FlashVars\" value=\"bigImages="+bigImagesString+"\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"movie\" value=\"common/flash/flashShowMakelaar.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"common/flash/flashShowMakelaar.swf\" FlashVars=\"bigImages="+bigImagesString+"\" wmode=\"transparent\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100%\" height=\"100%\" id=\"flashShow\" name=\"flashShow\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
    document.getElementById(this.target).innerHTML=flashstring;
}
/*
SlideShow.prototype.Stop = function(){
  alert("stop! aangeroepen");
  divTarget = document.getElementById(this.target);
  //document.getElementById(this.target).innerHTML = ""; //dit crashed firefox
  divTarget.style.display = 'none';
 
}
*/
function stopSlideShow(){
//alert("stop slideshow");
//document.getElementById('flashslideshow').innerHTML ="";//dit crashed firefox
document.getElementById('flashslideshow').style.display = 'none';


document.getElementById("container").style.display ="block";
document.getElementById("detailwindowcontainer").style.display ="block";
document.getElementById('banner01').style.display="block";
document.getElementById('banner02').style.display="block";
document.getElementById('banner03').style.display="block";
document.getElementById('mapnavwrap').style.display="block";

}

SlideShowHouse = new SlideShow('flashslideshow');

//MakelaarImageObjectList = new ImageObjectList();
//MakelaarImageObjectList.AddImageObject(new ImageObject("Pictures/Objectbeelden/01514_01.jpg","","",""));
//MakelaarImageObjectList.AddImageObject(new ImageObject("Pictures/Objectbeelden/01514_02.jpg","","",""));
SlideShowMakelaar = new SlideShow('makelaarsflash');


// Function that points to a specific flash movie
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return document.getElementById("videoview").firstChild;
    } else {
        return document[movieName];    //other

    }
}

//javascript voor het switchen van views:
function showView(contentView, tabViewObj){
    //verberg thumbs:
    try{document.getElementById('detailwindowsidewrap').style.display = 'none';} catch(err){}

    //verberg content divs
    try{document.getElementById('startview').style.display = 'none';} catch(err){}
    try{document.getElementById('informationview').style.display =  'none';} catch(err){}
    try{document.getElementById('imageview').style.display = 'none';} catch(err){}
    try{document.getElementById('videoview').style.display = 'none';} catch(err){}
    try{document.getElementById('downloadsview').style.display = 'none';} catch(err){}
    try{document.getElementById('contactview').style.display = 'none';} catch(err){}
    try{document.getElementById('emailview').style.display = 'none';} catch(err){}
    try{document.getElementById('omgevingview').style.display = 'none';} catch(err){}

    //zet tabs op niet actief
    try{document.getElementById('informationtab').className='';} catch(err){}
    try{document.getElementById('imagetab').className='';} catch(err){}
    try{document.getElementById('videotab').className='';} catch(err){}
    try{document.getElementById('downloadstab').className='';} catch(err){}
    try{document.getElementById('contacttab').className='';} catch(err){}
    try{document.getElementById('omgevingtab').className='';} catch(err){}

    //zet het juiste content op zichtbaar:
    try{document.getElementById(contentView).style.display = 'block';} catch(err){}
    //zet de juiste tab op actief
    tabViewObj.className='active';

    //toon de thumbnails
    if(contentView == "imageview"){
    try{document.getElementById('detailwindowsidewrap').style.display = 'block';} catch(err){}
    }

}


/*positioneer detailwindow*/
function positionDetailWindow(dwidth, dheight, id){
    // id is: detailwindowwrap, of detailwindowrap(bij detailwindow makelaar)
    posElement = document.getElementById(id);
    
    topPos = (document.body.offsetHeight-dheight) / 2 + 44;
    if (topPos < 168+5){ topPos = 168+5; }
    leftPos = (document.body.offsetWidth - dwidth) / 2;
    if (leftPos < 5){ leftPos = 5; }
    
    posElement.style.top = topPos +'px';
    posElement.style.left =leftPos + 'px';
 
}


/*sluit het detailwindow*/
function closeDetailWindow(){
document.getElementById('detailwindowcontainer').style.display="none";
}

function closeDetailWindowMakelaars(){
document.getElementById('detailwindowcontainer2').style.display="none";
}

function closeDetailWindows(){
    try
      {
       document.getElementById('detailwindowcontainer').style.display="none";
      }
    catch(err)
      {
      }
    try
      {
       document.getElementById('detailwindowcontainer2').style.display="none";
      }
    catch(err)
      {
      }
}
