function stopPropagation(event)
{
	var event = event || window.event;
	
	event.cancelBubble = true;
	
	if (event.stopPropagation)
	{
		event.stopPropagation();
	}
}

function openWindow(url)
{
	var nw = window.open(url, "mp3_speler", "width=350,height=168,scrollbars=0,toolbar=0,location=0,resizable=0,status=0");
	if(!nw)
		return false;
	
	// blank the page
	nw.document.write("");
	
	// load the template
	var template;
	
	// load parameters
	var params = {
		template: "layout/galleries/mp3_player_window.tpl"
	};
	
	xajax.call("xajax_getHTML", {parameters: [params], context: {
		callback: function(html)
		{
			template = html;
			nw.document.write(template);
			nw.document.close();
			
			var el = document.getElementById("pagePlayer");
			el.innerHTML = "";
			el.style.display = "none";
			
			return nw;
		}
	}});
}

function getTranslation(string)
{
	xajax.call("xajax_getTranslation", {parameters: [string], context: {
		callback: function(value)
		{
			alert(value);
		}		
	}});
}

function getTranslationConfirm(string, func, args)
{
	xajax.call("xajax_getTranslation", {parameters: [string], context: {
		callback: function(value)
		{
			var r = window.confirm(value)
			if (r == true)
			{
				func(args);
			}
			else
			{
				return false;
			}
		}		
	}});
}

function xajax_call(params)
{
	var div = document.getElementById(params.divId);
	if (div)
	{
		div.innerHTML = "";
		div.className = "loader";
		
		xajax.call("xajax_getHTML", {parameters: [params], context: {
			callback: function(html)
			{
				div.innerHTML = html;
				div.className = "";
			}		
		}});
	}
}

function switchVisible(id, titleLeft, titleRight)
{
	var elLeft = document.getElementById("left_" + id);
	var elRight = document.getElementById("right_" + id);
	var imgOver = document.getElementById("img_" + id + "_over");
	var imgOut = document.getElementById("img_" + id + "_out");
	
	imgOver.style.display == "none" ? imgOver.style.display = "block" : imgOver.style.display = "none";
	imgOut.style.display == "none" ? imgOut.style.display = "block" : imgOut.style.display = "none";
	
	elLeft.innerHTML == "&nbsp;" ? elLeft.innerHTML = titleLeft : elLeft.innerHTML = "&nbsp;";
	elRight.innerHTML == "&nbsp;" ? elRight.innerHTML = titleRight : elRight.innerHTML = "&nbsp;";
}

function onInit()
{
	if (window.g_showMessage != undefined && g_showMessage != "")
	{
		window.showMessage(g_showMessage);
	}
	
	var highlight = _GET("highlight");
	if (highlight)
	{
		x = document.getElementById("content") ? document.getElementById("content") : document.body;
		
		highlightText(highlight, "highlighted", x);
	}
}

function showHide()
{
	document.getElementById('pwShow').style.display = 'block';
	document.loginForm.password.focus();
	document.getElementById('pwHide').style.display = 'none';
}
