﻿/****************************************************
**
** all-in-one javascript - all used code in one js-file
** reduceses the requests and raises performance ;)
**
*****************************************************/

/****************************************************
*****************************************************
**
** UA-object from sifr.js 
**
*****************************************************
*****************************************************/
var hasFlash=function(){var a=6;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');if(window.hasFlash!=null)return window.hasFlash}if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;return parseInt(b.charAt(b.indexOf(".")-1))>=a}return false}();String.prototype.normalize=function(){return this.replace(/\s+/g," ")};if(Array.prototype.push==null){Array.prototype.push=function(){var i=0,a=this.length,b=arguments.length;while(i<b){this[a++]=arguments[i++]}return this.length}}if(!Function.prototype.apply){Function.prototype.apply=function(a,b){var c=[];var d,e;if(!a)a=window;if(!b)b=[];for(var i=0;i<b.length;i++){c[i]="b["+i+"]"}e="a.__applyTemp__("+c.join(",")+");";a.__applyTemp__=this;d=eval(e);a.__applyTemp__=null;return d}}function named(a){return new named.Arguments(a)}named.Arguments=function(a){this.oArgs=a};named.Arguments.prototype.constructor=named.Arguments;named.extract=function(a,b){var c,d;var i=a.length;while(i--){d=a[i];if(d!=null&&d.constructor!=null&&d.constructor==named.Arguments){c=a[i].oArgs;break}}if(c==null)return;for(e in c)if(b[e]!=null)b[e](c[e]);return};var parseSelector=function(){var a=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;
function r(s,t){var u=s.split(/\s*\,\s*/);var v=[];for(var i=0;i<u.length;i++)v=v.concat(b(u[i],t));return v}
function b(c,d,e){c=c.normalize().replace(" ","`");var f=c.match(a);var g,h,i,j,k,n;var l=[];if(f==null)f=[c,c];if(f[1]=="")f[1]="*";if(e==null)e="`";if(d==null)d=document;switch(f[2]){case "#":k=f[3].match(a);if(k==null)k=[null,f[3]];g=document.getElementById(k[1]);if(g==null||(f[1]!="*"&&!o(g,f[1])))return l;if(k.length==2){l.push(g);return l}return b(k[3],g,k[2]);case ".":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;k=f[3].match(a);if(k!=null){if(g.className==null||g.className.match("\\b"+k[1]+"\\b")==null)continue;j=b(k[3],g,k[2]);l=l.concat(j)}else if(g.className!=null&&g.className.match("\\b"+f[3]+"\\b")!=null)l.push(g)}return l;case ">":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;j=b(f[3],g,">");l=l.concat(j)}return l;case "`":h=m(d,f[1]);for(i=0,n=h.length;i<n;i++){g=h[i];j=b(f[3],g,"`");l=l.concat(j)}return l;default:if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;l.push(g)}return l}}
function m(d,o){if(o=="*"&&d.all!=null)return d.all;return d.getElementsByTagName(o)}
function o(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}return r}();
var sIFR=function(){var a="http://www.w3.org/1999/xhtml";var b=false;var c=false;var d;var ah=[];var al=document;var ak=al.documentElement;var am=window;var au=al.addEventListener;var av=am.addEventListener;
var f=function(){var g=navigator.userAgent.toLowerCase();var f={a:g.indexOf("applewebkit")>-1,b:g.indexOf("safari")>-1,c:navigator.product!=null&&navigator.product.toLowerCase().indexOf("konqueror")>-1,d:g.indexOf("opera")>-1,e:al.contentType!=null&&al.contentType.indexOf("xml")>-1,f:true,g:true,h:null,i:null,j:null,k:null};f.l=f.a||f.c;f.m=!f.a&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";if(f.m)f.j=new Number(g.match(/.*gecko\/(\d{8}).*/)[1]);f.n=g.indexOf("msie")>-1&&!f.d&&!f.l&&!f.m;f.o=f.n&&g.match(/.*mac.*/)!=null;if(f.d)f.i=new Number(g.match(/.*opera(\s|\/)(\d+\.\d+)/)[2]);if(f.n||(f.d&&f.i<7.6))f.g=false;if(f.a)f.k=new Number(g.match(/.*applewebkit\/(\d+).*/)[1]);if(am.hasFlash&&(!f.n||f.o)){var aj=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;f.h=parseInt(aj.charAt(aj.indexOf(".")-1))}if(g.match(/.*(windows|mac).*/)==null||f.o||f.c||(f.d&&(g.match(/.*mac.*/)!=null||f.i<7.6))||(f.b&&f.h<7)||(!f.b&&f.a&&f.k<124)||(f.m&&f.j<20020523))f.f=false;if(!f.o&&!f.m&&al.createElementNS)try{al.createElementNS(a,"i").innerHTML=""}catch(e){f.e=true}f.p=f.c||(f.a&&f.k<312)||f.n;return f}();
function at(){return{bIsWebKit:f.a,bIsSafari:f.b,bIsKonq:f.c,bIsOpera:f.d,bIsXML:f.e,bHasTransparencySupport:f.f,bUseDOM:f.g,nFlashVersion:f.h,nOperaVersion:f.i,nGeckoBuildDate:f.j,nWebKitVersion:f.k,bIsKHTML:f.l,bIsGecko:f.m,bIsIE:f.n,bIsIEMac:f.o,bUseInnerHTMLHack:f.p}}if(am.hasFlash==false||!al.getElementsByTagName||!al.getElementById||(f.e&&f.p))return{UA:at()};function af(e){if((!k.bAutoInit&&(am.event||e)!=null)||!l(e))return;b=true;for(var i=0,h=ah.length;i<h;i++)j.apply(null,ah[i]);ah=[]}var k=af;function l(e){if(c==false||k.bIsDisabled==true||((f.e&&f.m||f.l)&&e==null&&b==false)||(al.body==null||al.getElementsByTagName("body").length==0))return false;return true}function m(n){if(f.n)return n.replace(new RegExp("%\d{0}","g"),"%25");return n.replace(new RegExp("%(?!\d)","g"),"%25")}function as(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}function o(p,q,r,s,t){var u="";var v=p.firstChild;var w,x,y,z;if(s==null)s=0;if(t==null)t="";while(v){if(v.nodeType==3){z=v.nodeValue.replace("<","&lt;");switch(r){case "lower":u+=z.toLowerCase();break;case "upper":u+=z.toUpperCase();break;default:u+=z}}else if(v.nodeType==1){if(as(v,"a")&&!v.getAttribute("href")==false){if(v.getAttribute("target"))t+="&sifr_url_"+s+"_target="+v.getAttribute("target");t+="&sifr_url_"+s+"="+m(v.getAttribute("href")).replace(/&/g,"%26");u+='<a href="asfunction:_root.launchURL,'+s+'">';s++}else if(as(v,"br"))u+="<br/>";if(v.hasChildNodes()){y=o(v,null,r,s,t);u+=y.u;s=y.s;t=y.t}if(as(v,"a"))u+="</a>"}w=v;v=v.nextSibling;if(q!=null){x=w.parentNode.removeChild(w);q.appendChild(x)}}return{"u":u,"s":s,"t":t}}function A(B){if(al.createElementNS&&f.g)return al.createElementNS(a,B);return al.createElement(B)}function C(D,E,z){var p=A("param");p.setAttribute("name",E);p.setAttribute("value",z);D.appendChild(p)}function F(p,G){var H=p.className;if(H==null)H=G;else H=H.normalize()+(H==""?"":" ")+G;p.className=H}function aq(ar){var a=ak;if(k.bHideBrowserText==false)a=al.getElementsByTagName("body")[0];if((k.bHideBrowserText==false||ar)&&a)if(a.className==null||a.className.match(/\bsIFR\-hasFlash\b/)==null)F(a, "sIFR-hasFlash")}function j(I,J,K,L,M,N,O,P,Q,R,S,r,T){if(!l())return ah.push(arguments);aq();named.extract(arguments,{sSelector:function(ap){I=ap},sFlashSrc:function(ap){J=ap},sColor:function(ap){K=ap},sLinkColor:function(ap){L=ap},sHoverColor:function(ap){M=ap},sBgColor:function(ap){N=ap},nPaddingTop:function(ap){O=ap},nPaddingRight:function(ap){P=ap},nPaddingBottom:function(ap){Q=ap},nPaddingLeft:function(ap){R=ap},sFlashVars:function(ap){S=ap},sCase:function(ap){r=ap},sWmode:function(ap){T=ap}});var U=parseSelector(I);if(U.length==0)return false;if(S!=null)S="&"+S.normalize();else S="";if(K!=null)S+="&textcolor="+K;if(M!=null)S+="&hovercolor="+M;if(M!=null||L!=null)S+="&linkcolor="+(L||K);if(O==null)O=0;if(P==null)P=0;if(Q==null)Q=0;if(R==null)R=0;if(N==null)N="#FFFFFF";if(T=="transparent")if(!f.f)T="opaque";else N="transparent";if(T==null)T="";var p,V,W,X,Y,Z,aa,ab,ac;var ad=null;for(var i=0,h=U.length;i<h;i++){p=U[i];if(p.className!=null&&p.className.match(/\bsIFR\-replaced\b/)!=null)continue;V=p.offsetWidth-R-P;W=p.offsetHeight-O-Q;aa=A("span");aa.className="sIFR-alternate";ac=o(p,aa,r);Z="txt="+m(ac.u).replace(/\+/g,"%2B").replace(/&/g,"%26").replace(/\"/g, "%22").normalize() + S + "&w=" + V + "&h=" + W + ac.t;F(p,"sIFR-replaced");if(ad==null||!f.g){
	T="transparent"; // rw
	if(!f.g){
		//p.innerHTML=['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="',J,'" quality="best" wmode="',T,'" bgcolor="',N,'" flashvars="',Z,'" width="',V,'" height="',W,'" sifr="true"></embed>'].join("");
		
		//
		// The IE-Eolas-Patch-Hack for SIFR
		var fo=new FlashObject(J+"?"+Z, null, V, W, "6", N);fo.addParam("wmode", T);fo.write(p);

	}else{
		if(f.d){
			ab=A("object");
			ab.setAttribute("data",J);
			C(ab,"quality","best");
			C(ab,"wmode",T);
			C(ab,"bgcolor",N)
		}else{
			ab=A("embed");
			ab.setAttribute("src",J);
			ab.setAttribute("quality","best");
			ab.setAttribute("flashvars",Z);
			ab.setAttribute("wmode",T);
			ab.setAttribute("bgcolor",N)}
			ab.setAttribute("sifr","true");
			ab.setAttribute("type","application/x-shockwave-flash");
			ab.className="sIFR-flash";
			if(!f.l||!f.e)ad=ab.cloneNode(true)
		}
	}else ab=ad.cloneNode(true);if(f.g){if(f.d)C(ab,"flashvars",Z);else ab.setAttribute("flashvars",Z);ab.setAttribute("width",V);ab.setAttribute("height",W);ab.style.width=V+"px";ab.style.height=W+"px";p.appendChild(ab)}p.appendChild(aa);if(f.p)p.innerHTML+=""}if(f.n&&k.bFixFragIdBug)setTimeout(function(){al.title=d},0)}
function ai(){d=al.title}function ae(){if(k.bIsDisabled==true)return;c=true;if(k.bHideBrowserText)aq(true);if(am.attachEvent)am.attachEvent("onload",af);else if(!f.c&&(al.addEventListener||am.addEventListener)){if(f.a&&f.k>=132&&am.addEventListener)am.addEventListener("load",function(){setTimeout("sIFR({})",1)},false);else{if(al.addEventListener)al.addEventListener("load",af,false);if(am.addEventListener)am.addEventListener("load",af,false)}}else
 if(typeof am.onload=="function")
 {var ag=am.onload;am.onload=function(){ag();af()}}else am.onload=af;if(!f.n||am.location.hash=="")k.bFixFragIdBug=false;else ai()}k.UA=at();k.bAutoInit=true;k.bFixFragIdBug=true;k.replaceElement=j;k.updateDocumentTitle=ai;k.appendToClassName=F;k.setup=ae;k.debug=function(){aq(true)};k.debug.replaceNow=function(){ae();k()};k.bIsDisabled=false;k.bHideBrowserText=true;return k}();


var UA=sIFR.UA; // co4
UA.bIsIE7=(navigator.userAgent.toLowerCase().indexOf('msie')>-1);

//UA.bIsIE6
//alert(UA.bIsIE7);

if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && !sIFR.UA.bIsIE && !sIFR.UA.bIsOpera){ //  && !UA.bIsIE7
	//sIFR.setup();
};


/****************************************************
*****************************************************
**
** swfobject.js 
**
*****************************************************
*****************************************************/

/**
 * SWFObject v1.4.2: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 *//*
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=key+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);
axo.AllowScriptAccess="always";}
catch(e){
if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}
if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){
var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){
_2d[i].style.display="none";
for(var x in _2d[i]){if(typeof _2d[i][x]=="function"){_2d[i][x]=null;}}}};
if(typeof window.onunload=="function"){
var oldunload=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();
oldunload();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}
if(Array.prototype.push==null){
Array.prototype.push=function(_30){
this[this.length]=_30;
return this.length;};}

var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject; // for legacy support
var SWFObject=deconcept.SWFObject;
   */
 
 
 
 
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> */

var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();


/****************************************************
*****************************************************
**
** prototype.lite.js 
**
*****************************************************
*****************************************************/

/*  Prototype JavaScript framework
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
/*--------------------------------------------------------------------------*/

//note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).

var Class = {
	create: function() {
		return function() {
			this.initialize.apply(this, arguments);
		}
	}
}

Object.extend = function(destination, source) {
	for (property in source) destination[property] = source[property];
	return destination;
}

Function.prototype.bind = function(object) {
	var __method = this;
	return function() {
		return __method.apply(object, arguments);
	}
}

Function.prototype.bindAsEventListener = function(object) {
var __method = this;
	return function(event) {
		__method.call(object, event || window.event);
	}
}

function $() {
	if (arguments.length == 1) return get$(arguments[0]);
	var elements = [];
	$c(arguments).each(function(el){
		elements.push(get$(el));
	});
	return elements;

	function get$(el){
		if (typeof el == 'string') {
			el = document.getElementById(el);
		}
		return el;
	}
}

