/*------------------------------------------------------------------------------

  neikergn.de Javascript Headfile
    by Martin Walz

------------------------------------------------------------------------------*/

$(document).ready( function() {

// Navigation
  $(".subnav").show();
  $("#page_nav > ul > li").mouseenter( function() { $(this).css("background-color", "#50B0FF").children(".subnav").show(200); });
  $("#page_nav > ul > li").mouseleave( function() { $(this).css("background-color", "transparent").children(".subnav").hide(150); });
  $(".subnav > ul > li").mouseenter( function() { $(this).animate( { backgroundColor: "#50B0FF" }, 150).children(".subnav").show(200); });
  $(".subnav > ul > li").mouseleave( function() { $(this).animate( { backgroundColor: "#0099ff" }, 150).children(".subnav").hide(150); });
  $("#page_nav > ul > li").mouseover( function() {
    $(this).children(".subnav").position({
          of: $(this),
          my: "right top",
          at: "left top",
          offset: "10px -2px",
    });
    $(this).mouseover( function() {} );
  });
        
  $(".subnav > ul > li").mouseover( function() {
    $(this).children(".subnav").position({
          of: $(this),
          my: "right top",
          at: "left top",
          offset: "10px -2px",
    });
    $(this).mouseover( function() {} );
  });
        
  $(".subnav").hide();

// Silbentrennung
  Hyphenator.config({ minwordlength : 4 });
  Hyphenator.run();
  
// Hover-Effekt bei Zeilen
  $("tr.hover").mouseenter(function () { $(this).children("td").animate( { backgroundColor: "#D0DDFA" }, 200 ) });
  $("tr.hover").mouseleave(function () { $(this).children("td").animate( { backgroundColor: "#F0F4FA" }, 100 ) });
  
// Sonstiges
  if($.browser.msie) {
  } else {
  }
});

/*------------------------------------------------------------------------------

  alte Funktionen

------------------------------------------------------------------------------*/

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

var ObjVisible = new Array();

function Show() { //v6.0
  var i,obj,args=Show.arguments;
  for (i=0; i<(args.length); i++) { 
  $("#" + args[i]).show();
    window.clearInterval(ObjVisible[args[i]]);
  }
}

function Hide() { //v6.0
  var i,obj,args=Hide.arguments;
  for (i=0; i<(args.length); i++) { 
    $("#" + args[i]).hide();
    window.clearInterval(ObjVisible[args[i]]);
  }
}

function HideDelayed() {
  var i,obj,args=HideDelayed.arguments;
  for (i=0; i<(args.length); i++) { 
    if ((obj=MM_findObj(args[i]))!=null) {
      ObjVisible[args[i]] = window.setInterval('Hide(\'' + args[i] + '\')', 1000);
    }
  }
}

img_nr = 1;

function OpenPic(Picture)
{
img_name = 'img' + img_nr;
++img_nr;

	NewWindow=window.open("","Picture","fullscreen=0,scrollbars=no,resizable=no,top=\"100\",left=\"100\"");

  NewWindow.document.write ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
	NewWindow.document.write ("<html><head><title>Bild");
	NewWindow.document.write ("</title>");
	NewWindow.document.write ("<script language=\"JavaScript\">");
  
	NewWindow.document.write ("function ResizeWindow(obj) ");
	NewWindow.document.write ("{");
	NewWindow.document.write ("  x = obj.width;");
	NewWindow.document.write ("  y = obj.height;");
	NewWindow.document.write ("  ScreenWidth = screen.width;");
	NewWindow.document.write ("  ScreenHeight = screen.height;");
	NewWindow.document.write ("  xpos = (ScreenWidth/2)-(x/2);");
	NewWindow.document.write ("  ypos = (ScreenHeight/2)-(y/2);");
	NewWindow.document.write ("  window.resizeTo(x,y+30);");
	NewWindow.document.write ("  window.moveTo(xpos, ypos);");
	NewWindow.document.write ("}");
	NewWindow.document.write ("</script>");
	NewWindow.document.write ("</head>");
	NewWindow.document.write ("<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">");
	NewWindow.document.write ("<img onclick=\"window.close()\" id=\""+img_name+"\" onload=\"ResizeWindow(this)\" src=\"");
	NewWindow.document.write (Picture);
	NewWindow.document.write ("\" style=\"position:absolute;top=0;left=0;\">");
	NewWindow.document.write ("</body></html>");
	NewWindow.document.close();

  NewWindow.focus();
}

function OpenPage(id, param) {
  if (param)
    var file = "http://www.neunkirchen-am-brand.de/index.php?page=" + id + "&" + param
  else
    var file = "http://www.neunkirchen-am-brand.de/index.php?page=" + id;
  self.location= file;
}

function ChangeStyle() { //v6.0
  var i,obj,args=ChangeStyle.arguments;
  for (i=1; i<(args.length); i++) {
    document.getElementById(args[i]).className=args[0];
  }
}
