
// Copyright (C) 2005 Ilya S. Lyubinskiy. All rights reserved.
// Technical support: http://www.php-development.ru/
//
// YOU MAY NOT
// (1) Remove or modify this copyright notice.
// (2) Distribute this code, any part or any modified version of it.
//     Instead, you can link to the homepage of this code:
//     http://www.php-development.ru/javascripts/dropdown.php.
//
// YOU MAY
// (1) Use this code on your website.
// (2) Use this code as a part of another product provided that
//     its main use is not creating javascript menus.
//
// NO WARRANTY
// This code is provided "as is" without warranty of any kind, either
// expressed or implied, including, but not limited to, the implied warranties
// of merchantability and fitness for a particular purpose. You expressly
// acknowledge and agree that use of this code is at your own risk.


// ----- Popup Control ---------------------------------------------------------

function at_display(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ----- Show Aux -----

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ----- Show -----

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);
/*  alert (c.id); alert(document.getElementById('eval_button').disabled);
  if (c.id='eval_form' && document.getElementById('eval_button').disabled=true) {
  
  	at_hide();
  }
*/   
  at_show_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

// ----- Hide -----

function at_hide()
{
  var c = document.getElementById(this["at_child"]);
  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

// ----- Click -----

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible")
       at_show_aux(p.id, c.id);
  else c.style.visibility = "hidden";

  return false;
}

// ----- Attach -----

// PARAMETERS:
// parent   - id of visible html element
// child    - id of invisible html element that will be dropdowned
// showtype - "click" = you should click the parent to show/hide the child
//            "hover" = you should place the mouse over the parent to show
//                      the child
// position - "x" = the child is displayed to the right of the parent
//            "y" = the child is displayed below the parent
// cursor   - Omit to use default cursor or check any CSS manual for possible
//            values of this field

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}

/*
Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="fromBottom"

var showToTopLink = false;

function JSFX_FloatTopDiv(divId, startX, startY)
{
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	var totoplink = d.getElementById('totoplink');

	function paintLink() {
		var yOffset = ns ? pageYOffset : document.body.scrollTop; 
		var iHeight = ns ? innerHeight : document.body.clientHeight;
		if (yOffset>300 && showToTopLink==false) {
		showToTopLink = true;
		totoplink.innerHTML = '<img src="images/up2.gif" align="absmiddle"> <a href="#top"><strong>nach oben</strong></a> <img src="images/up2.gif" align="absmiddle">';
		}
		else if (yOffset<=300) {
		if (showToTopLink==true) {
			showToTopLink = false;
			totoplink.innerHTML = '';
		}
		}
	}
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/20;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y)/20;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 1);
		paintLink();
	}
	ftlObj = ml(divId);
	stayTopLeft();
}

/*
function JSFX_FloatTopDiv_2(divId, startX, startY, activate)
{
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml_2(id)
	{
		var el_2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el_2.style=el_2;
		el_2.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el_2.x = startX;
		if (verticalpos=="fromtop")
		el_2.y = startY;
		else{
		el_2.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el_2.y -= startY;
		}
		return el_2;
	}
	window.stayTopLeft_2=function()
	{
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj_2.y += (pY + startY - ftlObj_2.y)/8;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj_2.y += (pY - startY - ftlObj_2.y)/8;
		}
		ftlObj_2.sP(ftlObj_2.x, ftlObj_2.y);
		if (activate)
			setTimeout("stayTopLeft_2()", 10);
	}
	ftlObj_2 = ml_2(divId);
	stayTopLeft_2();
}
*/


//Uncrypt mail addresses to confuse spam robots
 function UnCryptMailto(s) {
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	return r;
 }
 function linkTo_UnCryptMailto(s)	{
	location.href=UnCryptMailto(s);
 }
 
 function EnCryptMailto(txtToEncrypt) {	
	var n=0;
	var r="";
	var s="mailto:"+txtToEncrypt;
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n+(1));
	}
	alert(r);
 }


// Calculate days for website age
    var d1 = 6;
    var m1 = 6;
    var y1 = 2007;

    today = new Date();
    var d2 = today.getDate();
    var m2 = today.getMonth()+1;
    var y2 = today.getFullYear();

    var oDate1 = new Date(y1, (m1-1), d1);
    var oDate2 = new Date(y2, (m2-1), d2);

    var iDays = Math.floor((oDate2.getTime()-oDate1.getTime())/(1000 * 86400));


function showBigImage(picName, size_w, size_h) {
  var width = size_w+20;
  var height = size_h+20;
  window.open(picName, 'bigImage', 'width='+width+', height='+height+', top=30, left=30')
}