//**************************//
//* Cookie fuer Newsletter *//
//*************************//

var expDays = 2; 
// Anzahl der Tage, die das Cookie gültig sein soll
var page = "newsletter.html";
// Seite, die aufgerufen wird
var windowprops = "width=500,height=400,left=250,top=250,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes";
// Angabe über die neue Seite: Breite, Höhe, Ort, Aussehen

//Cookie bekommen:
function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}

// Cookie setzen:
function SetCookie (name, value) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}

// Cookie löschen:
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

// Überprüfung, ob Cookie schon da ist:
function amt(){
	var count = GetCookie('count')
	if(count == null) {
		SetCookie('count','1')
		return 1
	}
	else {
		var newcount = parseInt(count) + 1;
		DeleteCookie('count')
		SetCookie('count',newcount,exp)
		return count
    }
}

// Cookie-Wert auslesen: 
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

// Überprüfung, ob Cookie gesetzt:
function checkCount() {
	var count = GetCookie('count');
	// Wenn der Zähler Null ist, wird er auf 1 gesetzt,
	// das Cookie gesetzt und das neue Fenster geöffnet:
	if (count == null) {
		count=1;
		SetCookie('count', count, exp);
		window.open(page, "", windowprops);
	}
	// Anderenfalls wird nur der Zähler erhöht
	// und das Cookie überschrieben.
	else {
		count++;
		SetCookie('count', count, exp);
	}
}

//**************************//
//*       World Timer      *//
//*************************//




var hours
var shifthours
var minutes
var seconds
var localhours
var pause=2000
var thisplace
var i_worldtime=0
var timer

var worldtime = new Array()

worldtime[0]="Berlin,2"
worldtime[1]="Azores,-1"
worldtime[2]="Baghdad,4"
worldtime[3]="Buenos Aires,-3"
worldtime[4]="Chicago,-5"
worldtime[5]="Denver,-6"
worldtime[6]="Hong Kong,8"
worldtime[7]="Honolulu,-10"
worldtime[8]="Johannesburg,2"
worldtime[9]="Kairo,3"
worldtime[10]="Lima,-5"
worldtime[11]="London,1"
worldtime[12]="Los Angeles,-7"
worldtime[13]="Mexico City,-5"
worldtime[14]="Moscow,4"
worldtime[15]="New York,-4"
worldtime[16]="Paris,2"
worldtime[17]="Perth,8"
worldtime[18]="Sao Paulo,-3"
worldtime[19]="Sydney,10"
worldtime[20]="Tokyo,9"

function showtime() {
if (document.all) {
	thisplace=worldtime[i_worldtime].split(",")
	thistime= new Date()
	hours=thistime.getUTCHours()
	hours=eval(hours)
	shifthours=eval(thisplace[1])
	localhours=eval(shifthours+hours)
	if (localhours <0) {localhours=24+localhours}
	if (localhours >=24) {localhours=localhours-24}
	
	minutes=thistime.getUTCMinutes()
	seconds=thistime.getUTCSeconds()
	
	if (thisplace[0]=='Delhi') {
		minutes=eval(minutes+30)
		if (minutes>=60) {
			minutes=eval(minutes-60)
			localhours=eval(localhours+1)
		}
	}
	if (eval(minutes) < 10) {minutes="0"+minutes}
	if (eval(seconds) < 10) {seconds="0"+seconds}
	if (eval(localhours) < 10) {localhours="0"+localhours}
	thistime = localhours+":"+minutes+":"+seconds
	document.title=" ------ "+thistime+" --- >>> "+thisplace[0]+" <<< ---------------------------------"
	i_worldtime++
	if (i_worldtime>=worldtime.length) {
		i_worldtime=0
	}
	timer =setTimeout("showtime()",pause)
	}
}

if (document.all) {
	window.onload=showtime
}


//**************************//
//*   Newsletter Pop-up    *//
//*************************//

