function Open(href, name, pref)
{
    window.open(href, name, pref);
    return void(0);
}

function setImage(id, src)
{
    var obj = document.getElementById(id);
    if(obj) obj.src = src;
}

function displayWindow(url, width, height)
{
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no' );
}

function OpenMMedia(file)
{
	var win = window.open("mmedia.php?file=" + escape(file), "_blank", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,dependent=yes");
	if(win && win.focus)
	    win.focus();
	return void(0);
}
function OpenYT(file)
{
	var win = window.open("/modules/YouTube/xtb_es_youtube.php?code=" + escape(file), "_blank", "width=440 ,height=360 ,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,dependent=yes");
	if(win && win.focus)
	    win.focus();
	return void(0);
}


function ShowMMedia(file)
{
    OpenMMedia(file);
}

function getPosition(el)
{
	for (var lx=0,ly=0;el!=null;
		lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
	return {x:lx,y:ly}
}

function SetLanguage(l)
{
    document.langmanager.setlanguage.value = l;
    document.langmanager.submit();
}

function getTopWindow() {
    if( window.top ) {
	return window.top;
    } else {
	var p = window;
	while( p.parent && p.parent != p ) {
	    p = p.parent;
	}
	return p;
    }
    return null;
}
