var font_timelimit = 1;
var time_unit = 'hours';
var efa_default = 83;
var efa_increment = 10;
var efa_bigger = ['','<img src="templates/10006-red-bt-t3-hs-seo/img/icons/16b_zoomIn.gif" alt="Bigger Fontsize" />','Schrift gr&ouml;sser','', '', '', '', '', '', '', '' ]
var efa_reset = ['','<img src="templates/10006-red-bt-t3-hs-seo/img/icons/16b_normal.gif" alt="Default Fontsize" />','Schriftgr&ouml;&szlig;e normal', '', '', '', '', '', '', '', '' ]
var efa_smaller = ['','<img src="templates/10006-red-bt-t3-hs-seo/img/icons/16b_zoomOut.gif" alt="Smaller Fontsize" />','Schrift kleiner', '', '', '', '', '', '', '', '' ]
var expires = getExpiration(font_timelimit, time_unit);

function Efa_Fontsize(increment, bigger, reset, smaller, def) {
	this.w3c = (document.getElementById);
	this.ms = (document.all);
	this.userAgent = navigator.userAgent.toLowerCase();
	this.isOldOp = ((this.userAgent.indexOf('opera') != -1) && (parseFloat(this.userAgent.substr(this.userAgent.indexOf('opera') + 5)) <= 7));
	
	if ((this.w3c || this.ms) && !this.isOldOp && !this.isMacIE) {
		this.name = "efa_fontSize";
		this.cookieName = 'efaSize';
		this.increment = increment;
		this.def = def;
		this.defPx = Math.round(16 * (def / 100));
		this.base = 1;
		this.pref = this.getPref();
		this.testHTML = '<div id="efaTest" style="position:absolute;visibility:hidden;line-height:1em;">&nbsp;<\/div>';
		this.biggerLink = this.getLinkHtml(1, bigger);
		this.resetLink = this.getLinkHtml(0, reset);
		this.smallerLink = this.getLinkHtml(-1, smaller);
	} else {
		this.biggerLink = '';
		this.resetLink = '';
		this.smallerLink = '';
		this.efaInit = new Function('return true;');
	}
	this.allLinks = this.biggerLink + this.resetLink + this.smallerLink;
}
Efa_Fontsize.prototype.efaInit = function() {
	document.writeln(this.testHTML);
	this.body = (this.w3c) ? document.getElementsByTagName('body')[0].style : document.all.tags('body')[0].style;
	this.efaTest = (this.w3c) ? document.getElementById('efaTest') : document.all['efaTest'];
	var h = (this.efaTest.clientHeight) ? parseInt(this.efaTest.clientHeight) : (this.efaTest.offsetHeight) ? parseInt(this.efaTest.offsetHeight) : 999;
	if (h < this.defPx)this.base = this.defPx / h;
	this.body.fontSize = Math.round(this.pref * this.base) + '%';
}
Efa_Fontsize.prototype.getLinkHtml = function(direction, properties) {
	var html = properties[0] + '<a href="#" onclick="efa_fontSize.setSize(' + direction + '); return false;"';
	html += (properties[2]) ? 'title="' + properties[2] + '"' : '';
	html += (properties[3]) ? 'class="' + properties[3] + '"' : '';
	html += (properties[4]) ? 'id="' + properties[4] + '"' : '';
	html += (properties[5]) ? 'name="' + properties[5] + '"' : '';
	html += (properties[6]) ? 'accesskey="' + properties[6] + '"' : '';
	html += (properties[7]) ? 'onmouseover="' + properties[7] + '"' : '';
	html += (properties[8]) ? 'onmouseout="' + properties[8] + '"' : '';
	html += (properties[9]) ? 'onfocus="' + properties[9] + '"' : '';
	return html += '>' + properties[1] + '<' + '/a>' + properties[10];
}
// get the saved preferences out of the cookie, if any
Efa_Fontsize.prototype.getPref = function() {
	var pref = this.getCookie(this.cookieName);
	if (pref)
		return parseInt(pref);
	else
		return this.def;
}
Efa_Fontsize.prototype.setSize = function(direction) {
	this.pref = (direction) ? this.pref + (direction * this.increment) : this.def;
	this.setCookie(this.cookieName, this.pref, expires);
	this.body.fontSize = Math.round(this.pref * this.base) + '%';
}
Efa_Fontsize.prototype.getCookie = function(cookieName) {
	var cookie = get_cookie(cookieName);
	return (cookie) ? cookie : false;
}
Efa_Fontsize.prototype.setCookie = function(cookieName, cookieValue, expires) {
	return set_cookie(cookieName, cookieValue, expires);
}
function getExpiration(expiration, units) {
	expiration = (expiration) ? expiration : 7;
	units = (units) ? units : 'days';
	var date = new Date();
	switch (units) {
	case 'years':
		date.setFullYear(date.getFullYear() + expiration);
		break;
	case 'months':
		date.setMonth(date.getMonth() + expiration);
		break;
	case 'days':
		date.setTime(date.getTime() + (expiration * 24 * 60 * 60 * 1000));
		break;
	case 'hours':
		date.setTime(date.getTime() + (expiration * 60 * 60 * 1000));
		break;
	case 'minutes':
		date.setTime(date.getTime() + (expiration * 60 * 1000));
		break;
	case 'seconds':
		date.setTime(date.getTime() + (expiration * 1000));
		break;
	default:
		date.setTime(date.getTime() + expiration);
		break;
	}
	// return expiration as GMT string
	return date;
}

