// insertAdjacentHTML(), insertAdjacentText() and insertAdjacentElement() // for Netscape 6/Mozilla by Thor Larholm me@jscript.dk // Usage: include this code segment at the beginning of your document // before any other Javascript contents. if(typeof HTMLElement!="undefined" && ! HTMLElement.prototype.insertAdjacentElement){ HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode) { switch (where){ case 'beforeBegin': this.parentNode.insertBefore(parsedNode,this) break; case 'afterBegin': this.insertBefore(parsedNode,this.firstChild); break; case 'beforeEnd': this.appendChild(parsedNode); break; case 'afterEnd': if (this.nextSibling) this.parentNode.insertBefore(parsedNode,this.nextSibling); else this.parentNode.appendChild(parsedNode); break; } } HTMLElement.prototype.insertAdjacentHTML = function (where,htmlStr) { var r = this.ownerDocument.createRange(); r.setStartBefore(this); var parsedHTML = r.createContextualFragment(htmlStr); this.insertAdjacentElement(where,parsedHTML) } HTMLElement.prototype.insertAdjacentText = function (where,txtStr) { var parsedText = document.createTextNode(txtStr) this.insertAdjacentElement(where,parsedText) } } function cancelEvent(e) { if(!e) e = window.event; if(e.stopPropagation) e.stopPropagation(); if(e.preventDefault) e.preventDefault(); e.cancelBubble = true; e.cancel = true; e.returnValue = false; return false; } function toggleDropdown(ddContainer) { //alert(ddContainer.childNodes.length); if(ddContainer.childNodes[ddContainer.childNodes.length-1].style.display=='none') { var iFrmae = ddContainer.childNodes[ddContainer.childNodes.length-1] iFrmae.src=pageBase + "Core/quickimage.aspx?user=" + SelectedUserID + "&image=" + ddContainer.nextSibling.value + "&SpecialOption=Send%20By%20Mail&SpecialOptionImage=sendbymail.gif&nocache=" + new Date(); iFrmae.style.width=ddContainer.scrollWidth; ddContainer.style.borderBottomColor="#ffffff"; iFrmae.style.display=''; } else { ddContainer.style.borderBottomColor="#000000"; ddContainer.childNodes[ddContainer.childNodes.length-1].style.display='none'; } } function selectImage(ddContainer,imageFile,user) { if (imageFile.substr(0,1)=="/") var path=""; else { if(user) var path=pageBase + "{images}/"; else var path=pageBase + "images/"; } var imagePath,imagePathBase; if(user) imagePathBase = path + escape(imageFile) + "?user="+user; else imagePathBase=path + escape(imageFile) + "?"; ddContainer.nextSibling.value=imageFile; ddContainer.childNodes[1].src= imagePathBase + "&width=50&height=50&aspectmode=slice&quality=30"; ddContainer.childNodes[2].innerText=imageFile; toggleDropdown(ddContainer); } function playFile(sFilename) { var wn = window.open(sFilename,"popupWin","menubar=no, toolbar=no, location=no,scrollbars=yes, status=yes, resizable=yes, width=100, height=100"); } function pleaseWait() { waitDiv.style.display=""; //Used for file upload, maybe a nice animtion would be good here, like a gif or somthing, although dont they stop working when the page starts loading - not sure } function fixScroll(scrollContainer) { s = scrollContainer.scrollTop; scrollContainer.childNodes[0].focus() scrollContainer.scrollTop = s; } function doCheckout(form) { if(confirm("This will complete the order, you will not be able to edit the order after this time.")) { form.checkout.value="yes"; form.submit(); } } var scrollStep = 10; var scrollDelay = 100; var slideshowDelay = 5000; var slideshowFadeTime = 500; var opacityStep = 5; var scrollGap = 0; var continueScroll; var scrollContainer; function autoScrollStart() { var containers = document.getElementsByTagName("div"); var firstTop; for(var a=0;a0) { scrollStep = containers[a].getAttribute("scrollSpeed")/10; scrollDelay = 10000 / containers[a].getAttribute("scrollSpeed"); } } startScroller(containers[a],true); /* if(containers[a].scrollHeight > containers[a].offsetHeight * 2) { continueScroll=true; /// scrollFwd(containers[a]); } else { containers[a].nextSibling.style.display="none"; } */ } if(containers[a].getAttribute("slideShow")=="true") { startSlideshow(containers[a],true); } } } var makeBigger = new Array(); var makeSmaller = new Array(); function startSlideshow(container,fwd) { if(fwd) container.setAttribute("direction",1); if (!document.addEventListener){ document.attachEvent("onmousedown",stopScroll); //MS only } else{ document.addEventListener ("mousedown",stopScroll,true);//FireFox...etc. } showNextPart( container.id ); } //Fade functions based on those from http://www.brainerror.net/scripts_js_blendtrans.php function opacity(containerID, index, opacStart, opacEnd, millisec) { //speed for each frame var speed = Math.round(millisec / 100); var timer = 0; //determine the direction for the blending, if start and end are the same nothing happens if(opacStart > opacEnd) { for(var i = opacStart; i >= opacEnd; i-=opacityStep) { if(i<=(opacEnd-opacityStep)) i = opacEnd; setTimeout("changeOpac(" + i + ",'" + containerID + "','" + index + "')",(timer * speed)); timer+=opacityStep; } } else if(opacStart < opacEnd) { for(var i = opacStart; i <= opacEnd; i+=opacityStep) { if(i>=(opacEnd-opacityStep)) i = opacEnd; setTimeout("changeOpac(" + i + ",'" + containerID + "','" + index + "')",(timer * speed)); timer+=opacityStep; // alert(i); } } } //change the opacity for different browsers function changeObjOpac(opacity, object) { if(opacity==0 && object.style.visibility=='visible') object.style.visibility='hidden'; else{ object.style.visibility='visible'; object.style.opacity = (opacity / 100); object.style.MozOpacity = (opacity / 100); object.style.KhtmlOpacity = (opacity / 100); object.style.filter = "alpha(opacity=" + opacity + ")"; } } function changeOpac(opacity, containerID, index) { var object = document.getElementById(containerID).childNodes[index]; changeObjOpac(opacity,object); } function showNextPart(containerID) { if(scrollStopped) return; var container = document.getElementById(containerID); if(container.getAttribute("direction")) if(container.getAttribute("direction")>0) { var sliders = container.childNodes; var frameLink = container.childNodes[container.childNodes.length-1]; var next =0 ; var current = container.getAttribute("curFrame")*1; var currentChild = sliders[current]; if(currentChild){ // if (current<2) next=current+1; //<-test line only if (current0){ container.childNodes[count].style.left=container.childNodes[count-1].offsetLeft+container.childNodes[count-1].offsetWidth; } else container.childNodes[count].style.left=0; } if(container.childNodes.length >0 && container.childNodes[container.childNodes.length-1].offsetLeft + container.childNodes[container.childNodes.length-1].offsetWidth>container.offsetWidth){ if (!document.addEventListener){ document.attachEvent("onmousedown",stopScroll); //MS only } else{ document.addEventListener ("mousedown",stopScroll,true);//FireFox...etc. } window.setTimeout("scrollLeft('" + container.id + "')",scrollDelay); } else { //Top if(container.previousSibling.previousSibling) container.previousSibling.previousSibling.style.width = container.childNodes[container.childNodes.length-1].offsetLeft + container.childNodes[container.childNodes.length-1].offsetWidth; //title container.previousSibling.style.width = container.childNodes[container.childNodes.length-1].offsetLeft + container.childNodes[container.childNodes.length-1].offsetWidth; //Controls container.nextSibling.style.display="none"; //Bottom container.nextSibling.nextSibling.style.width = container.childNodes[container.childNodes.length-1].offsetLeft + container.childNodes[container.childNodes.length-1].offsetWidth; container.style.width = container.childNodes[container.childNodes.length-1].offsetLeft + container.childNodes[container.childNodes.length-1].offsetWidth; } } function scrollLeft(containerId) { if(scrollStopped) return; var container = document.getElementById(containerId); if(container.getAttribute("direction")) if(container.getAttribute("direction")>0) { container.childNodes[0].style.left =container.childNodes[0].offsetLeft - (scrollStep*Math.abs(container.getAttribute("direction"))); for(var count=1;count container.offsetLeft + container.offsetWidth) break; } if(container.childNodes[0].offsetLeft + container.childNodes[0].offsetWidth < 0) { var firstChild=container.childNodes[0]; container.removeChild(firstChild); firstChild = container.appendChild(firstChild); } window.setTimeout("scrollLeft('" + container.id + "')",scrollDelay); return; } else { if(container.getAttribute("direction")) { if(container.getAttribute("direction")<0) { window.setTimeout("scrollRight('" + container.id + "')",scrollDelay); return; } } } window.setTimeout("scrollLeft('" + container.id + "')",scrollDelay); } function scrollRight(containerId) { if(scrollStopped) return; var container = document.getElementById(containerId); if(container.getAttribute("direction")) if(container.getAttribute("direction")<0) { container.childNodes[0].style.left =container.childNodes[0].offsetLeft + (scrollStep*Math.abs(container.getAttribute("direction"))); for(var count=1;count container.offsetLeft + container.offsetWidth) break; } var lastChild=container.childNodes[container.childNodes.length-1]; var firstChild=container.childNodes[0]; if(lastChild.offsetLeft>container.offsetLeft+container.offsetWidth) { lastChild.style.left = firstChild.offsetLeft-lastChild.offsetWidth; container.removeChild(lastChild); lastChild = container.insertBefore(lastChild,firstChild); } window.setTimeout("scrollRight('" + container.id + "')",scrollDelay); return; } else if(container.getAttribute("direction")) if(container.getAttribute("direction")>0) { window.setTimeout("scrollLeft('" + container.id + "')",scrollDelay); return; } window.setTimeout("scrollRight('" + container.id + "')",scrollDelay); } function printThis() { var printableUrl = document.location.href; if(printableUrl.indexOf("__view")>0)printableUrl=printableUrl.replace(/__view=[a-zA-Z_]*/g,"__view=printable"); else { if(printableUrl.indexOf("?")>0) printableUrl +="&__view=printable"; else printableUrl +="?__view=printable"; } window.open(printableUrl); } function scrollFwd(container) { container.setAttribute("direction",container.getAttribute("direction")-1); container.setAttribute("oldDirection",container.getAttribute("direction")); if(scrollStopped) { scrollStopped=false; scrollRight(container.id) } } function scrollBack(container) { container.setAttribute("direction",container.getAttribute("direction")+1); container.setAttribute("oldDirection",container.getAttribute("direction")); if(scrollStopped) { scrollStopped=false; scrollLeft(container.id) } } function pauseScroll(container) { if(container && container.getAttribute("direction")) { container.setAttribute("oldDirection",container.getAttribute("direction")); container.setAttribute("direction",0); } } function resumeScroll(container) { if(container && container.getAttribute("oldDirection")) { container.setAttribute("direction",container.getAttribute("oldDirection")); } } var importScrollEnabled; function startImportScroll() { importFrame.onfocus = stopImportScroll; importScrollEnabled=true; window.setTimeout(scrollImport,1000); } function stopImportScroll() { importScrollEnabled=false; } function tickAllBoxes(tickItem) { var inputs = document.getElementsByTagName("INPUT"); for(var a=0;a" + myProperty + "" + myObjectRef[myProperty] + "" } // Open a new browser window: var b=window.open("props.htm","c","") // Write HTML including a table into our new window, using our string for the table rows with properties: b.document.write("Object Properties ListProperties list for the object:

