// in deze array worden de tekstblokken verzameld die ingekort moeten worden
var arrFitContent = new Array();

// in deze array komen alle div's die als inline scherm moeten gaan functioneren
var arrInfoPanes = new Array();

// dit is een standaard object om een tesktblok te bexschrijven
function tekstblok(strIdBlok,intMarge) {
	this.name = strIdBlok;
	this.intMarge = intMarge
}

function init()	{
	flashDetection();
	for(i=0;i<arrFitContent.length;i++){fitContent(arrFitContent[i].name,arrFitContent[i].intMarge);}
	for(i=0;i<arrInfoPanes.length;i++){initInfoPane(arrInfoPanes[i]);}
	if(typeof(hideTipsEnTripsAfterShortenTexts)=="function"){hideTipsEnTripsAfterShortenTexts()};
	if(typeof(startupPlattegrond)=="function"){startupPlattegrond()};
	if(typeof(startupLandkaart)=="function"){startupLandkaart()};
	if(typeof(setExtrasOnload)=="function"){setExtrasOnload()};
	if(typeof(cookiecheck)=="function"){cookiecheck()};
	if(typeof(checktrain)=="function"){checktrain()};
	if(typeof(checktrainback)=="function"){checktrainback()};
	
}

function flipdisplay(strobj) {
	for(i=0;i,i<arguments.length;i++){
		try {
			var objflip=document.getElementById(arguments[i]);
			var strDisplay
			if(document.defaultView){strDisplay = document.defaultView.getComputedStyle(objflip,null).getPropertyValue("display")}
			else (strDisplay = objflip.currentStyle.display)
			if (strDisplay == "none"){objflip.style.display="block";}
			else {objflip.style.display="none"};
		}
		catch(e){}
	}
	
	//
	var el = document.getElementById('IEkalenderFIX');	
	if(el) {
		if(el.className == 'show') {
			el.className = 'noshow';
		} else {
			el.className = 'show';
		}
	}
	
}

function setdisplayToNone(strobj) {
	for(i=0;i,i<arguments.length;i++){
		try {
			var objflip=document.getElementById(arguments[i]);
				objflip.style.display="none";
		}
		catch(e){}
	}
}

function setdisplayToBlock(strobj) {
	for(i=0;i,i<arguments.length;i++){
		try {
			var objflip=document.getElementById(arguments[i]);
				objflip.style.display="block";
		}
		catch(e){}
	}
}

function getEventY(e){if (eventY = e.pageY) {eventY = e.pageY} else {eventY = e.clientY + document.body.scrollTop} return eventY;}
function getEventX(e){if (eventY = e.pageX) {eventX = e.pageX} else {eventX = e.clientX + document.body.scrollLeft} return eventX;}


function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 
var bw = new verifyCompatibleBrowser();

function addEvent(obj, evType, strJscript){ 
	var strFuncName = randomString(12);
	eval("window.document."+strFuncName+" = function(e){"+strJscript+"}")
	if (document.body.addEventListener){
		eval("obj.addEventListener(evType,window.document."+strFuncName+",false)")
		}
	else{eval("obj.on"+evType+" = function(){"+strJscript+"}")}
	}
	
function randomString(argLength) {
    pool = new String("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
    var i = 0;
    var str = "";
    while (i <= argLength) {
        rand = parseFloat(Math.random()) * parseInt(pool.length);
        str += pool.charAt(rand);
        i++;
    }
    return str
}

function funcGetScreenInnerWidth(){
	if (window.innerWidth){return window.innerWidth;}
	else if (document.body.offsetWidth){return document.body.offsetWidth;}
	else {alert("unexpected error!! please report at support@tpm-webapplicaties.nl, thank you")}
	}

function funcGetScreenInnerHeight(){
	if (window.innerHeight){return window.innerHeight;}
	else if (document.body.offsetHeight){return document.body.offsetHeight;}
	else {alert("unexpected error!! please report at support@tpm-webapplicaties.nl, thank you")}
	}
	
	
	
	
// Major version of Flash required
var requiredMajorVersion = 6;
// Minor version of Flash required
var requiredMinorVersion = 7;
// Minor version of Flash required
var requiredRevision = 7;
// the version of javascript supported
var jsVersion = 1.0;
// Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		flashVer = -1;
	}
	return flashVer;
} 
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
{
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
   	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];
			
			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
     	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
}

function flashDetection(){
// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) {  // if we've detected an acceptable version
    //alert("correct Flash Version");
} else {  // flash is too old or we can't detect the plugin
    if(confirm("Deze site is gemaakt voor Flash 7 en hoger.\nWilt u de nieuwe versie van flash downloaden?")){window.location.href="http://www.macromedia.com/go/getflashplayer"}
  }
}