// JavaScript Document
function flash(swf, w, h, opaque)
{
	if ( opaque == "none" )
	{
		wmode = "";
	}
	else if ( opaque )
	{
		wmode = "opaque";
	}
	else
	{
		wmode = "transparent";
	}
	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="allowScriptAccess" value="always"><param name="wmode" value="'+wmode+'"><param name="movie" value="'+swf+'"><embed src="'+swf+'" wmode="'+wmode+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>');
}

/*function flash(swf, w, h, opaque)
{
	if ( opaque )
	{
		wmode = "opaque";
	}
	else
	{
		wmode = "transparent";
	}
	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="allowScriptAccess" value="always"><param name="wmode" value="'+wmode+'"><param name="movie" value="'+swf+'"><embed src="'+swf+'" wmode="'+wmode+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>');
}*/

// Popup webshop

function shopOpenPopup(id, imageWidth, imageHeight) {
	var width = 640;
	var height = 640;
	var top = (screen.height-height)/2;
	var left = (screen.width-width)/2;
	//alert(width)
	if(top < 0) top=0;
	if(left < 0) left=0;
	var vWinCal = window.open("shopPopupFoto.php?contentid="+id+"&imageHeight="+imageHeight+"&imageWidth="+imageWidth, "imgPopup", "width="+imageWidth+",height="+imageHeight+",status=no,resizable=no,top="+top+",left="+left);
}

//gastenboek
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit){
		field.value = field.value.substring(0, maxlimit);
	}else{
		countfield.value = maxlimit - field.value.length;
	}
}

//chat

function CreateChatControl(DivID)
{
  var d = document.getElementById(DivID);
  d.innerHTML = ''+
				'<applet code="MSChat" archive="http://www.borsato.nl/~rgroesb/mschat/mschat.jar" name="Chat" width="570" height="325">'+
				'		<param name="codebase" value="http://www.borsato.nl/~rgroesb/mschat">'+
				'		<param name="cabbase" value="http://www.borsato.nl/~rgroesb/mschat/mschat.cab">'+
				'		<param name="port" value="6667">'+
				'		<param name="toolbar" value="true">'+
				'		<param name="autodisconnect" value="true">'+
				'		<param name="motd" value="true">'+
				'		<param name="room" value="borsato">'+
				'		<param name="stats" value="false">'+
				'		<param name="bgcolor" value="C0C0C0">'+
				'</applet>';
}

// Copyright melding

var message="© Copyright Marco Borsato";

function clickIE() {if (document.all) {
	alert(message);return false;
}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {
	alert(message);return false;
}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmousedown=clickNS;document.oncontextmenu=clickIE;}

// show or hide a div layer

function toggle(layer,kind,task) {
    
    if (kind=="visibility"){
        if (task=="hide")
            vis_to = "hidden";
        else if (task=="show")
            vis_to = "visible";
        else {
            
            if (document.layers)
                vis_to = (document.layers[layer].visibility=="hide") ? "show" : "hide";
                
            else if (document.all)
                vis_to = (document.all[layer].style.visibility=="hidden") ? "visible" : "hidden";
                
            else if (document.getElementById)
                vis_to = (document.getElementById(layer).style.visibility=="hidden") ? "visible" : "hidden";
        }
    } else if (kind=="display"){
        if (task=="hide")
            dis_to = "none";
        else if (task=="show")
            dis_to = "block";
        else {
            if (document.layers)
                dis_to = (document.layers[layer].display=="none") ? "block" : "none";
                
            else if (document.all)
                dis_to = (document.all[layer].style.display=="none") ? "block" : "none";
                
            else if (document.getElementById)
                dis_to = (document.getElementById(layer).style.display=="none") ? "block" : "none";
        }
    }
    
    if (document.layers)
        (kind=="display") ? document.layers[layer].display = dis_to : document.layers[layer].visibility = vis_to;
        
    else if (document.all)
        (kind=="display") ? document.all[layer].style.display = dis_to : document.all[layer].style.visibility = vis_to;
        
    else if (document.getElementById)
        (kind=="display") ? document.getElementById(layer).style.display = dis_to : document.getElementById(layer).style.visibility = vis_to;
}

//Swap Image

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//

function setStyleOver(x) {
	document.getElementById(x).style.background="url(img/homepagina/leesverderOnMouseOver.gif) no-repeat left bottom;";
	//document.getElementById(x).style.backgroundPosition="left bottom;";
}

function setStyleOut(x) {
	document.getElementById(x).style.background="url(img/homepagina/leesverderOnMouseOut.gif) no-repeat left bottom;";
	//document.getElementById(x).style.backgroundPosition="left bottom;";
}

//Pop up voor prikbord

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

Event.observe(window, 'load', function()
{
	
	if ($("iframe")) /*&& $('fotofilmflashBackground').innerHTML != "")*/
	{
		$("iframe").style.display = "block";
	}
	
	
	if ( $('fotofilmLinks') && $('fotofilmLinks').offsetWidth > 150 )
	{
		$('fotofilmArrowLeft').style.visibility = 'visible';
		$('fotofilmArrowRight').style.visibility = 'visible';
	}
});

function showHomeContent()
{
	$('contentHomeWrapper').style.visibility = 'visible';
}
//array met filmpjes voor niews pagina
var movies = new Array(
						"MB2008_Welkom.flv"
					);

function showMovie()
{
	/**
	 * Deze functie is niet nodig op het moment 
	//random nummer verhoog deze als je array langer word
	nr = get_random(1);
	//alert(movies[nr]);
	if ( movies[nr] )
	{
		var so = new SWFObject("flash/MB2008_Welkom.swf?flv=" + movies[nr], "sotester", "500", "576", "8", "#000000");
		so.addParam("wmode","transparent"); 
		so.addParam("z-index", 20);
	    so.write("homeFLV");
	}*/
}

function closeFlash()
{
	if ( $('homeFLV') )
	{
		$('homeFLV').style.display = "none";
	}
}

function get_random(num)
{
    var ranNum= Math.floor(Math.random()*num);
    return ranNum;
}

