function entryhover(inout,src){
	if (!Element.hasClassName(src,'listentry'))return;
	if (inout == 0){
		Element.addClassName(src, 'listentry_hover');
	} else if (inout == 1){
		Element.removeClassName(src, 'listentry_hover');
	}
}

function top(){ 
	new Effect.ScrollTo('header1', {'duration':1.5});
}


function createxmlhttp(){
	var xmlhttp = false;
 
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	  xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}


function headerflip_block (span_id_a)
{
	headerflip(span_id_a);
}

function headerflip( span_id_a )
 {
	Element.toggle($(span_id_a));
}
       

function newWindow(url,name){
	if (url.search("http://") == -1){
		url="http://" + url;
	}
	window.open(url,"");
}


function swapsize(element,stdwidth,stdheight,bigwidth,bigheight){

	var image=document.getElementById(element);
	if (image.width == stdwidth && image.height == stdheight){
		image.width = bigwidth;
		image.height = bigheight;
	} else if (image.width == bigwidth && image.height == bigheight){
		image.width = stdwidth;
		image.height = stdheight;
	}
}


function windowstate(filename, name, scroll, width, height, left, top)
{
	windowops = eval("'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + scroll + ",resizable=yes,copyhistory=yes,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + "'");

	newWindow = window.open(filename, name, windowops);
	newWindow.focus();
	return;
}  
		
function gemeindechange(){
		var value= $F("gemeinden");
		if (value != 0){
			if ($("gemeinde_info_bulp"))Element.remove('gemeinde_info_bulp');
			var name = $("gemeinden").options[$("gemeinden").selectedIndex].text;
			new Insertion.After("gemeinden","<span id=\"gemeinde_info_bulp\" style='font-size:11px' onclick=\"javascript:cleargemeindelist()\"><br><img src=\""+_document_root+"icons/stock_dialog-info-16.png\" width=\"16\" height=\"16\" alt=\"\" valign=\"middle\"> Suche wird auf "+name+" eingeschr&auml;nkt. <a>Einschr&auml;nkung aufheben.</a></span>");	
		} else if (value == 0){
			if ($("gemeinde_info_bulp"))Try.these(Element.remove('gemeinde_info_bulp'));
		}
}


function cleargemeindelist(){
	$("gemeinden").value=0;
	Try.these(Element.remove('gemeinde_info_bulp'));
}

function fade_new_image(id, new_url){
        var oldimg = document.getElementById(id);
        if (document.all){
                oldimg.style.filter='';
                oldimg.style.filter="blendTrans(duration=2)";
                oldimg.filters.item(0).Apply();
        }
        oldimg.src=new_url;

        if (document.all){
                oldimg.filters.item(0).Play();
        }
}

function openUrl(url){
	window.location.href=_document_root + url;
}

function openSub(url){
	window.location.href="http://"+url+"."+_tld;
}

function focus_first_textfield(){
	var fields = document.getElementsByTagName("input");
	var field;
	var focused=false;
	var i;
	for (i=0;i<fields.length;i++){
		fields[i].onfocus=myfocus;
		fields[i].onblur=myblur;
		if (fields[i].type == "text"){
			while (fields[i].value.match(/\\/)){
				fields[i].value = fields[i].value.replace('\\','');
			}

			if (!focused){
				try{
					fields[i].focus();
				} catch (asdf){
					
				}
				focused=true;
			}	
		}
	}
	
	fields = document.getElementsByTagName("select");
	for (i=0;i<fields.length;i++){
		fields[i].onfocus=myfocus;
		fields[i].onblur=myblur;
	}
	
	fields = document.getElementsByTagName("textarea");
	for (i=0;i<fields.length;i++){
		fields[i].onfocus=myfocus;
		fields[i].onblur=myblur;
		while (fields[i].value.match(/\\/)){
			fields[i].value = fields[i].value.replace('\\','');
		}
	}
	

}


function myfocus(){
	this.style.backgroundColor='#ffffa0';
}


function myblur(){
	this.style.backgroundColor='';
}

function checkUncheckAll(elem) {
  var form = elem.form;
  z = 0;
  for (z=0; z<form.length; z++) {
  if (form[z].type == 'checkbox' && form[z].name != 'checkall') {
    form[z].checked = elem.checked;
  }
  }
}

function checkUncheckAllName(elem,start) {
  var form = elem.form;
  z = 0;
  for (z=0; z<form.length; z++) {
  if (form[z].type == 'checkbox' && form[z].name != 'checkall' && form[z].name==start) {
    form[z].checked = elem.checked;
  }
  }
}

