var js=true;var isDealersLoad=false;var dct=window.document;var pSize=0;var objAct = null;var count = 0;var count2 = 0;
var ciW=0;var ciH=0;
var IE=document.all&&!window.opera;
var DOM=document.getElementById&&!IE;
var isSg=false;var sgTr=null;var iF=null;var iL=null;var lt=null;var rt=null;var up=null;var dn = null;var iW=null;var iW1=null;var iW2=null;
var hDoLt=function(e){if(!e)e=window.event;if(e.preventDefault){e.preventDefault();}init(e.srcElement?e.srcElement.id:e.target.id);doLt();setDnV(rt,"1");return false;}
var hDoRt=function(e){if(!e)e=window.event;if(e.preventDefault){e.preventDefault();}init(e.srcElement?e.srcElement.id:e.target.id);doRt();setDnV(lt,"1");return false;}
var hDoUp=function(e){if(!e)e=window.event;if(e.preventDefault){e.preventDefault();}init(e.srcElement?e.srcElement.id:e.target.id);doUp();setDnV(dn,"1");return false;}
var hDoDn=function(e){if(!e)e=window.event;if(e.preventDefault){e.preventDefault();}init(e.srcElement?e.srcElement.id:e.target.id);doDn();setDnV(up,"1");return false;}
var hDoSp=function(e){if(!e)e=window.event;if(e.preventDefault){e.preventDefault();}cSgTr();return false;}
var hGetInfo=function(e){if(!e)e=window.event;if(e.preventDefault){e.preventDefault();}getInfo(e.srcElement?e.srcElement.id:e.target.id);return false;}

function setDnV(el,v){if (v==1){el.className='buta';}else{el.className='butina';}}
function addHandler(object,e,handler,useCapture){if(object.addEventListener)object.addEventListener(e,handler,useCapture==true?useCapture:false);else if(object.attachEvent)object.attachEvent('on'+e,handler);}
function getPosAsNum(str){return parseInt(str.substring(0,str.length-2));}
function getPos(el,ab){offL=0;offT=0;while(el){offL+=el.offsetLeft;offT+=el.offsetTop;if(ab==0)break;el=el.offsetParent;}if(navigator.userAgent.indexOf("Mac")!=-1&&typeof document.body.leftMargin!="undefined"){offL+=document.body.leftMargin;offT+=document.body.topMargin;}return{left:offL,top:offT}}
function getEl(id){return document.getElementById(id);}
function getInt(x){return parseInt(x.replace(/px/g,''));}

function addXXL(href){
if(!checkCookie()){viewAddAsk();return false;}
$(document).ready(function() {
$.ajax({url: href, contentType: "text/xml", async: false, cache: false, success: function(data){
resp=trim(data).split("|");if(resp[0]==0){getEl("artcount").innerHTML = resp[1];getEl("subtotal").innerHTML = resp[2];}else{alert("Fehler!");}
}});
});
if(_gaq){_gaq.push(['_trackPageview', href.substr(href.indexOf(".de/")+3)]);}
}

function addArt2(href){
$(document).ready(function() {
$.ajax({url: href, contentType: "text/xml", async: false, cache: false, success: function(data){
resp=trim(data).split("|");if(resp[0]==0){viewAddAsk();getEl("artcount").innerHTML = resp[1];getEl("subtotal").innerHTML = resp[2];}else{getEl('addRes').innerHTML="Fehler!";}
}});
});
if(_gaq){_gaq.push(['_trackPageview', href]);}
}

function getPage2(href){
$(document).ready(function() {
$.ajax({url: href, contentType: "text/xml", async: true, cache: false, success: function(data){
getEl('calcw').innerHTML=(data)?trim(data):"";
}});
});
}

function findArt(obj){
$(document).ready(function() {
$.ajax({url: obj.action, contentType: "text/xml", async: false, cache: false, data: "an=" + obj.an.value, success: function(data){
resp=trim(data).split("|");if(resp[0]==0){window.location.href=resp[1];}
else {getEl("fResult").innerHTML = resp[1];}
}});
});
}

function trim(str){str=str.replace(/^\s+/,'');for(i=str.length-1;i>= 0;i--){if(/\S/.test(str.charAt(i))){str=str.substring(0,i+1);break;}}return str;}

