// javascript.js
// für Homepage: PROEMTEC GmbH, An der Leiten 1, D-82290 Landsberied
// copyright by: p r o e m t e c @ h e l m u t - b r a c k . d e
// 2008-12-01

var
 i,j,o,p;
 Dateiname = 'proemtec.html';
 Info = new Array ('','','','','',''); //BrowserInfo...

function Do(Funktionsaufruf,Parameter)
{
	if (Funktionsaufruf == 'OpenFirstPage' && top.frames.length > 0) top.location.href=self.location;
	if (Funktionsaufruf == 'OpenFirstPage')
	{
		SetNewFrameSet (Dateiname);
	};
	if (Funktionsaufruf == 'SetLoadedName' && top.frames.length == 0)
	{
		Dateiname = Parameter;
		SetNewFrameSet (Dateiname);
	};
	if (Funktionsaufruf == 'SetLoadedName' && Parameter =='') parent.frame_main.location.href = (Dateiname);
	j=0x81;
	if (Funktionsaufruf == 'OpenShop')
	{
		Dateiname = Parameter;
		OpenShopWindow (Dateiname);
	};
};

function SetNewFrameSet (Parameter)
{
	document.open('text/html','replace');
	document.writeln('<HTML>');
	document.writeln('<HEAD>');
	document.writeln('<TITLE>&nbsp;PROEMTEC&nbsp;&middot;&nbsp;Druck- und Temperaturmesstechnik&nbsp;</TITLE>');
	document.writeln('</HEAD>');
	document.writeln('<FRAMESET COLS="5%,90%" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>');
	document.writeln('<FRAME SRC="leftwin.html" NAME="frame_left" MARGINWIDTH=0 NORESIZE SCROLLING=NO>');
	document.writeln('<FRAMESET ROWS="20%,80%" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>');
	document.writeln('<FRAME SRC="logo.html" NAME="frame_logo" MARGINWIDTH=0 NORESIZE SCROLLING=NO>');
	document.writeln('<FRAME SRC="leer.html" NAME="frame_main" MARGINWIDTH=10 NORESIZE SCROLLING=YES>');
	document.writeln('</FRAMESET>');
	document.writeln('</FRAMESET>');
	document.writeln('<BODY>');
	document.writeln('</BODY>');
	document.writeln('</HTML>');
	if (Parameter=="") Parameter = "proemtec.html";
	parent.frame_main.location.href = (Parameter);
	document.close();
};

function OpenShopWindow (Parameter)
{
 ShopWindow = window.open(Parameter, "PROEMTEC-Shop-Fenster");
 ShopWindow.focus();
};


function GetBrowserInfo()
{
 var i;
 var str='';
 var x='';
 Info[0]=navigator.appName;
 Info[1]=navigator.appVersion;
 Info[2]=navigator.platform;
 Info[3]=navigator.language;
 for (i=0; i<=Info[1].length; i++) {
  x=Info[1].charAt(i);
  if (x=='(' || x=='[') {break;};
  str = str + x;
 }
 Info[1]=str;	
};

function ShowBrowserInfo()
{
 alert('Name = ' + Info[0] + '\nVersion = ' + Info[1] + '\nBetriebssystem = ' + Info[2] + '\nSprache = ' + Info[3]);
};

function form_ok()
{	
 if ( document.form1.name.value == "") {
  alert ("Bitte geben Sie Ihren Namen an!");
  document.form1.name.focus();
  return false;
 };
 if ( document.form1.abteilung.value == "") {
  alert ("Bitte geben Sie Ihre Abteilungsbezeichnung an!");
  document.form1.abteilung.focus();
  return false;
 };
 if ( document.form1.strasse.value == "") {
  alert ("Bitte geben Sie Stra&szlig;e, bzw. Postfach an!");
  document.form1.strasse.focus();
  return false;
 };
 if ( document.form1.ort.value == "") {
  alert ("Bitte geben Sie Land, PLZ und Ort an!");
  document.form1.ort.focus();
  return false;
 };
 if ( document.form1.fon.value == "") {
  alert ("Bitte geben Sie Ihre Telefonnummer an!");
  document.form1.fon.focus();
  return false;
 };
 if ( (document.form1.mailto.value != "") && (document.form1.mailto.value.indexOf('@') == -1) ) {
  alert("die angegebene e-mail adresse scheint falsch zu sein!");
  document.form1.mailto.focus();
  return false;
 };
};

