//Menu Set-Up Javascript

var help_width = 300;

var DOM = (document.getElementById)? true : false;
var OP = (window.opera)? true : false;
var OP5 = (OP && DOM)? true : false;
var NS = (window.outerWidth && !OP)? true : false;
var NS6 = (NS && DOM)? true : false;
var NS4 = (NS && !DOM)? true : false;
var IE = (document.all && !OP)? true : false;
var IE5 = (IE && DOM)? true : false;
var IE4 = (IE && !DOM)? true : false;

// New menu

function GetObjectById(id)
{
     var Obj;

     if (NS4) Obj = document.layers[id];
     else if (IE4) Obj = document.all[id];
     else if (IE5 || NS6) Obj = document.getElementById(id);

     return Obj;
}

function ShowHide(ObjectId)
{
	var Obj;
	Obj = GetObjectById(ObjectId)
	if (Obj.style.display == "none"){
		Obj.style.display = "block";
	} else {
		Obj.style.display = "none";
	};
	
	return true;
}

function ShowHideMenu()
{
	//alert(arguments.length);
	if (arguments.length < 1) return false;
	var o = GetObjectById(arguments[0]);
	var tmpO
	if (o.style.display == "none"){
		o.style.display = "block";
		for (var i = 1; i < arguments.length; i++){
			tmpO = GetObjectById(arguments[i]);
			tmpO.style.display="none";
		}
	} else {
		o.style.display = "none";
	};
	return true;
}

// Pop-Up Window

function PopUpPlainFixedNoScroll(src,width,height,wname){
	window.open(src,wname,'toolbar=no,resizable=no,scrollbars=no,top=100,left=100,width=' + width + ',height=' + height + '')
}

function PopUpPlain(src,width,height,wname){
	window.open(src,wname,'toolbar=no,resizable=yes,scrollbars=no,top=100,left=100,width=' + width + ',height=' + height + '')
}

function PopUpAktuality(src,width,height,wname){
	window.open(src,wname,'toolbar=no,resizable=yes,scrollbars=yes,top=100,left=100,width=' + width + ',height=' + height + '')
}

function ImagePopUp(src){
	window.open(src,'nrsr_image','toolbar=no,resizable=yes,scrollbars=no,top=100,left=100,width=' + 400 + ',height=' + 400 + '')
}

function PopUp(src,width,height,wname,title){
	window.open('layout/container_plain.aspx?docAddress=' + src + '&docTitle=' + title,wname,'toolbar=no,resizable=yes,scrollbars=yes,top=100,left=100,width=' + width + ',height=' + height + '')
}

// Pop-Up Window from calendar

function CalendarPopUp(src,width,height,wname,title){
	var wnd
	wnd = window.open(src,wname,'toolbar=no,resizable=yes,scrollbars=yes,top=100,left=100,width=' + width + ',height=' + height + '');
}

// resizovac

function Resize(width,height,top,left){
	if (!(NS6 || OP)) {
		window.resizeTo(width,height)
		window.moveTo(left,top)
	}
}

function Unloader() {
	window.close();
}

function HelpPopup(src,title) {
	if (IE4 || IE5) {
		newwin = window.open('./layout/container.aspx?docAddress=' + src + '&docTitle=' + title,'nrsr_help','toolbar=no,resizable=yes,scrollbars=yes,top=0,left=' + (screen.width-help_width) +',width=' + help_width +',height=' + (screen.height - 20) + '');
	} else {
		newwin = window.open('./layout/container.aspx?docAddress=' + src + '&docTitle=' + title,'nrsr_help','toolbar=no,resizable=yes,scrollbars=yes,top=0,left=' + (screen.width-help_width) +',width=' + help_width +',height=425');
	}
	newwin.opener = self;
}

function HelpClose() {
	Unloader()
}

function ResizeOnLoad() {
	if (!(NS6 || OP)) { 
		window.opener.moveTo(0,0);
		window.opener.resizeTo(screen.width-help_width,screen.height);
	}
}

function ResizeOnClose() {
	if (!(NS6 || OP)) window.opener.resizeTo(screen.width,screen.height);
}

// toggle

function Toggle(CatID, ImageID)
{
	Elem = GetObjectById(CatID);
	aImage = GetObjectById(ImageID);
	if (Elem.style.display == "none")
	{
		Elem.style.display = "";
		aImage.src = "js/minus.gif";
	} 
	else
	{
		Elem.style.display = "none";
		aImage.src = "js/plus.gif";
	}
}
