/* OBJECT zpager - sets up an object that has many pages and can be paged through. arguments: oid - id of the div container of the element */ var zpgReport = false; function zpager(oid) { this.pgr = $(oid); this.width = 0; this.height = 0; this.oid = oid; this.curPg = 1; this.cont = document.createElement("div"); this.contid = oid + "childcont"; this.cont.id = this.contid; this.pages = 0; this.zpg_isAnim = false; this.pageViewActions = new Array(); this.pageIsLoaded = new Array(); this.init = function(w,h,pgs) { if (zpgReport) $('jsout').value += "this.init("+w+","+h+","+pgs+")\n"; this.width = w; this.height = h; this.pages = pgs; this.pgr.style.width = w + "px"; this.pgr.style.height = h + "px"; this.pgr.style.overflow = 'hidden'; this.pgr.style.position = 'relative'; this.cont.style.height = h + "px"; this.cont.style.width = (w * pgs) + "px"; this.cont.style.position = 'absolute'; this.pgr.appendChild(this.cont); for (var i=0; i1) { this.goToPage((parseInt(this.curPg)-1),onCompleteAction,true); } } this.goToLastPage = function(onCompleteAction) { if (zpgReport) $('jsout').value += "this.goToLastPage("+onCompleteAction+")\n"; if (this.curPg!=this.pages) { this.goToPage(this.pages,onCompleteAction,true); } } this.showOffNext = function() { if (zpgReport) $('jsout').value += "this.showOffNext()\n"; var cp = this.curPg; if (this.pages > 1) { this.goToPage(cp+.1,"zpg_pagers['zpgr-"+this.oid+"'].goToPage("+cp+",'',false)",true); } } this.showOffPrev = function() { if (zpgReport) $('jsout').value += "this.showOffPrev()\n"; var cp = this.curPg; if (this.pages > 1) { this.goToPage(cp-.1,"zpg_pagers['zpgr-"+this.oid+"'].goToPage("+cp+",'',false)",true); } } this.goToRelativePage = function(change) { if (zpgReport) $('jsout').value += "this.goToRelativePage("+change+")\n"; if (this.pages > 1) { this.goToPage(this.curPg+change,"",true); } } this.backToNearestPage = function() { if (zpgReport) $('jsout').value += "this.backToNearestPage()\n"; if (this.pages > 1) { this.goToPage(Math.round(this.curPg),"",true); } } this.setPageContent = function(pg,content,finalLoad) { if (zpgReport) $('jsout').value += "this.setPageContent("+pg+","+finalLoad+")\n"; if (pg > this.pages) { //alert("Error: trying to create page that doesn't exist."); } if(this.cont.childNodes[pg-1] != null) { this.cont.childNodes[pg-1].innerHTML = content; } this.pageIsLoaded["page"+pg] = finalLoad; } this.setPageAction = function(pg,action) { if (zpgReport) $('jsout').value += "this.setPageAction("+pg+","+action+")\n"; //alert(pg +"-"+ action); this.pageViewActions['action'+pg] = action; } this.fadeAway = function(onCompleteAction) { if (zpgReport) $('jsout').value += "this.fadeAway("+onCompleteAction+")\n"; var k=1; if (!this.zpg_isAnim) { this.zpg_isAnim = true; for (var h=1; h>-.999; h=h-0.1) { setTimeout("changeOpac("+h*100+",'"+this.contid+"')",25*k); k++; } setTimeout("zpg_pagers['zpgr-"+this.oid+"'].zpg_isAnim=false",25*k); if (onCompleteAction != null) { if (onCompleteAction != "") { setTimeout(onCompleteAction,25*k); } } } } this.fadeIn = function(onCompleteAction) { if (zpgReport) $('jsout').value += "this.fadeIn("+onCompleteAction+")\n"; var k=1; if (!this.zpg_isAnim) { this.zpg_isAnim = true; for (var h=0; h<1.001; h=h+0.1) { setTimeout("changeOpac("+h*100+",'"+this.contid+"')",25*k); k++; } setTimeout("zpg_pagers['zpgr-"+this.oid+"'].zpg_isAnim=false",25*k); setTimeout("this.whiteBx=''",25*(k+1)); if (onCompleteAction != null) { if (onCompleteAction != "") { setTimeout(onCompleteAction,25*k); } } } } this.fadeInAndOut = function() { if (zpgReport) $('jsout').value += "this.fadeInAndOut()\n"; var k=10; for (var h=1; h>-.999; h=h-0.1) { setTimeout("changeOpac("+h*100+",'"+this.oid+"')",25*k); k++; } k=k+10; for (var h=0; h<1.001; h=h+0.1) { setTimeout("changeOpac("+h*100+",'"+this.oid+"')",25*k); k++; } } this.showNow = function () { changeOpac(100,this.oid); } this.fadeInSweetness = function() { if (zpgReport) $('jsout').value += "this.fadeInSweetness()\n"; if (this.pages > 1) { this.goToPage(1.175,'zpg_pagers[\'zpgr-'+this.oid+'\'].goToPage(1,\'\',true)',false); } else { this.goToPage(1,'',true); } } this.showLoading = function() { if (zpgReport) $('jsout').value += "this.showLoading()\n"; this.whiteBx = ""; this.whiteBx = document.createElement("div"); this.whiteBx.style.height = this.height + "px"; this.whiteBx.style.width = this.width + "px"; this.whiteBx.style.background = "#FFFFFF"; this.whiteBx.style.position = "absolute"; this.whiteBx.style.top = "0px"; this.whiteBx.style.left = "0px"; this.whiteBx.style.textAlign = "center"; this.whiteBx.style.paddingTop = "25px"; this.whiteBx.style.opacity = .5; this.whiteBx.style.MozOpacity = .5; this.whiteBx.style.KhtmlOpacity = .5; this.whiteBx.style.filter = "alpha(opacity=50)"; this.whiteBx.style.zIndex = "999"; this.whiteBx.appendChild(document.createTextNode("Processing... please wait... ")); this.pgr.appendChild(this.whiteBx); } this.clear = function(slideBack) { if (zpgReport) $('jsout').value += "this.clear("+slideBack+")\n"; var doSlide = slideBack || false; if ( doSlide ) { this.goToPage(1,'',(productSet != 'CATALOG')); } for(var u=1; u