<!--

function open_internerlink_nw(url,w,h)
	{
	l = Math.round(screen.width/2)-Math.round(w/2);
	t = Math.round(screen.height/2)-Math.round(h/2);
	window.open(url,'','left='+l+',top='+t+',dependent=no,width='+w+',height='+h+',scrollbars=yes,status=no,toolbar=no,menubar=no');
	}

function changeimg(bildname,dateiname)
	{
//	alert(document.images[bildname]);
	document.images[bildname].src=dateiname;
	}

function showpic(id,picture,width,height)
	{
	if (parseInt(width) < 2)
		{
		width  = parseInt(width) + 25;
		height = parseInt(height) + 25;
		}
	else
		{
		width	= 980
		height	= 680
		}
	window.open('/file/'+id+'_'+picture,'cmspicture'+id,'width='+(width)+',height='+(height)+',scrollbars=yes');
	}
	
function fhigh(id1, style1)
    {
	   document.getElementsByName(id1)[0].className = style1;
	}

function imghigh(id1, style1)
    {
	   document.getElementsByName(id1).className = style1;
	}


// onresize for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}




function normalize(what,digits) {
	var str=""+what;
	var pp=Math.max(str.lastIndexOf("+"),str.lastIndexOf("-"));
	var idot=str.indexOf(".");
	if (idot>=1) {
		var ee=(pp>0)?str.substring(pp-1,str.length):"";
		digits+=idot;
		if (digits>=str.length)
			return str;
		if (pp>0 && digits>=pp)
			digits-=pp;
		var c=eval(str.charAt(digits));
		var ipos=digits-1;
		if (c>=5) {
			while (str.charAt(ipos)=="9") ipos--;
			if (str.charAt(ipos)==".") {
				var nc=eval(str.substring(0,idot))+1;
				if (nc==10 && ee.length>0) {
					nc=1;
					ee="e"+(eval(ee.substring(1,ee.length))+1);
				}
				return ""+nc+ee;
			}
			return str.substring(0,ipos)+(eval(str.charAt(ipos))+1)+ee;
		} else
			var ret=str.substring(0,digits)+ee;
			for (var i=0; i<ret.length; i++)
				if (ret.charAt(i)>"0" && ret.charAt(i)<="9")
					return ret;
			return str;
	 }
	 return str;
}

function compute(obj,val,data) {
	if (obj[val].value) {
		var uval=0;
		uval = obj[val].value*data[val];
		for (var i in data)
		 if (obj[i]) obj[i].value=normalize(uval/data[i],8);
	}
}

function compute_abmessungen(obj,val) {
	compute(obj,val,data_abmessungen)
}

function compute_volumen(obj,val) {
	compute(obj,val,data_volumen)
}

function compute_flaeche(obj,val) {
	compute(obj,val,data_flaeche)
}

function compute_druck(obj,val) {
	compute(obj,val,data_druck)
}

//F = (C * 9/5) + 32
//C = (F - 32) * 5/9
//http://www.me-systeme.de/calculate/temp.html

function compute_temp(value)
{
 document.forms[0].Celsius.value = parseInt(value);
 document.forms[0].Fahrenheit.value = (parseInt(value)*9/5)+32;
 document.forms[0].Kelvin.value = parseInt(value)+273.15;

}

function compute_fahrenheit(value)
{
 document.forms[0].Celsius.value = (parseInt(value)-32)*5/9;
 document.forms[0].Fahrenheit.value = parseInt(value);
 document.forms[0].Kelvin.value = 5/9 * (parseInt(value) + 459.67);

}


function compute_kelvin(value)
{
 document.forms[0].Celsius.value = parseInt(value)-273.15;
 document.forms[0].Fahrenheit.value = (parseInt(value)-(5/9*459.67))/(5/9);
 document.forms[0].Kelvin.value = parseInt(value);

}

//function checkNum() is defined in site.pccms due to needed language text

//marcomedia layer stuff

function MM_showHideLayers()
 {
  var i,p,v,obj,args = MM_showHideLayers.arguments;

  for (i=0; i < (args.length-2); i += 3)
   {
    if ((obj = MM_findObj(args[i])) != null)
     {
      v = args[i+2];
      if (obj.style)
       {
        obj = obj.style;
        v = (v == 'show') ? 'visible' : (v = 'hide') ? 'hidden' : v;
       }
      obj.visibility = v;
     }
   }
 }

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);
 }

//-->
