/*
lbut11 = new Image();
lbut11.src = "pictures/lbut11.gif"
lbut12 = new Image();
lbut12.src = "pictures/lbut12.gif"
*/

opera = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
dom = (document.getElementById)? true : false;
ie4 = (document.all && !dom)? true : false;
nn4 = (document.layers)? true : false;



function showElem(elemId)
{
	if (dom) document.getElementById(elemId).style.visibility = "visible";
	else if (ie4) document.all[elemId].style.visibility = "visible";
	else if (nn4) document.layers[elemId].visibility = "show";
}
function hideElem(elemId)
{
	if (dom) document.getElementById(elemId).style.visibility = "hidden";
	else if (ie4) document.all[elemId].style.visibility = "hidden";
	else if (nn4) document.layers[elemId].visibility = "hide";
}
function putElem(elemId) {
	if (dom) document.getElementById(elemId).style.display = "block";
	else if (ie4) document.all[elemId].style.display = "block";
}
function removeElem(elemId) {
	if (dom) document.getElementById(elemId).style.display = "none";
	else if (ie4) document.all[elemId].style.display = "none";
}


function getElement( elemId )
{
    if (dom)
        return document.getElementById(elemId);
    else
        if (ie4)
            return document.all[elemId];
        else
            if (nn4)
                return document.layers[elemId];
    return null;
}




function showFlv( url )
{
	var popup_left = (window.screen.width/2)  - (320/2);
	var popup_top  = (window.screen.height/2) - (240/2);

    var w=window.open("/includes/player.php?url="+url,"flv","width=320,height=240,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,left=" + popup_left + ",top=" + popup_top + "");
    w.focus();
    return false;
}

function showFlv2( url )
{
	
	var popup_left = (window.screen.width/2)  - (520/2);
	var popup_top  = (window.screen.height/2) - (392/2);

    var w=window.open("/includes/player.php?url="+url,"flv","width=520,height=392,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,left=" + popup_left + ",top=" + popup_top + "");
    w.focus();
    return false;
}


function showFlvVideo( url )
{
	var popup_left = (window.screen.width/2)  - (320/2);
	var popup_top  = (window.screen.height/2) - (240/2);

    var w=window.open("/includes/player.php?url="+url,"flvVideo","width=320,height=240,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,left=" + popup_left + ",top=" + popup_top + "");
    w.focus();
    return false;
}

function showLargeImage( url, width, height )
{
    var w=window.open("/includes/zoomer.php?url="+url,"image","width="+width+",height="+height+",status=no,toolbar=no,menubar=no,location=no,scrollbars=no");
    w.focus();
    return false;
}

var fenster,closed=1;
function centerPopup(popup_name,popup_url,popup_with,popup_height,myWidth,myHeight)
{
	if(fenster)
	{ if(!closed)
	  { fenster.close();
	    closed=1;
	    fenster=0;
	  }
	}
	if(!myWidth) {myWidth = 10;}
	if(!myHeight){myHeight = 50;}
	var popup_left = (window.screen.width/2)  - (popup_with/2 + myWidth);
	var popup_top  = (window.screen.height/2) - (popup_height/2 + myHeight);
	var fenster = window.open(popup_url ,popup_name,"toolbar=no,location=no,status=no,menubar=yes,scrollbars=auto,resizable=yes,width=" + popup_with + ",height=" + popup_height + ",left=" + popup_left + ",top=" + popup_top + ",screenX=" + popup_left + ",screenY=" + popup_top);
	fenster.focus();
	
}


function register(e) {

    var code;
    if (!e) e = window.event;
    if (e.keyCode) code = e.keyCode;
      else if (e.which) code = e.which;

    if ((code == 37) && (e.ctrlKey == true)) {
    
        var destination = document.getElementById('previous_page');
        if (destination) location.href = destination.href;
    }
    if ((code == 39) && (e.ctrlKey == true)) {
    
    	var destination = document.getElementById('next_page');
        if (destination) location.href = destination.href;
    }
}


function setCookie(name, value, days, domain) {
	var expires = days*24*60*60*1000;
	var path="/";
	var todaydate=new Date();
   
	var expdate=new Date(todaydate.getTime()+expires);	
    var curCookie = name + "=" + escape(value) +
                "; expires=" + expdate.toGMTString()  +
                "; domain=" + domain +
                ((path) ? "; path=" + path : "");
                
	return curCookie;
}


function getCookie(name) {        
	var prefix = name + "=";
	var cookieStartIndex = document.cookie.indexOf(prefix);
	
	if (cookieStartIndex == -1) return "";
	
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
	
	if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length
		return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
	
}

function showHideDiv(divname){
	if (document.getElementById(divname).style.display=='none'){
		putElem(divname);
		return 1;
	}
	else {
		removeElem(divname);
		return 1;
	}

}

