// popup für nashorn...
function popup(){
	
	// war im onLoad-attribut des Body-Tags drin und sollte dort wieder hin, wenn die aktion vorbei ist. 
//	this.focus();
	openWindow('nashorn.html', 'nashorn', 300, 175, false, false);		
}	

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function switchLevel(id, state)
{
	MM_findObj('nav'+id).src=state ? "/~upload/nav_du_" + id + "on.gif" : "/~upload/nav_du_" + id + ".gif"
}

function switchLevel2(id, state)
{
	MM_findObj('nava'+id).src=state ? "img/subNavDot.gif" : "img/blank.gif"
}

function checkForm()
{
	//check ob Felder ausgef&uuml;llt sind	
	var check=1;

	obj=MM_findObj('editForm')
	for(i=0 ; i <= obj.length-1 ; i++)
	{
		x = obj.elements[i]

	    if((x.name == "title")||(x.name == "startDate"))
	    {
	    	if (x.value == "")
	        {
	        	check=0
				if(x.name == "title")
					alert("Bitte füllen Sie das Feld: 'Titel' aus");
				if(x.name == "startDate")
					alert("Bitte füllen Sie das Feld: 'Datum: Beginn' aus");
	            x.focus();
	            break;
	        }
	    }
	}
			
	//wenn das alles erf&uuml;llt ist und chkZ=1 ist, dann kann versendet werden.
	if(check==1)
	{
		obj.submit();
	}
}


function openWindow(dir, name, width, height, scroll, toolbar)
{
	dirName=dir
	param= "width="+width+",height="+height+",screenX=0,screenY=0, top=0, left=0, locationbar=no, menubar=no, resizeable=no, status=no";
	if(scroll)
		param+=",scrollbars=yes"
	if(toolbar)
		param+=",toolbar=yes"
	winName= name.replace(/ /,"_") + Math.floor(Math.random()*100000);
	window.open(dirName, winName, param);
}

/** runClock function for webcam */
var refreshInterval = 60
function runClock(picture, num) {
    refreshInterval = refreshInterval - 1

        var now = new Date()
        var refreshFudge = parseInt(now.getTime() / 1000)
        delete now

        if (refreshInterval < 0) 
        {
                if (document.images)
                        document.homeImage.src = "/webcam/" + picture + "?" + refreshFudge
                else
                        window.location.reload()
                refreshInterval =   120
        }
        eval("document." + num + ".countdownTime.value = refreshInterval")
        clockID = setTimeout("runClock('" + picture + "', '" + num + "')", 1000)
}

actPanoPointer=null
function panoSwitch(id)
{
	if(actPanoPointer==null)
		actPanoPointer=document.images['pano_pointer0'];
	document.applets['pano'].newPanoFromList(id)
	actPanoPointer.src="img/blank.gif"
	actPanoPointer=document.images['pano_pointer'+id]
	actPanoPointer.src="img/pointer.gif"
}