function neuesfenster() 
{
top.name = "main";
var popupURL = "newsletter.html";
var popup = window.open(popupURL,"neuesfenster",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=400,left=250,top=250,screenX=200,screenY=200');
// set the opener if it's not already set.  it's set automatically
// in netscape 3.0+ and ie 3.0+.
if( navigator.appName.substring(0,8) == "Netscape" )
{
popup.location = popupURL;
popup.opener = self;
}
}

//***************************//
//*  Frames im main laden   *//
//***************************//


/*
var neu = null;

function ProcessString(Str)
{
	ProcStr="";

	for(I=0;I<Str.length;I++)
	{
		if(    ((Str.charAt(I)>='a') && (Str.charAt(I)<='z'))
		    || ((Str.charAt(I)>='A') && (Str.charAt(I)<='Z'))
		    || ((Str.charAt(I)>='0') && (Str.charAt(I)<='9'))
		  )
			ProcStr+=Str.charAt(I);
		else
			if(Str.charAt(I)=='_')
				ProcStr+="__";
			else
				ProcStr+="_"+Str.charCodeAt(I)+"_";
	}

	return ProcStr;
}





var st= "test";

if (parent.frames.length>0) 
{
}

else

{
st=document.URL;
if (navigator.appName=='Netscape')

{window.name=ProcessString(st.substr(st.lastIndexOf("/")+1,st.length));
}

else

{window.name=ProcessString(st.substr(st.lastIndexOf("\\")+1,st.length));
}

;
self.location.href = "frameset.html";	

}

*/


//***************************//
/* Datum und Uhrzeit*/
//***************************//

/*
Wochentagname = new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");

function ZeitAnzeigen()
{
 var Jetzt = new Date(); var Tag = Jetzt.getDate();
 var Monat = Jetzt.getMonth() + 1; var Jahr = Jetzt.getYear();
 var Stunden = Jetzt.getHours(); var Minuten = Jetzt.getMinutes();
 var Sekunden = Jetzt.getSeconds(); var WoTag = Jetzt.getDay();
 var Vortag  = ((Tag < 10) ? "0" : "");
 var Vormon  = ((Monat < 10) ? ".0" : ".");
 var Vorstd  = ((Stunden < 10) ? "0" : "");
 var Vormin  = ((Minuten < 10) ? ":0" : ":");
 var Vorsek  = ((Sekunden < 10) ? ":0" : ":");
 var Datum = Vortag + Tag + Vormon + Monat  + "." + Jahr;
 var Uhrzeit = Vorstd + Stunden + Vormin + Minuten + Vorsek + Sekunden;
 var Gesamt = Wochentagname[WoTag] +"&nbsp;" +Datum +"&nbsp;" +Uhrzeit;

 if(document.all)
   document.all.MicrosoftUhr.innerHTML = Gesamt;
 else if(document.layers)
  {
   document.NetscapeUhr.document.open();
   Gesamt = '<span class="Uhr")>' + Gesamt + '</span>';
   document.NetscapeUhr.document.write(Gesamt);
   document.NetscapeUhr.document.close();
  }
 window.setTimeout("ZeitAnzeigen()",1000);}
 */
 
 
 
 
 //************************************//
 /* Uhrzeit in der Browsertitelleiste */
 //************************************//
 /*
 var name = document.title;

function doTheClock() {
   
   var a;
   
   a=new Date();
   t = new Date();
	lm_year=a.getYear();
	if (lm_year<1000){ 				//just in case date is delivered with 4 digits
		if (lm_year<70){
		lm_year=2000+lm_year;
		}
		else lm_year=1900+lm_year;
	}								//end workaround
	lm_month=a.getMonth()+1;
	if (lm_month<10){
		lm_month='0'+lm_month;
	}
	lm_day=a.getDate();
	if (lm_day<10){
		lm_day='0'+lm_day;
	}
	lm_hour=a.getHours();
	if (lm_hour<10){
		lm_hour='0'+lm_hour;
	}
	lm_minute=a.getMinutes();
	if (lm_minute<10){
		lm_minute='0'+lm_minute;
	}
	lm_second=a.getSeconds();
		if (lm_second<10){
		lm_second='0'+lm_second;
	}   
   if(document.all || document.getElementById){
      document.title = lm_hour+':'+lm_minute+':'+lm_second + ' - ' + name+ " - ";
   }else{   
      self.status = lm_hour+':'+lm_minute+':'+lm_second +  ' - ' + name+ " - ";
	  }
   window.setTimeout( 'doTheClock()', 1000 );
   
}
doTheClock();
*/

//*******************************//
//**      Script Basket       ** //
//******************************//
/*
function showItems() {
                var tablerowcolor = '#000000';
                index = document.cookie.indexOf("TheBasket");
		countbegin = (document.cookie.indexOf("=", index) + 1);
        	countend = document.cookie.indexOf(";", index);
        	if (countend == -1) {
            		countend = document.cookie.length;
        	}
		fulllist = document.cookie.substring(countbegin, countend);
		totprice = 0;
		document.writeln('<FORM NAME="updateform">');
		document.writeln('<div align="left">');
		document.writeln('<TABLE WIDTH=100% BORDER=0 CELLPADDING="2">');
		document.writeln('<TR BGCOLOR="#000000"><TD><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Artikel</FONT></b></TD><TD align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Menge</FONT></b></TD><TD align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Einzelpreis</FONT></b></TD><td align="right"><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Gesamtpreis</FONT></b></TD><TD>&nbsp;</TD></TR>');
// Nun die horizontale Linie:
		document.writeln('<TR BGCOLOR="000000"><TD colspan="5"><HR></TD></TR>');

		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
				thisitem = 1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				thequantity = fulllist.substring(itemstart, itemend);
				itemtotal = 0;
				itemtotal = (eval(theprice*thequantity));
				temptotal = itemtotal * 100;
				totprice = totprice + itemtotal;
				itemlist=itemlist+1;
				document.write('<tr valign="top"BGCOLOR="'+tablerowcolor+'"><td><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+theitem+'</FONT></td>');

				document.write('<td valign="top" align="right"><INPUT TYPE=TEXT NAME="quant'+itemlist+'" VALUE="'+thequantity+'" SIZE=3></td><td valign="top" align="right"><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+theprice+'</FONT></td><td valign="top" align="right"><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>'+top.menu.alterError(itemtotal)+'</FONT></td><td  align="center" valign="top"><a href="javascript:removeItem('+itemlist+')"><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Entfernen</FONT></a>&nbsp;<a href="javascript:amendItem('+itemlist+',document.updateform.quant'+itemlist+'.value)"><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Aktualisieren</FONT></a></td></tr>');

                                if (tablerowcolor == '#000000') {
                                  tablerowcolor = "#000000";
                                } else {
                                  tablerowcolor = "#000000";
                                }



			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) theprice = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}



		}

        document.writeln('<TR BGCOLOR="#000000"><TD colspan="5"><HR></TD></TR>');
		document.writeln('<tr BGCOLOR="#000000"><td colspan=3><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>Total</FONT></b></td><td align=right><b><FONT FACE="Verdana,Arial,Helvetica" SIZE=-1>DM '+top.menu.alterError(totprice)+'</FONT></b></td><td>&nbsp;</td></tr>');
		document.writeln('</TABLE><cr>');
		document.writeln('</div>');
		document.writeln('</FORM>');
	}

	function amendItem(itemno, newquant) {
		newItemList = null;
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				thisitem = 1;
				itemstart = i+1;
				fullstart = i+1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				itemlist=itemlist+1;
				if (itemlist != itemno) {
					newItemList = newItemList+'['+fulllist.substring(fullstart, itemend)+']';
				} else {
					newItemList = newItemList + '['+theitem+'|'+theprice+'|'+newquant+']';
				}
			} else if (fulllist.substring(i,i+1) == '|') {
				if (thisitem==1) theitem = fulllist.substring(itemstart, i);
				if (thisitem==2) theprice = fulllist.substring(itemstart, i);
				thisitem++;
				itemstart=i+1;
			}
		}
		index = document.cookie.indexOf("TheBasket");
		document.cookie="TheBasket="+newItemList;
		self.location = "basket.html";

	}

	function removeItem(itemno) {
		newItemList = null;
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) {
			if (fulllist.substring(i,i+1) == '[') {
				itemstart = i+1;
			} else if (fulllist.substring(i,i+1) == ']') {
				itemend = i;
				theitem = fulllist.substring(itemstart, itemend);
				itemlist=itemlist+1;
				if (itemlist != itemno) {
					newItemList = newItemList+'['+fulllist.substring(itemstart, itemend)+']';
				}
			}
		}
		index = document.cookie.indexOf("TheBasket");
		document.cookie="TheBasket="+newItemList;
		self.location = "basket.html";
	}

	// clearBasket() - removes all items from the basket
	function clearBasket() {
		if (confirm('Möchten Sie wirklich alle Artikel aus dem Einkaufswagen entfernen?')) {
			index = document.cookie.indexOf("TheBasket");
			document.cookie="TheBasket=.";
			self.location = "basket.html";
		}
	}






//*********
var neu = null;

function ProcessString(Str)
{
	ProcStr="";

	for(I=0;I<Str.length;I++)
	{
		if(    ((Str.charAt(I)>='a') && (Str.charAt(I)<='z'))
		    || ((Str.charAt(I)>='A') && (Str.charAt(I)<='Z'))
		    || ((Str.charAt(I)>='0') && (Str.charAt(I)<='9'))
		  )
			ProcStr+=Str.charAt(I);
		else
			if(Str.charAt(I)=='_')
				ProcStr+="__";
			else
				ProcStr+="_"+Str.charCodeAt(I)+"_";
	}

	return ProcStr;
}





var st= "test";

if (parent.frames.length>0) 
{
}

else

{
st=document.URL;
if (navigator.appName=='Netscape')

{window.name=ProcessString(st.substr(st.lastIndexOf("/")+1,st.length));
}

else

{window.name=ProcessString(st.substr(st.lastIndexOf("\\")+1,st.length));
}

;
self.location.href = "index.html";	

}

*/
