ThomasDux=function(){};ThomasDux.Init=function(){new ThomasDux.Menu(document.getElementById("menu-root"));NG.addEventListener(document.getElementById("search"),"focus",function(d){this.value="";this.style.textAlign="left"});NG.addEventListener(document.getElementById("search"),"blur",function(d){if(this.value==""){this.style.textAlign="center";this.value="Search Here"}});NG.addEventListener(document.getElementById("store"),"change",function(d){document.getElementById("storechanger-op").value="changestore";this.form.submit()});if(NG.Photogallery){var c=NG.Photogallery.open;NG.Photogallery.open=function(d){c.apply(this,[d]);this.popup.root.firstChild.removeChild(this.popup.root.firstChild.childNodes[2]);var e=this.popup.root.childNodes[1].firstChild;e.childNodes[1].innerHTML="&nbsp;";e.childNodes[2].innerHTML="";e.childNodes[3].innerHTML="";e.childNodes[4].innerHTML="&nbsp;"};var b=NG.Photogallery.updatePhoto;NG.Photogallery.updatePhoto=function(f,e){b.apply(this,[f,e]);var d=(f.responseXML.documentElement.firstChild.nodeType==3?f.responseXML.documentElement.firstChild.nextSibling:f.responseXML.documentElement.firstChild);this.popup.root.firstChild.childNodes[1].innerHTML=d.getAttribute("caption");var g=NG.getElementsByClassName(this.popup.root.lastChild,"imgholder")[0]};var a=NG.Photogallery.updatePage;NG.Photogallery.updatePage=function(d){a.apply(this,[d]);var e=parseInt(d.responseXML.documentElement.getElementsByTagName("page")[0].getAttribute("page"));var f=NG.getElementsByClassName(this.node,"navpage-current")[0];f.innerHTML=(e+1);NG.delClass(f,"navpage-selected");NG.delClass(NG.getElementsByClassName(this.node,"navpage-total")[0],"navpage-selected")}}if(NG.Catalogue){var c=NG.Catalogue.install;NG.Catalogue.install=function(g){c.apply(this,[g]);var f=this;var d=g.getElementsByTagName("a");for(var e=0;e<d.length;e++){if(NG.hasClass(d[e],"email")){NG.addEventListener(d[e],"click",function(){f.sendToAFriend()})}}};NG.Catalogue.sendToAFriend=function(){var e=NGUrl.thisRequest();e.addArgument("action","sendtoafriend",true);var f=document.getElementById("main");var d=new Array();if(!NG.hasClass(f,"hide")){NG.addClass(f,"hide");d.push(f)}new ThomasDux.Popup('<iframe src="'+e.toString()+'" scrolling="no"></iframe>',d)}}};ThomasDux.Menu=function(f,e){this.node=f;this.selected=null;if(e!=false){var d=this.node.getElementsByTagName("ul");for(var c=0;c<d.length;c++){var g=new ThomasDux.Menu(d[c],false)}}var b=this;var a=this.node.getElementsByTagName("li");for(var c=0;c<a.length;c++){if(a[c].parentNode==this.node){NG.addEventListener(a[c],"click",function(h){b.Select(this);NG.stopPropagation(h)})}}};ThomasDux.Menu.prototype.Select=function(a){if(this.selected){NG.delClass(this.selected,"selected")}if(this.selected!=a){this.selected=a;NG.addClass(this.selected,"selected")}else{this.selected=null}};ThomasDux.AddFloatEditor=function(){if(typeof NGCMSLoader!="undefined"){var a=NGCMSLoader._start;NGCMSLoader._start=function(){var b=NGCMS.load;NGCMS.load=function(c){b(c);NG.addEventListener(NGCMS.getSideNode(),"load",function(){var e=NGCMS.getSideNode().contentWindow.document;var d=e.getElementById("meta-form");var f=e.createElement("div");f.innerHTML='<input type="button" value="Image Placement Mode" />';NG.addEventListener(f.lastChild,"click",function(){var g=NGUrl.thisRequest();g.path="/admin/floateditor.html";g.addArgument("op","op_open",true);g.addArgument("pk[id]",NGCMS.id,true);g.redirect()});d.appendChild(f)})};a()}}};ThomasDux.ChooseStore=function(a){if(a==null){a="Please select a store:"}this.shade=new NG.Shade();this.node=document.createElement("div");NG.addClass(this.node,"floating-storechanger");NG.addClass(this.node,"floating");this.node.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild,"inner");this.node.appendChild(document.createElement("form"));var b=NGUrl.thisRequest();this.node.lastChild.method="post";this.node.lastChild.action=b.toString();this.node.lastChild.innerHTML=a+'<input type="hidden" name="op" value="changestore" />';var e=document.createElement("select");e.name="StoreID";NG.addEventListener(e,"change",function(){this.form.submit()});this.node.lastChild.appendChild(e);var f=document.createElement("option");f.innerHTML="(Select)";f.value=0;this.node.lastChild.lastChild.appendChild(f);var c=this;var b=NGUrl.thisRequest();b.addArgument("action","storexml",true);var d=new NG.AJAX(b,function(g){c.Populate(g)});d.send()};ThomasDux.ChooseStore.prototype.Populate=function(c){var a=c.responseXML.documentElement.getElementsByTagName("store");for(var b=0;b<a.length;b++){var d=document.createElement("option");d.innerHTML=a[b].getAttribute("name");d.value=a[b].getAttribute("id");this.node.lastChild.lastChild.appendChild(d)}document.body.appendChild(this.node);this.node.style.right=Math.max(0,Math.floor((document.body.clientWidth-this.node.clientWidth)/2))+"px"};ThomasDux.Popup=function(c,b){this.shade=new NG.Shade();this.node=document.createElement("div");this.hide=b;var a=this;NG.addClass(this.node,"popup");NG.addClass(this.node,"floating");this.node.appendChild(document.createElement("img"));this.node.lastChild.src="/designs/thomasdux09/magnet-td.png";this.node.lastChild.style.left="-40px";this.node.lastChild.style.top="265px";NG.addClass(this.node.lastChild,"floating");this.node.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild,"inner");this.node.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild,"scroll-content");this.node.lastChild.innerHTML=c;this.node.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild,"scroll-bar");this.node.lastChild.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild.lastChild,"arrow-up");this.node.lastChild.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild.lastChild,"arrow-down");this.node.lastChild.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild.lastChild,"scroll-nodule");this.scroller=new NG.Scroller();this.scroller.Enable(this.node.lastChild.previousSibling,this.node.lastChild,this.node.lastChild.lastChild);this.originalScroller=document.NGDefaultScroller;document.NGDefaultScroller=this.scroller;this.node.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild,"close");NG.addEventListener(this.node.lastChild,"click",function(){a.close()});document.body.appendChild(this.node);this.node.style.right=Math.max(0,Math.floor((document.body.clientWidth-this.node.clientWidth)/2))+"px"};ThomasDux.Popup.prototype.close=function(){document.body.removeChild(this.node);this.shade.close();document.NGDefaultScroller=this.originalScroller;if(this.hide&&this.hide.length>0){for(var a=0;a<this.hide.length;a++){NG.delClass(this.hide[a],"hide")}}};if(!NG.getElementsByClassName){NG.getElementsByClassName=function(f,e){var d=[];if(NG.hasClass(f,e)){d[d.length]=f}for(var b=0;b<f.childNodes.length;b++){var a=NG.getElementsByClassName(f.childNodes[b],e);d=d.concat(a)}return d}}function go_back(a){if(NG.ua.isEng("KHTML")){if(!a){a=2}return history.go(-a)}if(!a){a=1}history.back(a)};