// Dynamic menÃ¼
// code from the christmas- theme
var PreloadFlag = false;
var expDays = 100;
var exp = new Date();
var tmp = '';
var tmp_counter = 0;
var tmp_open = 0;

exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function SetCookie(name, value)
{
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape(value) +
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
		((path == null) ? "" : ("; path=" + path)) +
		((domain == null) ? "" : ("; domain=" + domain)) +
		((secure == true) ? "; secure" : "");
}

function getCookieVal(offset)
{
	var endstr = document.cookie.indexOf(";",offset);
	if (endstr == -1)
	{
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie(name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
			break;
	}
	return null;
}

ShowFirst = -1;

function ShowHide(id1, id2, id3)
{

	if(GetCookie(id3) == '2') document[id3].src = "images/arrow_up.gif";
	if(GetCookie(id3) == '1') document[id3].src = "images/arrow_down.gif";
	
	var res = expMenu(id1);
	if (id2 != '') expMenu(id2);
	if (id3 != '') SetCookie(id3, res, exp);
}

function expMenu(id)
{
	var itm = null;
	if (document.getElementById)
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	}
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	if (!itm)
	{
		// do nothing
	}
	else if (itm.style)
	{
		if (itm.style.display == "none")	
		{
			//if (id.indexOf("catrow_") > -1 ) document[id].src = "images/arrow_up.gif"
			itm.style.display = "";
			return 1;
		}
		else
		{//alert (id.indexOf("cat2_"))
			//if (id.indexOf("catrow_") > -1) document[id].src = "images/arrow_down.gif"
			itm.style.display = "none";
			return 2;
		}
	}
	else
	{
		itm.visibility = "show";
		return 1;

	}
	parent.window.focus()
}



function new_img (name)
{
	tmp = 'catrow_1';
	if(GetCookie(name) == '2') alert("2");
	if(GetCookie(name) == '1') alert("1");

}

// open a new window
// URL		=> absolute file-path
// W		=> width of the window
// H		=> heigth of the window
function OpenWindow(URL,W,H)
{
   try
   {
      win = window.open (URL,"",'scrollbars=yes,menubar=no,width=' + W + ',height=' + H + "'")
      win.moveTo(screen.width /2 - W /2, screen.height /2 - H /2)
      if (!win) throw "NOwin"
	if (win)  throw "winOK"
   }
   catch (e)
   {	
      if (e == "NOwin") alert ("Das Fenster kann nicht geÃ¶ffnet werden!\nWerden Popup-Fenster unterdrÃ¼ckt?")
   }
}