if (!window.Element) var Element = new Object();

Object.extend(Element, {
	remove: function(element) {
		element = $(element);
		element.parentNode.removeChild(element);
	},

	hasClassName: function(element, className) {
		element = $(element);
		if (!element) return;
		var hasClass = false;
		element.className.split(' ').each(function(cn){
			if (cn == className) hasClass = true;
		});
		return hasClass;
	},

	addClassName: function(element, className) {
		element = $(element);
		Element.removeClassName(element, className);
		element.className += ' ' + className;
	},
  
	removeClassName: function(element, className) {
		element = $(element);
		if (!element) return;
		var newClassName = '';
		element.className.split(' ').each(function(cn, i){
			if (cn != className){
				if (i > 0) newClassName += ' ';
				newClassName += cn;
			}
		});
		element.className = newClassName;
	},

	cleanWhitespace: function(element) {
		element = $(element);
		$c(element.childNodes).each(function(node){
			if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node);
		});
	},

	find: function(element, what) {
		element = $(element)[what];
		while (element.nodeType != 1) element = element[what];
		return element;
	}
});

var Position = {
	cumulativeOffset: function(element) {
		var valueT = 0, valueL = 0;
		do {
			valueT += element.offsetTop  || 0;
			valueL += element.offsetLeft || 0;
			element = element.offsetParent;
		} while (element);
		return [valueL, valueT];
	}
};

document.getElementsByClassName = function(className) {
	var children = document.getElementsByTagName('*') || document.all;
	var elements = [];
	$c(children).each(function(child){
		if (Element.hasClassName(child, className)) elements.push(child);
	});  
	return elements;
}

//useful array functions
Array.prototype.iterate = function(func){
	for(var i=0;i<this.length;i++) func(this[i], i);
}
if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;

function $c(array){
	var nArray = [];
	for (var i=0;i<array.length;i++) nArray.push(array[i]);
	return nArray;
}


/****************************************************
*****************************************************
**
** moo.ajax.js
**
*****************************************************
*****************************************************/

//based on prototype's ajax class
//to be used with prototype.lite, moofx.mad4milk.net.

ajax = Class.create();
ajax.prototype = {
	initialize: function(url, options){
		this.transport = this.getTransport();
		this.postBody = options.postBody || '';
		this.method = options.method || 'post';
		this.onComplete = options.onComplete || null;
		this.update = $(options.update) || null;
		this.request(url);
	},

	request: function(url){
		this.transport.open(this.method, url, true);
		this.transport.onreadystatechange = this.onStateChange.bind(this);
		if (this.method == 'post') {
			this.transport.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			if (this.transport.overrideMimeType) this.transport.setRequestHeader('Connection', 'close');
		}
		this.transport.send(this.postBody);		
	},

	onStateChange: function(){
		try {
			if (this.transport.readyState == 4 && this.transport.status == 200) {
				if (this.onComplete) 
					setTimeout(function(){this.onComplete(this.transport);}.bind(this), 10);
				if (this.update)
					setTimeout(function(){this.update.innerHTML = this.transport.responseText;}.bind(this), 10);
				this.transport.onreadystatechange = function(){};
			}
		} catch(e) { /* Error occurs when a request is cancelled by page-unload (rw) */ /*alert("Error onStateChange:\n"+e)*/ }
	},

	getTransport: function() {
		if (window.XMLHttpRequest) return new XMLHttpRequest();
		else if (window.ActiveXObject) return new ActiveXObject('Microsoft.XMLHTTP');
		else return false;
	}
};


//
// the IE-no-ActiveX alternative
if (!window.XMLHttpRequest) { // keep normal Browsers away
	try {
		var t=new ActiveXObject('Microsoft.XMLHTTP'); // the normal IE6 way
	} catch(e) {
	
		// start no_ax_xmlhttpreq.js	
		/*
		coded by Kae - http://verens.com/
		use this code as you wish, but retain this notice
		*/
		
		//alert("alternative ajax");
		
		
		var kXHR_instances=0;
		var kXHR_objs=[];
		
		
		XMLHttpRequest=function(){
			//alert("create xhr instance!");
			var i=0;
			var url='';
			var responseText='';
			var iframe='';
			this.onreadystatechange=function(){
				return false;
			}
			this.open=function(method,url){
				//TODO: POST methods
				this.i=++kXHR_instances; // id number of this request
				this.url=url;
				document.body.appendChild(document.createElement('<iframe id="kXHR_iframe_'+this.i+'" style="display:none" src="/"></iframe>'));
			}
			this.send=function(postdata){
				//TODO: use the postdata
				document.getElementById('kXHR_iframe_'+this.i).src=this.url+'?'+postdata;
				kXHR_objs[this.i]=this;
				setTimeout('XMLHttpRequest_checkState('+this.i+',2)',2);
			}
			//
			// some dummy function for combatibility (rw)
			this.setRequestHeader=function(){};
			
			return true;
		}
		XMLHttpRequest_checkState=function(inst,delay){
			var el=document.getElementById('kXHR_iframe_'+inst);
			if(el.readyState=='complete'){
				var html=document.frames['kXHR_iframe_'+inst].document.body.innerHTML;
				var responseText=html;
				var responseCDATA=html.substring(html.indexOf('coredatastart')+21, html.lastIndexOf('coredataend')-8).replace(/&lt;/gi, '<').replace(/&gt;/gi, '>').replace(/&amp;/gi, '&'); // Alternative for XML
				kXHR_objs[inst].responseText=responseText;
				kXHR_objs[inst].responseCDATA=responseCDATA;
				kXHR_objs[inst].readyState=4;
				kXHR_objs[inst].status=200;
				kXHR_objs[inst].onreadystatechange();
				// keep the iframe as responseXML root node (rw) - el.parentNode.removeChild(el);
			}else{
				delay*=1.5;
				setTimeout('XMLHttpRequest_checkState('+inst+','+delay+')',delay);
			}
		}
		// end no_ax_xmlhttpreq.js
	
	}
}


/****************************************************
*****************************************************
**
** moo.dom.js
**
*****************************************************
*****************************************************/

//moo.dom by Valerio Proietti (http://mad4milk.net) MIT Open Source license;
//v 1.5 (beta);

function $S() {
	var elements = [];
	$c(arguments).each(function(sel){
		if (typeof sel == 'string') {
			sel.getElements().each(function(el){
				elements.push(el);
			});
		}
		else elements.push(sel);
	});
	return elements;
}

/*------------------String Prototypes----------------------*/

Object.extend(String.prototype, {
	getElements: function(filter){
		var params = [];
		this.split(' ').each(function(arg, j){
			params[j] = param = [];
			if (arg.indexOf('#') > -1) {
				var bits = arg.split('#');
				param['tag'] = bits[0] || '*';
				param['id'] = bits[1];
			}
			else if (arg.indexOf('.') > -1) {
				var bits = arg.split('.');
				param['tag'] = bits[0] || '*';
				param['class'] = bits[1];
			}
			else param['tag'] = arg;
		});
		var filter = filter || document;
		filter = $c(filter.getElementsByTagName('*'));
		params.each(function(param, k){
			if (param['tag'] != '*' && k == 0) filter = filter.filterByTagName(param['tag']);
			else if (k != 0) filter = filter.getElementsByTagName(param['tag']);
			if (param['id']) filter = filter.filterById(param['id']);
			if (param['class']) filter = filter.filterByClassName(param['class']);
		});
		return filter;
	},
	
	getElementsBySelector: function(filter){
		if (!filter) filter = null;
		var elements = [];
		this.split(',').each(function(selector){
			elmnts = selector.replace(/^\s*|\s*$/g,"").getElements(filter);
			elmnts.each(function(el){
				elements.push(el);
			});
		});
		return elements;
	}
});


/*----------------------Array Prototypes-----------------------*/

function $c(array){
	var nArray = [];
	for (i=0;el=array[i];i++) nArray.push(el);
	return nArray;
}

Object.extend(Array.prototype, {
	iterate: function(func){
		for(var i=0;ob=this[i];i++) func(ob, i);
	},

	action: function(actions){
		this.each(function(el){
			if (actions.initialize) actions.initialize.apply(el);
			for(action in actions){
				if (action.slice(0,2) == 'on') el[action] = actions[action];
			}
		});
	},
	
	filterById: function(id){
		var found = [];
		this.each(function(el){
			if (el.id == id) found.push(el);
		});
		return found;
	},

	filterByClassName: function(className){
		var found = [];
		this.each(function(el){
			if (Element.hasClassName(el, className)) found.push(el);
		});
		return found;
	},

	filterByTagName: function(tagName){
		var found = [];
		this.each(function(el){
			if (el.tagName.toLowerCase() == tagName) found.push(el);
		});
		return found;
	},

	getElementsByTagName: function(tagName){
		var found = [];
		this.each(function(el){
			$c(el.getElementsByTagName(tagName)).each(function(tn){
				found.push(tn);
			});
		});
		return found;
	}
	
});

if(!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;


/****************************************************
*****************************************************
**
** moo.fx.js
**
*****************************************************
*****************************************************/

/*
moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
for more info (http://moofx.mad4milk.net).
Sunday, March 05, 2006
v 1.2.3
*/

var fx = new Object();
//base
fx.Base = function(){};
fx.Base.prototype = {
	setOptions: function(options) {
	this.options = {
		duration: 500,
		keepCentered: false, /* rw add: keeps an absolute positioned element centered while changing size :) */
		topEl: '', /* rw add: this is the absolute positioned element, maybe on top */
		onComplete: '',
		transition: fx.sinoidal
	}
	Object.extend(this.options, options || {});
	},

	step: function() {
		var time  = (new Date).getTime();
		if (time >= this.options.duration+this.startTime) {
			this.now = this.to;
			clearInterval (this.timer);
			this.timer = null;
			if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);
		}
		else {
			var Tpos = (time - this.startTime) / (this.options.duration);
			this.now = this.options.transition(Tpos) * (this.to-this.from) + this.from;
		}
		this.increase();
	},

	custom: function(from, to) {
		if (this.timer != null) return;
		if (this.options.keepCentered) {
			this.startTop=$(this.options.topEl).offsetTop; /* rw add: remember start top position */
		}
		this.from = from;
		this.to = to;
		this.startTime = (new Date).getTime();
		this.timer = setInterval (this.step.bind(this), 13);
	},

	hide: function() {
		this.now = 0;
		this.increase();
	},

	clearTimer: function() {
		clearInterval(this.timer);
		this.timer = null;
	}
}

//stretchers
fx.Layout = Class.create();
fx.Layout.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		try {
			this.el = $(el);
			this.el.style.overflow = "hidden";
			this.iniWidth = this.el.offsetWidth;
			this.iniHeight = this.el.offsetHeight;
			this.setOptions(options);
		} catch (e) { };
	}
});

fx.Height = Class.create();
Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {	
	increase: function() {
		if (this.options.keepCentered) { // rw add
			$(this.options.topEl).style.top = Math.round(this.startTop-((this.now-this.from)/2)) + "px"; /* rw add: setting top position half the value of size growing, so it remains centered */
			if (UA.bIsIE7) $(this.options.topEl).style.height = (Math.round(this.now)+21) + "px"; // rw add: ie7 fix: manually size outer window
		} // rw add
		this.el.style.height = this.now + "px";
	},

	toggle: function() {
		if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);
		else this.custom(0, this.el.scrollHeight);
	}
});

fx.Width = Class.create();
Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {	
	increase: function() {
		this.el.style.width = this.now + "px";
	},

	toggle: function(){
		if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);
		else this.custom(0, this.iniWidth);
	}
});

//fader
fx.Opacity = Class.create();
fx.Opacity.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		this.el = $(el);
		this.now = 1;
		this.increase();
		this.setOptions(options);
	},

	increase: function() {
		if (this.now == 1 && (/Firefox/.test(navigator.userAgent))) this.now = 0.9999;
		this.setOpacity(this.now);
	},
	
	setOpacity: function(opacity) {
		if (opacity == 0 && this.el.style.visibility != "hidden") this.el.style.visibility = "hidden";
		else if (this.el.style.visibility != "visible") this.el.style.visibility = "visible";
		if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + opacity*100 + ")";
		this.el.style.opacity = opacity;
	},

	toggle: function() {
		if (this.now > 0) this.custom(1, 0);
		else this.custom(0, 1);
	}
});

//transitions
fx.sinoidal = function(pos){
	return ((-Math.cos(pos*Math.PI)/2) + 0.5);
	//this transition is from script.aculo.us
}
fx.linear = function(pos){
	return pos;
}
fx.cubic = function(pos){
	return Math.pow(pos, 3);
}
fx.circ = function(pos){
	return Math.sqrt(pos);
}


/****************************************************
*****************************************************
**
** moo.fx.pack.js - do we really need this one?
**
*****************************************************
*****************************************************/

/****************************************************
*****************************************************
**
** moo.show.lite.js
**
*****************************************************
*****************************************************/

// mooShow 1.04
// (c)2006 Stuart Eaton - http://www.eatpixels.com
//
// Credit where credit is due: Inspiration from Lightbox (http://www.huddletogether.com/projects/lightbox2/)
// and Couloir (http://www.couloir.org/js_slideshow/) and of course moo.fx (http://moofx.mad4milk.net/
// moo.fx and prototype are covered by their own respective license terms.

var mooShows=new Object();
var isPair=false;

var blankImg=appPath+'file/all/b.gif';

var mooLastWidth=498;
var mooLastHeight=200;

function moo_start(id, nr, orl) {
	if (!mooShows[id]) mooShows[id]=new mooshow(id); // create new mooshow objects
	create_mooshow(id, nr || 0, orl);
}
	
