var timer = new Array();

function changeStyle(element, property, value){
  //alert("change "+ element+"-"+property+" to "+value)
  if(property.indexOf("-") != -1){
    var propArr = property.split("-");
    property = propArr[0]+propArr[1].substr(0,1).toUpperCase()+propArr[1].substr(1);
  }
  if(document.getElementById){
    if(document.getElementById(element)){
      document.getElementById(element).style[property] = value;
    }
  }
  else if(document.all){
    if(document.all[element]){
      document.all[element].style[property] = value;
    }
  }
}

function openWindow(url, t, width, height, properties){
  var left = screen.width/2 - width/2;
  var top = screen.height/2 - height/2;
  var props = "left="+left+", top="+top+", width="+width+", height="+height+", "+properties;
  win = window.open(url, t, props);
}

function confirmLink(link, text){
  if(confirm(text)){
    self.location.href = link;
  }
}

//Start PULLDOWN-MENU
function mainmenuHideSub(menuitem){
  changeStyle("pulldownmenu_"+menuitem, "visibility", "hidden");
}

function mainmenuOut(menuitem){
  timer[menuitem] = setTimeout("mainmenuHideSub('"+menuitem+"')", 50);
}

function mainmenuIn(menuitem){
  changeStyle("pulldownmenu_"+menuitem, "visibility", "visible");
  clearTimeout(timer[menuitem]);
}
//End PULLDOWN-MENU

$(document).ready(function(){
	var search_value = ""; //"Suche...";
	$("#searchField").focus(function(){
		if($(this).val() == search_value){
			$(this).val("");
		}
		$(this).addClass("active");
	});
	$("#searchField").blur(function(){
		if($(this).val() == ""){
			$(this).val(search_value);
			$(this).removeClass("active");
		}
	});
	$(".search_autocomplete").autocomplete("search_autocomplete.php", {minChars: 2});
	$(".search_autocomplete").result(function(){
		this.form.submit();
	});
	$("#searchField").autocomplete("search_autocomplete.php", {minChars: 2, width:138});
	$("#searchField").result(function(){
		this.form.submit();
	});
});

