<!--
/* Shop */
function adresseanders() {
	if(document.formular.geschenk.checked) {
		document.formular.liefisrech[1].checked = true;
	}
}	
	
function close_focus() {
	window.close();
	opener.focus();
}
	
function go_rez() {
	opener.focus();
}

function OpenCertDetails() {
	thewindow = window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=ATFALT2-5X', 'thawte', config='height=400,width=500,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
}

function OpenShop(url) {
		NewWindow=window.open(url,"shop","resizable=1,location=0,directories=0,status=1,menubar=0,scrollbars=1,toolbar=0,width=782,height=500");
		NewWindow.focus();
}

function popup(theURL,width,height) {
	window.open(theURL,'popup','toolbar=no,location=no,directories=no,status=0,menubar=no,scrollbars=auto,resizable=yes,width=' + width + ',height=' + height + ',left=300,top=100');
}

function print_close() {
	window.print();
	window.close();
}

function close_back(theURL) {
	opener.location.href = theURL;
	window.close();
}

/* Abo */
function OpenNewWindow(WindowPicture,WindowParameters)
	{
	NewWindow=window.open("","NewOne", "resizable=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,toolbar=0,width=620,height=510");
	NewWindow.document.write ('<html><head><title>');
	NewWindow.document.write ('Falter. Wir holen dich da raus.');
	NewWindow.document.write ('</title></head>');
	NewWindow.document.write ('<body bgcolor="#ffffff">');
	NewWindow.document.write ('<link rel="stylesheet" href="./../_style/zeitung.css" type="text/css">');
	NewWindow.document.write ('<table width="100%" height="100%" border="0">');
	NewWindow.document.write ('<tr><td><div style="text-align:center;">');
	NewWindow.document.write ('<img src="');
	NewWindow.document.write (WindowPicture);
	NewWindow.document.write ('"><br><br>');
	NewWindow.document.write ('<a href="JavaScript:this.close()">');
	NewWindow.document.write ('Fenster schlie&szlig;en');
	NewWindow.document.write ('</a>');
	NewWindow.document.write ('</div></td></tr></table>');
	NewWindow.document.write ('</body></html>');
	NewWindow.document.close();
	return false;
	}

function emptyShopSearchFields() {
  var myForm = document.getElementById('searchForm');
  for (var i=0; i< myForm.elements.length; i++) {
  	var element = myForm.elements[i];
    if (element.type != 'button' && element.type != 'submit' && element.type != 'reset') myForm.elements[i].value = "xxx"; 
		if (element.type == 'checkbox') element.checked = false;
  }
  document.getElementById('publisher').value = 'xxx';
  document.getElementById('publisher_id').selectedIndex = 0;
}

function clearControls(form) {	
	if (typeof form == 'string') form = document.getElementById(form);
	if (form) {
		for (var i = 0; i < form.elements.length > 0; i++) {
			var el = form.elements[i];
			if (el.type == 'text') el.value = '';
			if (el.type == 'textarea') el.value = '';
			if (el.type == 'select-one') el.selectedIndex = 0;
			if (el.type == 'checkbox') el.checked = false;
			if (el.type == 'hidden') el.value = '';
			if (el.type == 'checkbox') el.style.border = '0';
		}
	}
}

function calcBundle() {
	var summe = '0';
	var anz = '0';
	var form = document.getElementById('formBundle');
	var artikelanz = form.elements.length;
	if (form) { 
		for (var i = 0; i < artikelanz; i++) {
			var el = form.elements[i];
			if (el.type && el.type == 'checkbox' && el.checked) {
				var id = el.id.substr(3);
				var wert = document.getElementById('preis_' + id).firstChild.nodeValue;
				if (wert) summe = parseInt(summe) + parseInt(wert);
				anz++;
			}
		}
		var gessumme = summe / 100;
		document.getElementById('sumBundle').firstChild.nodeValue = gessumme.toFixed(2);
		var minpcs = document.getElementById('minpcs');
		if (minpcs && minpcs != '') {
			var anzminpcs = document.getElementById('minpcs').firstChild.data;
			if (anz >= anzminpcs) {
				document.getElementById('wk').style.display = 'block';
				document.getElementById('errortext').style.display = 'none';
			} else {
				document.getElementById('wk').style.display = 'none';
				document.getElementById('errortext').style.display = 'block';
			}
		}
		var mincent = document.getElementById('mincent');
		if (mincent && mincent != '') {
			var anzmincent = document.getElementById('mincent').firstChild.data;
			if (summe >= anzmincent) {
				document.getElementById('wk').style.display = 'block';
				document.getElementById('errortext').style.display = 'none';
			} else {
				document.getElementById('wk').style.display = 'none';
				document.getElementById('errortext').style.display = 'block';
			}
		}
	}
}

function markAll(FormName,FieldNamePrefix) {
	var allChecked = false;
	var el = document[FormName];
	for (i=0; i< el.elements.length; i++)
		if (el.elements[i].type == "checkbox" && el.elements[i].name.indexOf(FieldNamePrefix) >= 0)
			el.elements[i].checked = (allChecked) ? false : true;
	allChecked  = (allChecked) ? false : true;
}

function clearField(FormName,FieldName) {
	document.forms[FormName].elements[FieldName].value = '';
}

function emptyFields() {
  var myForm = document.getElementById('searchForm');
  for (var i=0; i< myForm.elements.length; i++) {
  	var element = myForm.elements[i];
    if (element.type != 'button' && element.type != 'submit') myForm.elements[i].value = "";
	if (element.type == 'checkbox') element.checked = false;
  }
  document.getElementById('datum').selectedIndex = 0;
  document.getElementById('bdsland').selectedIndex = 0;
}

function markPresent() {
	document.orderform.shipping_id[1].checked = true;
}
function markGift() {
	document.orderForm.apart[1].checked = true;
}
function unmarkGift() {
	document.orderForm.gift.checked = false;
}

function getBack() {
	document.orderForm.back.value = 'y';
	orderForm.submit();	
}

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);


//->