function create_mooshow(showName, shownumber, orl) {
	photoArray=eval(showName); // set up image array based on id
	shownumber++; // add 1 to shownumber so it starts on 1 not 0
	var isp=(photoArray[0].length > 8);
	if ( (!isp && photoArray.length <= 2) || (isp && photoArray.length <= 3) ) {
		mooShows[showName].overlayNav='no';
	} else {
	}
	if(this.topNav=='no' || photoArray.length<=2) {
		Element.hide(showName+'_topNav');
		
	} else {
		mooShows[showName].updateTopNav(showName);
	}
	if (!orl) {
		mooShows[showName].jumptoImage(shownumber);
	} else {
		var w=photoArray[0][1];
		var h=photoArray[0][2];
		//Element.setHeight(showName+'_overlayNav', h);
		//Element.setWidth(showName+'_overlayNav', ( (isp) ? w*2 : w ));
		Element.setHeight(showName+'_overlayNav', 500);
		Element.setWidth(showName+'_overlayNav', 800);
		if (mooShows[showName].overlayNav=='yes') Element.show(showName+'_overlayNav');
		if (mooShows[showName].IPTCinfo=='yes') Element.show(showName+'_zoombutton');
	}
}

var mooshow = Class.create();
mooshow.prototype = {

	initialize: function(showName) {
		this.id = showName;
		this.busy = 0;
		this.counter = 0;
		this.photoArray = eval(this.id);
		this.numberOfImages = this.photoArray.length-2;
		this.IPTCinfoStatus = 0;
		// new 9 static settings
		this.speed=500;
		this.fadeSpeed=500;
		this.topNav='yes';
		this.overlayNav='yes';
		//this.dropShadow='no';
		//this.captions='no';
		//this.border=0;
		this.copyright='yes';
		this.IPTCinfo=(showName=="zoomShow") ? 'no' : 'yes';
	},
	
	nextImage: function() {
		if(this.busy<1){
			this.busy=1;
			if(this.counter < this.numberOfImages) {
				this.counter ++;
			} else {
				this.counter = 0;
			}
			this.loadImage();
		}
	},
	
	prevImage: function() {
		if(this.busy<1){
			this.busy=1;
			if(this.counter > 0) {
				this.counter --;
			} else {
				this.counter = this.numberOfImages;
			}
			this.loadImage();			
		}
	},
	
	jumptoImage: function(counter) {
		if(this.busy<1){
			this.busy=1;
			this.counter = counter-1;
			this.loadImage();		
		}
	},
	
	switchContent: function(newArray) {
		if(this.busy<1){
			this.busy=1;
			this.photoArray = eval(newArray);
			this.numberOfImages = this.photoArray.length -2;
			this.counter = 0;
			this.loadImage();		
		}
	},
	
	updateIPTCinfoToggle: function() {
		TB_overlaySize();
		//alert("c:"+this.counter);
		moo_start('zoomShow', this.counter);
	},
	
	updateTopNav: function(showName) {
		Element.setInnerHTML(showName+'_topNav', ''); // ???
		this.topNavContent = $(showName+'_topNav').innerHTML; // ???
		
		//this.topNavContent = '<div><span class="cnt">'+(this.counter+1) + ' / ' + (this.photoArray.length-1) + '</span>';
		this.topNavContent = '<div><a href="#" onclick="mooShows[&#39;'+showName+'&#39;].prevImage(); return false;">&lt;</a>';
		for (var i=1; i<this.photoArray.length; i++) {
			if (i==this.counter+1) {
				this.topNavContent=this.topNavContent+'<span>'+i+'</span>';
			} else {
				this.topNavContent=this.topNavContent+'<a href=\'#'+i+'\' onclick=\'mooShows[&#39;'+showName+'&#39;].jumptoImage('+i+'); return false;\'>'+i+'</a>';
			}
		}
		this.topNavContent+='<a href="#" onclick="mooShows[&#39;'+showName+'&#39;].nextImage(); return false;">&gt;</a>';
		document.getElementById(showName+'_topNav').innerHTML = this.topNavContent+"</div>";
	},
	
	// -----------------------------------------------------------------------------------

	loadImage: function() {
		//get showname
		showName=this.id;
		// update top navigation
		if (this.topNav=='yes') this.updateTopNav(showName);
		// show laoding animation
		var corr=(UA.bIsIE7) ? Math.round(( ( ( (showName=="zoomShow") ? 950 : Element.getWidth(showName+'_outerContainer') ) )-Element.getWidth(showName+'_imageContainer'))/2) : 0; // idiot explorer 7 hack
		$(showName+'_loading').style.left=Math.round(((Element.getWidth(showName+'_imageContainer')-32)/2)+corr)+'px';
		$(showName+'_loading').style.top=Math.round((Element.getHeight(showName+'_imageContainer')-32)/2)+'px';
		Element.show(showName+'_loading'); // causes IE to make bg higher :(
		// hide IPTC info
		Element.hide(showName+'_zoom');
		Element.hide(showName+'_zoombutton');
		// overlay navigation
		Element.hide(showName+'_overlayNav');
		// rw - check for a image pair
		isPair=(this.photoArray[this.counter].length > 8);
		// preload in new image
		newImgPreloader1=new Image();
		newImgPreloader2=new Image(); // rw
		newImgPreloaderProtect = new Image(); //image protection
		// if image is preloaded
		newImgPreloader1.onload=function(){
			// when loaded
			$(showName+'_imageContainer').style.visibility='visible';
			if(showName=='zoomShow')$(showName+'_imageContainer').innerHTML = $(showName+'_imageContainer').innerHTML + '<img src="'+appPath+'file/all/b.gif"  style="z-index:123456;position:absolute;left:0;top:0;width:100%;height:100%;display:inline"/>'; //image protection
			// hide current photo
			Element.setSrc(showName+'_image1', blankImg);
			Element.setOpacity(showName+'_image1',0);
			Element.setSrc(showName+'_image2', blankImg);
			Element.setOpacity(showName+'_image2',0);
			// hide laoding animation
			Element.hide(showName+'_loading');
			// set captions to blank space
			// set copyright to blank
			Element.setInnerHTML(showName+'_copyright', '');
			// get new sizes
			newHeight=mooShows[showName].photoArray[mooShows[showName].counter][2];
			newWidth=mooShows[showName].photoArray[mooShows[showName].counter][1];
			// resize containers to new size
				// use given size from array instead of real image size - so we can scale them down on demand
				var w=mooShows[showName].photoArray[mooShows[showName].counter][1];
				var h=mooShows[showName].photoArray[mooShows[showName].counter][2];
				mooLastWidth=(isPair) ? w*2 : w;
				mooLastHeight=h
				// set up next image
				Element.setSrc(showName+'_image1', newImgPreloader1.src);
				if (isPair) Element.setSrc(showName+'_image2', newImgPreloader2.src); // rw
				// reposition overlay nav
				// rw: set image size
				if (isPair) {
					//alert("showing img 2 now!");
					Element.show(showName+'_image2');
					w=mooShows[showName].photoArray[mooShows[showName].counter][1];
					h=mooShows[showName].photoArray[mooShows[showName].counter][2];
				}
				// end rw
				//show captions
				// copyright
				if (mooShows[showName].copyright=='yes') Element.setInnerHTML(showName+'_copyright', 'Copyright &copy; Duravit');
				var corr=(UA.bIsIE7) ? Math.round(( ( ( (showName=="zoomShow") ? 950 : Element.getWidth(showName+'_outerContainer') ) )-Element.getWidth(showName+'_imageContainer'))/2) : 0; // idiot explorer 7 hack
				$(showName+'_copyright').style.right=(10+corr)+'px'; // ie7 - doesn't affect other browsers
				this.fader1=new fx.Opacity(showName+'_image1', {duration: mooShows[showName].fadeSpeed, onComplete:function() { 
					mooShows[showName].busy=0;
					// overlay navigation
					if (mooShows[showName].overlayNav=='yes') Element.show(showName+'_overlayNav');
					//IPTC panel height
					if (mooShows[showName].IPTCinfo=='yes') Element.show(showName+'_zoombutton');
					Element.setWidth(showName+'_zoom', newImgPreloader1.width);
					if (mooShows[showName].IPTCinfoStatus==1) { mooShows[showName].IPTCinfoStatus=0; mooShows[showName].updateIPTCinfoToggle(); }
				}});
				// call fader fx
				if (isPair) {
					this.fader2=new fx.Opacity(showName+'_image2', {duration:mooShows[showName].fadeSpeed, onComplete:function() { /*alert("image 2 faded in!");*/ }});
					this.fader2.hide(); this.fader2.toggle();
				}
				this.fader1.hide(); this.fader1.toggle();
			
			// get current sizes
			oldHeight=Element.getHeight(showName+'_imageContainer');
			if (UA.bIsIE7 && oldHeight==0) oldHeight=400; // fix another ie7 bug - on first image, no height is given :(
			oldWidth=Element.getWidth(showName+'_imageContainer');

			// call moo.fx and when done switchImage()
		};
		
		if (isPair) { // create a preloader chain - rw
			newImgPreloader2.onload=function(){
				newImgPreloader1.src=mooShows[showName].photoArray[mooShows[showName].counter][0]; // preloader src
			}
			newImgPreloader2.src=this.photoArray[this.counter][8]; // preloader src
		} else { // create a single preloader
			newImgPreloader1.src=this.photoArray[this.counter][0]; // preloader src
		}
	}
	
	// -----------------------------------------------------------------------------------

}


//	Additional methods for Element by SU, Couloir
//	- further additions by Lokesh Dhakar (huddletogether.com)
//	- and Stuart Eaton (eatpixels.com)

// !!! Replacing by moo.dom ???

Object.extend(Element, {
	getWidth: function(element) {
   	element = $(element);
   	return element.offsetWidth; 
	},
	
	getHeight: function(element) {
   	element = $(element);
   	return element.offsetHeight; 
	},
	
	setWidth: function(element,w) {
   	element = $(element);
   	element.style.width = w +"px";
	},

	setHeight: function(element,h) {
 		element = $(element);
   	element.style.height = h +"px";
	},

	setTop: function(element,t) {
   	element = $(element);
   	element.style.top = t +"px";
	},

	setSrc: function(element,src) {
   	element = $(element);
   	element.src = src; 
	},
	
	setAlt: function(element,alt) {
   	element = $(element);
   	element.alt = alt; 
	},
	
	setOpacity: function(element,opacity) {
   	element = $(element);
   	element.style.opacity = opacity; 
	},

	setHref: function(element,href) {
   	element = $(element);
   	element.href = href; 
	},
	setInnerHTML: function(element,content) {
		element = $(element);
		element.innerHTML = content;
	},

	hide: function(element) {
   	element = $(element);
   	element.style.display = 'none';
 	},

 	show: function(element) {
  	element = $(element);
   	element.style.display = 'inline';
 	}
});

// ---------------------------------------------------


// TB stuff

function TB_overlaySize() {
	showInlineWindow(952, 420);
	TB_writecode();
}

function TB_writecode() {
	//
	// writing moo.show code
	var s=''+
	'<img onclick="TB_hide()" style="float:right; margin-left:10px;" title="Close Zoom" src="'+appPath+'file/all/icon_closewin_gr.gif" width="20" height="20" alt="Close" /><div id="zoomShow_topNav" style="overflow: hidden; width: 340px;" class="mooshow_topNav"></div>'+
	'<div style="background-color:#fff; padding:0px 1px 1px 1px; clear:both;">'+
	'	<div style="display: inline;" id="zoomShow" class="mooshow"><div id="zoomShow_outerContainer" class="mooshow_outerContainer">'+
	'	<div id="zoomShow_contentContainer" class="mooshow_contentContainer">'+
	'		<div id="zoomShow_imageContainer" style="background-color:#cacaca; visibility:hidden;"><img style="overflow: hidden; height:400px; width:475px;" src="'+appPath+'file/all/b.gif" class="mooshow_image" id="zoomShow_image1" height="400"'+
	'		><img style="display:none; overflow: hidden; height: 1px; width: 1px; visibility: hidden;" src="'+appPath+'file/all/b.gif" class="mooshow_image" id="zoomShow_image2" height="1"'+
	'		width="1"></div><img style="display: none;" src="'+appPath+'file/all/ani_loader_big2.gif" id="zoomShow_loading" class="mooshow_loading"'+
	'		  alt="Loading"><div id="zoomShow_copyright" class="mooshow_copyright">Copyright © Duravit</div>'+
	'		<div id="zoomShow_overlayNav" class="mooshow_overlayNav" style="height: 296px; width: 249px; display: inline;">'+
	'			<a href="#1" id="zoomShow_prevLink" class="mooshow_prevLink" onclick="mooShows[\'zoomShow\'].prevImage();"></a>'+
	'			<a href="#1" id="zoomShow_nextLink" class="mooshow_nextLink" onclick="mooShows[\'zoomShow\'].nextImage();"></a>'+
	'		</div>'+
	'		<div id="zoomShow_zoom" class="mooshow_zoom" style="width: 249px; display: none;"></div>'+
	'		<a href="#" onclick="mooShows[\'zoomShow\'].updateIPTCinfoToggle(); return false;"><img style="display: none;" src="'+appPath+'file/all/moo_info.gif" id="zoomShow_zoombutton" class="mooshow_zoombutton"></a>'+
	'	</div>'+
	'</div></div><script></script></div>';
	$("TB_window").innerHTML=s;
}



/****************************************************
*****************************************************
**
** universal inline box-handling ala thickbox
**
*****************************************************
*****************************************************/