" + myString + "
") } function Array_pop() { var response = this[this.length - 1]; this.length--; return response; } function xBrowser() { //Array().pop support for IE5 if (typeof(Array.prototype.pop) == "undefined") { Array.prototype.pop = Array_pop } //Adds some usefull stuff to Mozilla et al //if(Node) Node.prototype.selectSingleNode = function(xpath) { var xpe = new XPathEvaluator(); return xpe.evaluate(xpath, this, xpe.createNSResolver(this), XPathResult.FIRST_ORDERED_NODE_TYPE, null); }; } function loadHandler() { xBrowser(); setTimeout(loadFlash,1); setTimeout(loadDelayedImages,1); TagTooga.Mp3.go(); renderFonts(); if(startupMessage.length>0) alert(startupMessage); if(startupActions.length>0) { do { var thisAction = startupActions.pop(); window.status="Running action (" + startupActions.length + ") : " + thisAction; eval(thisAction); } while (startupActions.length>0) } //if (itemsToScroll.length>0) //{ //for(var a=0;a"; } if(spans[i].currentStyle && spans[i].currentStyle.fontFamily && spans[i].currentStyle.fontFamily.match("Jenkins v2.0")) { var w = spans[i].offsetWidth * 0.9; var h = spans[i].offsetHeight * 1.2; var c = spans[i].currentStyle.color.replace("#",""); var bg = spans[i].currentStyle.backgroundColor.replace("#",""); var s = spans[i].currentStyle.fontSize.replace("px","") * 1.2; var text = escape(spans[i].innerHTML); spans[i].innerHTML=""; } } /* var headers = document.getElementsByTagName("H1"); for (var i=0; i"; } if(headers[i].currentStyle && spans[i].currentStyle.fontFamily && headers[i].currentStyle.fontFamily.match("Jenkins v2.0")) { var w = headers[i].offsetWidth ; var h = headers[i].offsetHeight * 1.2; var c = headers[i].currentStyle.color.replace("#",""); var bg = headers[i].currentStyle.backgroundColor.replace("#",""); var s = headers[i].currentStyle.fontSize.replace("px","") * 1.2; var text = escape(headers[i].innerHTML); headers[i].innerHTML=""; } } */ /* if(document.body.currentStyle){ var ff=document.body.currentStyle.fontFamily; }else{ var vw=document.defaultView; var cs=vw.getComputedStyle(document.body,''); var ff=cs.getPropertyValue('font-family'); } alert(ff); */ } function loadDelayedImages() { window.status="Loading Images"; var images = document.getElementsByTagName("IMG"); for (var i=0; i") // objectHTMLWriter.Write("") injectFlash(moviePlaceholders[i].getAttribute("flashsrc"), moviePlaceholders[i].getAttribute("width"), moviePlaceholders[i].getAttribute("height"), moviePlaceholders[i].getAttribute("bgcolor"), moviePlaceholders[i].getAttribute("flashvars"),moviePlaceholders[i]) } } window.status=""; } function writeFlash(name, width, height, bgcolor, flashvars) { flashvars = flashvars!=null ? flashvars : ''; var swf = ''; swf += ''; swf += ''; swf += ''; swf += ''; if(bgcolor!=null) { swf += ''; swf += ''; } else { swf += ''; } swf += ''; swf += ''; swf += ''; swf += ''; if(bgcolor!=null) { swf += ''; swf += ''; } else { swf += ''; } swf += '0)sBuild+=","; sBuild+=inputs[a].name; } else { if (container.getAttribute("includeNots")=="true") { if(sBuild.length>0)sBuild+=","; sBuild+= "!" + inputs[a].name; } } } } targetElement.value=sBuild; if (container.getAttribute("submitOnHide")=="true") { targetElement.form.submit(); event.cancelBubble=true; } } } function checkBasketForm(e,form) { if(window.opener) window.opener.name='_opener'; if (!e) var e = window.event; if(e) var tg = (e.currentTarget) ? e.currentTarget : e.srcElement if(!form) form=tg; if(form.getAttribute("noSubmit")=='true') { alert("Please choose a product from the list"); return false; } else { form.submit(); return false; } } function chooseVariety(selectObj,thisUniqueForm) { if(selectObj.value.length>0) { selectObj.form.Qty.disabled=false; selectObj.form.Qty.value="1"; //selectObj.form.submit.disabled=false; var allowCheckout=false; if(selectObj.tagName=='SELECT') { if(selectObj.options[selectObj.selectedIndex].getAttribute("checkout")!="False") allowCheckout =true; selectObj.form.UnitCost.value = selectObj.options[selectObj.selectedIndex].getAttribute("cost"); selectObj.form.price.value = selectObj.options[selectObj.selectedIndex].getAttribute("display_cost"); //selectObj.form.Qty.value = selectObj.options[selectObj.selectedIndex].getAttribute("qty"); document.getElementById("pricecell_" + thisUniqueForm).innerHTML = selectObj.options[selectObj.selectedIndex].getAttribute("display_cost"); document.getElementById("stockcell_" + thisUniqueForm).innerHTML = selectObj.options[selectObj.selectedIndex].getAttribute("stock"); selectObj.form.ProductCode.value = selectObj.options[selectObj.selectedIndex].getAttribute("code"); selectObj.form.Description.value = selectObj.form.Description.getAttribute("baseDescription") + " - " + selectObj.options[selectObj.selectedIndex].value; } else { if(selectObj.getAttribute("checkout")!="False") allowCheckout =true; selectObj.form.UnitCost.value = selectObj.getAttribute("cost"); selectObj.form.price.value = selectObj.getAttribute("display_cost"); //selectObj.form.Qty.value = selectObj.getAttribute("qty"); document.getElementById("pricecell_" + thisUniqueForm).innerHTML = selectObj.getAttribute("display_cost"); document.getElementById("stockcell_" + thisUniqueForm).innerHTML = selectObj.getAttribute("stock"); selectObj.form.ProductCode.value = selectObj.getAttribute("code"); selectObj.form.Description.value = selectObj.form.Description.getAttribute("baseDescription") + " - " + selectObj.value; } if(allowCheckout) { document.getElementById("basketrow_" + thisUniqueForm).style.visibility="visible"; selectObj.form.setAttribute("noSubmit","false"); } else { selectObj.form.Qty.disabled=true; selectObj.form.Qty.value="0"; // selectObj.form.submit.disabled=true; selectObj.form.UnitCost.value = 0; document.getElementById("pricecell_" + thisUniqueForm).innerHTML = "Choose another option"; document.getElementById("basketrow_" + thisUniqueForm).style.visibility="hidden"; selectObj.form.price.value = "-"; selectObj.form.setAttribute("noSubmit","true"); } } else { selectObj.form.Qty.disabled=true; selectObj.form.Qty.value="0"; // selectObj.form.submit.disabled=true; selectObj.form.UnitCost.value = 0; document.getElementById("pricecell_" + thisUniqueForm).innerHTML = "Choose another option"; document.getElementById("basketrow_" + thisUniqueForm).style.visibility="hidden"; selectObj.form.price.value = "-"; selectObj.form.setAttribute("noSubmit","true"); } } function deleteProduct(Del) { Del.previousSibling.previousSibling.value = 0; qtyChanged(Del.previousSibling.previousSibling); Del.parentNode.parentNode.style.display='none'; if(HasClassName(Del.parentNode.parentNode.nextSibling, "form")) { Del.parentNode.parentNode.nextSibling.style.display='none'; } } function updateShipping(button) { document.getElementById("shipping_amount").innerHTML = button.getAttribute("tariff"); button.form.submit(); /* window.status="works till here"; if (button.getAttribute("taxes").length>0) { var taxes = button.getAttribute("taxes").split(";"); // alert(taxes.length); if (taxes.length==1) { document.getElementById("order_tax").innerHTML=taxes[0]; document.getElementById("taxrow").style.display=''; } else { for (a=0;a0) { document.getElementById("order_tax")[a].innerHTML=taxes[a]; document.getElementById("taxrow")[a].style.display=''; } } } } */ // if(document.getElementById("order_grandtotal")) document.getElementById("order_grandtotal").innerHTML=button.getAttribute("total"); // if(document.getElementById("grandtotalrow")) document.getElementById("grandtotalrow").style.display=''; // if(document.getElementById("nextbutton")) document.getElementById("nextbutton").style.display=''; } function qtyChanged(input) { var taxRow = document.getElementById("taxrow"); /*if (!taxRows) { } else if (taxRows.length>1) { for (var a=0;a0) { retVal += "." if(DecPart==0) { for(a=0;a1) { //Landscape //width = 80% of screen width //calculate height var iw = sw * maxSize; var ih = iw / m; } else if(m<1) { //Portrait //height = 80% of screen hieght //calculate width var ih = sh * maxSize; var iw = ih * m; } else { //square //height = 80% of screen hieght //calculate width var ih = sh * maxSize; var iw = ih * m; } } ih = Math.round(ih); iw = Math.round(iw); if (fileName.substr(0,1)=="/") var path=""; else { if(user && user.length>0) var path=pageBase + "{images}/"; else var path=pageBase + "images/"; } var imagePath,imagePathBase; if(user) imagePathBase = path + fileName + "?user="+user; else imagePathBase=path + fileName + "?"; imagePath = imagePathBase + "&width=" + iw + "&height=" + ih; var winFrame=10; var winExtraY = 49; var winExtraX = 9; win= window.open("","viewPicture","menubar=no, toolbar=no, location=no,scrollbars=yes, status=yes, resizable=no, width=" + (iw+winExtraX) + ", height=" + (ih+winExtraY) + ""); win.document.write("\n\n"+fileName + "\n"); win.document.write("\n"); win.document.write("\n"); win.document.write("
"); win.document.write(""); win.document.write("\n"); win.document.close(); win.focus(); } function housePicture(fileName,m) { viewPicture(false,fileName,m); } function houseJigsaw(fileName) { virtualJigsaw(false,fileName); } function virtualJigsaw(user, fileName) { if (fileName.substr(0,1)=="/") var path=""; else { if(user) var path=pageBase + "{images}/"; else var path=pageBase + "images/"; } var imagePath,imagePathBase; if(user) imagePathBase = path + escape(fileName) + "?user="+user; else imagePathBase=path + escape(fileName) + "?"; win = window.open("",'javaJigsaw','menubar=no,toolbar=no,location=no,status=no,resizable=no,width=800,height=600'); win.document.write("Please wait for jigsaw to be created, use right mouse button to rotate pieces.\n"); win.document.write("\n"); win.document.write("\n"); win.document.write(" \n"); win.document.write(" \n"); win.document.write(" \n"); win.document.write(" \n"); win.document.write(" \n"); win.document.write(" Click here to install Sun Java - it must be Installed and Enabled for this game to function.\n"); win.document.write(" \n"); win.document.write("\n"); win.document.write("\n"); } /* function checkForm(form) { if (form.valid=='false') { alert("Please correct the following errors:\n\n" + form.Reasons); return false; } } */ function setDisablednessOnFormElements(container,value) { if(container.nodeType==1) { if(container.style) { if(value) { container.style.display='none'; } else { container.style.display=''; } } switch(container.tagName) { case 'INPUT' : case 'TEXTAREA' : case 'SELECT' : if(container.valid='true') container.valid='false'; container.disabled=value; break; default : for (var a =0;a=document.body.offsetHeight) menuID.style.top=document.body.offsetHeight-+menuID.offsetHeight; else menuID.style.top=pos.y+pos.h; menuID.setAttribute("uid", imgObj.getAttribute("uid")); menuID.setAttribute("page", imgObj.getAttribute("page")); e.cancelBubble=true; menuID.style.visibility="visible"; return false; } } } function doOption(e,container) { if (!e) var e = window.event; var tg = (e.originalTarget) ? e.originalTarget : e.srcElement if (tg.nodeType==3)tg=tg.parentNode; var now = new Date(); var command=tg.getAttribute("command"); if (command) { var uid = container.getAttribute("uid"); var page = container.getAttribute("page"); switch(command) { case "Refresh" : var page = container.getAttribute("page"); callWebService("","","",page) break; case "EditArt" : openArticle(uid,page); break; case "EditMenu" : openMenu(uid,page); break; default : if (tg.getAttribute("confirm")) { if (!confirm(tg.getAttribute("confirm"))) { return false; } } var userResponse=""; if(tg.getAttribute("prompt")) { userResponse = prompt(tg.getAttribute("confirm"),tg.getAttribute("defaultvalue")); if(userResponse) callWebService(command,uid,userResponse,page); } else { callWebService(command,uid,userResponse,page); } } } } function hideMenu() { if(pageMenus.length>0) { do { var menuID = pageMenus.pop(); menuID.style.display="none"; } while (pageMenus.length>0) } } var barSize=10; function getXYHW(obj,stopObj,pos, depth) { if(depth==0 ) { var stoppos = new Object; stopObj.setAttribute("stopHere",true) stoppos.x=stopObj.offsetLeft; stoppos.y=stopObj.offsetTop; stoppos.h=stopObj.offsetHeight; stoppos.w=stopObj.offsetWidth; //var stoppos = getXYHW(stopObj,document.body,stoppos, -1); } if(pos) { if(obj.offsetTop>0) { // debugExtra += "(" + obj.offsetTop + " " + obj.scrollTop + " " + obj.nodeName + ")"; } pos.x += obj.offsetLeft - obj.scrollLeft; pos.y += obj.offsetTop - obj.scrollTop; if(obj.getAttribute("stopHere")) { //Wierd hack- Mozilla seems to not get here as the offset parent is different than in IE..... So for Moz its set first, ie just takes off the double dose at the top... //debugExtra += pos.y + " " + stopObj.scrollTop + " -- "; pos.y += stopObj.scrollTop; pos.x += stopObj.scrollLeft; } } else { var pos = new Object; pos.x = obj.offsetLeft - obj.scrollLeft;// - stopObj.scrollLeft; pos.y = obj.offsetTop - obj.scrollTop;// - stopObj.scrollTop; pos.w=obj.offsetWidth; pos.h=obj.offsetHeight; } if(obj.offsetParent) { if(depth==-1) pos=getXYHW(obj.offsetParent,stopObj,pos,1); else pos=getXYHW(obj.offsetParent,stopObj,pos,depth+1); } if(depth==0) { //debugExtra+="ex" +stoppos.y; if(pos.ystoppos.y+stoppos.h) pos.h = stoppos.y+stoppos.h-pos.y-barSize; if(pos.x+pos.w>stoppos.x+stoppos.w) pos.w = stoppos.x+stoppos.w-pos.x-barSize; stopObj.setAttribute("stopHere",false) } return pos; } // Change these two lines to modify your PLAY and STOP buttons. var mp3PlayButton = "/builtin_resources/sound_symbol.gif"; var mp3StopButton = "/builtin_resources/stop.gif"; // Change these two lines to modify the "playing..." font and size. var mp3PlayingFont = "Verdana"; var mp3PlayingSize = "8pt"; //var mp3PlayButton = "http://www.jpgsvr.com/mp3/play.png"; //var mp3StopButton = "http://www.jpgsvr.com/mp3/pause.png"; if(typeof(TagTooga) == 'undefined') TagTooga = {} TagTooga.Mp3 = { playimg: null, player: null, go: function() { var all = document.getElementsByTagName('a'); for (var i = 0, o; o = all[i]; i++) { if(o.href.match(/\.mp3$/i)) { var img = document.createElement('img'); img.src = mp3PlayButton; img.title = 'listen'; //img.height = img.width = 12; img.style.marginRight = '0.5em'; img.style.cursor = 'pointer'; img.onclick = TagTooga.Mp3.makeToggle(img, o.href); o.parentNode.insertBefore(img, o); o.style.display='none'; } } }, toggle: function(img, url) { if (TagTooga.Mp3.playimg == img) TagTooga.Mp3.destroy(); else { if (TagTooga.Mp3.playimg) TagTooga.Mp3.destroy(); var a = img.nextSibling; img.src = mp3StopButton; TagTooga.Mp3.playimg = img; TagTooga.Mp3.player = document.createElement('span'); var mp3player = 'playMp3.swf'; //mp3player.swf var theseflashVars ='theLink='+url+'?&time=' + new Date() ; // 'file='+url+'&autostart=true'; TagTooga.Mp3.player.innerHTML = '' + '' + '' + '' + '' + ''; img.parentNode.insertBefore(TagTooga.Mp3.player, img.nextSibling); } }, destroy: function() { TagTooga.Mp3.playimg.src = mp3PlayButton; TagTooga.Mp3.playimg = null; //TagTooga.Mp3.player.removeChild(TagTooga.Mp3.player.firstChild); TagTooga.Mp3.player.removeChild(TagTooga.Mp3.player.firstChild); TagTooga.Mp3.player.parentNode.removeChild(TagTooga.Mp3.player); TagTooga.Mp3.player = null; }, makeToggle: function(img, url) { return function() { TagTooga.Mp3.toggle(img, url); } } } ///Class manipulation functions from http://snippets.dzone.com/posts/show/2630 // ---------------------------------------------------------------------------- // HasClassName // // Description : returns boolean indicating whether the object has the class name // built with the understanding that there may be multiple classes // // Arguments: // objElement - element to manipulate // strClass - class name to add // function HasClassName(objElement, strClass) { // if there is a class if ( objElement.className ) { // the classes are just a space separated list, so first get the list var arrList = objElement.className.split(' '); // get uppercase class for comparison purposes var strClassUpper = strClass.toUpperCase(); // find all instances and remove them for ( var i = 0; i < arrList.length; i++ ) { // if class found if ( arrList[i].toUpperCase() == strClassUpper ) { // we found it return true; } } } // if we got here then the class name is not there return false; } // // HasClassName // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // AddClassName // // Description : adds a class to the class attribute of a DOM element // built with the understanding that there may be multiple classes // // Arguments: // objElement - element to manipulate // strClass - class name to add // function AddClassName(objElement, strClass, blnMayAlreadyExist) { // if there is a class if ( objElement.className ) { // the classes are just a space separated list, so first get the list var arrList = objElement.className.split(' '); // if the new class name may already exist in list if ( blnMayAlreadyExist ) { // get uppercase class for comparison purposes var strClassUpper = strClass.toUpperCase(); // find all instances and remove them for ( var i = 0; i < arrList.length; i++ ) { // if class found if ( arrList[i].toUpperCase() == strClassUpper ) { // remove array item arrList.splice(i, 1); // decrement loop counter as we have adjusted the array's contents i--; } } } // add the new class to end of list arrList[arrList.length] = strClass; // add the new class to beginning of list //arrList.splice(0, 0, strClass); // assign modified class name attribute objElement.className = arrList.join(' '); } // if there was no class else { // assign modified class name attribute objElement.className = strClass; } } // // AddClassName // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // RemoveClassName // // Description : removes a class from the class attribute of a DOM element // built with the understanding that there may be multiple classes // // Arguments: // objElement - element to manipulate // strClass - class name to remove // function RemoveClassName(objElement, strClass) { // if there is a class if ( objElement.className ) { // the classes are just a space separated list, so first get the list var arrList = objElement.className.split(' '); // get uppercase class for comparison purposes var strClassUpper = strClass.toUpperCase(); // find all instances and remove them for ( var i = 0; i < arrList.length; i++ ) { // if class found if ( arrList[i].toUpperCase() == strClassUpper ) { // remove array item arrList.splice(i, 1); // decrement loop counter as we have adjusted the array's contents i--; } } // assign modified class name attribute objElement.className = arrList.join(' '); } // if there was no class // there is nothing to remove } // // RemoveClassName // ----------------------------------------------------------------------------