function searchQuery(url) {
	try {
		var queryValue = document.searchForm.search.value;
		var parameters = "?s=t&q=" + encodeURIComponent(queryValue);
		location.href = "http://www2.serima.de" + url + parameters + "&sb=score";
	} catch(err) {
		alert(err);
	}
	
}

function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
}

$(document).ready(function(){
	mainmenu();
});

/* ------------------------------------------- */
/*  COUNTRY SWITCHER			       */
/* ------------------------------------------- */
function linkTo(item) 
{
	var action = item.options[item.selectedIndex].value;
	document.location = action;
}


/* ------------------------------------------- */
/*  PROZESSKETTE			       */
/* ------------------------------------------- */
function showDiv(divId) {
	var id = '#div-' + divId.id;
	$(id).removeClass('invisible');
	$(id).css({visibility: "visible",display: "none"}).slideDown(400);
}

function hideDiv(divId) {
	var id = '#div-' + divId.id;
	$(id).css({visibility: "visible",display: "block"}).slideUp(400);
}


/* ------------------------------------------- */
/*  MAPS                                       */
/* ------------------------------------------- */
var holdItem;	

function isEmpty(field) {
    if (field != null && field.length > 0) {
        return false;
    }
    return true;
}

function showMapItem(elem) {
	if(!isEmpty(holdItem))
		return;
$(".standort_text").hide();
$("#"+elem).show();
}	

function hideMapItem(elem) {
	if(holdItem && holdItem == elem)
		return;
	$("#"+elem).hide();
}
function lockMapItem(elem) {
	holdItem = '';
	$(".standort_text").hide();
	showMapItem(elem);
	holdItem = elem;
}
function release(elem) {
	holdItem = '';
	hideMapItem(elem);
}


//SimpleSwap by Jehiah Czebotar
//
function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }

  var y = document.getElementsByTagName("input");
  for (var j=0;j<y.length;j++){
    oversrc = y[j].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    y[j].oversrc_img = new Image();
    y[j].oversrc_img.src=oversrc;
    // set event handlers
    y[j].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    y[j].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    y[j].setAttribute("origsrc",y[j].src);
  }

}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}