function showInlineWindow(w, h, special) {
	var pagesize=TB_getPageSize();	
	var arrayPageScroll=TB_getPageScrollTop();
	var titleHtml1='<div class="title"><div class="titletext">';
	var titleHtml2='</div><div class="closewin" onclick="TB_hide()" title="'+lang.Close+'">&nbsp;</div><div class="brclear hide showie7"></div><br class="brclear" /></div>';
	var sw=getSiteWidth();
 	var sh=getSiteHeight();
	if (UA.bIsIE) $("TB_overlay").style.width=$("TB_HideSelect").style.width=sw+"px";
	$("TB_overlay").style.height=$("TB_HideSelect").style.height=sh+"px";
	$("TB_overlay").style.display=$("TB_HideSelect").style.display="block";
	//$("TB_overlay").onclick=TB_hide;
	var winRef=(w > 498) ? $("TB_window") : $("TB_window_small");
	//Element.addClassName(winRef, 'hidden');
	winRef.innerHTML=(special && special.title) ? titleHtml1+special.title+titleHtml2 : '';
	if (special && special.image) { // create image code
		special.code='<img src="'+special.image+'" alt="Image" onload="TB_done()" />';
	} else {
		TB_done();
	}
	if (special && special.code) winRef.innerHTML+=special.code;
	if (special && special.flashUrl) {
		winRef.innerHTML+='<div id="flash-win"></div>';
		var winObj = new SWFObject(special.flashUrl, "flashwin", "936", "686", "7", "#ffffff"); // "896", "634"
	  winObj.addVariable("baseURL", special.flashUrl.substring(0,special.flashUrl.lastIndexOf('/')+1));
		//winObj.addParam("wmode", "transparent"); <- why do we need this? sux in firefox (catalogs)
		winObj.addParam("scale", "noscale");
		var res=winObj.write('flash-win');
		if (!res) $('flash-win').innerHTML=lang.missingFlashPlayerText;
	}
	winRef.style.width=w+"px";
	winRef.style.height=h+"px";
	winRef.style.left=Math.round((sw-w)/2)+"px";
	winRef.style.top=Math.round((arrayPageScroll[1]+((pagesize[1]-h)/2)))+"px";
	winRef.style.display="block";
	var color=(special && special.color) || '#757575';
	var border=(special && special.color) ? special.border+'px solid '+color : 'none';
	winRef.style.border=border;
	//alert("win:"+$$('#TB_window.title').length);
	
	//$S('#TB_window .title')[0].style.backgroundColor=col;
	
//	var fader1=new fx.Opacity( ( (w > 498) ? 'TB_window' : 'TB_window_small' ), {duration:500, onComplete:function() { }});
//	fader1.hide();
//	fader1.toggle();
//  => much better performance w/out fading windows

}

function showContent(titleEl, contentEl, h) {
	var hd=titleEl.innerHTML;
	if (hd.length>60) hd=hd.substr(0,60)+'&#133;';
	showInlineWindow(498, h, {title:hd, code:$(contentEl).innerHTML, color:'#005099', border:1});
}

/** 
* Temp: test the new thickbox 2.0 dimension methods (for inline windows)
* @author	Ralf Walter
* @param {String}	
* @return {String}	Returns 
*/
function TB_getPageScrollTop(){
	var yScrolltop;
	if (self.pageYOffset) {
		yScrolltop = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScrolltop = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScrolltop) 
	return arrayPageScroll;
}

function TB_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = new Array(w,h) 
	return arrayPageSize;
}

function TB_done() {
	Element.removeClassName('TB_window_small', 'hidden');
	Element.removeClassName('TB_window', 'hidden');
}

function TB_hide() {
	storeBusy=false;
	$("TB_overlay").style.display="none";
	$("TB_HideSelect").style.display="none";
	$("TB_window").style.display="none";
	$("TB_window").innerHTML='';
	$("TB_window_small").style.display="none";
	$("TB_window_small").innerHTML='';
	//$("product-matrix").style.visibility="hidden"; // special case
	if (document.getElementById("teaser")) $("teaser").style.visibility='visible'; // extra für Opera
	isMatrixOn=false;
}


/****************************************************
*****************************************************
**
** the native duravit.js code
**
*****************************************************
*****************************************************/

//
// global Vars
var myFX={}; // namespace for moo.fx instances
var myUser=null; // the user-object - populated by json-data
var pageIsLoaded=false; // set to true onload
var ppResolution=300; // download-resolution for press photos
var isXms=false; // needs to change also the bg-image in CSS


// needs reviewing - moo.dom, prototype, etc.

function focusSearchField(obj) {
	if (obj.value==searchDefVal) obj.value="";
	//obj.style.color="#005099";
	//obj.style.borderColor="#005099";
	//obj.className+=" form-focus";
}

function blurSearchField(obj) {
	if (obj.value=="") obj.value=searchDefVal;
	//obj.style.color="#a9bacb";
	//obj.style.borderColor="#6b9ac2";
	//obj.className=obj.className.replace(/ form-focus/, "");
}

function foldColumn(id, denyUA) {
	if(denyUA && UA.bIsSafari) return;
	var cn=document.getElementById(id).className;
	var state=(cn.indexOf("fc-closed")>-1) ? true : false;
	document.getElementById(id).className=(cn.indexOf("fc-closed")>-1) ? cn.replace(/fc-closed/gi, "") : cn+"fc-closed";
	setCookie("column-"+id+"="+state); // set cookie
}

function foldBlock(id, denyUA, openonly) {
	if(denyUA && UA.bIsSafari) return;
	var cn=document.getElementById(id).className;
	if (openonly && cn.indexOf("fb-closed") == -1) return;
	var state=(cn.indexOf("fb-closed")>-1) ? true : false;
	document.getElementById(id).className=(cn.indexOf("fb-closed")>-1) ? cn.replace(/ fb-closed/gi, "") : cn+" fb-closed";
	setCookie("block-"+id+"="+state); // set cookie
	// todo:
	// Ajax-Nachladen bei initial geschlossenem Block - spter :)
}
function toggleSection(section) {//to fold productdetail file group
	var toFold = document.getElementsByClassName(section);
	for(var i=0; i < toFold.length; i++){
		cn = toFold[i].className;
		toFold[i].className=(cn.indexOf("fb-closed")>-1) ? cn.replace(/ fb-closed/gi, "") : cn+" fb-closed";
	}
	var cnHeader = $(section).className;
	if(cnHeader!=undefined){
		$(section).className=(cnHeader.indexOf("Closed")>-1) ? cnHeader.replace(/Closed/gi, "") : cnHeader+"Closed";
	}
}
function foldAllBlocks(state) {
	if (state) {
		$S('.foldable-block').each(function(el) {
				el.className = el.className.replace(/ fb-closed/gi, "");
		})
	} else {
		$S('.foldable-block').each(function(el) {
				el.className+= " fb-closed";
		})
	}
}

var faqItemSelected=null;
function foldFAQ(id, srcEl) {
	if (srcEl) srcEl.blur();
	el=document.getElementById(id);
	if (faqItemSelected!=null) { // close old
		eo=document.getElementById(faqItemSelected);
		//eo.className=eo.className.replace(/ exclusive-style/gi, "");
		eo.getElementsByTagName('A')[0].style.backgroundPosition='0 11px'; // DT A 
		eo.getElementsByTagName('DD')[0].style.display='none';
		eo.getElementsByTagName('DT')[0].style.backgroundColor='transparent';
	}
	if (faqItemSelected==id) { // close only
		faqItemSelected=null;
		return;
	}
	//el.className=el.className+" exclusive-style";
	el.getElementsByTagName('A')[0].style.backgroundPosition='0 -89px'; // DT A 
	el.getElementsByTagName('DD')[0].style.display='block';
	el.getElementsByTagName('DT')[0].style.backgroundColor='#e8e8e8';
	faqItemSelected=id;
}

function hasNoAjax() {
	return false;
}

function setCookie(str, days) {
	if (!days) days=365;
	var expireDate = new Date();
	expireDate.setTime(expireDate.getTime() + (days * 24 * 60 * 60 * 1000)); // Cookie TTL
	document.cookie = str+"; expires="+expireDate.toGMTString();
}

var isMatrixOn=false;

function switchProductMatrix() { // switch visibility of p-mx
	var pm=$('product-matrix');
	// evtl. hier für bestimmte browser flash-elemente ausblenden - oder aus performance-gründen ;)
	if (!isMatrixOn) { hideFlash(document.getElementById('wrapper1'), 165, 490) } else { showFlash(); };
	if (!isMatrixOn) {
		pm.style.visibility='visible';
		var sw=getSiteWidth();
	 	var sh=getSiteHeight();
		if (UA.bIsIE) $("TB_overlay").style.width=$("TB_HideSelect").style.width=sw+"px";
		$("TB_overlay").style.height=$("TB_HideSelect").style.height=sh+"px";
		$("TB_overlay").style.display=$("TB_HideSelect").style.display="block";
		$("TB_overlay").onclick=TB_hide;
		if (document.getElementById("teaser")) $("teaser").style.visibility='hidden'; // extra für Opera
		isMatrixOn=true;
	} else {
		TB_hide();
		isMatrixOn=false;
	}
	setProductMatrix();
	if (isMatrixOn) {
		var res=pmObj.write("pm-flash");
		if (!res) $('pm-flash').innerHTML=lang.missingFlashPlayerText;
	} else {
		$('pm-flash').innerHTML='';
	}
}

function setProductMatrix() { // set size and position of p-mx
	var pm=$('product-matrix');
	var l=(!UA.bIsIE7)?10:390;
	//alert(isHome);
	var t=(isHome)?-202:10;
	var iemac=(UA.bIsIEMac)?-10:0;
	var saf=(UA.bIsSafari)?0:0;
	var elm=$('wrapper1');
	while (elm.offsetParent) {
		t+=elm.offsetTop;
		l+=elm.offsetLeft;
		elm=elm.offsetParent;
	}
	pm.style.top=(t+iemac+saf)+"px";
	pm.style.left=(l+iemac)+"px";
	var w=(!UA.bIsIE7)?24:34;
	pm.style.width=(document.getElementById('border').offsetWidth-w)+'px';
}


function switchLoginContainer() {
	var lc=document.getElementById('login-container');
	var dis=(lc.style.display!='none')?'none':'block';
	lc.style.display=dis;
}


var hiddenFlash=[];
function hideFlash(baseElem, min, max) {
	if (!baseElem) baseElem=document;
	var emb=baseElem.getElementsByTagName('EMBED');
	if (emb.length==0) emb=baseElem.getElementsByTagName('OBJECT');
	for (var i=0; i<emb.length; i++) {
		var t=getTotalTop(emb[i]);
		if (t > min && t < max) {
			emb[i].style.visibility='hidden';
			hiddenFlash[hiddenFlash.length]=emb[i];
		}
	}
}

function showFlash() {
	for (var i=0; i<hiddenFlash.length; i++) {
		hiddenFlash[i].style.visibility='visible';
	}
	hiddenFlash=[];
}

function getTotalTop(elm) {
	var t=0;
	while (elm.offsetParent) {
		t+=elm.offsetTop;
		elm=elm.offsetParent;
	}
	return t;
}

var pmSelectedSeries='';
var pmSelectedCategory='';

function pmChangeSeries(selObj, form, elem, ddc) {
	//var sel=document.forms['prodnavForm'].elements['prodnavCategories'];
	var sel=document.forms[form].elements[elem];
	var sid=selObj.options[selObj.selectedIndex].value;
	//var isDDC=(sid=='ddc') ? true:false;
	if (sid=='' || sid=='ddc') sid='all';
	var selCat=sel.options[sel.selectedIndex].value;
	sel.options.length=1; // All Cat's löschen
	//
	// set categories
	for (var i=0; i < pmSelectorSeries[sid].length; i++) {
		sel.options[i+1]=new Option(pmSelectorSeries[sid][i].name, pmSelectorSeries[sid][i].id, false, (pmSelectorSeries[sid][i].id==selCat)?true:false );
	}
	if (ddc && sid=='all') {
		sel.options[i+1]=new Option('Duravit Design Center', 'ddc', false, false );
	}
}

function pmChangeCategory(selObj, form, elem, ddc) {
	//var sel=document.forms['prodnavForm'].elements['prodnavSeries'];
	var sel=document.forms[form].elements[elem];
	var cid=selObj.options[selObj.selectedIndex].value;
	//var isDDC=(cid=='ddc') ? true:false;
	if (cid=='' || cid=='ddc') cid='all';
	var selSer=sel.options[sel.selectedIndex].value;
	sel.options.length=1; // All Ser's löschen
	//
	// set series
	pmSelectorCategories[cid].sort();
	for (var i=0; i < pmSelectorCategories[cid].length; i++) {
		sel.options[i+1]=new Option(pmSelectorCategories[cid][i].name, pmSelectorCategories[cid][i].id, false, (pmSelectorCategories[cid][i].id==selSer)?true:false );
	}
}

var selectedSeries = '';
var selectedCategory = '';
var selectedColor = '';

var searchDP = {};
//{
//	qSeries: [
//		['0815', 'Serie 0815'],
//		['0816', 'Serie 0816'],
//		['0817', 'Serie 0817']
//	],
//	
//	qGroup: [
//		['washbasins', 'Waschtische'],
//		['washbasins2', 'Waschtische 2'],
//		['washbasins3', 'Waschtische 3']
//	],
//	
//	qColor: [
//		['00', 'Rot'],
//		['10', 'Grün'],
//		['22', 'Blau']
//	]
//}

function getSearchLists(post) {
	new ajax(appPath+'html/getsearchmenu.json.'+lang.Language+'.html', {postBody:post, onComplete:parseSearchLists });
}

function parseSearchLists(request) {
	searchDP = eval('('+request.responseText+')'); // JSON "parsen"
	renderSearchLists();
}

function renderSearchLists() {
	qsEl = document.getElementById('qSeries');
	if (searchDP.qSeries.length > 0) {
		qsEl.options.length = 1;
		for (var i = 0; i < searchDP.qSeries.length; i++) {
			qsEl.options[i+1] = new Option(searchDP.qSeries[i][1], searchDP.qSeries[i][0], false, (searchDP.qSeries[i][0] == selectedSeries) ? true : false );
		}
	}

	qgEl = document.getElementById('qGroup');
	if (searchDP.qGroup.length > 0) {
		qgEl.options.length = 1;
		for (var i = 0; i < searchDP.qGroup.length; i++) {
			qgEl.options[i+1] = new Option(searchDP.qGroup[i][1], searchDP.qGroup[i][0], false, (searchDP.qGroup[i][0] == selectedCategory) ? true : false );
		}
	}

	qcEl = document.getElementById('qColor');
	if (searchDP.qColor.length > 0) {
		qcEl.options.length = 1;
		for (var i = 0; i < searchDP.qColor.length; i++) {
			qcEl.options[i+1] = new Option(searchDP.qColor[i][1], searchDP.qColor[i][0], false, (searchDP.qColor[i][0] == selectedColor) ? true : false );
		}
	}
}

//
// new dynamic search menus
function onSeriesChange() {
	var qs = ''; // : DataProvider;
	selObj = document.getElementById('qSeries');
	selectedSeries = selObj.options[selObj.selectedIndex].value;;
	
	qs+= 's='+selectedSeries;
	qs+= '&g='+selectedCategory;
	qs+= '&c='+selectedColor;
	qs+= '&m=s'; // mode ("series")
	
	document.getElementById('qMode').value = 's';
	
	getSearchLists(qs);
}

