function jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function findObj(n, d) {
  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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function jumpMenuGo(selName,targ,restore){
  var selObj = findObj(selName); if (selObj) jumpMenu(targ,selObj,restore);
}

function checkAll(status,element,formular) {
  for (i=0; i<document.picUpload.length;i++){
	if(document.picUpload.elements[i].name=="" + element + "[]"){
	  document.picUpload.elements[i].checked=status;
	}
  }
}

function jsOpenWnd(url)
{
	p ="height=660,width=380,toolbar=no,directories=no,status=no,scrollbars=auto,resizable=no,menubar=no";
	hWnd=window.open(url,"Hwnd",p);
	hWnd.focus();
}

function openWindow(url,height,width)
{
	p ="height=" + height + ",width=" + width + ",toolbar=no,directories=no,status=no,scrollbars=auto,resizable=no,menubar=no";
	hWnd=window.open(url,"Hwnd",p);
	hWnd.focus();
}
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("portalNav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;

function eventNew(){
	document.getElementById("locationChoose").style.display="block";
	document.getElementById("locationEnter").style.display="none";
	document.getElementById("tableMain").style.display="block";
	document.getElementById("tableSub").style.display="none";
}
function eventNewByLocation(){
	document.getElementById("tableMain").style.display="block";
	document.getElementById("tableSub").style.display="none";
}
function eventNewLocationEnter() {
	document.getElementById("locationChoose").style.display="none";
	document.getElementById("locationEnter").style.display="block";
}
function eventNewLocationChoose() {
	document.getElementById("locationChoose").style.display="block";
	document.getElementById("locationEnter").style.display="none";
	
}
function eventNewLocationCities() {
	req = getXMLRequester();
	var jetzt = new Date();
	var v = jetzt.getTime();
	req.onreadystatechange = handleResponse;
	id = document.getElementById('eventNewLocationCitiesChoose').options[document.getElementById('eventNewLocationCitiesChoose').selectedIndex].value;
	//id = document.getElementById('eventNewLocationCitiesChoose').value;
	req.open('get', 'action/ajax.php?s='+ id +'&v='+ v, true);
	req.send(null); 
}

function handleResponse() {
	if ((req.readyState == 4) && (req.status == 200)) { 
		//document.getElementById('eventNewLocationsOut2').innerHTML = req.responseText;
		document.getElementById('eventNewLocationsOut2').innerHTML = unescape(req.responseText);
	}
}

function getXMLRequester( ){
    var xmlHttp = false;
    // try to create a new instance of the xmlhttprequest object        
    try{
        // Internet Explorer
        if( window.ActiveXObject ){
            for( var i = 5; i; i-- ){
                try{
                    // loading of a newer version of msxml dll (msxml3 - msxml5) failed
                    // use fallback solution
                    // old style msxml version independent, deprecated
                    if( i == 2 ){
                        xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );    
                    }
                    // try to use the latest msxml dll
                    else{
                        
                        xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
                    }
                    break;
                }
                catch( excNotLoadable ){                        
                    xmlHttp = false;
                }
            }
        }
        // Mozilla, Opera und Safari
        else if( window.XMLHttpRequest ){
            xmlHttp = new XMLHttpRequest();
        }
    }
    // loading of xmlhttp object failed
    catch( excNotLoadable ){
        xmlHttp = false;
    }
    return xmlHttp ;
}
