var sgRedirect="http://www.google.com";var sgXmlSource="xml/spiralgyro.xml";var sgDebug=false;var sgOverlayIdx=8;var sgPocketIdx=9;var sgMaxOffset=100;var sgShowDelay=500;var sgHideDelay=200;var sgFadeTimer=300;var sgGrowInterval=20;var sgLeftOffset=8;var sgDefaultSeed="home";var sgDefaultIdx=0;var sgRightAdjustment=35;var sgBottomAdjustment=20;var sgSitePath="/";var sgDefaultMap=new Array();sgDefaultMap[0]={l:20,t:30,w:360,h:240};sgDefaultMap[1]={l:382,t:30,w:180,h:119};sgDefaultMap[2]={l:382,t:151,w:180,h:119};sgDefaultMap[3]={l:20,t:272,w:133,h:89};sgDefaultMap[4]={l:155,t:272,w:133,h:89};sgDefaultMap[5]={l:20,t:363,w:133,h:89};sgDefaultMap[6]={l:155,t:363,w:133,h:89};sgDefaultMap[7]={l:290,t:272,w:272,h:180};sgDefaultMap[8]={l:20,t:30,w:542,h:422};sgDefaultMap[9]={l:20,t:30,w:480,h:250};var sgInitialize=function(){SpiralGyro.prototype.setCurrent=sgCurrent;SpiralGyro.prototype.fadeIn=sgFadeIn;SpiralGyro.prototype.fadeOut=sgFadeOut;SpiralGyro.prototype.growIcons=sgGrowIcons;SpiralGyro.prototype.importXml=sgImportXml;SpiralGyro.prototype.loadTemplate=sgLoadTemplate;SpiralGyro.prototype.positionWindow=sgPositionWindow;SpiralGyro.prototype.startTemplate=sgStartTemplate;SpiralGyro.prototype.stopTemplate=sgStopTemplate;SpiralGyro.prototype.showCells=sgShowCells;SpiralGyro.prototype.sort=sgSort;SpiralGyro.prototype.select=sgSelect;SpiralGyro.prototype.swapTemplate=sgSwapTemplate;SpiralGyro.prototype.slideWindow=sgSlideWindow;SpiralGyro.prototype.track=sgTrack;SpiralGyro.prototype.weight=sgWeight;Sg=new SpiralGyro();Sg.importXml(sgXmlSource);Sg.showCells();if(document.images){pic1=new Image(126,27);pic1.src="images/hometabon.jpg";pic2=new Image(126,27);pic2.src="images/onlinetabon.jpg";pic3=new Image(126,27);pic3.src="images/storetabon.jpg";}};var sgCursor={x:0,y:0};var Sg=false;var sgNumeric=/^[0-9]+/;var sgQueryString=/(\?.*)$/;var sgIdxPool=0;if(document.all&&!document.getElementById){document.getElementById=function(id){return document.all[id];}}else if(document.layers&&!document.getElementById){document.getElementById=function(id){return document.layers[id];}}var _sg={ValidEnv:function(){return true;},PutSeed:function(idx,map,seed){document.cookie='lastmap='+idx+',sgDefaultMap,'+seed+'; path='+sgSitePath;},GetSeed:function(){var nameEq="lastmap=";var pieces=document.cookie.split(';');for(var i=0;i<pieces.length;i++){var piece=pieces[i];while(piece.charAt(0)==' ')piece=piece.substring(1,piece.length);if(piece.indexOf(nameEq)==0){return piece.substring(nameEq.length,piece.length);}}return false;},GetXmlHttpObject:function(){var returnObj=false;try{returnObj=new XMLHttpRequest();}catch(e){try{returnObj=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){returnObj=new ActiveXObject("Microsoft.XMLHTTP");}}return returnObj;},GetCursorPos:function(e){e=e||window.event;if(e.pageX||e.pageY){sgCursor.x=e.pageX;sgCursor.y=e.pageY;}else{var de=document.documentElement;var b=document.body;sgCursor.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);sgCursor.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0);}},ShowTemplate:function(href){Sg.pocket.innerHTML="<table style=\"background: transparent; height: 250px; width: 560px; vertical-align: middle;\"><tr><td style=\"text-align: center; height: 100%; width: 100%;\"><img style=\"height: 22px; width: 126px;\" src=\"images/ajax-loader.gif\" alt='Loading...' /></td></tr></table>";Sg.fadeIn(Sg.overlay,80);Sg.fadeIn(Sg.pocket,100);Sg.loadTemplate(href);},HideTemplate:function(href){Sg.fadeOut(Sg.pocket,100);Sg.fadeOut(Sg.overlay,80);},SelectTab:function(obj){var container=obj.parentNode;var tabs=container.getElementsByTagName("li");for(i=0;i<tabs.length;i++){tabs[i].className=tabs[i].className.replace("-selected","");}obj.className=obj.className+"-selected";},AsyncCall:function(href){var xmlHttpObj=_sg.GetXmlHttpObject();xmlHttpObj.open('GET',href,true);xmlHttpObj.onreadystatechange=function(){if(xmlHttpObj.readyState==4){Sg.pocket.innerHTML=xmlHttpObj.responseText;for(i=0;i<Sg.pocket.childNodes.length;i++){if(Sg.pocket.childNodes[i].nodeType==1){if(Sg.pocket.childNodes[i].style.width.toString().length>0)Sg.pocket.style.width=Sg.pocket.childNodes[i].style.width;if(Sg.pocket.childNodes[i].style.height.toString().length>0)Sg.pocket.style.height=Sg.pocket.childNodes[i].style.height;}}Sg.positionWindow();}};xmlHttpObj.send(null);},PopulateCellMenu:function(){if(Sg==false){if(sgDebug)alert('Invalid XML doc');return false;}var nodes,nodeName,nodeValue,tabNode,linkNode;var attr=new Array();var i,j,k;nodes=Sg.doc.getElementsByTagName("tab");if(nodes.length<1){if(sgDebug)alert("Empty node list: menu.tab");}for(j=0;j<nodes.length;j++){nodeValue=nodes[j].firstChild.nodeValue;attr["action"]=nodes[j].getAttribute("action");attr["class"]=nodes[j].getAttribute("class");if(attr["class"]==null)attr["class"]="";tabNode=document.createElement("li");tabNode.className=attr["class"];linkNode=document.createElement("a");if(attr["action"]!=null){linkNode.setAttribute("href","javascript: "+attr["action"]);linkNode.className=attr["class"];}var imgNode=document.createElement("img");imgNode.setAttribute("src","images/gap.gif");linkNode.appendChild(imgNode);tabNode.appendChild(linkNode);Sg.tabs[0].appendChild(tabNode);}nodes=Sg.doc.getElementsByTagName("cell");if(nodes.length<1){if(sgDebug)alert('Empty node list: menu.cell');return false;}for(j=0;j<nodes.length;j++){attr["action"]=nodes[j].getAttribute("action");if(attr["action"]==null)attr["action"]="Sg.startTemplate('ajax.template.html');";attr["inaction"]=nodes[j].getAttribute("inaction");if(attr["inaction"]==null)attr["inaction"]="Sg.stopTemplate();";for(i=0;i<nodes[j].childNodes.length;i++){nodeName=nodes[j].childNodes[i].nodeName;if(nodeName=="image"||nodeName=="img"){nodeValue=nodes[j].childNodes[i].firstChild.nodeValue;attr["alt"]=nodes[j].childNodes[i].getAttribute("alt");if(attr["alt"]==null)attr["alt"]="";Sg.controls[j]='<img class="sg-fill" id="'+j+'" src="'+nodeValue+'" alt="'+attr["alt"]+'" onmouseover="javascript: Sg.setCurrent('+j+');'+decodeURI(attr["action"])+';Sg.track('+j+')" onmouseout="'+decodeURI(attr["inaction"])+'" />';}else if(nodeName=="meta"){Sg.meta[j]=nodes[j].childNodes[i].firstChild.nodeValue;}else if(nodeName=="omniture"){Sg.omniture[j]={pagename:null,eventstring:null};for(k=0;k<nodes[j].childNodes[i].childNodes.length;k++){if(nodes[j].childNodes[i].childNodes[k].nodeType==1){if(nodes[j].childNodes[i].childNodes[k].nodeName=='pagename'){Sg.omniture[j].pagename=nodes[j].childNodes[i].childNodes[k].firstChild.nodeValue;}else if(nodes[j].childNodes[i].childNodes[k].nodeName=='eventstring'){Sg.omniture[j].eventstring=nodes[j].childNodes[i].childNodes[k].firstChild.nodeValue;}}}}}}var lastMap=_sg.GetSeed();var idx=sgDefaultIdx;if(!lastMap){Sg.select(sgDefaultIdx,sgDefaultMap,sgDefaultSeed);}else{var p=lastMap.split(',');Sg.select(p[0],sgDefaultMap,p[2]);idx=p[0];}var menus=document.getElementById('spiralgyro-menu');if(menus!=null){var counter=0;for(i=0;i<menus.childNodes.length;i++){if(menus.childNodes[i].nodeType==1){if(counter==idx){_sg.SelectTab(menus.childNodes[i]);break;}else counter++;}}}},Fade:function(eid,start,end,ms){var speed=Math.round(ms/100);var timer=0;if(start>end){for(i=start;i>=end;i--){setTimeout("_sg.ChangeOpacity("+i+",'"+eid+"')",(timer*speed));timer++;}}else if(start<end){for(i=start;i<=end;i++){setTimeout("_sg.ChangeOpacity("+i+",'"+eid+"')",(timer*speed));timer++;}}},ChangeOpacity:function(opacity,eid){var obj=document.getElementById(eid);obj.style.opacity=(opacity/100);obj.style.MozOpacity=(opacity/100);obj.style.KhtmlOpacity=(opacity/100);if(obj.filters)obj.filter="alpha(opacity="+opacity+")";if(opacity==0&&obj.style.display!='none')obj.style.display='none';else if(opacity>0&&obj.style.display=='none')obj.style.display='block';},MoveWindow:function(x,y){Sg.pocket.style.left=x+"px";Sg.pocket.style.top=y+"px";},GrowIcon:function(idx){if(Sg.cells[idx].style.height==null)return;if(Sg.cells[idx].style.width==null)return;var currentHeight=sgNumeric.exec(Sg.cells[idx].firstChild.style.height)*1;var currentWidth=sgNumeric.exec(Sg.cells[idx].firstChild.style.width)*1;if(currentHeight<100)currentHeight+=10;if(currentHeight>100)currentHeight=100;if(currentWidth<100)currentWidth+=10;if(currentWidth>100)currentWidth=100;Sg.cells[idx].firstChild.style.height=currentHeight+"%";Sg.cells[idx].firstChild.style.width=currentWidth+"%";}};if(document.all&&!document.getElementById){document.getElementById=function(id){return document.all[id];}}else if(document.layers&&!document.getElementById){document.getElementById=function(id){return document.layers[id];}}function SpiralGyro(seed){this.container=document.getElementById('spiralgyro');this.cells=this.container.getElementsByTagName('div');this.tabs=this.container.getElementsByTagName('ul');this.overlay=document.getElementById('sg-overlay');this.pocket=document.getElementById('sg-pocket');this.doc=false;this.controls=new Array();this.timers=new Array();this.meta=new Array();this.view={left:0,top:0,right:0,bottom:0};this.current=0;this.currentMap=new Array();this.omniture=new Array();}var sgTrack=function(cid){try{window.s_pageName=this.omniture[cid].pagename;sendAnalyticsEvent(this.omniture[cid].eventstring);}catch(err){if(sgDebug)alert(err);}};var sgLoadTemplate=function(href){_sg.AsyncCall(href);this.pocket.onmouseover=function(){clearTimeout(Sg.timers["hide"+href]);};this.pocket.onmouseout=function(){Sg.timers["hide"+href]=setTimeout("_sg.HideTemplate('"+href+"')",sgHideDelay);}};var sgSwapTemplate=function(href){_sg.ChangeOpacity(10,Sg.pocket.id);_sg.Fade(Sg.pocket.id,10,100,(sgFadeTimer*2));Sg.loadTemplate(href);};var sgCurrent=function(cid){this.current=cid;};var sgImportXml=function(source){if(document.implementation&&document.implementation.createDocument){this.doc=document.implementation.createDocument("","",null);this.doc.onload=_sg.PopulateCellMenu;if(this.doc.onload==null){var xmlHttpObj=_sg.GetXmlHttpObject();xmlHttpObj.open('GET',source,true);xmlHttpObj.onreadystatechange=function(){if(xmlHttpObj.readyState==4){var parser=new DOMParser();Sg.doc=parser.parseFromString(xmlHttpObj.responseText,"text/xml");_sg.PopulateCellMenu();}};xmlHttpObj.send(null);}}else if(window.ActiveXObject){this.doc=new ActiveXObject("Microsoft.XMLDOM");this.doc.onreadystatechange=function(){if(Sg.doc.readyState==4)_sg.PopulateCellMenu();}}else{if(sgDebug)alert("Does not supprt XML import");return false;}if(this.doc.async)this.doc.load(source);return true;};var sgWeight=function(meta,seed){var tokens=meta.split(",",100);if(tokens[0]==seed){return tokens[1]*1;}return 100;};var sgSelect=function(idx,map,seed,obj){_sg.PutSeed(idx,map,seed);var counter=-1;if(obj!=null)alert(obj);for(i=0;i<this.tabs[0].childNodes.length;i++){if(this.tabs[0].childNodes[i].nodeType==1){if(++counter==idx){this.tabs[0].childNodes[i].className+=' selected';if(this.tabs[0].childNodes[i].childNodes.length>0){if(this.tabs[0].childNodes[i].childNodes[0].className!=null)this.tabs[0].childNodes[i].childNodes[0].className+=' selected';}}else{this.tabs[0].childNodes[i].className=this.tabs[0].childNodes[i].className.replace('selected','');if(this.tabs[0].childNodes[i].childNodes.length>0){if(this.tabs[0].childNodes[i].childNodes[0].className!=null)this.tabs[0].childNodes[i].childNodes[0].className=this.tabs[0].childNodes[i].className.replace('selected','');}}}}this.sort(map,seed);};var sgSort=function(map,seed){var weighted=new Array();for(i=0;i<this.controls.length;i++){if(this.meta[i]!=null)weighted[i]=this.weight(this.meta[i],seed);else weighted[i]=i;}for(cid in weighted){var mid=weighted[cid];this.currentMap[cid]=mid;if(map[mid]==null)continue;this.cells[mid].innerHTML=this.controls[cid];this.cells[mid].style.top=map[mid].t+"px";this.cells[mid].style.left=map[mid].l+"px";this.cells[mid].style.width=map[mid].w+"px";this.cells[mid].style.height=map[mid].h+"px";this.growIcons(mid);}this.cells[sgOverlayIdx].style.top=map[sgOverlayIdx].t+"px";this.cells[sgOverlayIdx].style.left=map[sgOverlayIdx].l+"px";this.cells[sgOverlayIdx].style.width=map[sgOverlayIdx].w+"px";this.cells[sgOverlayIdx].style.height=map[sgOverlayIdx].h+"px";this.cells[sgPocketIdx].style.top=map[sgPocketIdx].t+"px";this.cells[sgPocketIdx].style.left=map[sgPocketIdx].l+"px";this.cells[sgPocketIdx].style.width=map[sgPocketIdx].w+"px";this.cells[sgPocketIdx].style.height=map[sgPocketIdx].h+"px";this.view.top=map[sgOverlayIdx].t;this.view.left=sgLeftOffset;this.view.right=(map[sgOverlayIdx].w-map[sgOverlayIdx].l)+(2*sgLeftOffset);this.view.bottom=this.view.top+(map[sgOverlayIdx].h+map[sgOverlayIdx].t);this.view.bottom-=sgBottomAdjustment;this.view.right+=sgRightAdjustment;};var sgStartTemplate=function(href){this.timers["show"+href]=setTimeout("_sg.ShowTemplate('"+href+"')",sgShowDelay);};var sgStopTemplate=function(href){for(var t in this.timers){clearTimeout(this.timers[t]);}};if(!sgFadeOut){var sgFadeOut=function(obj,upper){if(obj.style.display!='none')_sg.Fade(obj.id,upper,0,100);}}if(!sgFadeIn){var sgFadeIn=function(obj,upper){if(obj.style.display=='none')_sg.Fade(obj.id,0,upper,sgFadeTimer);}}var sgPositionWindow=function(){var idx=this.currentMap[this.current];var pixelsLeft=sgNumeric.exec(this.cells[idx].style.left)*1;var pixelsTop=sgNumeric.exec(this.cells[idx].style.top)*1;var cellWidth=sgNumeric.exec(this.cells[idx].style.width)*1;var cellHeight=sgNumeric.exec(this.cells[idx].style.height)*1;var windowWidth=sgNumeric.exec(this.pocket.style.width)*1;var windowHeight=sgNumeric.exec(this.pocket.style.height)*1;if((pixelsLeft+windowWidth)>this.view.right){pixelsLeft-=((pixelsLeft+windowWidth)-this.view.right);if(pixelsLeft<this.view.left)pixelsLeft=this.view.left;}if((pixelsTop+windowHeight)>this.view.bottom){pixelsTop-=((pixelsTop+windowHeight)-this.view.bottom);if(pixelsTop<this.view.top)pixelsTop=this.view.top;}this.slideWindow(pixelsLeft,pixelsTop);};var daz_Obj=false;var daz_SlidePane=function(x2,y2){var x1=sgNumeric.exec(daz_Obj.style.left)*1;var y1=sgNumeric.exec(daz_Obj.style.top)*1;var m,b,y;var frames=10;var timer=0;var rate=0.8;var mult=1.0045;if(x2-x1==0&&y2-y1==0){return;}else if(x2-x1==0){frames=Math.abs(y1-y2);if(y1>y2){for(i=y1;i>=y2;i--){setTimeout("daz_MovePane("+x2+","+i+")",(timer+=(rate*=mult)));}}else{for(i=y1;i<=y2;i++){setTimeout("daz_MovePane("+x2+","+i+")",(timer+=(rate*=mult)));}}}else if(y2-y1==0){frames=Math.abs(x1-x2);if(x1>x2){for(i=x1;i>=x2;i--)setTimeout("daz_MovePane("+i+","+y2+")",(timer+=(rate*=mult)));}else{for(i=x1;i<=x2;i++)setTimeout("daz_MovePane("+i+","+y2+")",(timer+=(rate*=mult)));}}else {m=(y2-y1)/(x2-x1);b=y1-m*x1;var dX=Math.abs(x1-x2);var dY=Math.abs(y1-y2);if(dX>dY){frames=dX;if(x1>x2){for(i=x1;i>=x2;i--){y=m*i+b;setTimeout("daz_MovePane("+i+","+y+")",(timer+=(rate*=mult)));}}else{for(i=x1;i<=x2;i++){y=m*i+b;setTimeout("daz_MovePane("+i+","+y+")",(timer+=(rate*=mult)));}}}else{frames=dY;if(y1>y2){for(i=y1;i>=y2;i--){x=(i-b)/m;setTimeout("daz_MovePane("+x+","+i+")",(timer+=(rate*=mult)));}}else{for(i=y1;i<=y2;i++){x=(i-b)/m;setTimeout("daz_MovePane("+x+","+i+")",(timer+=(rate*=mult)));}}}}};var daz_MovePane=function(x,y){daz_Obj.style.left=x+'px';daz_Obj.style.top=y+'px';};var sgSlideWindow=function(x2,y2){daz_Obj=this.pocket;daz_SlidePane(x2,y2);};var sgShowCells=function(){for(i=0;i<this.cells.length;i++){this.cells[i].style.visibility='visible';}};var sgGrowIcons=function(idx){if(idx==sgOverlayIdx||idx==sgPocketIdx)return;for(i=0;i<10;i++)setTimeout("_sg.GrowIcon("+idx+")",(sgGrowInterval*i));};if(!_sg.ValidEnv())sgRedirect();if(window.attachEvent){window.attachEvent("onload",sgInitialize);document.attachEvent("onmousemove",_sg.GetCursorPos);}else if(window.addEventListener){window.addEventListener("load",sgInitialize,false);window.addEventListener("mousemove",_sg.GetCursorPos,false);}else if(window.captureEvents){window.onload=sgInitialize;window.onmousemove=_sg.GetCursorPos;window.captureEvents(Event.LOAD);window.captureEvents(Event.MOUSEMOVE);}