function onCategoryChange(e) {
	var qs = ''; // : DataProvider;
	selObj = document.getElementById('qGroup');
	selectedCategory = selObj.options[selObj.selectedIndex].value;;
	
	qs+= 's='+selectedSeries;
	qs+= '&g='+selectedCategory;
	qs+= '&c='+selectedColor;
	qs+= '&m=g'; // mode ("category/group")

	document.getElementById('qMode').value = 'g';
	
	getSearchLists(qs);
}

function onColorChange(e) {
	var qs = ''; // : DataProvider;
	selObj = document.getElementById('qColor');
	selectedColor = selObj.options[selObj.selectedIndex].value;;
	
	qs+= 's='+selectedSeries;
	qs+= '&g='+selectedCategory;
	qs+= '&c='+selectedColor;
	qs+= '&m=c'; // mode ("color")

	document.getElementById('qMode').value = 'c';
	
	getSearchLists(qs);
}


function selectToURL(selObj) {
	window.location.href=selObj.options[selObj.selectedIndex].value;
}

function tableRuler() {
	var tables=document.getElementsByTagName('table');
	for (var i=0; i<tables.length; i++) {
		if(tables[i].className.indexOf('ruler')!=-1) {
			var trs=tables[i].getElementsByTagName('tr');
			for(var j=0;j<trs.length;j++) {
				if(trs[j].parentNode.nodeName=='TBODY' && trs[j].parentNode.nodeName!='TFOOT') {
					trs[j].onmouseover=function(){this.className='ruled';return false}
					trs[j].onmouseout=function(){this.className='';return false}
				}
			}
		}
	}
}

function stretchContentColumn() {
	try {
		//content-column
		//alert("body:"+document.body.offsetHeight+" content:"+document.getElementById("content-column").offsetHeight);
		var sh=getSiteHeight();
		var vh=getVpHeight();
		//alert(sh+" < "+vh);
		if (sh < vh) {
			//alert("stretch by:"+(vh-sh)+"\nsizer-h:"+$('sizer').offsetHeight+"\ncontainer-measure-h:"+$('content-measure').offsetHeight );
			var homeh=(isHome) ? 212 : 0;
			var free=$('sizer').offsetHeight-174-homeh-$('content-measure').offsetHeight-45; // total - header - right-content - footer
			//alert('free:'+free);
			$('stretch-col').style.height=( free+(vh-sh) )+'px';
			$('stretch-col').style.display='';
		}
	} catch (e) { }
}









// refactored code follows...

/*****************************************************************
* 
* Common Functions
* 
******************************************************************/

/** 
* Gets the the width of the document including scrollbars
* @author	Ralf Walter
* @return {Int}	Returns the width in pixels
*/
function getSiteWidth() { // derived from thickbox.js
	if (document.width) { // added rw
		xScroll = document.width;
	} else if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
 	}
 	return xScroll;
}

/** 
* Gets the the height of the document including scrollbars and scrollable size
* @author	Ralf Walter
* @return {Int}	Returns the height in pixels
*/
function getSiteHeight() { // derived from thickbox.js
	if (window.innerHeight && window.scrollMaxY) {	
		//alert(1);
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		//alert(2+' '+document.body.scrollHeight+' > '+document.body.offsetHeight);
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		//alert(3+' '+document.body.scrollHeight+' > '+document.body.offsetHeight);
		yScroll = document.body.offsetHeight;
 	}
 	return yScroll;
}

function getScrollTop() {

	if(UA.bIsWebKit){
		return document.defaultView.pageYOffset;
	}

	//
	// replace by TB_getPageScrollTop() of TB 2.0 ??? Let's see how it works
	if (window.scrollX) { // all except Explorer
		return window.scrollX;
	} else if (document.documentElement && document.documentElement.clientHeight) {	// Explorer 6 Strict Mode
		return document.documentElement.scrollTop;
	} else if (document.body) { // other Explorers
		return document.body.scrollTop;
	}
}

/** 
* Gets the width of the viewport - without scrolling overflow, but with scrollbar (should not!)
* @author	Ralf Walter
* @return {Int}	Returns width in pixels
*/
function getVpWidth() {
	if (window.innerHeight) { // all except Explorer
		return self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientHeight) {	// Explorer 6 Strict Mode
		return document.documentElement.clientWidth;
	} else if (document.body) { // other Explorers
		return document.body.clientWidth;
	}
}