function doRt() {
p1=getPos(iL,0);p2=getPos(iF,0);iLW=getInt(iL.style.width);iFW=getInt(iF.style.width);
if(p1.left+iLW<=iFW){doScrRt();setDnV(rt,"0");cSgTr();return false;}
m=p1.left%iW;if(m>0){doScrRt();};
iL.style.left=(p1.left-((m==0)?(0):(m))-iW)+'px';doScrRt();//if(scroll!=null)doScrRt();
if(isSg!=true){sgTr=setInterval(doRt,150);isSg=true;}
}
function doScrLt() {
if(iL.id.lastIndexOf("1")<1){return false;}
if(!objDrag){objDrag=getEl('scr2');}
p=scrLl-scrrL;di=Math.round(iW1/pSize+0.5);di=(p-di)>0?di:p;
pl=getPosAsNum(objDrag.style.left)-di;if(pl<((IE)?(-1*scrrPosL):0)){pl=((IE)?(-1*scrrPosL):0)}{objDrag.style.left=pl+'px';}
}
function doLt() {
p1=getPos(iL,0);p2=getPos(iF,0);iLW=getInt(iL.style.width);iFW=getInt(iF.style.width);
if(p1.left+iFW>=iFW){doScrLt();setDnV(lt,"0");cSgTr();return false;}
m=p1.left%iW;if(m>0){doScrLt();};
iL.style.left=(p1.left+((m==0)?(0):(-m))+iW)+'px';doScrLt();
if(isSg!=true){sgTr=setInterval(doLt,150);isSg=true;}
}
function doScrRt() {
if(iL.id.lastIndexOf("1")<1){return false;}
if(!objDrag){objDrag=getEl('scr2');}
p=scrLl-scrrL;di=Math.round(iW1/pSize+0.5);di=(p-di)>0?di:p;
pl=getPosAsNum(objDrag.style.left)+di;if(pl>((IE)?(scrrPosL):2*scrrPosL)){pl=((IE)?(scrrPosL):2*scrrPosL)}objDrag.style.left=pl+'px';
}
function doDn() {
p1=getPos(iL,0);p2=getPos(iF,0);iLW=getInt(iL.style.height);iFW=getInt(iF.style.height);
if(p1.top + iLW<=iFW){setDnV(dn,"0");cSgTr();return false;}
iL.style.top=(p1.top-iW)+'px';
if(isSg!=true){sgTr=setInterval(doDn,150);isSg=true;}
}
function doUp() {
p1=getPos(iL,0);p2=getPos(iF,0);iLW=getInt(iL.style.height);iFW=getInt(iF.style.height);
if(p1.top>=0){setDnV(up,"0");cSgTr();return false;}
iL.style.top=(p1.top+iW)+'px';
if(isSg!=true){sgTr=setInterval(doUp,150);isSg=true;}
}
var oW=0;var oH=0;var oT=0;var oL=0;var objOld="";var objTmp="";
function doJump(e) {
if(!e)e=window.event;
if(!objAct)objAct=e.target||e.srcElement;
if(e.type=="click"){
if(objOld!=""&&objOld!=objAct){objTmp=objAct;doJumpIn();objAct=objOld;doJumpOut();objOld=objTmp;}else{doJumpIn();objOld=objAct;objAct=null;}return;
}else{if(e.type=="mouseover"){doJumpIn();}else{doJumpOut();}}
}

function doJumpIn() {
if(objAct.id.lastIndexOf("oi_")==0){cObj=getEl(objAct.id.replace(/oi/,"oc"));}
else{cObj=getEl(objAct.id.replace(/i/,"c"));}
oW=getPosAsNum(objAct.style.width);
if (objAct.style.height) oH=getPosAsNum(objAct.style.height);
oT=getPosAsNum(objAct.style.top);
oL=getPosAsNum(objAct.style.left);
if (objAct.style.top) objAct.style.top='2px';
//objAct.style.left='1px';
objAct.style.width=(getPosAsNum(cObj.style.width)-2)+'px';
objAct.style.height=(getPosAsNum(cObj.style.height)-4)+'px';
}

function doJumpOut() {
if (objAct.style.top) objAct.style.top=oT+'px';
objAct.style.left=oL+'px';
objAct.style.width=oW+'px';
if (objAct.style.height) objAct.style.height=oH+'px';
objAct = null;
}

function cSgTr(){if(isSg==true){clearInterval(sgTr);}isSg=false;}

function addBookmark(pUrl,pTitel){
pUrl=pUrl+((pUrl.indexOf("?")>0)?"&":"?")+'adv=fvt';
if(window.sidebar){window.sidebar.addPanel(pTitel,pUrl,"");}
else if(document.all){window.external.AddFavorite(pUrl,pTitel);}
else if(window.opera&&window.print){el=document.createElement('a');el.setAttribute('href',pUrl);el.setAttribute('title',pTitel);el.setAttribute('rel','sidebar');el.click();}
}

function checkCookie(){setCookie("tc","tp");if(!getCookie("tc")){return false;}else{eraseCookie("tc");return true;}}
function setCookie(c,v){document.cookie=c+"="+escape(v);}
function getCookie(c){if(document.cookie.length>0){cs=document.cookie.indexOf(c+"=");if(cs!=-1){cs=cs+(c.length+1);ce=document.cookie.indexOf(";",cs);if(ce==-1)ce=document.cookie.length;return unescape(document.cookie.substring(cs,ce));}}return "";}
function eraseCookie(c){setCookie(c,null);}
