//###22.06.05/roettger: Popup durch <DIV> ersetzen
//owc('/afterbuy/Meldung.aspx')
//###22.06.05/roettger: Popup durch <DIV> ersetzen
//###30.08.05/czock: Link unter Logo entfernt (Sprungmarke: ##sc20050830)

function MM_swapImgRestore()
{ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages()
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d)
{ //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage()
{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function owc(seite)
  { 
	w1 = window.open( seite, 'LEAF','toolbar=no,status=no,width=700,height=550,directories=no,scrollbars=yes,location=no,resizable=yes,menubar=no');
  	w1.focus();
  }
  
function owdok(seite)
  { 
	w1 = window.open( seite, 'LEAF','toolbar=no,status=no,width=700,height=550,directories=no,scrollbars=yes,location=no,resizable=yes,menubar=no');
  	w1.focus();
  }

var activeSub=0;
var SubNum=0;
var mfree=0;

//function reDo(){ window.location.reload() }
    //window.onresize = reDo;


    //Define global variables

var timerID = null;
var timerOn = false;
var timecount = 1000;
var what = null;
var newbrowser = true;
var check = false;
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;
		
var tempX = 0
var tempY = 0
var tempMWX = 0
var tempMWY = 0
        
function getMouseXY(e)
{
  	if (IE) { // grab the x-y pos.s if browser is IE
    	tempX = event.clientX + document.body.scrollLeft
	    tempY = event.clientY + document.body.scrollTop
	    tempMWX = event.clientX; // + document.body.scrollLeft
	    tempMWY = event.clientY; // + document.body.scrollTop		    
  	} else {  // grab the x-y pos.s if browser is NS
    	tempX = e.pageX
    	tempY = e.pageY
    	tempMWX = e.pageX
    	tempMWY = e.pageY
  	}  
  	if (tempX < 0){tempX = 0}
  	if (tempY < 0){tempY = 0}  
  	return true
}
		
function init()
{
	//  alert ("Running Init");
  	if (document.layers) {
   		//  alert ("Running Netscape 4");
   	    layerRef="document.layers";
        styleSwitch="";
        visibleVar="show";
		screenSize = window.innerWidth;
		what ="ns4";
	}else if(document.all){
        //  alert ("Running IE");
        layerRef="document.all";
        styleSwitch=".style";
        visibleVar="visible";
		screenSize = document.body.clientWidth + 18;
		what ="ie";
	}else if(document.getElementById){
        //  alert ("Running Netscape 6");
        layerRef="document.getElementByID";
        styleSwitch=".style";
        visibleVar="visible";
		what="moz";
  	}else{
  		//alert("Older than 4.0 browser.");
		what="none";
		newbrowser = false;
  	}
  
	window.status='status bar text to go here';
	check = true;
}

function MM_showHideLayers()
{ //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
		    obj.visibility=v;
		    //obj.left=tempX-15; 
		    //obj.top=tempY+35; 
		    }
		
		}
		
function chgBg(obj,color)
{
	if (document.all || document.getElementById)
		  document.getElementById(obj).style.backgroundColor=color;
}

//MM_showHideLayers('navstamm','','show')
function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
		
function hideLayer(layerName)
{
	MM_showHideLayers(layerName,'','hide')
}

function showLayer(layerName)
{
	if(mfree == 1){
		MM_showHideLayers(layerName,'','show')}
	}
	
function hideAll()
{
	hideLayer('layer1');
	hideLayer('layer2');
	hideLayer('layer3');
	hideLayer('layer4');
	hideLayer('layer5');
	hideLayer('layer6');
	//hideLayer('layer7');
	//hideLayer('layer8');
}

function hideAll2()
{
	mfree = 0;
	hideAll();
}

function makefree()
{
	if(mfree == 0) {
		mfree = 1;
	 }
	 else{
		 mfree = 0;
		 hideAll();
		 }
}

function startTime()
{
	if (timerOn == false) {
    	timerID=setTimeout( "hideAll2()" , timecount);
        timerOn = true;
        }
}

function stopTime()
{
	if (timerOn) {
    	clearTimeout(timerID);
        timerID = null;
        timerOn = false;
	}
}

function onLoad()
{
	init();
}

function popupme(destination,win_name,win_dim)
{
	var MyLittlePopupWindow = window.open(destination ,win_name,win_dim + ',' + 'resizable=no,scrollbars=yes,toolbar=no,Left=250,Top=100,status=no,directories=no,menubar=no,location=tabelle');
    //window.open (destination ,win_name,win_dim + ',' + 'resizable=no,scrollbars=yes,toolbar=no,Left=250,Top=100,status=no,directories=no,menubar=no,location=tabelle');
    MyLittlePopupWindow.focus();    
}

var SCount = 0;
function OneOnly (obj){
	SCount++;
	if (SCount > 1)
	{
	//alert('nana');
	}else{
	obj.submit()
	}
}

// TOOLBAR SETTINGS
var vdisplay = "";
vdisplay = "block";
var MyCookieName;
var MyCookieValue;
var Verfall = 1000*60*60*24*365;
var jetzt = new Date();
var Auszeit = new Date(jetzt.getTime() + Verfall);

imdata = new Array();
imdata[0] = "https://static.afterbuy.de/afterbuy/images/abroot/open.gif";
imdata[1] = "https://static.afterbuy.de/afterbuy/images/abroot/close.gif";
image = new Array();

for(var i=0;i<imdata.length;i++)
{
	image[i] = new Image();
	image[i].src = imdata[i];
}

function owstamm(seite)
  {
        wstamm = window.open('/' + seite, 'LEAF2', 'toolbar=no,status=no,width=800,height=600,directories=no,scrollbars=yes,location=no,resizable=yes,menubar=no');
        wstamm.focus();
  }

function Bildwechsel(Bildobj,nr)
{
	document.images[Bildobj].src = image[nr].src;
}

function anzeigen (vwert)
{
	document.getElementById(vwert).style.display = vdisplay;
}
function verstecken (vwert)
{
	try
	{
		document.getElementById(vwert).style.display = "none";
	}
	catch (e)
	{}
	finally
	{}
}


function aus(vwert, vbild)
{
	document.getElementById(vwert).style.display = "none";
	verstecken (vwert)
}

function readMyCookiesValue(mCookieName)
{
    var MyCookie = document.cookie.split(";");
    var TmpArray;
    var CompareArray;
    var iCheck = 0;
    //alert('MyCookieCompl: ' + document.cookie);
    //alert(MyCookie.length);
    for (i = 0; i < MyCookie.length; i++)
    {
        CompareArray = MyCookie[i].split("=")
        //alert(CompareArray[0]);
        if (CompareArray[0].replace(' ', '') == mCookieName)
        {
            iCheck++;
            TmpArray = MyCookie[i].split("=");
            break;
        }
    }

    if (iCheck != 0){return TmpArray[1];}else{return '-1';}
}

function insertLoadArea(elementID, AreaName)
{
	tajax('/afterbuy/interfaces/general_interface.aspx','art=LoadArea&LoadAreaName='+ AreaName,elementID,'','HTML','',0,0,'leer');
}

/*
Die folgende Funktion ermoeglicht es zur Laufzeit Aenderungen dynamisch am Stylesheet vorzunehmen
*/
function changeCssClass(className, styleName, styleValue) {
	var i=0, j=0;
	var cssRules = 'cssRules';
	if (document.all) {cssRules = 'rules';}
	className = '.' + className;
	for (i=0;i<document.styleSheets.length;i++) {
		for (j=0;j<document.styleSheets[i][cssRules].length;j++) {
			if (document.styleSheets[i][cssRules][j].selectorText == className) {
				//alert(document.styleSheets[i][cssRules][j].selectorText);
				if (document.styleSheets[i][cssRules][j].style[styleName]) {
					//alert('hier' + styleValue);
					document.styleSheets[i][cssRules][j].style[styleName] = styleValue;					
					//alert('hier');
					if (cssRules == 'rules' && styleName == 'background' && styleValue == '') {
						//alert('hier');
						document.styleSheets[i][cssRules][j].style.cssText = document.styleSheets[i][cssRules][j-1].style.cssText;
					}
				} else {
					//alert('hier');
					if (styleName.substring(0,7) == 'border-') {
						//alert(document.styleSheets[i][cssRules][j].style.cssText);
						document.styleSheets[i][cssRules][j].style.cssText =  document.styleSheets[i][cssRules][j].style.cssText + ';' + styleName + ':' + styleValue;
						//alert(document.styleSheets[i][cssRules][j].style.cssText);
					}
					if (cssRules == 'cssRules' && styleValue == '') document.styleSheets[i][cssRules][j].style.cssText =  styleName + ':' + styleValue;
					if (cssRules == 'cssRules' && styleName == 'background') document.styleSheets[i][cssRules][j].style.cssText =  styleName + ':' + styleValue;
					if (cssRules == 'rules') document.styleSheets[i][cssRules][j].style[styleName] = styleValue;
					if (styleName == 'text-align') document.styleSheets[i][cssRules][j].style.cssText = document.styleSheets[i][cssRules][j].style.cssText + ";text-align:" + styleValue;
				}
			}
		}
	}
}