

var previous_menu = "";
var menu_timer;
function menu(name) {

	if (name != "") {
		clearTimeout(menu_timer);
		
		//open het menu, en sluit het vorige
		if (name != previous_menu) {
			try {
				$('children_'+previous_menu).style.display = 'none';
			} catch (E) {}
			$('children_'+name).style.display = '';
			previous_menu = name;
		}
	}
	else {
		if (previous_menu != "") {
			id = 'children_'+previous_menu;
			menu_timer = setTimeout("$('"+id+"').style.display = 'none'; previous_menu = ''",500);
		}
	}
}



function addoverlay() {
	// setup overlay actions to buttons
	$("a[rel]").overlay({
		
		// setup exposing (optional operation);
		onBeforeLoad: function() {	
			var boxje = this
			$(this.getTrigger().attr('rel')).expose({
				onClose: function() {
					boxje.close();
				}
			});	
		},				
		
		onLoad: function(content) {
			// find the player contained inside this overlay and load it
			//console.log(this.getContent());
			this.getContent().find("a.player").flowplayer(0).load();
			//$.expose.close(); 
			/*$f().unload();
			this.close();
			$.expose.close();*/
		},
		
		onClose: function(content) {
			$f().unload();
			
			// cloase exposing
			$.expose.close();
		}
	});	
}

function addflowplayer(id,subtitle,lang) {

	$(id).flowplayer("/flowplayer-3.1.1.swf", { 
		clip: {
			captionUrl: '/media/'+subtitle+'_'+lang+'.xml'
		},
		plugins:  { 
			captions: { 
			  url: '/flowplayer.captions-3.1.1.swf', 
			  captionTarget: 'content' 
			}, 
			
			// configure a content plugin to look good for our purpose 
			content: { 
		            url:'/flowplayer.content-3.1.0.swf', 
		            bottom: 40, 
		            height:50, 
		            backgroundColor: 'transparent', 
		            backgroundGradient: 'none', 
		            border: 0, 
		            textDecoration: 'outline', 
		            style: {  
		                body: {  
		                    fontSize: 18,  
		                    fontFamily: 'Arial', 
		                    textAlign: 'center', 
		                    color: '#ffffff',
		                    fontWeight: 'bold'
		                }  
		            }  
		        }
		} 
	});
}


function jscheck(obj,code) {
	var element = document.createElement('input');
	element.setAttribute('name', 'jscheck');
	element.setAttribute('type', 'hidden');
	
	code = code.substring(5)+code.substring(0,5);
	element.setAttribute('value', code);

	obj.appendChild(element);

	return true;
}