var dbug = 0;
function d_a(ary) {
	var beg = next_entry(ary) - 1;
	for ( var i = beg; i > -1; i--) {
		ary[i] = null;
	}
}
function init_array() {
	if (dbug)
		alert('init_cookie');
	var ary = new Array(null);
	return ary;
}
function set_cookie(name, value, expires) {
	if (dbug)
		alert('set_cookie');
	if (!expires)
		expires = new Date();
	document.cookie = name + '=' + escape(value) + '; expires='
			+ expires.toGMTString() + '; path=/';
}
function get_cookie(name) {
	if (dbug)
		alert('get_cookie');
	var dcookie = document.cookie;
	var cname = name + "=";
	var clen = dcookie.length;
	var cbegin = 0;
	while (cbegin < clen) {
		var vbegin = cbegin + cname.length;
		if (dcookie.substring(cbegin, vbegin) == cname) {
			var vend = dcookie.indexOf(";", vbegin);
			if (vend == -1)
				vend = clen;
			return unescape(dcookie.substring(vbegin, vend));
		}
		cbegin = dcookie.indexOf(" ", cbegin) + 1;
		if (cbegin == 0)
			break;
	}
	return null;
}
function del_cookie(name) {
	if (dbug)
		alert('del_cookie');
	document.cookie = name + '=' + '; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';
}
function get_array(name, ary) {
	if (dbug)
		alert('get_array');
	d_a(ary);
	var ent = get_cookie(name);
	if (ent) {
		i = 1;
		while (ent.indexOf('^') != '-1') {
			ary[i] = ent.substring(0, ent.indexOf('^'));
			i++;
			ent = ent.substring(ent.indexOf('^') + 1, ent.length);
		}
	}
}
function set_array(name, ary, expires) {
	if (dbug)
		alert('set_array');
	var value = '';
	for ( var i = 1; ary[i]; i++) {
		value += ary[i] + '^';
	}
	set_cookie(name, value, expires);
}
function del_entry(name, ary, pos, expires) {
	if (dbug)
		alert('del_entry');
	var value = '';
	get_array(name, ary);
	for ( var i = 1; i < pos; i++) {
		value += ary[i] + '^';
	}
	for ( var j = pos + 1; ary[j]; j++) {
		value += ary[j] + '^';
	}
	set_cookie(name, value, expires);
}
function next_entry(ary) {
	if (dbug)
		alert('next_entry');
	var j = 0;
	for ( var i = 1; ary[i]; i++) {
		j = i
	}
	return j + 1;
}
function debug_on() {
	dbug = 1;
}
function debug_off() {
	dbug = 0;
}
function dump_cookies() {
	if (document.cookie == '')
		document.write('No Cookies Found');
	else {
		thisCookie = document.cookie.split('; ');
		for (i = 0; i < thisCookie.length; i++) {
			document.write(thisCookie[i] + '<br\/>');
		}
	}
}
var efa_fontSize = new Efa_Fontsize(efa_increment, efa_bigger, efa_reset,
		efa_smaller, efa_default);

// SOF: COMFORTCARD NEU-ANTRAG
function Fenstername() {
	this.name = 'musikschmidt';
	this.url_real = 'https://www.comfort-card.de/';
	this.url_test = 'https://62.156.189.164/';
	this.antrag_dir = 'ComfortWebPlus/onlineAntrag/main.jsp';
	this.antrag_url = url_real + antrag_dir;
	this.v_nr_test = '0050510'; // Laden
	this.v_nr_real = '0050512'; // Netshop
	this.VertragspartnerNummer = 'Vertragspartner-Nummer=' + v_nr_real;
	this.req_type = 'req_type=1';
	this.command = 'command=netshoplogin';
	this.windowName = 'windowName=' + this.name
	// nur bei req_type 2 & 3 erforderlich:
	this.goodscode = 'goodscode=';
	this.gesamtbetrag = 'gesamtbetrag=';
	this.netshop_success_url = 'netshop_success_url=http://www.musik-schmidt.de/osc-schmidt/catalog/info_pages.php?pages_id=30';
	this.netshop_fail_url = 'netshop_fail_url=http://www.musik-schmidt.de/osc-schmidt/catalog/info_pages.php?pages_id=31';
	this.antragOutput = antrag_url + '?' + VertragspartnerNummer + '&' + req_type + '&' + command + '&' + windowName + '&' + netshop_success_url + '&' + netshop_fail_url + '&' + goodscode + '&' + gesamtbetrag;
	this.antrag_php = 'comfort_antrag_edit.php';
}
Fenstername();
function openNeuAntrag() {
	comfortcard = window.open(antragOutput,'comfortcard','width=' + screen.width + ',height=' + screen.height + ',menubar=0,location=no,resizable=yes, status=0,scrollbars=yes,screenX=0,screenY=0,left=0,top=0');
	setTimeout("comfortcard.focus()", 1000);
	comfortcard.moveTo(0, 0);
}
function openBeispielRechnung() {
	BeispielRechnung = window.open('https://www.comfort-card.de/ComfortWebPlus/beispielRechnungBudgetRatenkauf.jsp','BeispielRechnung','width=480,height=640,menubar=0,location=no,resizable=yes, status=0, scrollbars=yes, screenX=0,screenY=0');
	setTimeout("BeispielRechnung.focus()", 1000);
	BeispielRechnung.moveTo(screen.width / 2 - 500 / 2, screen.height / 2 - 640 / 2);
}
// EOF: COMFORTCARD NEU-ANTRAG

