// Common Javascript functions
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function toggleDiv(what){
	var elem = document.getElementById(what);
	if(elem.style.display!='none'){
		elem.style.display='none';
	}else{
		elem.style.display='block';
	}
}
function deliciousLink(where){
	document.write("(<a style='font-size:11px' href='http://whatever.com/index.php?link=" + where + "'>really.really.go.od</a>)");
}
function popUpWin(what, w, h, m){
	// what: address of page to display
	// w: window's width
	// window's height
	// m: true=modal, false=non-modal
	var wwin = window.open(what, "LEARN", "width="+w+",height="+h);
}
function goSelect(what){
	var elem = what.options[what.selectedIndex].value;
	if (elem != ""){
            //top.document.location.href = elem;
            window.open(elem, "SCHOOL");
        }
}
function showMe(what){
	//var what2 = escape(what);
	var elem = document.getElementById('floatingDiv');
	var menuBar = "<div style='background-color: #369; color: #FFF'><a href='Javascript:hideElem(\"floatingDiv\")' style='float: right'>Fermer</a></div>";
	var innerText = '<embed width="460" height="340" flashvars="file=' + what +
	'" autoplay="false" allowfullscreen="true" bgcolor="#f0fafa"' +
	' src="/streaming/player_fs.swf?file=' + what + 
	'" style="display: block;">';
	elem.innerHTML = menuBar + innerText;
	elem.style.display = 'block';
}
function hideElem(which){
	document.getElementById(which).style.display = "none";
}
$(document).ready(function(){
	$("<div id='floatingDiv' style='background-color: rgb(240, 250, 250)'></div>").prependTo("body");
	$("#floatingDiv").dialog({
		autoOpen: false,
		height: 300,
		modal: true
	});
	$(".opener").click(function() {
			var $this = $(this);
			var obj = $("#floatingDiv");
			var tmpSizes = $this.attr("size");
			var arrSizes = tmpSizes.split(",");
			var what = $this.attr("href");
			var innerText = '<embed width="460" height="340" flashvars="file=' + what +
			'" autoplay="false" allowfullscreen="true" bgcolor="#f0fafa"' +
			' src="/streaming/player_fs.swf?file=' + what + 
			'" style="display: block;">';
			obj.dialog("option", "width", arrSizes[0]);
			obj.dialog("option", "height", arrSizes[1]);
			obj.dialog("open");
			obj.html(innerText);
			return false;
		});
});
