
// ##################
// Windows functions
// ##################
function Confirm( okurl, notokurl, text )
{
	CheckBox=confirm(text);
	if (CheckBox==true)
	{
		window.location = okurl;
	}
	else
	{
		window.location = notokurl;
	}
	return;
}

function PopupWindow( url, name )
{
	myPopup = open( url, name, "top=150,left=150,width=490,height=450,toolbar=no,locationbar=no,menubar=no,scrollbars=no" );
	myPopup.focus();
	return myPopup;
}


function PopupWindowAdv( url, name)
{
	var height;
	var width;
	width=495;
	height=530;
//	myPopup = open( url, name, "top=150,left=150,width=" + width + ",height=" + height + ",toolbar=no,locationbar=no,menubar=no,scrollbars=no" );
	myPopup = open( url, name, "top=150,left=150,width=" + width + ",height=" + height + ",toolbar=no,locationbar=no,menubar=no,scrollbars=yes,resizable=yes" );
	myPopup.focus();
	return myPopup;
}

function PopupWindowWizard( url, name)
{
	var height;
	var width;
	width=495;
	height=600;
	myPopup = open( url, name, "top=150,left=150,width=" + width + ",height=" + height + ",toolbar=no,locationbar=no,menubar=no,scrollbars=yes,resizable=yes" );
	myPopup.focus();
	return myPopup;
}


function PopupWindow2( url, name, w, h )
{
	myPopup = open( url, name, "top=150,left=150,width=" + w + ",height=" + h + ",toolbar=no,locationbar=no,menubar=no,scrollbars=yes" );
	myPopup.focus();
	return myPopup;
}


function PopupWindow3( url, name, w, h )
{
	myPopup = open( url, name, "top=150,left=150,width=" + w + ",height=" + h + ",toolbar=no,locationbar=no,menubar=no,resizable=yes" );
	myPopup.focus();
	return myPopup;
}


function PopupWindow4( url, name )
{
	myPopup = open( url, name, "top=150,left=150,width=490,height=450,toolbar=no,locationbar=no,menubar=no,scrollbars=yes" );
	myPopup.focus();
	return myPopup;
}

function faqwindow(faq)
{
    fenster = open(faq,"windowsmall","width=600,height=540,toolbar=no,locationbar=no,menubar=no,scrollbars=default,resizable=yes")
  fenster.focus();
}

function IsPlayerOk()
{
	var agt = navigator.userAgent.toLowerCase();
	var isOpera = (agt.indexOf("opera")!=-1);

	if (isOpera == true)
	{
		if ((opener == null) && (document.referrer.length == 0))
		{
			return false;
			//alert("Opera...kein Sound");
//			return;
		}
		return;
	}

	if( window.menubar ) 
	{
		if( window.menubar.visible==true ) 
		{
			if 	(!((opener == null) && (document.referrer.length != 0))) 
			{
				return false;
//				alert("Kein Sound! \nEinbindung nicht ok: Mozilla/NS mit Menubar");
//				return;
			}
		}
		return;

	}

	if (((opener != null) && (document.referrer.length != 0)) ||
	   ((opener == null) && (document.referrer.length == 0)))
		{
			return false;
//			return alert( "Kein Sound!! \nIE Einbindung nicht ok!");
//			return;
		}
	
}

// ##################
// TimeZone functions
// ##################

//function calculateTimezoneOffset(servertime)
//{
// var dd = new Date();
// var localtime = dd.getTime();
// difference
// var diff = (localtime - servertime) / 60000;
// runde auf volle Stunden:
// diff = diff + 30;
// diff = diff - ( diff % 60 );
// return diff * 60000;
//}

function getTimezoneOffset()
{
 var dd = new Date();
 return dd.getTimezoneOffset() * 60000;
}
 
// store offset between server and local time
//var timezoneOffset = calculateTimezoneOffset(1005732591812 - 120 * 24 * 3600 * 1000);;
// use JavaScripts build-in function to calculate time zone
var glTimezoneOffset = getTimezoneOffset();

// serverDate
// serverToLocalTime(settime)
// settime should be in seconds
function svr2LT(settime)
{
 var dd = new Date();
 dd.setTime(1000*settime);
 return dd;
}

//document.Startseite.TimeZone.value = glTimezoneOffset;

// function wt 
// write the actual time hh:mm
function wt(dd)
{
 var hh = dd.getHours();
 if( hh<10 ) document.write("0", hh);
 else document.write( hh );
 var min = dd.getMinutes();
 if( min<10 ) document.write(":0", min);
 else document.write(":", min);
 return true;
}

