// fix the extra click in IE on activex elements
function fixextraclick() {
	var theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}

}
function ws(t) {
	window.status = t;
}
//rescale movie by width and height
function rescale(movid,w,h) {
	if (w> 0 && h > 0) {
		var obmov = document.getElementById(movid)
		if (typeof(obmov) != 'undefined' && obmov != null) {
			obmov.width = w
			obmov.height = h
		}
		obmov =	document.getElementById("emb"+ movid)
		if (typeof(obmov) != 'undefined' && obmov != null) {
			obmov.width = w
			obmov.height = h
		}
	}
}

function openad(url) {
	window.open(url)
}

function movieDimensions (movieOb) {
	var res = ' width="' + (movieOb.initialWidth + 8) + '" '
	res += 'height="' + (movieOb.initialHeight+ 25 + movieOb.directAdFooterImageHeight ) + '" '
	
	return res
}


function createMovieURL (movieOb,site)
{
	var res = 'http://movies.flabber.nl/dplayer2.swf'
	res += '?movieXmlURL='+ escape(site + movieOb.id + ".xml") 
	res += '&initwidth='+ escape(movieOb.initialWidth) 
	res += '&initheight='+ escape(movieOb.initialHeight) 
	res += '&adFooterWidth='+ escape(movieOb.directAdFooterImageWidth) 
	res += '&adFooterHeight='+ escape(movieOb.directAdFooterImageHeight) 
	return res;
}


function inlinemovie2(movieOb, b) {
	
	var res =  '<' + 'object id="' + movieOb.id +'" ' + "\n";

	res += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' 
	res += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" '
	res += movieDimensions(movieOb)
	res += 'align="middle">'+ "\n"
	res += '<' + 'param name="allowScriptAccess" value="sameDomain" />'+ "\n"
	res += '<' + 'param name="allowFullScreen" value="true" />'+ "\n"
	res += '<' + 'param name="movie" value="' 
	res += createMovieURL(movieOb,movieOb.urlprefix)
	res += '" />'+ "\n"
	res += '<' + 'param name="loop" value="false" />'+ "\n"
	res += '<' + 'param name="menu" value="false" />'+ "\n"
	res += '<' + 'param name="quality" value="high" />'+ "\n"
	res += '<' + 'param name="scale" value="noscale" />'+ "\n"
	res += '<' + 'param name="salign" value="lt" />'+ "\n"
	res += '<' + 'param name="bgcolor" value="#ffffff" />'+ "\n"
	res += '<' + 'embed id="emb' + movieOb.id + '" src="' 
	res += createMovieURL(movieOb,movieOb.urlprefix)
	res += '" loop="false" '+ "\n"
	res += 'menu="false" quality="high" scale="noscale" '+ "\n"
	res += 'salign="lt" bgcolor="#ffffff" '+ "\n"
	res += movieDimensions(movieOb)
	res += 'swLiveConnect=false '+ "\n"
	res += 'align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" '+ "\n"
	res += 'pluginspage="http://www.macromedia.com/go/getflashplayer" />'+ "\n"
	res += '<' + '/object>'+ "\n"

	if (b)
		res += '<br>html code om te delen:<br><textarea rows=5 cols=40>' + res + '</textarea>'
	return res;
}

function showpop (title, movieOb) {
	var w = window.open("","pop","width=" + (movieOb.initialWidth + 8) + ",height=" + (movieOb.initialHeight + 49))
	if (typeof(w) != "undefined" && w != null) {
		w.document.write ('<' + 'HTML' + '><'+ 'head' + '><' + 'title' + '>' + title + '<' + '/title' + '><' + '/head'+ '>' + "\n");
		w.document.write ('<' + 'script'+ '>' + 'function rescale(movieOb.id,w,h) {'+ "\n")
		w.document.write ('	obmov =	document.getElementById(movieOb.id)'+ "\n")
		w.document.write ('     if (typeof(obmov) != "undefined" && obmov != null) {'+ "\n")
		w.document.write ('	obmov.width= w '+ "\n")
		w.document.write ('	obmov.height= h'+ "\n")
		w.document.write ('	}')
		w.document.write ('	obmov =	document.getElementById("emb" + movieOb.id)'+ "\n")
		w.document.write ('     if (typeof(obmov) != "undefined" && obmov != null) {'+ "\n")
		w.document.write ('	obmov.width= w '+ "\n")
		w.document.write ('	obmov.height= h'+ "\n")
		w.document.write ('	}')
		w.document.write ('	window.resizeBy (w - document.body.clientWidth ,(h + 20) - document.body.clientHeight)'+ "\n")

		w.document.write ('}<'+ '/script' + '>'+ "\n")

		w.document.write ('<' + 'BODY style="margin:0">'+ "\n")
		w.document.write (inlinemovie2(movieOb, false))
		w.document.write ("</body></html>")
	}
	else {
		alert ('Disable popup blocker')
	}
}
