dmt = document;
wdw = window;

dhtml = ((dmt.all) || (dmt.layers) || (dmt.getElementById)) ? true : false;
ie = ((dmt.all) && (wdw.offscreenBuffering)) ? true : false;
ns = ((dmt.captureEvents) && (!dmt.getElementById)) ? true : false;
n6 = ((dmt.getElementById) && (!dmt.all) && (dmt.documentElement)) ? true : false;
op = ((dmt.getElementById) && (navigator.userAgent.indexOf('Opera') != -1)) ? true : false;

floatX=20;
floatY=40;
layerwidth=162;
layerheight=300;
align="right";
valign="top";
delayspeed=7;
/*
floatX=10;
floatY=10;
layerwidth=162;
layerheight=250;
align="right";
valign="top";
delayspeed=7;
*/
// This script is copyright (c) Henrik Petersen, NetKontoret
// Feel free to use this script on your own pages as long as you do not change it. 
// It is illegal to distribute the script as part of a tutorial / script archive.
// Updated version available at: http://www.echoecho.com/toolfloatinglayer.htm
// This comment and the 4 lines above may not be removed from the code.


function adjust() {
if (!op) {
if ((ns) || (n6)) {
if (lastX==-1 || delayspeed==0)
{
lastX=window.pageXOffset + floatX;
lastY=window.pageYOffset + floatY;
}
else
{
dx=Math.abs(window.pageXOffset+floatX-lastX);
dy=Math.abs(window.pageYOffset+floatY-lastY);
d=Math.sqrt(dx*dx+dy*dy);
c=Math.round(d/10);
if (window.pageXOffset+floatX>lastX)
{lastX=lastX+delayspeed+c;}
if (window.pageXOffset+floatX<lastX) {lastX=lastX-delayspeed-c;}
if (window.pageYOffset+floatY>lastY) {lastY=lastY+delayspeed+c;}
if (window.pageYOffset+floatY<lastY) {lastY=lastY-delayspeed-c;}
}
if (ns){
document.layers['floatlayer'].pageX = lastX;
document.layers['floatlayer'].pageY = lastY;
}
if (n6){
document.getElementById('floatlayer').style.left=lastX;
document.getElementById('floatlayer').style.top=lastY;
}
}
else if (ie){
if (lastX==-1 || delayspeed==0)
{
lastX=document.body.scrollLeft + floatX;
lastY=document.body.scrollTop + floatY;
}
else
{
dx=Math.abs(document.body.scrollLeft+floatX-lastX);
dy=Math.abs(document.body.scrollTop+floatY-lastY);
d=Math.sqrt(dx*dx+dy*dy);
c=Math.round(d/10);
if (document.body.scrollLeft+floatX>lastX)
{lastX=lastX+delayspeed+c;}
if (document.body.scrollLeft+floatX<lastX)
{lastX=lastX-delayspeed-c;}
if (document.body.scrollTop+floatY>lastY)
{lastY=lastY+delayspeed+c;}
if (document.body.scrollTop+floatY<lastY)
{lastY=lastY-delayspeed-c;}
}
document.all['floatlayer'].style.posLeft = lastX;
document.all['floatlayer'].style.posTop = lastY;
} 
setTimeout('adjust()',50);
}
}

function define()
{
if ((ns) || (n6)) 
{ 
if (align=="left") {floatX=ifloatX};
if (align=="right")
{floatX=window.innerWidth-ifloatX-layerwidth-20};
if (align=="center")
{floatX=Math.round((window.innerWidth-20)/2)-Math.round(layerwidth/2)};
if (valign=="top") {floatY=ifloatY};
if (valign=="bottom")
{floatY=window.innerHeight-ifloatY-layerheight};
if (valign=="center")
{floatY=Math.round((window.innerHeight-20)/2)-Math.round(layerheight/2)};
}
if (ie) 
{
if (align=="left") {floatX=ifloatX};
if (align=="right")
{floatX=document.body.offsetWidth-ifloatX-layerwidth-20}
if (align=="center")
{floatX=Math.round((document.body.offsetWidth-20)/2)-Math.round(layerwidth/2)}
if (valign=="top") {floatY=ifloatY};
if (valign=="bottom")
{floatY=document.body.offsetHeight-ifloatY-layerheight}
if (valign=="center")
{floatY=Math.round((document.body.offsetHeight-20)/2)-Math.round(layerheight/2)}
}
if (ns) {document.layers['floatlayer'].visibility="show";}
if (n6) {document.getElementById('floatlayer').style.visibility="visible";}
if (ie) {document.all['floatlayer'].style.visibility="visible";}
}
                  
 
 
 
function checkKK(url) {
	if (document.formular.elements["Ich_bezahle_mit"].options[document.formular.elements["Ich_bezahle_mit"].options.selectedIndex].value == "Kreditkarte_neu")
	{
	var kredfenst2 = window.open('https://secure-isf3.spat.at/heilfasten/shop/cred.php?'+url,'Kreditkarte','width=620,height=480,toolbar=yes,screenX=100,screenY=10,left=100,top=10,status=yes');
	}
}

function kredkartopen() {
	var kredfenst2 = window.open('https://secure-isf3.spat.at/heilfasten/shop/cred.php','','width=620,height=480,toolbar=yes,screenX=100,screenY=10,left=100,top=10,status=yes');
}

function checkpayform(sprache) {
	var ret_txt="";
	if (document.formular.elements["Ich_bezahle_mit"].options[document.formular.elements["Ich_bezahle_mit"].options.selectedIndex].index == 0)
	{
		if(sprache=="de") {
		ret_txt = ret_txt + "Bitte die Zahlungsart angeben.\n";
		}
	}
	if (document.formular.elements["AGB_ja"].checked==false)
	{
		if(sprache=="de") {
		ret_txt = ret_txt + "Bitte AGB lesen und 'AGB gelesen' ankreuzen.\n";
		}
	}
if (ret_txt!="") {
	alert (ret_txt);
	return false;
}else {
return true;
}
}

function preloadImages() {
 newImages = new Array();
 for (cnt = 0; cnt < preloadImages.arguments.length; cnt++) {
  newImages[cnt] = new Image();
  newImages[cnt].src = "images/" + preloadImages.arguments[cnt];
 }
}

function tauschen(bild, neu) {
 window.document.images[bild].src = newImages[neu].src;
}

function OpenWindow(strZiel, strName, intWidth)
{
    var Test = window.open(strZiel, strName, 'width='+intWidth+',height=150,scrollbars=no,resizable');
    if (document.all)
	{
		var ClickX = window.event.x;
		var ClickY = window.event.y;
		if (navigator.appVersion.indexOf("MSIE 5")>0 )
		{
			Test.moveTo(ClickX+window.screenLeft+5, ClickY+window.screenTop-50);
		}
	}
}

var func_js_loaded = true;