// SOF: Opening Browser-Windows the unobtrusive way by Dirk Ginader
// (www.ginader.de)
this.PopUp = function(autoapply) {
	this.types = [];
	this.defaults = {
		width : 800,
		height : 600,
		top : 0,
		left : 0,
		location : false,
		resizable : false,
		scrollbars : false,
		status : false,
		toolbar : false,
		menubar : false,
		center : true,
		title : "Dieser Link wird in einem neuen Fenster geöffnet"
	}
	this.addType( {
		name : "standard",
		location : true,
		resizable : true,
		scrollbars : true,
		status : true,
		toolbar : true,
		menubar : true
	});
	if (autoapply)
		this.apply();
}
this.o = PopUp.prototype;
o.apply = function() {
	var links = document.getElementsByTagName("a");
	if (!links)
		return;
	for ( var i = 0; i < links.length; i++) {
		var l = links[i];
		if (l.className.indexOf("popup") > -1) {
			this.attachBehavior(l, this.getType(l));
		}
	}
}
o.addType = function(type) {
	for ( var prop in this.defaults) {
		if (type[prop] == undefined)
			type[prop] = this.defaults[prop];
	}
	this.types[type.name] = type;
}
o.getType = function(l) {
	for ( var type in this.types) {
		if (l.className.indexOf(type) > -1)
			return type;
	}
	return "standard";
}
o.attachBehavior = function(l, type) {
	var t = this.types[type];
	l.title = t.title;
	l.popupProperties = {
		type : type,
		ref : this
	};
	l.onclick = function() {
		this.popupProperties.ref.open(this.href, this.popupProperties.type);
		return false;
	}
}
o.booleanToWord = function(bool) {
	if (bool)
		return "yes";
	return "no";
}
o.getTopLeftCentered = function(typeObj) {
	var t = typeObj;
	var r = {
		left : t.left,
		top : t.top
	};
	var sh = screen.availHeight - 20;
	var sw = screen.availWidth - 10;
	if (!sh || !sw)
		return r;
	r.left = (sw / 2) - (t.width / 2);
	r.top = (sh / 2) - (t.height / 2);
	return r;
}
o.getParamsOfType = function(typeObj) {
	var t = typeObj;
	var c = this.booleanToWord;
	if (t.center) {
		var tc = this.getTopLeftCentered(typeObj);
		t.left = tc.left;
		t.top = tc.top;
	}
	var p = "width=" + t.width;
	p += ",height=" + t.height;
	p += ",left=" + t.left;
	p += ",top=" + t.top;
	p += ",location=" + c(t.location);
	p += ",resizable=" + c(t.resizable);
	p += ",scrollbars=" + c(t.scrollbars);
	p += ",status=" + c(t.status);
	p += ",toolbar=" + c(t.toolbar);
	p += ",menubar=" + c(t.menubar);
	return p;
}
o.open = function(url, type) {
	if (!type)
		type = "standard";
	var t = this.types[type];
	var p = this.getParamsOfType(t);
	var w = window.open(url, t.name, p);
	if (w)
		w.focus();
	return false;
}

window.onload = function() { // Better use use a modern onDomReady-Event instead
	if (document.getElementById && document.getElementsByTagName) { // DOM available?
		this.popup = new PopUp();
		popup.addType( {
			name : "shippingPop",
			width : 640,
			height : 600,
			resizable : true,
			center : true,
			scrollbars : true,
			title : "Versandkosten"
		});
		popup.addType( {
			name : "printOrder",
			width : 640,
			height : 600,
			resizable : true,
			center : true,
			title : "Print"
		});
		popup.addType( {
			name : "image",
			width : 300,
			height : 200,
			resizable : true,
			center : true,
			scrollbars : true,
			toolbar : false,
			title : "Image"
		});
		popup.addType( {
			name : "info",
			width : 640,
			height : 600,
			resizable : true,
			center : true,
			scrollbars : true,
			title : "Info"
		});
		popup.apply();
		// popup.open("http://www.webkrauts.de");
		// popup.open("http://www.webkrauts.de","extern");
	}
}
// EOF: Opening Browser-Windows the unobtrusive way by Dirk Ginader (www.ginader.de)

