/** TOOLTIP **/
function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1) { c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return null
}
function setCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setTime(exdate.getTime()+(expiredays*24*3600*1000))
document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : "; expires="+exdate)
}
var startX = -1; var startY = -1; var elStartX = -1; var elStartY = -1; var canMove = false; function relocate(id, e) { if (canMove) { var element = document.getElementById(id); var newX, newY, elX, elY; if (window.event) { elX = elStartX; elY = elStartY; newX = window.event.clientX + document.body.scrollLeft; newY = window.event.clientY + document.body.scrollTop; element.style.left = newX - startX + "px"; element.style.top = newY - startY + "px"; return;} else { elX = elStartX; elY = elStartY; newX = e.pageX; newY = e.pageY;}
if (startX > 0) { element.style.left = (elX + newX - startX) + "px"; element.style.top = (elY + newY - startY) + "px";} else { element.style.left = newX + "px"; element.style.top = newY + "px";}
}
}
var stillHovering = false; var hasHovered = false; var hoveringEnabled = true; var isShowing = false; function imageDisplay() { this.show = function() { if (stillHovering && sameImage) { linkElement.appendChild(imageElement); document.getElementById('imageDiv').appendChild(linkElement); document.getElementById('imageDiv').style.display = "";}
if (!hasHovered) { checkStillHovering();}
hasHovered = true; isShowing = true;}
}
var imageDisp; var lastImageUrl = ""; var sameImage = true; var imageElement; var linkElement; function startImageHover(imgUrl, productUrl, e) { stillHovering = true; if (stillHovering && hoveringEnabled && !isShowing){ if (hasHovered) { var node = document.getElementById('imageDiv'); while (node.hasChildNodes()) { node.removeChild(node.firstChild);}
}
if (lastImageUrl == imgUrl) { sameImage = true;}
lastImageUrl = imgUrl; linkElement = document.createElement('a'); linkElement.href = productUrl; linkElement.id = "imageLink"; linkElement.name = "imageLink"; imageElement = document.createElement('IMG'); imageElement.style.borderStyle = "none"; imageDisp = new imageDisplay(); var imageLoad = "setTimeout('imageDisp.show()', 100);"
imageElement.onload = function() {eval(imageLoad)}; imageElement.src = imgUrl; canMove = true; relocate('imageDiv', e); canMove = false; notChanged = true;}
}
function checkStillHovering() { if (!stillHovering) { document.getElementById("imageDiv").style.display = "none"; isShowing = false;}
setTimeout("checkStillHovering()", 3);}
function tryFade(){ if (hoveringEnabled){ if (!stillHovering) { document.getElementById('imageDiv').style.display = "none";}
}
}
var hoverToggleImage = document.createElement('IMG'); function setZoomCookies() { var cookieValue = getCookie('imageHovering'); hoverToggleImage.style.borderStyle = "none"; hoverToggleImage.src = "/images/zoomOn.gif"; var hoverToggle = document.getElementById('hoverToggle'); if (hoverToggle) { hoverToggle.appendChild(hoverToggleImage); if (cookieValue == '-1'){ hoveringEnabled = false; hoverToggleImage.src = "/images/zoomOff.gif";}
if (hoveringEnabled) { document.getElementById('hoverToggle').href = "javascript:disableImageHovering()";} else { document.getElementById('hoverToggle').href = "javascript:enableImageHovering()";}
}
}
function disableImageHovering() { setCookie('imageHovering', '-1', 365); hoveringEnabled = false; hoverToggleImage.src = "/images/zoomOff.gif"; document.getElementById('hoverToggle').href = "javascript:enableImageHovering()"; document.getElementById('hoverToggle').removeChild(hoverToggleImage); document.getElementById('hoverToggle').appendChild(hoverToggleImage);}
function enableImageHovering() { setCookie('imageHovering', '1', 365); hoveringEnabled = true; hoverToggleImage.src = "/images/zoomOn.gif"; document.getElementById('hoverToggle').href = "javascript:disableImageHovering()"; document.getElementById('hoverToggle').removeChild(hoverToggleImage); document.getElementById('hoverToggle').appendChild(hoverToggleImage);}
/** RSSTICKER **/
var lastrssbridgeurl="http://www.jumbomarketplace.com/rss_specials_ticker.php"
function createAjaxObj(){ var httprequest=false
if (window.XMLHttpRequest){ httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ try { httprequest=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){ try{ httprequest=new ActiveXObject("Microsoft.XMLHTTP");}
catch (e){}
}
}
return httprequest
}
function rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, logicswitch){ this.RSS_id=RSS_id
this.cachetime=cachetime
this.tickerid=divId
this.delay=delay
this.logicswitch=(typeof logicswitch!="undefined")? logicswitch : ""
this.mouseoverBol=0
this.pointer=0
this.opacitysetting=0.2
this.title=[], this.link=[], this.description=[], this.pubdate=[]
this.ajaxobj=createAjaxObj()
document.write('<div id="'+divId+'" class="'+divClass+'" >Initializing ticker...</div>')
if (window.getComputedStyle)
this.mozopacityisdefined=(window.getComputedStyle(document.getElementById(this.tickerid), "").getPropertyValue("-moz-opacity")==1)? 0 : 1
this.getAjaxcontent()
}
rssticker_ajax.prototype.getAjaxcontent=function(){ if (this.ajaxobj){ var instanceOfTicker=this
var parameters="id="+encodeURIComponent(this.RSS_id)+"&cachetime="+this.cachetime+"&bustcache="+new Date().getTime()
this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
this.ajaxobj.open('GET', lastrssbridgeurl, true)
this.ajaxobj.send(null)
}
}
rssticker_ajax.prototype.initialize=function(){ if (this.ajaxobj.readyState == 4){ if (this.ajaxobj.status==200){ var xmldata=this.ajaxobj.responseXML
if(xmldata.getElementsByTagName("item").length==0){ document.getElementById(this.tickerid).innerHTML="<b>Error</b> fetching remote RSS feed!<br />"+this.ajaxobj.responseText
return
}
var instanceOfTicker=this
this.feeditems=xmldata.getElementsByTagName("item")
for (var i=0; i<this.feeditems.length; i++){ this.title[i]=this.feeditems[i].getElementsByTagName("title")[0].firstChild.nodeValue
this.link[i]=this.feeditems[i].getElementsByTagName("link")[0].firstChild.nodeValue
}
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()
}
}
}
rssticker_ajax.prototype.rotatemsg=function(){ var instanceOfTicker=this
if (this.mouseoverBol==1)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{ var tickerDiv=document.getElementById(this.tickerid)
var linktitle='<div class="whturl"><a href="'+this.link[this.pointer]+'" title="'+this.title[this.pointer]+'">'+this.title[this.pointer]+'</a></div>'
var tickercontent=linktitle
this.fadetransition("reset")
tickerDiv.innerHTML=tickercontent
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100)
this.pointer=(this.pointer<this.feeditems.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay)
}
}
rssticker_ajax.prototype.fadetransition=function(fadetype, timerid){ var tickerDiv=document.getElementById(this.tickerid)
if (fadetype=="reset")
this.opacitysetting=0.2
if (tickerDiv.filters && tickerDiv.filters[0]){ if (typeof tickerDiv.filters[0].opacity=="number")
tickerDiv.filters[0].opacity=this.opacitysetting*100
else
tickerDiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof tickerDiv.style.MozOpacity!="undefined" && this.mozopacityisdefined){ tickerDiv.style.MozOpacity=this.opacitysetting
}
if (fadetype=="up")
this.opacitysetting+=0.2
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}
/** DROPDOWNCONTENT **/
var dropdowncontent={ disableanchorlink: true, hidedivmouseout: [false, 200], ajaxloadingmsg: "Loading content. Please wait...", ajaxbustcache: false, getposOffset:function(what, offsettype){ return (what.offsetParent)? what[offsettype]+this.getposOffset(what.offsetParent, offsettype) : what[offsettype]
}, isContained:function(m, e){ var e=window.event || e
var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
if (c==m)
return true
else
return false
}, show:function(anchorobj, subobj, e){ if (!this.isContained(anchorobj, e)){ var e=window.event || e
if (e.type=="click" && subobj.style.visibility=="visible"){ subobj.style.visibility="hidden"
return
}
var horizontaloffset=(subobj.dropposition[0]=="left")? -(subobj.offsetWidth-anchorobj.offsetWidth) : 0
var verticaloffset=(subobj.dropposition[1]=="top")? -subobj.offsetHeight : anchorobj.offsetHeight
subobj.style.left=this.getposOffset(anchorobj, "offsetLeft") + horizontaloffset + "px"
subobj.style.top=this.getposOffset(anchorobj, "offsetTop")+verticaloffset+"px"
subobj.style.clip=(subobj.dropposition[1]=="top")? "rect(auto auto auto 0)" : "rect(0 auto 0 0)"
subobj.style.visibility="visible"
subobj.startTime=new Date().getTime()
subobj.contentheight=parseInt(subobj.offsetHeight)
if (typeof window["hidetimer_"+subobj.id]!="undefined")
clearTimeout(window["hidetimer_"+subobj.id])
this.slideengine(subobj, (subobj.dropposition[1]=="top")? "up" : "down")
}
}, curveincrement:function(percent){ return (1-Math.cos(percent*Math.PI)) / 2
}, slideengine:function(obj, direction){ var elapsed=new Date().getTime()-obj.startTime
if (elapsed<obj.glidetime){ var distancepercent=(direction=="down")? this.curveincrement(elapsed/obj.glidetime) : 1-this.curveincrement(elapsed/obj.glidetime)
var currentclip=(distancepercent*obj.contentheight)+"px"
obj.style.clip=(direction=="down")? "rect(0 auto "+currentclip+" 0)" : "rect("+currentclip+" auto auto 0)"
window["glidetimer_"+obj.id]=setTimeout(function(){dropdowncontent.slideengine(obj, direction)}, 10)
}
else{ obj.style.clip="rect(0 auto auto 0)"
}
}, hide:function(activeobj, subobj, e){ if (!dropdowncontent.isContained(activeobj, e)){ window["hidetimer_"+subobj.id]=setTimeout(function(){ subobj.style.visibility="hidden"
subobj.style.left=subobj.style.top=0
clearTimeout(window["glidetimer_"+subobj.id])
}, dropdowncontent.hidedivmouseout[1])
}
}, hidediv:function(subobjid){ document.getElementById(subobjid).style.visibility="hidden"
}, ajaxconnect:function(pageurl, divId){ var page_request = false
var bustcacheparameter=""
if (window.XMLHttpRequest)
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ try { page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
document.getElementById(divId).innerHTML=this.ajaxloadingmsg
page_request.onreadystatechange=function(){dropdowncontent.loadpage(page_request, divId)}
if (this.ajaxbustcache)
bustcacheparameter=(pageurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', pageurl+bustcacheparameter, true)
page_request.send(null)
}, loadpage:function(page_request, divId){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){ document.getElementById(divId).innerHTML=page_request.responseText
}
}, init:function(anchorid, pos, glidetime, revealbehavior){ var anchorobj=document.getElementById(anchorid)
var subobj=document.getElementById(anchorobj.getAttribute("rel"))
var subobjsource=anchorobj.getAttribute("rev")
if (subobjsource!=null && subobjsource!="")
this.ajaxconnect(subobjsource, anchorobj.getAttribute("rel"))
subobj.dropposition=pos.split("-")
subobj.glidetime=glidetime || 1000
subobj.style.left=subobj.style.top=0
if (typeof revealbehavior=="undefined" || revealbehavior=="mouseover"){ anchorobj.onmouseover=function(e){dropdowncontent.show(this, subobj, e)}
anchorobj.onmouseout=function(e){dropdowncontent.hide(subobj, subobj, e)}
if (this.disableanchorlink) anchorobj.onclick=function(){return false}
}
else
anchorobj.onclick=function(e){dropdowncontent.show(this, subobj, e);return false}
if (this.hidedivmouseout[0]==true)
subobj.onmouseout=function(e){dropdowncontent.hide(this, subobj, e)}
}
}
function ShowHideBox (box_num) { if (box_num > 100) { box_num -= 100; cfocus = false;} else { cfocus = true;}
var trans_value = ''; try { for (x=1; x < 1000; x++){ if (document.getElementById('box_' + x).className != 'box') { if (document.getElementById('box_' + x).value != '') { trans_value = document.getElementById('box_' + x).value; if (box_num != 9 && box_num != 10) { if (x == 9 || x == 10) { trans_value = '';}
}
}
var t = window.setTimeout('SearchBoxClose('+x+')', 1);}
}
} catch(e){}
if (document.getElementById('box_' + box_num).className != '' ) { document.getElementById('box_' + box_num).className = ''; document.getElementById('box_' + box_num).style.width = '1px'; var t = window.setTimeout('SearchBoxOpen('+box_num+')', 1); if (cfocus) { document.getElementById('box_' + box_num).focus();}
if (trans_value!='') { document.getElementById('box_' + box_num).value = trans_value;}
} else { window.focus();}
}
function SearchBoxClose (box_num) { box = document.getElementById('box_' + box_num)
if (box.style.width.replace('px', '') > 16) { document.getElementById('button_' + box_num).style.visibility = 'hidden'; box.style.width = (parseInt(box.style.width.replace('px', '')) - 15) + 'px'; t = window.setTimeout('SearchBoxClose('+box_num+')', 1);} else { document.getElementById('box_' + box_num).className = 'box'; document.getElementById('button_' + box_num).title = ''; if (isOpera())
box.parentNode.parentNode.parentNode.removeAttribute('width');}
}
function SearchBoxOpen (box_num) { box = document.getElementById('box_' + box_num)
if (box.style.width.replace('px', '') < 95) { box.style.width = (parseInt(box.style.width.replace('px', '')) + 15) + 'px'; var t = window.setTimeout('SearchBoxOpen('+box_num+')', 1); document.getElementById('button_' + box_num).style.visibility = 'visible';} else { if (isOpera())
box.parentNode.parentNode.parentNode.parentNode.width = '135%';}
}
function isOpera () { z = navigator.userAgent.indexOf('Opera'); if (z == -1)
return false; else
return true;}
function SearchButton (n) { document.getElementById('form' + n).submit();}
/** YAHOO.js **/
var YAHOO = function() { return { util: {}, widget: {}, example: {}, namespace: function( sNameSpace ) { if (!sNameSpace || !sNameSpace.length) { return null;}
var levels = sNameSpace.split("."); var currentNS = YAHOO; for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) { currentNS[levels[i]] = currentNS[levels[i]] || {}; currentNS = currentNS[levels[i]];}
return currentNS;}
};} ();
/** TREEVIEW **/
YAHOO.widget.TreeView = function(id) { if (id) { this.init(id);}
}; YAHOO.widget.TreeView.prototype = { id: null, _nodes: null, locked: false, _expandAnim: null, _collapseAnim: null, _animCount: 0, _maxAnim: 2, setExpandAnim: function(type) { if (YAHOO.widget.TVAnim.isValid(type)) { this._expandAnim = type;}
}, setCollapseAnim: function(type) { if (YAHOO.widget.TVAnim.isValid(type)) { this._collapseAnim = type;}
}, animateExpand: function(el) { if (this._expandAnim && this._animCount < this._maxAnim) { var tree = this; var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el, function() { tree.expandComplete();}); if (a) { ++this._animCount; a.animate();}
return true;}
return false;}, animateCollapse: function(el) { if (this._collapseAnim && this._animCount < this._maxAnim) { var tree = this; var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el, function() { tree.collapseComplete();}); if (a) { ++this._animCount; a.animate();}
return true;}
return false;}, expandComplete: function() { --this._animCount;}, collapseComplete: function() { --this._animCount;}, init: function(id) { this.id = id; this._nodes = new Array(); YAHOO.widget.TreeView.trees[id] = this; this.root = new YAHOO.widget.RootNode(this);}, draw: function() { var html = this.root.getHtml(); document.getElementById(this.id).innerHTML = html; this.firstDraw = false;}, regNode: function(node) { this._nodes[node.index] = node;}, getRoot: function() { return this.root;}, setDynamicLoad: function(fnDataLoader) { this.root.setDynamicLoad(fnDataLoader);}, expandAll: function() { if (!this.locked) { this.root.expandAll();}
}, collapseAll: function() { if (!this.locked) { this.root.collapseAll();}
}, getNodeByIndex: function(nodeIndex) { var n = this._nodes[nodeIndex]; return (n) ? n : null;}, getNodeByProperty: function(property, value) { for (var i in this._nodes) { var n = this._nodes[i]; if (n.data && value == n.data[property]) { return n;}
}
return null;}, onExpand: function(node) { }, onCollapse: function(node) { }
}; YAHOO.widget.TreeView.trees = []; YAHOO.widget.TreeView.getTree = function(treeId) { var t = YAHOO.widget.TreeView.trees[treeId]; return (t) ? t : null;}; YAHOO.widget.TreeView.nodeCount = 0; YAHOO.widget.TreeView.getNode = function(treeId, nodeIndex) { var t = YAHOO.widget.TreeView.getTree(treeId); return (t) ? t.getNodeByIndex(nodeIndex) : null;}; YAHOO.widget.TreeView.addHandler = function (el, sType, fn, capture) { capture = (capture) ? true : false; if (el.addEventListener) { el.addEventListener(sType, fn, capture);} else if (el.attachEvent) { el.attachEvent("on" + sType, fn);} else { el["on" + sType] = fn;}
}; YAHOO.widget.TreeView.preload = function() { var styles = [ "ygtvtn", "ygtvtm", "ygtvtmh", "ygtvtp", "ygtvtph", "ygtvln", "ygtvlm", "ygtvlmh", "ygtvlp", "ygtvlph", "ygtvloading" ]; var sb = []; for (var i = 0; i < styles.length; ++i) { sb[sb.length] = '<span class="' + styles[i] + '">&nbsp;</span>';}
var f = document.createElement("div"); var s = f.style; s.position = "absolute"; s.top = "-1000px"; s.left = "-1000px"; f.innerHTML = sb.join(""); document.body.appendChild(f);}; YAHOO.widget.TreeView.addHandler(window, "load", YAHOO.widget.TreeView.preload); YAHOO.widget.Node = function(oData, oParent, expanded) { if (oParent) { this.init(oData, oParent, expanded);}
}; YAHOO.widget.Node.prototype = { index: 0, children: null, tree: null, data: null, parent: null, depth: -1, href: null, ic: null, target: "_self", expanded: false, multiExpand: true, renderHidden: false, childrenRendered: false, previousSibling: null, nextSibling: null, _dynLoad: false, dataLoader: null, isLoading: false, hasIcon: true, init: function(oData, oParent, expanded) { this.data = oData; this.children = []; this.index = YAHOO.widget.TreeView.nodeCount; ++YAHOO.widget.TreeView.nodeCount; this.expanded = expanded; if (oParent) { this.tree = oParent.tree; this.parent = oParent; this.href = "javascript:" + this.getToggleLink(); this.depth = oParent.depth + 1; this.multiExpand = oParent.multiExpand; oParent.appendChild(this);}
}, appendChild: function(node) { if (this.hasChildren()) { var sib = this.children[this.children.length - 1]; sib.nextSibling = node; node.previousSibling = sib;}
this.tree.regNode(node); this.children[this.children.length] = node; return node;}, getSiblings: function() { return this.parent.children;}, showChildren: function() { if (!this.tree.animateExpand(this.getChildrenEl())) { if (this.hasChildren()) { this.getChildrenEl().style.display = "";}
}
}, hideChildren: function() { if (!this.tree.animateCollapse(this.getChildrenEl())) { this.getChildrenEl().style.display = "none";}
}, getElId: function() { return "ygtv" + this.index;}, getChildrenElId: function() { return "ygtvc" + this.index;}, getToggleElId: function() { return "ygtvt" + this.index;}, getEl: function() { return document.getElementById(this.getElId());}, getChildrenEl: function() { return document.getElementById(this.getChildrenElId());}, getToggleEl: function() { return document.getElementById(this.getToggleElId());}, getToggleLink: function() { return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + this.index + ").toggle()";}, collapse: function() { if (!this.expanded) { return;}
if (!this.getEl()) { this.expanded = false; return;}
this.hideChildren(); this.expanded = false; if (this.hasIcon) { this.getToggleEl().className = this.getStyle();}
this.tree.onCollapse(this);}, expand: function() { if (this.expanded) { return;}
if (!this.getEl()) { this.expanded = true; return;}
if (! this.childrenRendered) { this.getChildrenEl().innerHTML = this.renderChildren();}
this.expanded = true; if (this.hasIcon) { this.getToggleEl().className = this.getStyle();}
if (this.isLoading) { this.expanded = false; return;}
if (! this.multiExpand) { var sibs = this.getSiblings(); for (var i=0; i<sibs.length; ++i) { if (sibs[i] != this && sibs[i].expanded) { sibs[i].collapse();}
}
}
this.showChildren(); this.tree.onExpand(this);}, getStyle: function() { if (this.isLoading) { return "ygtvloading";} else { var loc = (this.nextSibling) ? "t" : "l"; var type = "n"; if (this.hasChildren(true) || this.isDynamic()) { type = (this.expanded) ? "m" : "p";}
return "ygtv" + loc + type;}
}, getHoverStyle: function() { var s = this.getStyle(); if (this.hasChildren(true) && !this.isLoading) { s += "h";}
return s;}, expandAll: function() { for (var i=0;i<this.children.length;++i) { var c = this.children[i]; if (c.isDynamic()) { alert("Not supported (lazy load + expand all)"); break;} else if (! c.multiExpand) { alert("Not supported (no multi-expand + expand all)"); break;} else { c.expand(); c.expandAll();}
}
}, collapseAll: function() { for (var i=0;i<this.children.length;++i) { this.children[i].collapse(); this.children[i].collapseAll();}
}, setDynamicLoad: function(fnDataLoader) { this.dataLoader = fnDataLoader; this._dynLoad = true;}, isRoot: function() { return (this == this.tree.root);}, isDynamic: function() { var lazy = (!this.isRoot() && (this._dynLoad || this.tree.root._dynLoad)); return lazy;}, hasChildren: function(checkForLazyLoad) { return ( this.children.length > 0 || (checkForLazyLoad && this.isDynamic() && !this.childrenRendered) );}, toggle: function() { if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) { if (this.expanded) { this.collapse();} else { this.expand();}
}
}, getHtml: function() { var sb = []; sb[sb.length] = '<div class="ygtvitem" id="' + this.getElId() + '">'; sb[sb.length] = this.getNodeHtml(); sb[sb.length] = this.getChildrenHtml(); sb[sb.length] = '</div>'; return sb.join("");}, getChildrenHtml: function() { var sb = []; sb[sb.length] = '<div class="ygtvchildren"'; sb[sb.length] = ' id="' + this.getChildrenElId() + '"'; if (!this.expanded) { sb[sb.length] = ' style="display:none;"';}
sb[sb.length] = '>'; if (this.hasChildren(true) && this.expanded) { sb[sb.length] = this.renderChildren();}
sb[sb.length] = '</div>'; return sb.join("");}, renderChildren: function() { var node = this; if (this.isDynamic() && !this.childrenRendered) { this.isLoading = true; this.tree.locked = true; if (this.dataLoader) { setTimeout( function() { node.dataLoader(node, function() { node.loadComplete();});}, 10);} else if (this.tree.root.dataLoader) { setTimeout( function() { node.tree.root.dataLoader(node, function() { node.loadComplete();});}, 10);} else { return "Error: data loader not found or not specified.";}
return "";} else { return this.completeRender();}
}, completeRender: function() { var sb = []; for (var i=0; i < this.children.length; ++i) { sb[sb.length] = this.children[i].getHtml();}
this.childrenRendered = true; return sb.join("");}, loadComplete: function() { this.getChildrenEl().innerHTML = this.completeRender(); this.isLoading = false; this.expand(); this.tree.locked = false;}, getAncestor: function(depth) { if (depth >= this.depth || depth < 0) { return null;}
var p = this.parent; while (p.depth > depth) { p = p.parent;}
return p;}, getDepthStyle: function(depth) { return (this.getAncestor(depth).nextSibling) ?
"ygtvdepthcell" : "ygtvblankdepthcell";}, getNodeHtml: function() { return "";}
}; YAHOO.widget.RootNode = function(oTree) { this.init(null, null, true); this.tree = oTree;}; YAHOO.widget.RootNode.prototype = new YAHOO.widget.Node(); YAHOO.widget.RootNode.prototype.getNodeHtml = function() { return "";}; YAHOO.widget.TextNode = function(oData, oParent, expanded) { if (oParent) { this.init(oData, oParent, expanded); this.setUpLabel(oData);}
}; YAHOO.widget.TextNode.prototype = new YAHOO.widget.Node(); YAHOO.widget.TextNode.prototype.labelStyle = "ygtvlabel"; YAHOO.widget.TextNode.prototype.labelElId = null; YAHOO.widget.TextNode.prototype.label = null; YAHOO.widget.TextNode.prototype.setUpLabel = function(oData) { if (typeof oData == "string") { oData = { label: oData };}
this.label = oData.label; if (oData.href) { this.href = oData.href;}
if (oData.ic) { this.ic = oData.ic;}
if (oData.target) { this.target = oData.target;}
this.labelElId = "ygtvlabelel" + this.index;}; YAHOO.widget.TextNode.prototype.getLabelEl = function() { return document.getElementById(this.labelElId);}; YAHOO.widget.TextNode.prototype.getNodeHtml = function() { var sb = new Array(); sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">'; sb[sb.length] = '<tr>'; for (i=0;i<this.depth;++i) { sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&nbsp;</td>';}
var getNode = 'YAHOO.widget.TreeView.getNode(\'' + this.tree.id + '\',' + this.index + ')'; sb[sb.length] = '<td'; sb[sb.length] = ' id="' + this.getToggleElId() + '"'; sb[sb.length] = ' class="' + this.getStyle() + '"'; if (this.hasChildren(true)) { sb[sb.length] = ' onmouseover="this.className='; sb[sb.length] = getNode + '.getHoverStyle()"'; sb[sb.length] = ' onmouseout="this.className='; sb[sb.length] = getNode + '.getStyle()"';}
sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">&nbsp;'; sb[sb.length] = '</td>'; sb[sb.length] = '<td>'; sb[sb.length] = '<a'; sb[sb.length] = ' id="' + this.labelElId + '"'; sb[sb.length] = ' class="' + this.labelStyle + '"'; sb[sb.length] = ' href="' + this.href + '"'; sb[sb.length] = ' target="' + this.target + '"'; if (this.hasChildren(true)) { sb[sb.length] = ' onmouseover="document.getElementById(\''; sb[sb.length] = this.getToggleElId() + '\').className='; sb[sb.length] = getNode + '.getHoverStyle()"'; sb[sb.length] = ' onmouseout="document.getElementById(\''; sb[sb.length] = this.getToggleElId() + '\').className='; sb[sb.length] = getNode + '.getStyle()"';}
sb[sb.length] = ' >'; if (this.ic == "T") { sb[sb.length] = '<b style="color:#CC0000;text-decoration:underline;">' + this.label + '</b>';} else { sb[sb.length] = this.label;}
sb[sb.length] = '</a>'; sb[sb.length] = '</td>'; sb[sb.length] = '</tr>'; sb[sb.length] = '</table>'; return sb.join("");}; YAHOO.widget.MenuNode = function(oData, oParent, expanded) { if (oParent) { this.init(oData, oParent, expanded); this.setUpLabel(oData);}
this.multiExpand = false;}; YAHOO.widget.MenuNode.prototype = new YAHOO.widget.TextNode(); YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) { if (oParent) { this.init(oData, oParent, expanded); this.initContent(oData, hasIcon);}
}; YAHOO.widget.HTMLNode.prototype = new YAHOO.widget.Node(); YAHOO.widget.HTMLNode.prototype.contentStyle = "ygtvhtml"; YAHOO.widget.HTMLNode.prototype.contentElId = null; YAHOO.widget.HTMLNode.prototype.content = null; YAHOO.widget.HTMLNode.prototype.initContent = function(oData, hasIcon) { if (typeof oData == "string") { oData = { html: oData };}
this.html = oData.html; this.contentElId = "ygtvcontentel" + this.index; this.hasIcon = hasIcon;}; YAHOO.widget.HTMLNode.prototype.getContentEl = function() { return document.getElementById(this.contentElId);}; YAHOO.widget.HTMLNode.prototype.getNodeHtml = function() { var sb = new Array(); sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">'; sb[sb.length] = '<tr>'; for (i=0;i<this.depth;++i) { sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&nbsp;</td>';}
if (this.hasIcon) { sb[sb.length] = '<td'; sb[sb.length] = ' id="' + this.getToggleElId() + '"'; sb[sb.length] = ' class="' + this.getStyle() + '"'; sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">&nbsp;'; if (this.hasChildren(true)) { sb[sb.length] = ' onmouseover="this.className='; sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\''; sb[sb.length] = this.tree.id + '\',' + this.index + ').getHoverStyle()"'; sb[sb.length] = ' onmouseout="this.className='; sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\''; sb[sb.length] = this.tree.id + '\',' + this.index + ').getStyle()"';}
sb[sb.length] = '</td>';}
sb[sb.length] = '<td'; sb[sb.length] = ' id="' + this.contentElId + '"'; sb[sb.length] = ' class="' + this.contentStyle + '"'; sb[sb.length] = ' >'; sb[sb.length] = this.html; sb[sb.length] = '</td>'; sb[sb.length] = '</tr>'; sb[sb.length] = '</table>'; return sb.join("");}; YAHOO.widget.TVAnim = new function() { this.FADE_IN = "YAHOO.widget.TVFadeIn"; this.FADE_OUT = "YAHOO.widget.TVFadeOut"; this.getAnim = function(type, el, callback) { switch (type) { case this.FADE_IN: return new YAHOO.widget.TVFadeIn(el, callback); case this.FADE_OUT: return new YAHOO.widget.TVFadeOut(el, callback); default: return null;}
}; this.isValid = function(type) { return ( "undefined" != eval("typeof " + type) );};}; YAHOO.widget.TVFadeIn = function(el, callback) { this.el = el; this.callback = callback;}; YAHOO.widget.TVFadeIn.prototype = { animate: function() { var tvanim = this; var s = this.el.style; s.opacity = 0.1; s.filter = "alpha(opacity=10)"; s.display = ""; var dur = 0.4; var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur); a.onComplete.subscribe( function() { tvanim.onComplete();} ); a.animate();}, onComplete: function() { this.callback();}
}; YAHOO.widget.TVFadeOut = function(el, callback) { this.el = el; this.callback = callback;}; YAHOO.widget.TVFadeOut.prototype = { animate: function() { var tvanim = this; var dur = 0.4; var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur); a.onComplete.subscribe( function() { tvanim.onComplete();} ); a.animate();}, onComplete: function() { var s = this.el.style; s.display = "none"; s.filter = "alpha(opacity=100)"; this.callback();}
};
/** LOADNODES **/
function nodeData(id, path) { this.id = id; this.path = path;}
function makeRequest(url, node, onCompleteCallback) { var http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml');}
browser = 'mozilla';} else if (window.ActiveXObject) { browser = 'IE'; try { http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}
}
}
if (!http_request) { alert('Giving up :( Cannot create an XMLHTTP instance');}
http_request.onreadystatechange = function() { alertContents(http_request, node, onCompleteCallback);}; http_request.open('GET', url, true); http_request.send(null);}
function alertContents(http_request, node, onCompleteCallback) { var tmpNode; if (http_request.readyState == 4) { if (http_request.status == 200) { if (browser == 'IE') { var xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmldoc.loadXML(http_request.responseText);} else { var xmldoc = http_request.responseXML;}
var root_node = xmldoc.getElementsByTagName('category'); for (i = 0; i < root_node.length; i++) { var id = root_node.item(i).getElementsByTagName('id').item(0).firstChild.data; var childCount = root_node.item(i).getElementsByTagName('childcount').item(0).firstChild.data; var productsCount = root_node.item(i).getElementsByTagName('productscount').item(0).firstChild.data; var multiExpand = root_node.item(i).getElementsByTagName('multiexpand').item(0).firstChild.data; var path = root_node.item(i).getElementsByTagName('path').item(0).firstChild.data; if (productsCount > 0 || childCount == 0) { tmpNode = new YAHOO.widget.MenuNode({label: root_node.item(i).getElementsByTagName('name').item(0).firstChild.data, href: path, ic: root_node.item(i).getElementsByTagName('ic').item(0).firstChild.data }, node, false);} else { tmpNode = new YAHOO.widget.MenuNode({label: root_node.item(i).getElementsByTagName('name').item(0).firstChild.data, ic: root_node.item(i).getElementsByTagName('ic').item(0).firstChild.data }, node, false);}
if (multiExpand == 1) { tmpNode.multiExpand = true;}
tmpNode.data = new nodeData(id, path); if (childCount > 0) { tmpNode.setDynamicLoad(loadDataForNode);}
}
onCompleteCallback();} else { alert('There was a problem with the request.');}
}
}