/** 
* Gets the height of the viewport - without scrolling overflow, but with scrollbar (should not!)
* @author	Ralf Walter
* @return {Int}	Returns height in pixels
*/
function getVpHeight() {
	if (window.innerHeight) { // all except Explorer
		return self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {	// Explorer 6 Strict Mode
		return document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		return document.body.clientHeight;
	}
}

/**
* Applies highlight effect - requires moo.fx
* fx.Flash
* @author Dmytro Shteflyuk --- http://kpumuk.info/php/extending-moo-fx-with-custom-effect-fx-flash/lang/en/
*/

fx.Flash = Class.create();
Object.extend(Object.extend(fx.Flash.prototype, fx.Base.prototype), {	
	hD: "0123456789ABCDEF",
	
	initialize: function(el, options) {
		this.el = $(el);

		var color_from = (options && options.color_from) || "#ffffff";
		var color_to = (options && options.color_to) || "#ff0000";
		var color_f = this.h2d(color_from.substr(1));
		var color_t = this.h2d(color_to.substr(1));
		
		var _options = {
			red: [color_f >> 16, color_t >> 16],
			green: [(color_f >> 8) & 255, (color_t >> 8) & 255],
			blue: [color_f & 255, color_t & 255],
			count: 1
		};
		Object.extend(_options, options || {});
		if (_options.onComplete) _options.flashOnComplete = _options.onComplete;
		this.setOptions(_options);
	},
	
	increase: function() {
		var r = this.d2h(this.now * (this.options.red[0] - this.options.red[1]) / 255 + this.options.red[1]);
		var g = this.d2h(this.now * (this.options.green[0] - this.options.green[1]) / 255 + this.options.green[1]);
		var b = this.d2h(this.now * (this.options.blue[0] - this.options.blue[1]) / 255 + this.options.blue[1]);
		this.el.style.backgroundColor = "#" + r + g + b;
	},

	toggle: function() {
		if (this.flashCount == undefined) this.flashCount = this.options.count;
		this.options.onComplete = this.onComplete.bind(this);
		this.custom(255, 0);
	},
	
	onComplete: function() {
		this.flashCount--;
		if (this.flashCount == 0)
		{
			this.flashCount = undefined;
			this.options.onComplete = this.options.flashOnComplete;
		} else
			this.options.onComplete = this.toggle.bind(this);
		//this.custom(0, 255); Sebastian: wenn aktiv Farbe faded zurueck
	},
	
	d2h: function(d) {
		var h = this.hD.substr(d & 15, 1);
		while (d > 15) { d >>= 4; h = this.hD.substr(d & 15, 1) + h; }
		if (h.length == 1) h = "0" + h;
		return h;
	},
	
	h2d: function(h) {
		return parseInt(h, 16);
	}
});

var aktiv;
function jumpAndFade(el) {
	if(aktiv!=undefined){
		 var effectaktiv = new fx.Flash("active"+aktiv, {color_from:"#c8e2f4",color_to:"#ffffff",count:1,duration:4000});
		 effectaktiv.toggle();
	}
	var effect = new fx.Flash("active"+el, {color_from:"#ffffff",color_to:"#c8e2f4",count:1,duration:4000});
	effect.toggle();
	aktiv = el;
}

/** 
* Displays a flash catalog in inline popup
* @author	Ralf Walter
* @param {String} url Flash-Movie URL	
*/
function previewCatalog(url, titel) {
	//showInlineWindow(896, (634+23), {title:titel, flashUrl:url, color:'#005099', border:1});
	showInlineWindow(936, (686+23), {title:titel, flashUrl:url, color:'#005099', border:1});
}


/** 
* Applies image rollover events to all images with "ro"-class in document - called on load
* @author	Ralf Walter
*/
function setRollOverEvents() {
	$S('img.ro').each(function(element){
		element.onmouseover = function(){
			this.src=this.src.replace(/\.gif/gi, '_hi.gif').replace(/\.png/gi,'_hi.png');
		}
		element.onmouseout = function(){
			this.src=this.src.replace(/_hi\.gif/gi, '.gif').replace(/_hi\.png/gi, '.png');
		}
	});
}

/** 
* Does the confirm checkbox handling for retailer print stuff 
* @author	Ralf Walter
*/
var confOk=false;
function confConditions() {
	if ($('fConfirmConditions').checked) {
		$('list-table').style.visibility='visible';
		if (UA.bIsIE) $('list-table').style.display='block'; // IE hack
		$('fConfirmConditions').checked=true;
		confOk=true;
	} else {
		if (confOk) $('fConfirmConditions').checked=true;
	}
}

/** 
* All code that will be executed after the page has been loaded
* @author	Ralf Walter
*/
function debugkey(e){
	try {
		var kk=e.keyCode || 0
		//alert(kk+'-'+ck);
		if (kk==192) {
			$('debugBox').innerHTML=$('debugBox').innerHTML.replace(/%cc%/, $('cctime').innerHTML);
			$('debugBox').style.display='block';
		}
	} catch (e) {}
}
document.onkeyup=debugkey;

var storage;
var storageOnloadFunction;
window.onload=function() { 
	
	storage=StorageManager.getInstance().getStorage();
	if (storageOnloadFunction) {
		storage.setOnload( storageOnloadFunction );
		storage.load();
	}

	/* *
	storage.setOnload( function()
	{
		alert("Storage ready!");
		if(storage.contains('scfquiz')) {
			alert("stg.get: "+storage.get('scfquiz').nick+" / "+storage.get('scfquiz').formsent);
		}
		storage.put('scfquiz', {nick:'Ralf', formsent:false});
		storage.save();
	});
	storage.load();
	* */


	pageIsLoaded=true;
	if (showPrintDialog) {
		window.print();
		return; // skip other onload-actions
	}
	tableRuler();
	if (!$('ecardview')) {
		stretchContentColumn(); // not working in ecard-viewer
	}
	setRollOverEvents();

	//
	// check TML-Warnings
	/*
	try {
		if (document.getElementById("debugBox").innerHTML.indexOf("warning(s) detected")>-1 || document.getElementById("debugBox").innerHTML.indexOf("stacktrace")>-1) {
			document.getElementById("debugIndicator").style.display="block";
			document.getElementById("debugBox").style.display="block";
		}
	} catch (e) { };
	*/
	// TEST TEST TEST!!!!
	//this will make all the list items inside the element with id = container red.
	/*
	$S('.container-left li').each(function(element){
		element.onclick = function(){
			Element.remove(this);
		}
	});
	*/
	
	//document.onmousedown=function(evt) { document.title=(' click:'+evt.target.tagName+':'+evt.target.id); }
	
	
	if (!$('ecardview')) {
		//myFX.loginBox=new fx.Height($('login-container') , {duration: 200, onComplete: function() { } });
		myFX.inlineWinH=new fx.Height($('TB_window_small'), {duration: 200, keepCentered: true, topEl: 'TB_window_small', onComplete: TB_done });
		getUserInfo(); // rwuser gets the user data an displays it in the myduravit-box
		//setCartIcons(); // rwuser sets the "filled"-state of the cart icon if it finds some that are in download list
		if (typeof(moodShow)!="undefined") moo_start('moodShow', 0, true); // creates a mooshow-instance for image-viewer in product milieu if needed
	} // else alert("you're on ecard!");
	
	/*if (isHome) {
		if (isXms) {
			onloadXms();
		} else {
			onloadShowcase();
		}
	}*/
	
	//try { if (doFoldBlock) foldBlock(doFoldBlock, null, true); } catch(e) {};
	
	tooltip.init ();
	
}
function onloadShowcase() {
	try {
	if (isXms) {
		$('teaser').style.backgroundImage='url('+xmsNormBg+')';
		$('teaser').innerHTML='';
	}
	var so = new SWFObject(showcaseURL, "slideshow", "100%", "202", "7", "#ffffff");
	so.addParam("base", showcaseURL.substring(0,showcaseURL.lastIndexOf('/')+1));
	so.addParam("scale", "noscale");
	so.addParam("wmode", "transparent");
	so.addParam("allowScriptAccess", "sameDomain");
	so.addVariable("xmlPath", showcaseXML);
	var res=so.write("teaser");
	//if (!res) alert("No Flash installed!");
	} catch (e) { }
}
function onloadXms() {
	try {
		var so = new SWFObject(xmsURL, "slideshow", "100%", "202", "7", "#ffffff");
		so.addParam("base", showcaseURL.substring(0,showcaseURL.lastIndexOf('/')+1));
		so.addParam("scale", "noscale");
		so.addParam("wmode", "transparent");
		so.addParam("allowScriptAccess", "sameDomain");
		// 
		// xms special
		so.addVariable("closeLink", "javascript:onloadShowcase()");
		so.addVariable("sendEcardLink", xmsCardSendURL);
		so.addVariable("sendEcardTarget", "_blank");
		so.addVariable("sendEcardBtnTxt", xmsSendTitle);
		so.addVariable("soundMode", "true");
	
		var res=so.write("teaser");
		if (!res) $('teaser').style.backgroundImage='url('+appPath+'file/flash/xmas_home_bg2.gif)'; // alternative bg image xms
	} catch (e) {}
}
function soundMode(state) {
}


/*****************************************************************
* 
* User + Download (AJAX/JSON-) stuff
* 
******************************************************************/

var storeBusy=false;
var storeId=null;

/** 
* Starts a request to get user specific data and optional sends a action to be executed on backend
* @author	Ralf Walter
* @param {String}	mode Optional: Specifies a action to the server - can be "login" or "logout"
* @return {Async}	Returns a asynchronous function call to "processMyDuravit" after request is completed
*/
function getUserInfo(mode) {
	if (!storeBusy && pageIsLoaded) {
		storeBusy = true;
		var postParams = '&';
		if (mode == "logout") postParams += 'loginAction=logout&';
		if (mode == "login") postParams += 'loginAction=login&fEmail=' + $('login-user').value + '&fPassword=' + escape(encodeURIComponent(($('login-password').value))) + '&fRememberMe=' + $('fRememberme').checked;
		//alert(postParams);
		//return;
		new ajax(appPath + 'html/getuserinfo.json.'+lang.Language+'.html', {postBody:'id=' + ((new Date).getTime()) + postParams, onComplete:processMyDuravit });
		//window.open(appPath+'html/getuserinfo.json.'+lang.Language+'.html?'+postParams);
	}
}

/** 
* Starts a request to get the download list from the current user object and displays the download list window
* If no downloads are in the list, nothing happens
* @author	Ralf Walter
* @return {Async}	Returns a asynchronous function call to "processDownloadList" after request is completed
*/
function getDownloadList(preventMsg) {
	if (!storeBusy && pageIsLoaded) {
		storeBusy=true;
		//showDownloadList(); // oldskool! remove... asap
		showInlineWindow(498, 300, {title:lang.DownloadBasket, border:1, color:'#ccc'});
		//window.open(appPath+'xml/getdownloadlist.xml');
		if (!myUser.downloads || myUser.downloads == 0) { 
			//if (!preventMsg) alert('There are no downloads');
			new ajax(appPath+'xml/downloadlist_empty_text.xml.' + lang.Language+'.xml', {postBody:'id='+((new Date).getTime()), onComplete:processDownloadList });
			return;
		} 
		new ajax(appPath+'xml/getdownloadlist.xml', {postBody:'id='+((new Date).getTime()), onComplete:processDownloadList });
	}
}

/** 
* Stores user information on the server - can be downloads or notes
* @author	Ralf Walter
* @param {String}	mode Tells the method what kind of data to store - can be "download" or "note"
* @param {Object}	dataobj Contains the data in an object - structure depends on mode
* @return {Async}	Returns a asynchronous function call to "processMyDuravit" after request is completed
*/
function storeUserInfo(mode, dataobj) {
	if (!storeBusy && pageIsLoaded) {
		storeBusy = true;
		var postParams = '&';
		//alert(dataobj.zip);
		var zip = (dataobj.zip) ? dataobj.zip : '';
		if (mode == "download") {
			postParams += 'storeAction=download&id=' + dataobj.id + '&productId=' + dataobj.productId + '&downloadId=' + dataobj.storeId + '&url=' + dataobj.url + '&zip=' + zip + '&name=' + urlenc(dataobj.name) + '&type=' + dataobj.type;
		} else if (mode == "note") {
			//var ooo=eval('('+ unescape(dataobj.comparisonProperties) +')' );
			//alert(ooo.colors);
			//alert('comparisonProperties:'+unescape(dataobj.comparisonProperties));
			postParams+='storeAction=note&comparisonProperties='+dataobj.comparisonProperties+'&nodeId='+dataobj.nodeId+'&externalNr='+dataobj.externalNr+'&title='+dataobj.title+'&description='+dataobj.description+'&assetId='+dataobj.assetId+'&url='+dataobj.url;
		}
		//alert('postParams:\n'+postParams);
		//window.open(appPath+'html/getuserinfo.json.'+lang.Language+'.html?'+postParams);
		new ajax(appPath+'html/getuserinfo.json.'+lang.Language+'.html', {postBody:'id='+((new Date).getTime())+postParams, onComplete:processMyDuravit });
	}
}

/** 
* Calls the "storeUserInfo" method to store a download (shortcut-method)
* @author	Ralf Walter
* @param {Object}	obj	Object that contains the download-parameters
*/
function storeDL(obj) {
	storeId = obj.storeId;
	storeUserInfo('download', obj);
}

/** 
* Calls the "storeUserInfo" method to store a note (shortcut-method)
* @author	Ralf Walter
* @param {Object}	obj	Object that contains the note-parameters
*/
function storeNote(obj) {
	storeId=obj.storeId;
	storeUserInfo('note', obj);
}

/** 
* Processes the response data from requests send by methods "getUserInfo" and "storeUserInfo" - onComplete-callback
* Manages the appearance of the my-duravit box on the right side
* @author	Ralf Walter
* @param {XMLHTTPRequest}	request Contains a reference to the request object
*/
var processMyDuravitCallBack = null;
function processMyDuravit(request){ // callback fn
	
	//alert(request.responseText);
	//alert("kekse gefunden:"+document.cookie);
	storeBusy=false;
  try {
	  myUser = eval('('+request.responseText+')'); // JSON "parsen"
	if($('user_downloads'))$('user_downloads').innerHTML = '(' + myUser.downloads + ')';

		if($('login-error')){
		  $('login-error').style.display='none';
		}
		
	
	  if (myUser.loginAction=='logout') {
		
			if ($S('.force-reload').length > 0) {
  			window.location.reload(true);
  			return;
			}
	  }		
	  if (myUser.rememberMe == true) {
	  	document.cookie = myUser.createClientCookie; 
  	  }	
	  
	  if (myUser.loginAction == 'login') {
	  	if (myUser.isValidUser) {
		  	// successful login - get to requested url
	  		window.location.href='?login';
	  		return;
		} else {
		  	// login failed
				$('login-error').style.display = 'block';
				$('login-error').innerHTML = myUser.errorMessage;

		  	if (myUser.acceptCookies) {
	  			$('login-error').style.display='block';
	  		} else {
	  			
	  		}
		}
	  } else if (myUser.storeAction == 'download') {
			if (myUser.storeState == 0) {
				try {
					//setCartFull($S('#'+storeId+' img.dl-cart')[0], true); // set animated cart-full gif
					//setTimeout("setCartFull($S('#"+storeId+" img.dl-cart')[0])", 3000);
				} catch (e) {
					//alert("Something went wrong :(\n\ne01: "+e+"\n\nstoreId:"+storeId);
				}
			} else {
				//if (myUser.storeState != 3) alert('Download not saved! Code:'+myUser.storeState); // on code 3 - not stored cause file was in list - no message
			}
		} else if (myUser.storeAction == 'cleardownload') {
			if (myUser.downloads == 0) TB_hide();
		}
		if (!(myUser.loginAction=='logout') && !myUser.isAnonymous) {
		  try { 
		  	if($('fRememberme')){
		  		$('fRememberme').checked = myUser.rememberMe;
		  	} 
		  } catch(e) { 
		  			  	
		  }
		  //alert("checkbox set!");
		}
		
		//if (typeof(processMyDuravitCallBack)=='function') processMyDuravitCallBack();

		
		// 
		// /
		// Show detailed error messages in extra window
  	/*if (myUser.errorMessage!='') {
  		var code='<div style="height:100px; background-color:#fff; padding:10px;">'+myUser.errorMessage+'</div>';
  		showInlineWindow(498, 130, {title:lang.Hint, code:code, color:'#005099', border:1});
  	}*/
	  //alert("rmc:"+$('fRememberme').checked);
	} catch(e) {
	  alert('Invalid JSON data (1):\n'+request.responseText+'\n\n\nCode:\n'+e);
	  //$('content-column').innerHTML=('Invalid JSON data:\n'+request.responseText+'\n\n\nCode:\n'+e);
	}
}

/** 
* Shows the inline window for the download list with a loading animation
* @author	Ralf Walter
*/
function showDownloadList() {
 	var w=getSiteWidth();
 	var h=getSiteHeight();
	if (UA.bIsIE) $("TB_overlay").style.width=w +"px";
	$("TB_overlay").style.height=h +"px";
	$("TB_overlay").style.display="block";
	$("TB_overlay").onclick=TB_hide;
	//
	// more stuff
	if (UA.bIsIE) $("TB_HideSelect").style.width=w +"px";
	$("TB_HideSelect").style.height=h +"px";
	$("TB_HideSelect").style.display="block";
	//
	// set the window in place
	$("TB_window_small").innerHTML='';
	$("TB_window_small").style.left=Math.round((w-498)/2)+"px";
	$("TB_window_small").style.display="block";
	
}

/** 
* Processes the response data from requests send by method "getDownloadList" - onComplete-callback
* Response data is a xml text-node that contains the html pushed to the inline window
* @author	Ralf Walter
* @param {XMLHTTPRequest}	request Contains a reference to the request object
*/
function processDownloadList(request) {
	//alert("responseXML:"+":"+typeof(request.responseXML)+":"+request.responseXML);
	//alert(request.responseXML.getElementsByTagName("ajax-response"));
	var responseData='';
	try {
		responseData=request.responseXML.getElementsByTagName("ajax-response")[0].childNodes[0].nodeValue; // the normal way
	} catch(e) {
		responseData=request.responseCDATA; // the IE6 with no ax or maybe IE5-Mac way
	}
	//alert("responseData:"+(responseData));
	storeBusy=false;
  try {
		$("TB_window_small").innerHTML+=responseData;
		var maxH=getVpHeight() - 27 - 40; // abstand oben - abstand unten
		var innerH=$("inline-content").scrollHeight;
		var h=(innerH > maxH) ? maxH : innerH;
		if (h<250) h=250; // keep min height
		var oldHeight=Element.getHeight('TB_window_small');
		myFX.inlineWinH.custom(oldHeight,h);
		$("inline-content").style.height=h - 25+"px";
		setRollOverEvents();
	} catch(e) {
	  //alert('Invalid download XML data:\n'+'\n\n\nCode:\n'+e);
	  return;
	}
}

/** 
* Closes the download inline window and sends a request to the server with a remove-download-action
* After that, my-duravit box and cart icons will be refreshed :)
* @author	Ralf Walter
* @return {Async}	Returns a asynchronous function call to "processMyDuravit" and "setCartIcons" after request is completed
*/
function clearDownloadList() {
	TB_hide();
	new ajax(appPath+'html/getuserinfo.json.'+lang.Language+'.html', {postBody:'id='+((new Date).getTime())+'&storeAction=clearalldownloads', onComplete:function() { processMyDuravit(this.transport);} });// setCartIcons(true); 
}

/** 
* Deletes a single download element from the list
* @author	Ralf Walter
* @param {String}	url The URL as unique id 
* @return {Async}	Returns a asynchronous function call to "processMyDuravit" and "setCartIcons" after request is completed
*/
function clearDownload(url) {
	$("ic-container").innerHTML='Updating list ...';
	//alert('downloadurl='+url);
	new ajax(appPath+'html/getuserinfo.json.'+lang.Language+'.html', {postBody:'id='+((new Date).getTime())+'&storeAction=cleardownload&downloadurl='+escape(url), onComplete:function() { processMyDuravit(this.transport); getDownloadList(true);  } });//setCartIcons(true);
}

/** 
* Initiates a login action via AJAX - shortcut method
* @author	Ralf Walter
*/
function userLogIn() {
	if (pageIsLoaded) {
		$('login-error').style.display='none';
		getUserInfo('login');
	}
}

/** 
* Initiates a logout action via AJAX - shortcut method
* @author	Ralf Walter
*/
function userLogOut() {
	if (pageIsLoaded) getUserInfo('logout');
}

/** 
* Displays details about the currently logged in user
* @author	Ralf Walter
*/
function userShowLoginDetails() {
	if (pageIsLoaded) {
		if ($('user_login_details').style.display=='inline') {
			$('user_login_details').style.display='none';
		} else {
			$('user_login_details').style.display='inline';
		}
	}
}

/** 
* Displays the user login form
* @author	Ralf Walter
*/
function userShowLoginForm() {
	//alert($('login-container').style.display);
	if ($('login-container').style.display=='block') { // just close
		$('login-error').style.display='none';
		myFX.loginBox.toggle();
		return;
	}
	$('login-container').style.display='block';
	myFX.loginBox.hide();
	myFX.loginBox.toggle();
}

/** 
* Requests a short download list in json-format to find out which images to set in "filled"-state
* The function is called onload and looks for elements containing the "dl-cart" class
* @author	Ralf Walter
* @return {Async}	Returns a asynchronous function call to "processCartIcons" after request is completed
*/
function setCartIcons(forceClear) {
	if ($S('.dl-cart').length > 0) { // is there a cart icon in the document?
		if (forceClear) { // set all icons to clear state
			$S('img.dl-cart').action({
				initialize:function() { 
					setCartEmpty(this);
				}
			});
		}
		new ajax(appPath+'html/getshortdownloads.json', {postBody:'id='+((new Date).getTime()), onComplete:processCartIcons });
	}
}

/** 
* Sets the cart icon to empty state
* @author	Ralf Walter
* @param {HTMLObject}	imgref Reference to DOM-Image-Element
*/
function setCartEmpty(imgref) {
	imgref.src=appPath+'file/all/icon_cart.gif';
	imgref.title='Add to download cart';
}

/** 
* Sets the cart icon to full state
* @author	Ralf Walter
* @param {HTMLObject}	imgref Reference to DOM-Image-Element
*/
function setCartFull(imgref, ani) {
	imgref.src=appPath+'file/img/icon_cart_full'+((ani)?'_ani':'')+'.gif';
	imgref.title='This item is in your download cart';
}

/** 
* Processes the response data from requests send by method "setCartIcons" - onComplete-callback
* Sets the cart-icons to "filled" state if the download is in the users download list
* @author	Ralf Walter
* @param {XMLHTTPRequest}	request Contains a reference to the request object
*/
function processCartIcons(request) {
	// rw 
	//alert(request.responseText);
  try {
  	var img, dl;
	  var sd=eval('('+request.responseText+')'); // JSON "parsen"
	  //alert(request.responseText);
	  for (var i=0; i<sd.shortdownloads.length; i++) {
	  	//alert('$S:'+sd.shortdownloads[i]);
	  	dl=(sd.shortdownloads[i].substr(0,3)!='dl_') ? 'dl_' : '';
	  	img=$S('#'+dl+sd.shortdownloads[i]+' img.dl-cart');
	  	if (img.length>0) {
	  		 setCartFull(img[0]);
	  	}
	  }
	} catch(e) {
	  // rw alert('Invalid JSON data (2):\n'+request.responseText+'\n\n\nCode:\n'+e);
	}
}

/** 
* Displays a preview image in inline window
* @author	Ralf Walter
* @param {String}	imgurl Location of the image
* @param {Int}	imgw	Width of the image
* @param {Int}	imgh	Height of the image
* @param {String}	title optional - the title for the image
*/
function showPreviewImage(imgurl, imgw, imgh, title) {
	if (pageIsLoaded) {
		if (isValidUser()) {
			var code='<img src="'+imgurl+'" class="content" style="width:'+(imgw-2)+'px; height:'+(imgh-2)+'px;" onload="TB_done();/*this.style.visibility=\'visible\'*/" alt="Preview" /></div>';
			showInlineWindow(imgw-2, imgh-2, {title:title, code:code, color:'#005099', border:1});
		}
	}
}

/** 
* Updates all resolution selectboxes (300/72 dpi) after change of one box and store value in global var
* @author	Ralf Walter
* @param {HTMLSelect}	selectRef	A html select-element
*/
function updatePPResolution(selectRef) {
	if (pageIsLoaded) {
		ppResolution=selectRef.options[selectRef.selectedIndex].value;
		$S('.pp-res').action({
			initialize:function() { 
				this.options[selectRef.selectedIndex].selected = true;
			}
		});
	}
}

/** 
* Validate user state
* @author	Ralf Walter
* @return true/false
*/
function isValidUser() {
	//
	// check for valid access
	/*if (String(servermt).length > 30 && mactoken != servermt) { // mactoken+ "=" +servermt
		myUser.pdbstate = 3;
	}*/
	if (myUser.name == "Wim Delfs" && myUser.pdbstate == 3) {
		myUser.pdbstate = 0;
	}
	if (myUser.name == "Sarah Venter" && myUser.pdbstate == 3) {
		myUser.pdbstate = 0;
	}
	if (myUser.pdbstate !== 0) {
		//alert('You need to be logged in! '+myUser.pdbstate);
		if (!myUser.isValidUser) {
			showInlineWindow(498, 330, {title:lang.Hint, code:$('not-reg-warning').innerHTML, color:'#005099', border:1});
		} else if (myUser.pdbstate == 1) { // expired
			showInlineWindow(498, 330, {title:lang.Hint, code:$('expired-warning').innerHTML, color:'#005099', border:1});
		} else if (myUser.pdbstate == 2) { // locked
			showInlineWindow(498, 330, {title:lang.Hint, code:$('expired-warning').innerHTML, color:'#005099', border:1});
		} else if (myUser.pdbstate == 3) { // wrong token
			showInlineWindow(498, 330, {title:lang.Hint, code:$('token-warning').innerHTML, color:'#005099', border:1});
		}
		return false;
	} else {
		return true;
	}
}


/** 
* Starts a zipped download of a single press photo file and checks for permission
* @author	Ralf Walter
* @param {String}	assetId	PIM-assetId
* @return {ZIP}	Returns a zipped file if permission is ok
*/
function getPPDL(assetId, assetFolder) {
	if (pageIsLoaded) {
		var firstSel=$S('.pp-res')[0];
		ppResolution=firstSel.options[firstSel.selectedIndex].value; // update selected resolution
		if (isValidUser()) {
			var derivatName=(ppResolution > 72) ? '' : 'mil_print_preview'; //was 2598x2598 where now is ''
			var derivatGroup=(ppResolution > 72) ? '' : 'web'; //was presse where now is ''
			var fileNameRes=(ppResolution > 72) ? '300dpi' : '72dpi';
			var ext=(ppResolution > 72) ? 'eps' : 'jpg'; // tiff hack //was 'tiff' where now is 'eps'
			if (ppResolution <= 72) assetFolder=assetFolder.replace(/\.tiff/gi, '.jpg'); // tiff hack
			if (ppResolution > 72) assetFolder=assetFolder.replace(/\.tiff/gi, '.eps'); // 300dpi hack
			var folder=(assetFolder && assetFolder!='') ? assetFolder : 'duravit_'+assetId+'_'+fileNameRes+'.'+ext;
			//alert("DL:"+appPath+'zip/getfilelist?files='+getAssetURL(assetId, derivatGroup, derivatName, ext)+'&names='+folder);
			location.href=appPath+'zip/getfilelist?files='+getAssetURL(assetId, derivatGroup, derivatName, ext)+'&names='+folder;
		}
	}
}

/** 
* Stores a press photo file in the downloadlist and checks for permission
* @author	Ralf Walter
* @param {String}	obj	Object containing the following values: storeId, assetId, name, productId, type
* @return {ZIP}	Returns a zipped file if permission is ok
*/
function storePPDL(obj) {
	// storePPDL({storeId:\''+id+'\', assetId:\'109d98c6c7d99229\', name:\'Some name\', productId:\'pim\', type:\'jpg\'});
	if (pageIsLoaded) {
		var firstSel=$S('.pp-res')[0];
		ppResolution=firstSel.options[firstSel.selectedIndex].value; // update selected resolution
		if (isValidUser()) {
			var derivatName=(ppResolution > 72) ? '' : 'mil_print_preview'; //2598x2598
			var derivatGroup=(ppResolution > 72) ? '' : 'web'; //presse
			var ext=(ppResolution > 72) ? 'eps' : 'jpg'; // tiff hack //tiff
			if (ppResolution <= 72) obj.zip=obj.zip.replace(/\.tiff/gi, '.jpg'); // tiff hack
			if (ppResolution > 72) obj.zip=obj.zip.replace(/\.tiff/gi, '.eps'); // 300dpi hack
			//var fileNameRes=(ppResolution > 72) ? '300dpi' : '72dpi';
			//alert('file to store:'+getAssetURL(obj.assetId, derivatGroup, derivatName));
			storeId=obj.storeId;
			//alert( obj.zip );
			storeUserInfo("download", {id:0, productId:obj.productId, downloadId:obj.storeId, storeId:obj.storeId, url:getAssetURL(obj.assetId, derivatGroup, derivatName, ext), zip:( obj.zip || '' ), name:obj.name, type:obj.type });
			// if (mode=="download") postParams+='storeAction=download&id='+dataobj.id+'&productId='+dataobj.productId+'&url='+dataobj.url+'&name='+dataobj.name+'&type='+dataobj.type;
		}
	}
}

/** 
* Builds a inline video window
* @author	Ralf Walter
* @param {String}	playerswf - swf of the player control
* @param {String}	swf - swf of the video to play in the player
* @param {Number}	vw - width (without player)
* @param {Number}	vh - height (without player)
* @param {String}	vdtitle - window title
*/
function showInlineVideo(playerswf, swf, vw, vh, vdtitle, altswf, altversion) {
	var code='<div id="video-flash"></div>';
	if (altswf != '') {
	  showInlineWindow(vw, vh+23, {title:vdtitle, code:code, color:'#005099', border:1});
		// first try the higher version...
	  var vdObj = new SWFObject(altswf, "inlinevideo", vw, vh, altversion, "#ffffff");
		if (altswf.indexOf('http://') > -1) vdObj.addParam("base", altswf.substring(0, altswf.lastIndexOf('/')+1));
	 	var res=vdObj.write('video-flash');
	 	// ...if fails, try the standard version
	 	if (!res) {
	 		vdObj = new SWFObject(swf, "inlinevideo", vw, vh, "7", "#ffffff");
			if (swf.indexOf('http://') > -1) vdObj.addParam("base", swf.substring(0, swf.lastIndexOf('/')+1));
	 		res=vdObj.write('video-flash');
	 		// minimum req's not given
			if (!res) $('video-flash').innerHTML=lang.missingFlashPlayerText;
		}
	} else {
		if (playerswf && playerswf!='') {
			var offw=(playerswf.indexOf('audio') > -1) ? 0 : 3;
			var offh=(playerswf.indexOf('audio') > -1) ? 0 : 22;
		  /*var vdObj = new SWFObject(playerswf, "inlinevideo", vw+offw, vh+offh, "7", "#ffffff");
			vdObj.addVariable("videoUrl", swf);
			vdObj.addVariable("soundUrl", swf);
			vdObj.addVariable("videoBreite", vw);
			vdObj.addVariable("videoHoehe", vh);
			vdObj.addVariable("bufferMsgReady", "");
			vdObj.addVariable("bufferMsgFull", lang.VideoIsLoading);
			vdObj.addVariable("bufferMsgRep", lang.VideoWatchAgain);*/
			swfobject.embedSWF(playerswf, "inlinevideo", vw+offw, vh+offh, "7.0.0");
			vw+=offw; vh+=offh;
			
		} else {
			var version=(altversion!='') ? altversion : "7";
			swfobject.embedSWF(swf, "inlinevideo", vw, vh, "7.0.0");
		  /*var vdObj = new SWFObject(swf, "inlinevideo", vw, vh, version, "#ffffff");
			var swffiltered=swf.substring(0, swf.lastIndexOf('.swf')); // filter out url-params
		  vdObj.addParam("base", swf.substring(0, swffiltered.lastIndexOf('/')+1));*/
		  //if (baseurl && baseurl != '') 
		}
		/*vdObj.addParam("scale", "noscale");
		if (swf.indexOf('http://') > -1) {
			vdObj.addParam("base", swf.substring(0, swf.lastIndexOf('/')+1));
		}*/
		
		var col=(vdtitle.indexOf("Duravit Kick") > -1) ? '#111111' : '#ccc';
	  showInlineWindow(vw, vh+23, {title:vdtitle, code:code, color:col, border:1});
	 	/*var res=vdObj.write('video-flash');
		if (!res) $('video-flash').innerHTML=lang.missingFlashPlayerText;
		if (vdtitle.indexOf("Duravit Kick") > -1) {
			$S('#TB_window .title')[0].style.backgroundColor='#111111';
		}*/
	}
}

/** 
* Builds a inline iframe window
* @author	Ralf Walter
* @param {String}	url - url of the iframe-content
* @param {Number}	vw - width (without player)
* @param {Number}	vh - height (without player)
* @param {String}	vdtitle - window title
*/
function showInlineIFrame(url, vw, vh, vdtitle) {
	var code='<iframe id="inline-iframe" width="'+vw+'" height="'+vh+'" src="'+url+'" scrolling="no" marginheight="0" marginwidth="0" frameborder="0"></iframe>';
  showInlineWindow(vw, vh+23, {title:vdtitle, code:code, color:'#005099', border:1});
}

/** 
* Builds a valid asset URL out of the given parameters - based on the tml method "dbm.GetAssetURL"
* @author	Ralf Walter
* @param {String}	assetId
* @param {String}	derivatGroup
* @param {String}	derivatName
* @param {String}	ext	optional - Extension - if not given, "jpg" is default
* @return {String}	Returns the URL
*/
function getAssetURL(assetId, derivatGroup, derivatName, ext) {
	if (!ext) ext='jpg';
	var tempUrl = assetURLTemplate.replace(/%assetId%/, assetId).replace(/%derivatGroup%/, derivatGroup).replace(/%derivatName%/, derivatName).replace(/%ext%/, ext);
	//if(derivateGroup=='') {
	if(derivatGroup=='') {
		tempUrl = tempUrl.replace('__.', '.');
	}
	return tempUrl;
}

/** 
* Three Helper-Functions for registration form
* @author	Ralf Walter
*/
//company
function showCompany() {
	$('field-student').style.display='none';
	$('star-company').style.display='';
	//$('star-line').style.display='';
	$('star-university').style.display='none';
}
//student
function showStudent() {
	$('field-student').style.display='';
	$('star-university').style.display='';
	$('star-company').style.display='none';
	//$('star-line').style.display='none';
}
//other
function showOther() {	
	$('field-student').style.display='none';
	$('star-company').style.display='none';
	$('star-university').style.display='none';
	//$('star-line').style.display='none';
}

/** 
* Extends the escape-Function with escaping of the + (plus)
* @author	Ralf Walter
* @param {String}	
* @return {String}	Returns encoded string
*/
function urlenc(str) {
	var enc=escape(str);
	return str.replace(/\+/g, '%2B');
}

/** 
* Countryselecter
* @author	Sebastian Weiss
*/
function switchCountry (alt, neu) {
	window.document.getElementById(alt).style.display='none';
	window.document.getElementById(neu).style.display='block'; 
	window.document.getElementById('karte').src=appPath+'file/all/'+neu+'.png';
}


/** 
* Tooltip Methods
* @author	Ralf Walter
*/
tooltip = {
  name : "tooltip",
  offsetX : 0,
  offsetY : 0,
  tip : null,
  wrapperXOff : 0
}

tooltip.init = function() {
	this.tip = document.getElementById(this.name);
	$S('a.tt').each(function(element){
		element.setAttribute("tiptitle", element.getAttribute("title"));
		element.removeAttribute("title");
		element.onmouseover = function(){
			tooltip.show(this.getAttribute('tiptitle'));
		};
		element.onmouseout = function(){
			tooltip.hide();
		};
	});
	this.wrapperXOff=0;
	this.offsetX = 0; // (UA.bIsIE7) ? -60 : ( (UA.bIsOpera || UA.bIsSafari) ? 50 : 0 );
}

tooltip.move = function(evt) {
	var x=0, y=0;
	if (document.all) {
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
	} else {
		x = evt.pageX;
		y = evt.pageY;
	}
	//document.title=x+":"+this.wrapperXOff;
	this.tip.style.left = ( (x - this.wrapperXOff + 60) + this.offsetX ) + "px";
	this.tip.style.top = (y + this.offsetY + 5) + "px";
}

tooltip.show = function(text) {
	if (!this.tip) return;
	this.tip.innerHTML = '<img src="'+appPath+'file/assets/color_'+(text.toLowerCase())+'.jpg" alt="" style="height:110px; border:1px solid #ccc;" />';
	this.tip.style.display = "block";
	this.wrapperXOff=0;
	var el=$('wrapper');
	while (el.offsetParent) {
		this.wrapperXOff+=el.offsetLeft;
		el=el.offsetParent;
	}
	document.onmousemove = function(evt) { tooltip.move(evt) };
}

tooltip.hide = function() {
	if (!this.tip) return;
	this.tip.innerHTML = "";
	this.tip.style.display = "none";
	document.onmousemove = null;
}


var dkUserid='';
function checkNick() {
	if ($('fNickname').value == '') {
		alert("Bitte geben Sie einen Nickname an");
	} else {
		var nickfiltered=$('fNickname').value;
		nickfiltered=nickfiltered.replace(/\'/g, '').replace(/\"/g, '').replace(/\&/g, '').replace(/\?/g, '');
		$('fNickname').value=nickfiltered;
		try {
			storage.put('scfquiz2', { nick:nickfiltered }, new Date(new Date().getTime()+14*7*24*3600000));
			storage.save();
		} catch(e) { }
		var pwdfiltered=$('fPassword').value;
		pwdfiltered=pwdfiltered.replace(/\'/g, '').replace(/\"/g, '').replace(/\&/g, '').replace(/\?/g, '');
		new ajax(appPath+'html/kickinituser', {postBody:'id='+((new Date).getTime())+'&nick='+nickfiltered+'&pwd='+pwdfiltered, onComplete:processDuravitKick });
	}
}

function processDuravitKick(request) {
	//alert("processDuravitKick");
	var dk=eval('('+request.responseText+')'); // JSON "parsen"
	if (dk.action != 'denied') { // alles ok
		dkUserid=dk.userid;
		showDuravitKick();
	} else {
		alert(dk.error);
	}
}

function showDuravitKick() {
	showInlineVideo('', '/statc/duravitkick2/duravit_kick.swf?userid='+dkUserid+"&hsurl="+highscoreURL.replace(/kickscore/gi, ''), 812, 506, 'Duravit Kick', '', '7'); // 'Test:'+storage.get('scfquiz').nick+'/'+storage.get('scfquiz').formsent
	$("TB_overlay").onclick=null;
}

function setCountryByState(state) {
	try {
		var idx;
		if (state=='AB' ||
				state=='BC' ||
				state=='MB' ||
				state=='NB' ||
				state=='NF' ||
				state=='NT' ||
				state=='NS' ||
				state=='NU' ||
				state=='ON' ||
				state=='PE' ||
				state=='QC' ||
				state=='SK' ||
				state=='YT') { // CAN
			idx=39;
		} else { // US
			idx=226;
		}
		$('fCountry').selectedIndex=idx;
	} catch (e) { }
}


/******************************************************************************

fontsizer.js

******************************************************************************/
function initTextSize(){
	if(document.cookie){
		loadFontSize('fsz');
	}
}
function setFontSize(size) {
	document.getElementsByClassName("textpadder")[0].style.fontSize = size;
	var myDate = new Date();
	myDate = new Date(myDate.getTime() + (100 * 24 * 60 * 60 * 1000));
	document.cookie = 'fsz='+size+'; expires='+myDate.toGMTString()+'; path=/';
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function loadFontSize(name) {
	var myCookie = readCookie(name);
	if (myCookie != null) {
		setFontSize(myCookie);
	}
}
function editNumber(key) {
   var number = document.phone.number.value + key;
   document.phone.number.value = number;
}
function resetNumber() {
   document.phone.number.value = "";
}

/*******************************************************************************

the tab thing

*******************************************************************************/
function initTabs() {
	if(location.hash!='' && location.hash!='#') {//if a tab number is in URL...
		goToTab(location.hash.replace('#',''));//...go to tab
	}else {
		goToTab('tab-1');//default is first tab
	}
	return true;
}
   
function goToTab(tabToGoTo) {
	var allTabs = document.getElementsByClassName("tab-content");//get all tabs
	var curTab = 'a-'+tabToGoTo;//current selection
	$(curTab).style.display='block';//make tab visible
	setBlockRowHeightsByMax();//for locations, distibutors
	tiles = document.getElementsByClassName("tile-outer");//if contact persons from duravit cs are listed...
	if(tiles!='')setContainerHeight(curTab);//set container height by js
	highlightTab(tabToGoTo);//set active state of tab
	for(var i=0; i<allTabs.length; i++){
		if(allTabs[i]!=$(curTab))allTabs[i].style.display='none';//hide other tabs
		
	}	
	return true;
}
function setContainerHeight(tabConcerned) {
	var maxHeight = $(tabConcerned).offsetHeight; //tab current height
	var tiles = document.getElementsByClassName('tile-outer'); //get tiles from lister
	for(var i=0; i < tiles.length; i++) {
		if(tiles[i].offsetHeight > maxHeight) {
			maxHeight = tiles[i].offsetHeight;//get max height
		}
	}
	maxHeight += 400;//add space (e.g for .cn contact persons)
	document.getElementById('tab-container').style.height = maxHeight + "px";//set height of container

}
function highlightTab (tabToGoTo) {
	var lastLi = document.getElementById('current-tab');//last active tab
	if(lastLi) {
		lastLi.id = '';//remove id
		lastLi.backgroundImage = 'url("../file/img/reiter_inaktiv_rechts.png")'; //set background image (for IE6)
	}
	var allLinks = document.getElementById('tab-navi').childNodes;
	for(var i=0; i<allLinks.length; i++){
		if(allLinks[i].nodeName.toLowerCase()=='li') {
			grandChildren = allLinks[i].childNodes;
			for(j=0; j<grandChildren.length; j++){
				if(grandChildren[j].nodeName.toLowerCase()=='a') {
					if(String(grandChildren[j]).indexOf('#'+tabToGoTo)!=-1){
						allLinks[i].id = 'current-tab';//set current id for desired tab
						allLinks[i].backgroundImage = 'url("../file/img/reiter_aktiv_rechts.png")';//set background image(for IE6)
						return true;
					}
				}
			}
			
		}
	}
}
function truncateText (cssClass){
	var len = 7;//upper border for text length
	var p = document.getElementsByClassName(cssClass);
	if (p) {
		var truncText, toTrunc, trunc;
		for(var i=0; i < p.length; i++){
			truncText = p[i].innerHTML;//get content from text to shorten
			toTrunc = (p[i].offsetWidth > 60) ? true : false;//get width			
			truncText = truncText.split(' ');//split by words
			if (toTrunc) {
				for(var j=0; j < truncText.length; j++){
						if(truncText.length==j + 1)trunc = '<span title="'+p[i].innerHTML+'">';//add span class open
						trunc += truncText[0].substring(0, len)+'...';//add dots
						if(truncText.length==j + 1)trunc +='<\/span>';//close span tag
						if(truncText.length==j + 1)p[i].innerHTML = trunc;//set new content
				}
			
			}
		}
	}
	
}
function setBlockRowHeightsByMax() {
	var max;
	var rowTop = -1;
	var rowElements = [];
	var totalRowElems = $S('.h-check').length;
	var rowCount = 0;
	$S('.h-check').each(function(el) {
		rowCount++;
		/*if (el.offsetHeight > max) {
			max = el.offsetHeight;
		}*/
		if (el.parentNode.parentNode.parentNode.offsetTop > rowTop || rowCount >= totalRowElems) {
			if (rowCount >= totalRowElems) {
				rowElements.push(el); // dont forget the last one
			}
			//
			// process all elements stored from previous row
			if (rowElements.length > 0) {
				//rowElements[0].innerHTML = rowElements[0].innerHTML + " - MAX: "+max;
				for (var i = 0; i < rowElements.length; i++) {
					rowElements[i].parentNode.parentNode.parentNode.style.height = String(max + 55) +"px";
				}
			}
			//
			// init process next row
			rowTop = el.parentNode.parentNode.parentNode.offsetTop;
			//
			// reset row elements store and max value
			rowElements = [];
			max = 0;
		}
		//
		// store all elements of one row
		if (el.offsetHeight > max) {
			max = el.offsetHeight;
		}
		rowElements.push(el);
		//don't forget the last one
		if (rowElements.length > 0) {
			//rowElements[0].innerHTML = rowElements[0].innerHTML + " - MAX: "+max;
			for (var i = 0; i < rowElements.length; i++) {
				rowElements[i].parentNode.parentNode.parentNode.style.height = String(max + 55) +"px";
			}
		}
		/*if (el.offsetHeight > max) {
			max = el.offsetHeight;
		}*/
		
	});
}

function getCheckedInputs (fieldArray){
	var values= new Array();
	for(var i=0; i<fieldArray.length; i++){	
		if(fieldArray[i].checked==true){
			values.push(fieldArray[i].value);//add if input is checked
		}
	}
	return values;
}

function checkSubs(caller, type){
	theFields = document.forms.fileform.elements["filecheck"];//get all checkboxes
	for(var i=0; i<theFields.length; i++){
		curField = theFields[i];
		curFieldVal = unescape(curField.value);
		callerVal = unescape(caller.value);		
		if(curField!=caller){//if not the same element
			if(curFieldVal.indexOf(type)!=-1){//if same type of file
				if(type=='tif'){//tech draws and product pictures
					if(callerVal.indexOf('tech_draw')!=-1 && curFieldVal.indexOf('tech_draw')!=-1){
						curField.checked = caller.checked;	
					}else if(callerVal.indexOf('tech_draw')==-1 && curFieldVal.indexOf('tech_draw')==-1){
						curField.checked = caller.checked;
					}
				}else{
					curField.checked = caller.checked;//all other files
				}
			}
		}
	}
}

function storeDlViaForm(){
	theFields = document.forms.fileform.elements["filecheck"];//get all checkboxes
	fields = getCheckedInputs(theFields);//get all checked checkboxes
	
	theTime = new Date();
	dateString = theTime.getFullYear() + ''+fillZeros(theTime.getMonth() + 1,2) + '' + fillZeros(theTime.getDate(),2) + '' + fillZeros(theTime.getHours(),2) + '' + fillZeros(theTime.getMinutes(),2) + '' + fillZeros(theTime.getSeconds(),2); // for date string
	var dlObj = {}
	dlObj.storeId = "";
	dlObj.url = "";
	dlObj.zip = "";
	dlObj.name = "";
	if (fields.length > 1) {
		dlObj.name = label.selectedFile + " #";
	}
	dlObj.type = "zip";
	dlObj.productId = "pim";
	for(var j=0; j < fields.length; j++){
		values = unescape(fields[j]).split(':::');//get value from checkbox
		if(values[0].indexOf('all') == -1){//if not a group checkbox (just for group selection)
			dlObj.url += values[1]+'|';
			dlObj.zip += values[2]+'|';
		}
		if(j == 0){
			if (fields.length > 1) {
				dlObj.name += values[3];
			} else {
				dlObj.name = values[2];
			}
			
			dlObj.storeId += dateString+" sel #" + values[3];
			dlObj.id = dateString + "_" + values[3];
		}
	}
	if(fields.length > 0) storeDL(dlObj);//call store method
}

function fillZeros (str, len){
	var out=str;
	while (String(out).length < len) out="0"+out;
	return out;
}

function addToProject(theSeries, theNodeId, theCategory, theProduct, isSparepart){
	theFields = document.forms.fileform.elements["filecheck"];//get all checkboxes
	fieldValues = escape(getCheckedInputs(theFields).join());//get checked inputs and join them to URL parameter
	if(fieldValues.length>0){//if something selected, open popup
		showInlineWindow(500, 400, {title:"Mein pro.duravit", code:"<iframe marginheight='0' marginwidth='0' frameborder='0' width='500' height='400' id='folderPopup' src='/produravit/html/mypro:picaddpopup?fAdds="+fieldValues+"&fSeries="+theSeries+"&fNodeId="+theNodeId+"&fCat="+theCategory+"&fProduct="+theProduct+"&fIssparepart="+isSparepart+"&useraction=addpics'></iframe>", border:1, color:"#666"});
	}else{
		alert('Bitte wählen Sie mindestens eine Datei aus.\nAlle notwendigen Dateien, die Sie zur Erstellung von Mustermappen benötigen, werden automatisch übernommen.');//if no files are selected
	}
	
}

function folderPopup (useraction, projid, folderid, followaction, inviteid, email) {//for all my.pro.duravit actions in picaddpopup
	showInlineWindow(500, 400, {title:"Mein pro.duravit", code:"<iframe marginheight='0' marginwidth='0' frameborder='0' width='500' height='400' id='folderPopup' src='/produravit/html/mypro:picaddpopup?useraction="+useraction+"&project="+projid+"&folder="+folderid+"&fa="+followaction+"&invite="+inviteid+"&email="+email+"'></iframe>", border:1, color:"#666"});
}

var  pm = {
	bgif : ''
};

pm.setBgif = function (thePic){
	this.bgif = thePic;
}
pm.previewError = function(){
	this.hidePrvwDlNew();
	document.getElementById('preview-error').innerHTML = "<br/>No image found";
}
pm.setPreviewSource = function(previewPic){
	document.images.preview.src = previewPic;
}
pm.previewDownloadNew = function(e, thePic){
	var evt =  window.event || e; //read event
	var mouseY = evt.clientY; //read mouse Y-Position
	
	document.getElementById('preview-error').innerHTML = ""; //delete error message
	var imgObj = new Image();
	imgObj.src = thePic;
	var imgHeight = imgObj.height;		
	var endHeight = 0;

	var sizeCont = document.getElementById('tab-container').offsetHeight; //read height of outer tab container
	if(imgHeight > sizeCont) document.images.preview.height = imgHeight = Math.floor(sizeCont/2) - 20; //if picture bigger than container, set height to half the size
	endHeight = (getScrollTop() - 220) + mouseY - Math.floor(imgHeight/2); //calculate endheight: scrolledAmount - header + mouseposition - half of the picture
	if((endHeight + imgHeight) > sizeCont) { //if preview position bigger than container (bottom edge)
		endHeight = sizeCont - imgHeight - 20;
	}
	if(endHeight < 105) endHeight = 105; 
	
	if(document.getElementById('bHM') != null){
		document.getElementById('bHM').style.visibility = "hidden";
	}
	
	document.getElementById('download-preview').style.visibility = "visible";
	
	this.setPreviewSource(thePic);
}
// Added 03.11.2010: http://pam.visia.de/public/index.php/projects/49/tickets/320#task21669
// Adds the title in the DownloadPreviewTitle Div
pm.previewAddDownloadTitle = function (e, thePic, title) {
	pm.previewDownloadNew(e, thePic);
	document.getElementById('DownloadPreviewTitle').innerHTML = "<h3>" + title + "</h3>";
}
// Added 03.11.2010: http://pam.visia.de/public/index.php/projects/49/tickets/320#task21669
// CloseButton for ImageLayer
pm.closeDP = function () {
	document.getElementById('download-preview').style.visibility = "hidden";
	
	if(document.getElementById('bHM') != null){
		document.getElementById('bHM').style.visibility = "visible";
	} 
}
pm.hidePrvwDlNew = function(){
	this.setPreviewSource(this.bgif);
}
