/*---------- Copyright 2011 Neotek Limited (http://www.neotek.co.nz). All rights reserved. -----------*/
function SpecialsRotator(XMLDoc,XSLDoc,HTMLElementId){Rotator.Load(XMLDoc,XSLDoc,HTMLElementId);}var Rotator={xmlurl:'',xslurl:'',elementId:'',totalNodes:0,nodes:null,xsl:null,Load:function(xmlurl,xslurl,elementId){Rotator.xmlurl=xmlurl;Rotator.xslurl=xslurl;Rotator.elementId=elementId;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}Rotator.Reload();},LoadXMLDoc:function(Doc){xmlhttp.open("GET",Doc,false);xmlhttp.send('');return xmlhttp.responseXML;},DisplayResult:function(xml,node){if(xml==null){return;}var elementObj=$(Rotator.elementId);if(window.ActiveXObject){IExmlDoc=new ActiveXObject("Microsoft.XMLDOM");IExmlDoc.async="false";IExmlDoc.loadXML(xml.xml);ex=IExmlDoc.transformNode(Rotator.xsl);elementObj.innerHTML=ex;IExmlDoc=null;}else if(document.implementation&&document.implementation.createDocument){xsltProcessor=new XSLTProcessor();xsltProcessor.importStylesheet(Rotator.xsl);FFxmlDoc=document.implementation.createDocument("","",null);FFxmlDoc.appendChild(xml.cloneNode(true));var resultDocument=xsltProcessor.transformToFragment(FFxmlDoc,document);elementObj.innerHTML="";elementObj.appendChild(resultDocument);FFxmlDoc=null;}Rotator.Fade(Rotator.elementId,0,100,10);setTimeout(function(){Rotator.Fade(Rotator.elementId,100,0,-10);},4300);node++;if(node==Rotator.totalNodes){node=0;}setTimeout(function(){Rotator.DisplayResult(Rotator.nodes[node],node);},5000);},Fade:function(element,from,to,step){if(Rotator.totalNodes==0){return;}$(element).style.opacity=from/100;$(element).style.filter='alpha(opacity='+from+');';if(from==to){if(to!=0){$(element).style.filter=null;}return true;}else{from=from+step;setTimeout(function(){Rotator.Fade(element,from,to,step);},20);}},Reload:function(){Rotator.xsl=Rotator.LoadXMLDoc(Rotator.xslurl);ParentXML=Rotator.LoadXMLDoc(Rotator.xmlurl);Rotator.nodes=ParentXML.getElementsByTagName('product');Rotator.totalNodes=Rotator.nodes.length;if(Rotator.totalNodes<=0){$(Rotator.elementId).innerHTML="<p style='padding: 10px;'>Sorry, no Specials Available</p>";return;}else{Rotator.DisplayResult(Rotator.nodes[0],0);}}};