// return actual time + seconds
function fTime(dd)
{
 var result = "";
 var hh = dd.getHours();
 if( hh<10 ) result += "0" + hh;
 else result +=  hh;
 var min = dd.getMinutes();
 if( min<10 ) result += ":0"+min;
 else result+=":"+min;
 var sec = dd.getSeconds();
 if( sec<10 ) result += " 0"+sec;
 else result+=" "+sec;
 return result;
}

// function wt 
// write the actual time hh:mm
function wd2test(dd, br)
{
  // test: is it today?
  var today = new Date();
  if( (dd.getDate() != today.getDate()) 
    || (dd.getMonth() != today.getMonth())
    || (dd.getFullYear() != today.getFullYear()) )
   {
     if( br ) {
     	document.write( "<br>" );
     }
     wd2(dd);
   }
 return true;
}

// function wd1(dd)
// write the actual date in format wday, dd. Monthname
function wd1(dd) {
  var weekday = new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");
  var monthday = new Array("Januar","Februar","M&auml;rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");
  // write weekday
  document.write( weekday[dd.getDay()]+", "+dd.getDate()+". "+monthday[ dd.getMonth() ] );
  // check year
  var today = new Date();
  if( today.getFullYear() != dd.getFullYear() )
    document.write( " ", dd.getFullYear() );
  return true;
}

// function wd1(dd)
// write the actual date in format 00.00.01
function wd2(dd) {
  // write weekday
  var i = dd.getDate();
  if( i< 10 ) document.write( "0", i );
  else document.write( i );
  i = dd.getMonth()+1;
  if( i< 10 ) document.write( ".0", i );
  else document.write( ".", i );
  i = dd.getFullYear();
  document.write( ".", i );
  return true;
} 


function wd2l(dd,lan) {
  var d, m, y, sep;
  // write weekday
  d = dd.getDate();
  m = dd.getMonth()+1;
  y = dd.getFullYear();

  if (lan == 1)
  {
	if( d< 10 ) document.write( "0", d );
	else document.write( d );
	if( m< 10 ) document.write( ".0", m );
	else document.write( ".", m );
	document.write( ".", y );
  }
  else
  {
	if( m< 10 ) document.write( "0", m );
	else document.write( m );
	if( d< 10 ) document.write( "/0", d );
	else document.write( "/", d );
	document.write( "/", y );
  }
	return true;
} 


function printDate(dd)
{
 document.write( dd );
 return true;
}


function wdt(dd)
{
	// document.write(dd.toLocaleDateString());  // gibt in lokalen Langformat aus
	var ActDate = wd1(dd);
    document.write(" - ");	
	var ActTime = wt(dd);
}

function wdtl(dd)
{
//	document.write(dd.toLocaleDateString()," - ", dd.toLocaleTimeString());
}

function PrintHeadline(text)
{
	var part1 = '<br><br><table width="100%" border=0 cellspacing=0 cellpadding=0 ID="Table1"><tr><td width=1><img src="i/s.gif" alt="" width=1 height=1></td><td class=do><img src="i/s.gif" width=1 height=1></td><td width=1><img src="i/s.gif" width=1 height=1></td></tr></table><table width="100%" border=0 cellspacing=0 cellpadding=0 ID="Table2"><tr><td width=1 class=do height="14"><img src="i/s.gif" width=1 height=1></td><td class=o><img src="i/s.gif" width=1 height=1> <b>';
	var part2 = '</b></td><td width=1 class=do><img src="i/s.gif" alt="" width=1 height=1></td></tr></table><table width="100%" border=0 cellspacing=0 cellpadding=0 ID="Table3"><tr><td width=1 class=do><img src="i/s.gif" width=1 height=1></td><td class=o><img src="i/s.gif" width=1 height=1></td><td width=1 class=do><img src="i/s.gif" width=1 height=1></td></tr></table><table width="100%" border=0 cellspacing=0 cellpadding=0 ID="Table4"><tr><td width=1><img src="i/s.gif" width=1 height=1></td><td class=do><img src="i/s.gif" width=1 height=1></td><td width=1><img src="i/s.gif" width=1 height=1></td></tr></table>';
	document.write(part1 + text + part2);
}

// This funtcion detects (value = true) if the enter-key has been pressed
function IsEnter(my, e) {
    var keycode;
    if (window.event)   // IE
    {
        keycode = e.keyCode;
    }
    else if (e)         // Mozilla
    {
        keycode = e.which;
    }
    else
    {
        keycode = 0;
    }
    if (keycode == 13) // Enter-Key
    {
        return true;
    }
    else
    {
        return false;
    }
}





