var defaultlist='';
var win;
var wurl=location.host;
var reiterTab=new Object();
var MaxLen=4;
var navName = navigator.appName ;
function getElById(id){
	return(document.getElementById==null) ?
   (document.all==null ? null : document.all[id]) : document.getElementById(id);
}
function openBrWindow(theURL,winName,features) { //v2.0
 return window.open(theURL,winName,features);
}
function switchTab(id,path,mode){
	
	
	var aktiveItem=getElById(defaultlist);

	if(aktiveItem){
		aktiveItem.className='';

	}
	var newItem=getElById('li_'+id);
	if(newItem){
		newItem.className='aktuell';
		defaultlist='li_'+id;
	
	}
	if(mode && mode!='undefined' && mode=='true'){
		traveldetail.location.href='http://'+wurl+'/'+id+'?popup=true&showframe=true';
	
	}
	else{
		traveldetail.location.href=path+'?iframe=true&view='+id;
	}

}

function rezizePage(width){
	
	var div=getElById('popup');

	var height=div.offsetHeight;

	window.resizeTo(width, height);
}

function PopUpImage(imageid,close){
	if(close && win && win.open){
		win.close();
	}
	var link='http://'+wurl+'/image.php?id='+imageid;

	var param='top=10,left=10,width=300,height=200,scrollbars=no';
	win= window.open(link,'Bilder',param);
 if(win)
	win.focus();
}

function PopUpGeoObject(id,close){
	if(close && win && win.open){
		win.close();
	}
	var link='http://'+wurl+'/'+id+'?popup=true';

	var param='top=100,left=100,width=620,height=600,scrollbars=yes,resizable=no';
	
	win= window.open(link,'Geoobjekte',param);
 if(win)
	win.focus();	
	
}

function openRequest(id){
	
	if(close && win && win.open){
		win.close();
	}
	var link='http://'+wurl+'/request?obj='+id+'&popup=true';

	var param='top=10,left=100,width=620,height=600,scrollbars=yes,resizable=no';
	
	win= window.open(link,'Anfrage',param);
 if(win)
	win.focus();	
	
}




function DoSearch(mode){
	switch(mode){
		
		default:
		 val=getElById('search-site').value;
		 if(val.search(/[\w]{1,}/)==-1){  
		 	return false;
		 }
		 return true;
		break;
	}
}

function selectAll(allbox,name,ename){
	var box=document.forms[name].elements[ename];

	for(i=0; i< box.length;i++){
		box[i].checked=allbox.checked;

	}	
}

function printPage(){
	if(close && win && win.open){
		win.close();
	}
	var link=location.href+(location.search==''?'?':'&')+'print=true';

	var param='top=10,left=10,width=610,height=550,scrollbars=yes';
	win= window.open(link,'Bilder',param);
 if(win){
	win.focus();	
 }
}

function printTravel(){
	if(close && win && win.open){
		win.close();
	}
	var link=location.href+(location.search==''?'?':'&')+'print=true';

	var param='top=10,left=10,width=620,height=600,scrollbars=yes';
	win= window.open(link,'Bilder',param);
 if(win){
	win.focus();	
 }
}

function DoPrint(){
	div=getElById('printdiv');
	div.style.display='none';
	window.print();
	if(window.print){
		self.close();
	}	
	
}

function TabInit(id){

	var c=0;
	var tab=getElById(id);
	var padding=3;
	row=tab.insertRow(0);
	cell = row.insertCell(0);
  var sub=1;
  if(navName=='Mozilla' || navName=='Netscape'){
  	sub=0;
  }
	set='';
 
	for(i=0;i<reiterTab.length-sub;i++){
		iTem=reiterTab[i];
		scl='';
		if(i==0){
			scl=' class="aktuell"';
		}
		
		set+="<td "+scl+" id='li_"+iTem[1]+"'><a href=\"javascript:switchTab('"+iTem[1]+"','"+iTem[2]+"','"+iTem[3]+"')\">"+iTem[0]+"</a></td>";
		x=i+1;
		m=x % MaxLen;
	
		if(m == 0){
	
			cell.innerHTML='<table border="0" cellpadding="0" cellspacing="0" class="reiter"><tr>'+set+'</tr></table>';
			row=tab.insertRow(0);
			cell = row.insertCell(0);
	    set='';
		  cell.style.paddingLeft=padding+'px';
		  cell.style.paddingRight=padding+'px';
		  padding+=3;
		}		
    
		
	}

	cell.innerHTML='<table border="0" cellpadding="0" cellspacing="0" class="reiter"><tr>'+set+'</tr></table>';
	
}

