var root = 'http://www.gutscheine-von-a-z.de/';
var arr = new Array();
var ld = new Image();
ld.src = root+'p.gif';
document.onkeydown = function(event) { if (event.keyCode == 27) clnAll();}
function shwBx(w,h,nod,dat,mod) {
bg = document.createElement('div');
bg.style.cssText = 'position:fixed; z-index:10; top:0px; left:0px; width:100%; height:100%; background-color:#000000; opacity:0.8; filter: alpha(opacity=80)';
nod.appendChild(bg);
bx = document.createElement('div');
bx.style.cssText = 'position:fixed; z-index:11; top:100px; width:'+w+'px; height:'+h+'px; left:50%; margin-left:-'+(w/2)+'px; background-color:#FFFFFF; opacity:1; filter: alpha(opacity=100); padding:7px;';
nod.appendChild(bx);
if (mod == 'text') {
tx = document.createTextNode(dat);
bx.appendChild(tx);
}
else bx.innerHTML = dat;
arr.push(bg);
arr.push(bx);
return bx;
}
function shwLd() {
ld.style.cssText = 'position:fixed; top:100px; left:50%; margin-left:-21px; width:42px; height:42px;';
document.body.appendChild(ld);
arr.push(ld);
return ld;
}
function clnAll() {
var l = arr.length;
for (i = 0; i < l; i++) {
if (arr[0] != '') arr[0].parentNode.removeChild(arr[0]);
arr.shift();
}
}
function clnObj(ref) {
for (i = 0; i < arr.length; i++) {
if (arr[i] == ref) {
arr[i].parentNode.removeChild(arr[i]);
arr[i] = '';
}
}
}
function cllAjx(w,h,mth,url,par,cbk,xml,nod) {
	var req = false;
	ld = shwLd();
	if (window.XMLHttpRequest) req = new XMLHttpRequest();
	else if(window.ActiveXObject) {
		try {	req = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch(e) {
			try {	req = new ActiveXObject("Microsoft.XMLHTTP"); }
			catch(e) {}
		}
	}
	if (!req) return false;
	if (req.overrideMimeType) req.overrideMimeType('text/xml; charset= iso-8859-1');
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			clnObj(ld);
			if (req.status == 200) {
				if (xml) {
				}
				else {
					try {
						if(req.responseText != '') {
							var script = '';
							rsp = req.responseText.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function() { if (req.responseText !== null) script += arguments[1] + '\n'; return ''; });
							if(script) (window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
							rsp = rsp.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, '');
							if (cbk != '') {
								if (cbk.search(/[^a-z_0-9]/gi) == -1 && nod.search(/[^a-z_0-9]/gi) == -1) eval(cbk + '(\''+rsp+'\', \''+nod+'\')');
							}
							else if (cbk == '' && nod != '') {
								bx = shwBx(w, h, document.getElementsByTagName('body')[0], rsp, 'html');
							}
						}
					}
					catch(e) {}
				}
			}
			else return false;
		}
	}
	dat = new Date();
	if (url.indexOf('?') == -1) url += '?noc='+dat.getTime();
	else url += '&noc='+dat.getTime();
	if (mth == 'get') {
		req.open('GET', url, true);
		req.send(null);
	}
	else {
		tmp = par.split('&');
		for (i=0; i < tmp.length; i++) {
			tmp2 = tmp[i].split('=');
			tmp2[1] = encodeURIComponent(tmp2[1]);
			tmp[i] = tmp2[0]+'='+tmp2[1];
		}
		par = tmp.join('&');
		req.open('POST', url, true);
		req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		req.setRequestHeader("Content-length", par.length);
		req.send(par);
	}
}
function shwC(mid, vid) {
cllAjx(320, 320, 'get', root+'_/code.php?vid='+vid, '', '', false, 'x');
pre = window.open(root+'off/off.php?mid='+mid+'&vid='+vid, 'vouchercode', '');
pre.focus();
if (document.getElementById(vid+'_2') && document.getElementById(vid+'_2').alt != '') document.getElementById(vid+'_1').innerHTML = '<code class="vrce2">'+document.getElementById(vid+'_2').alt+'</code>';
}
function chkS(ref, q, dflt) {
if (q == dflt) {
ref.value = '';
ref.style.color = '#000000';
}
else if (ref.value == '') {
ref.value = dflt;
ref.style.color = '#c6c6c6';
}
}
function shwD(did, tc) {
cllAjx(0, 0, 'get', root+'_/deal.php?did='+did, '', '', false, '');
return window.open(tc, 'deal', 'width=320,height=200,left=0,top=0,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}
function chgCl(ref) {
	ref.src = '/s.gif';
}
function chgCh(ref) {
	ref.src = '/sh.gif';
}
function shwFB(response, node) {
	alert(response);
}