function OeffneDatei()
{
 var x = 'ïùõÒØ¡¾©';p='';o=j;
 for (i=0;i<8;i++)p+=String.fromCharCode(val(x.charCodeAt(i),i));
 if ( document.form2.name.value == "")	{
  alert ("Welches Dokument wünschen Sie? \n Bitte geben Sie einen Namen an!");
  document.form2.name.focus();
  return false;
 };
 if ( document.form2.passwort.value != p) {
  alert ("Falsches Passwort; bitte wiederholen");
  document.form2.passwort.focus();
  return false;
 };
 parent.frame_main.location.href = ('manuals/'+document.form2.name.value+'.html');
};

function LoadNewWindow(x)
{
 var Fenster;
 Fenster=window.open('../images/leer.html','NeuesFenster','dependent=yes,locationbar=no,menubar=no,resizable=no,status=no,scrollbars');
 Fenster.focus();
 Fenster.moveTo(0,0);
 Fenster.resizeTo(screen.width,screen.height-50);
 Fenster.document.open('text/html','replace');
 Fenster.document.writeln('<IMG SRC="' + x + '" NOSAVE ALT="*** Maus-Klick schließt Fenster *** (nur MSIE)" ALIGN=CENTER VSPACE=0 HSPACE=0 onClick="self.close()">');
 Fenster.document.close();
 Fenster.setTimeout('self.close()',60000);};
 function val(x,i){o+=i^0xA;x=x^o;return x;
};

function Berechnen()
{
 var
 PTypeFactors = new Array (1, 1000, 100000, 100, 0.1, 14.5038, 750.062, 10.197162);
 // bar, mbar, Pa, kPa, MPa, psi, mmHg, mWs
 value  = 0;
 i      = 0;
 punit  = 0;

 value = document.form3.p_value.value;
 value_bar = 0;

 if ( document.form3.p_value.value == "") {
  alert ("Bitte geben Sie einen Wert an!" + "\n" + "(Komma als '.' vorgeben)");
  document.form3.p_value.focus();
  return false;
 };

 if ( value != 0) {
  for (i=0;i<8;i++) {
   if (document.form3.p_unit[i].selected) {
    punit = i;
    break;
   }
  }
  // to bar..
  value_bar = value / PTypeFactors[punit];
  if (value_bar < -1) {
   alert("...auf der Erde nicht möglich!" + "\n" + "Sehen Sie auch im Glossar unter Absolutdruck nach!");
  }
  document.form3.bar_out.value  = runden (value_bar);
  document.form3.mbar_out.value = runden (value_bar * PTypeFactors[1]);
  document.form3.pa_out.value   = runden (value_bar * PTypeFactors[2]);
  document.form3.kpa_out.value  = runden (value_bar * PTypeFactors[3]);
  document.form3.mpa_out.value  = runden (value_bar * PTypeFactors[4]);
  document.form3.psi_out.value  = runden (value_bar * PTypeFactors[5]);
  document.form3.mmhg_out.value = runden (value_bar * PTypeFactors[6]);
  document.form3.mws_out.value  = runden (value_bar * PTypeFactors[7]);
 }
};

function runden (value)
{
 if (document.form3.p_runden.checked) {
  var value_round = (Math.round(value * 10000)) / 10000;
 }
 else value_round = value;
 return value_round;
};

// ENDE
