Search Results

Search found 41 results on 2 pages for 'offsetwidth'.

Page 1/2 | 1 2  | Next Page >

  • IE performance issues with offsetHeight and offsetWidth

    - by Paul
    I have a site that grabs the response text from an AJAX call and does 'innerHTML' on a div that is going to contain it. After I do the 'innerHTML' I process the DIV by traversing the whole hierarchy of nodes and grabbing their [offsetWidth/offsetHeight] to do some operations with it. Why not css style width/height? because sometimes those values are not available since I don't control what is coming from the AJAX response, plus I want the real box dimensions including borders/scrolls/padding. On large injections (let's say 7,000 new DOM elements) IE takes way longer time than FF/Safari just to get this [offsetWidth/offsetHeight], actually if I wasn't doing injection but just render the contents of the HTML in the browser and processing it, it would be much faster. But that is not an option since I have to inject it on a div that will contain it. Anybody has deal with this kind of issue before? is there an alternative to innerHTML, I have try using documentFragment to inject and process and the move it to the div and still I don't see much gain. How can I get the values that are available with [offsetWidth/offsetHeight]? Thanks a bunch for any suggestions. Paul

    Read the article

  • offsetWidth or CSS expression problem for IE6

    - by Bipul
    I need to set the width of textboxes as 80% of it's parent. So first I used td input[type="text"] { width: 80%; } But it was not rendering properly if the input is the child of td. So, I used Css expressions td input[type="text"] { width: expression(this.parentNode.offsetWidth*0.8); } It is working as I wanted in every browser except IE 6. Can anybody help me, where I am going wrong? I know that expressions are allowed in IE 6. So, is it the problem of using css expression or something to do offsetWidth. Thanks in advance.

    Read the article

  • Dynamic width of DIV (offsetWidth issue).

    - by Tom
    Hi all, I face issue with retrieving (via javascript) width of the div which content is changed (just before reading the widht via offsetWidth) in dynamic way (via changing innerHTML or using createTextNode). Here is some sample code: var con = document.getElementById('avContent'); //content div within page var temp = document.createElement('div');<br /> var text1 = document.createTextNode('CCCCC');<br /> temp.appendChild(text1);<br /> con.appendChild(temp);<br /> var length1 = temp.offsetWidth;<br /> var text2 = document.createTextNode('CCCCC33333333vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv');<br /> temp.removeChild(text1);<br /> temp.appendChild(text2);<br /> con.removeChild(temp);<br /> con.appendChild(temp); var length2 = temp.offsetWidth;<br /> The length1 and length2 do have the same width.. (the same result I get while using innerHTML instead of createTextNode). Looks like it's the same issue like described in following discussion: http://www.webdeveloper.com/forum/showthread.php?t=187716 Does anybody have answer (work around)? Thanks much for help in advance.

    Read the article

  • "'0.offsetWidth' is null or not an object" - Coda Slider - Javascript Error Question

    - by bgadoci
    I implemented the Coda Slider tutorial successfully that is located here: http://jqueryfordesigners.com/coda-slider-effect/ The slider works great but I am getting a javascript error that I am not sure how to fix. The error says: '0.offsetWidth' is null or not an object coda-slider.js, line 19 character 3 Not sure how to fix it. Anyone have any ideas? Here is my js and css (don't think I need to upload the HTML but let me know if that helps). JS (coda-slider.js) // when the DOM is ready... $(document).ready(function () { var $panels = $('#slider .scrollContainer > div'); var $container = $('#slider .scrollContainer'); // if false, we'll float all the panels left and fix the width // of the container var horizontal = true; // float the panels left if we're going horizontal if (horizontal) { $panels.css({ 'float' : 'left', 'position' : 'relative' // IE fix to ensure overflow is hidden }); // calculate a new width for the container (so it holds all panels) $container.css('width', $panels[0].offsetWidth * $panels.length); <------line 19 } // collect the scroll object, at the same time apply the hidden overflow // to remove the default scrollbars that will appear var $scroll = $('#slider .scroll').css('overflow', 'hidden'); // apply our left + right buttons $scroll .before('<img class="scrollButtons left" src="/images/layout/navigation/scroll_left.png" />') .after('<img class="scrollButtons right" src="/images/layout/navigation/scroll_right.png" />'); // handle nav selection function selectNav() { $(this) .parents('ul:first') .find('a') .removeClass('selected') .end() .end() .addClass('selected'); } $('#slider .navigation').find('a').click(selectNav); // go find the navigation link that has this target and select the nav function trigger(data) { var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0); selectNav.call(el); } if (window.location.hash) { trigger({ id : window.location.hash.substr(1) }); } else { $('ul.navigation a:first').click(); } // offset is used to move to *exactly* the right place, since I'm using // padding on my example, I need to subtract the amount of padding to // the offset. Try removing this to get a good idea of the effect var offset = parseInt((horizontal ? $container.css('paddingTop') : $container.css('paddingLeft')) || 0) * -1; var scrollOptions = { target: $scroll, // the element that has the overflow // can be a selector which will be relative to the target items: $panels, navigation: '.navigation a', // selectors are NOT relative to document, i.e. make sure they're unique prev: 'img.left', next: 'img.right', // allow the scroll effect to run both directions axis: 'xy', onAfter: trigger, // our final callback offset: offset, // duration of the sliding effect duration: 500, // easing - can be used with the easing plugin: // http://gsgd.co.uk/sandbox/jquery/easing/ easing: 'swing' }; // apply serialScroll to the slider - we chose this plugin because it // supports// the indexed next and previous scroll along with hooking // in to our navigation. $('#slider').serialScroll(scrollOptions); // now apply localScroll to hook any other arbitrary links to trigger // the effect $.localScroll(scrollOptions); // finally, if the URL has a hash, move the slider in to position, // setting the duration to 1 because I don't want it to scroll in the // very first page load. We don't always need this, but it ensures // the positioning is absolutely spot on when the pages loads. scrollOptions.duration = 1; $.localScroll.hash(scrollOptions); }); CSS #slider { margin-left: 35px; position: relative; width: 875px; } .scroll { position: relative; width: 875px; height: 268px; overflow: auto; /* fix for IE to respect overflow */ background: #FFFFFF scroll 0; } .scrollContainer div.panel { position: relative; height: 210px; width: 875px; /* change to 560px if not using JS to remove rh.scroll */ } .scrollButtons { position: absolute; top: 115px; cursor: pointer; } .scrollButtons.left { left: -20px; } .scrollButtons.right { right: -20px; }

    Read the article

  • how do I make my submenu position dynamic based on the distance to the edge of the window?

    - by Mario Antoci
    I'm trying to write a jQuery script that will find the distance to the right edge of the browser window from my css class element and then position the child submenu dropdowns to the right or left depending on the available space to the right. Also it needs to revert to the default settings on hoverout. Here is what I have so far but it's not calculating properly. $(document).ready(function(){ $('#dnnMenu .subLevel').hover(function(){ if ($(window).width() - $('#dnnMenu .subLevel').offset().left - '540' >= '270') { $('#dnnMenu .subLevelRight').css('left', '270px');} else {$('#dnnMenu .subLevelRight').css('left', '-270px');} }); $(document).ready(function () { function HoverOver() { $(this).addClass('hover'); } function HoverOut() { $(this).removeClass('hover'); } var config = { sensitivity: 2, interval: 100, over: HoverOver, timeout: 100, out: HoverOut }; $("#dnnMenu .topLevel > li.haschild").hoverIntent(config); $(".subLevel li.haschild").hover(HoverOver, HoverOut); }); Basically I tried to take the width of the current window, minus the distance to the left edge of the browser of the first level submenu, minus the width of both elements together which would equal 540px, to calculate the distance to the right edge of the window when the first level submenu is hovered over. if the distance to the right of my first level submenu element is less than 540px then the second level sub menu css property is changed to position to the left instead of right. I also know that it needs to revert back to default after hover out so it can recalculate the distance from other positions within the menu structure and still have those second level submenus with enough room to still display on the right of the first level. here is css for the elements in question. #dnnMenu .subLevel{ display: none; position: absolute; margin: 0; z-index: 1210; background: #639ec8; text-transform: none;} #dnnMenu .subLevelRight{ position: absolute; display: none; left: 270px; top: 0px;} The site's not live yet and I tried to create a jsfiddle but it doesn't look right. Any help would be greatly appreciated! Best Regards, Mario

    Read the article

  • JavaScript window resize

    - by Happy
    I have piece of javascript code, which should process when the browser window is resized. var resize=$('div.resize',$(this).parent())[0]; resize.style.marginRight=(resize.offsetWidth-$(this)[0].offsetWidth)+'px' Tryed this stuff (doesn't work): var resize=$('div.resize',$(this).parent())[0]; window.onresize = function(event) { resize.style.marginRight=(resize.offsetWidth-$(this)[0].offsetWidth)+'px' } Thanks.

    Read the article

  • jQuery window resize

    - by Happy
    I have piece of javascript code, which should process when the browser window is resized. resize.style.marginRight=(resize.offsetWidth-$(this)[0].offsetWidth)+'px' Tryed this stuff (doesn't work): window.onresize = function(event) { resize.style.marginRight=(resize.offsetWidth-$(this)[0].offsetWidth)+'px' } Full code available - http://jsbin.com/adelu3/2/ (see page source) Thanks.

    Read the article

  • Need to calculate offsetRight in javascript

    - by Dan Bailiff
    I need to calculate the offsetRight of a DOM object. I already have some rather simple code for getting the offsetLeft, but there is no javascript offsetRight property. If I add the offsetLeft and offsetWidth, will that work? Or is there a better way? function getOffsetLeft(obj) { if(obj == null) return 0; var offsetLeft = 0; var tmp = obj; while(tmp != null) { offsetLeft += tmp.offsetLeft; tmp = tmp.offsetParent; } return offsetLeft; } function getOffsetRight(obj) { if (obj == null) return 0; var offsetRight = 0; var tmp = obj; while (tmp != null) { offsetRight += tmp.offsetLeft + tmp.offsetWidth; tmp = tmp.offsetParent; } return offsetRight; }

    Read the article

  • Right Click Context Menu Script for iFrame

    - by Ramiz Uddin
    The context of the problem is related to an application which is based on single-page Ajax application which consists of three different panels (iframes). The layout of the page is as follows: _________________________________________________ | | | Frame A | FRAME C |__________________| | | | Frame B | | | | | | | | | | | | | | | The problem is with the context menu (right-click menu) in Frame C. The position of the context menu is not perfectly positioned with the mouse click. Particularly, if you drag and increase the size of the Frame C window. Code snippet: var rightedge = parent.frames["FrameC"].frameElement.clientWidth-event.clientX; var bottomedge = parent.frames["FrameC"].frameElement.clientHeight-event.clientY; if (rightedge < document.getElementById('Menu').offsetWidth) menuCoorX = parent.frames["FrameC"].frameElement.scrollLeft + event.clientX - document.getElementById('Menu').offsetWidth; else menuCoorX = parent.frames["FrameC"].frameElement.scrollLeft + event.clientX; if (bottomedge < document.getElementById('Menu').offsetHeight) menuCoorY = parent.frames["FrameC"].frameElement.scrollTop + event.clientY - document.getElementById('Menu').offsetHeight; else menuCoorY = parent.frames["FrameC"].frameElement.scrollTop + event.clientY; Currently, we need it to work only for IE (7 and 8). Please, help! Thanks.

    Read the article

  • Auto-resize custom horizontal scrollbar/slider?

    I'm working on a site that scrolls horizontally. I know very little about jQuery and prototype and I got this slider script working as the page scrollbar. When the window is resized smaller, the custom horizontal slider/scrollbar won't resize to the viewport's width. I have the page and js files here http://keanetix.co.cc/scrollpage/ Try to resize the browser and you'll notice the custom scrollbar extending to the right. The custom scrollbar wont fit on the viewport, unless you refresh the page when it's been resized. Can somebody help me with this? Thanks. This is the code in the HTML page: <script type="text/javascript" language="javascript"> // <![CDATA[ // horizontal slider control var slider2 = new Control.Slider('handle', 'track', { onSlide: function(v) { scrollHorizontal(v, $('scrollable'), slider2); }, onChange: function(v) { scrollHorizontal(v, $('scrollable'), slider2); } }); // scroll the element horizontally based on its width and the slider maximum value function scrollHorizontal(value, element, slider) { element.scrollLeft = Math.round(value/slider.maximum*(element.scrollWidth-element.offsetWidth)); } // disable horizontal scrolling if text doesn't overflow the div if ($('scrollable').scrollWidth <= $('scrollable').offsetWidth) { slider2.setDisabled(); $('track').hide(); } // ]]> </script>

    Read the article

  • cant calculate width of elements

    - by Kein
    I try to get width of dom objects: function resizeArea(){ var width = 0; area.children().each(function(i){ alert(this.offsetWidth); width += this.offsetWidth; }); area.css('width', width); } In get results: Chrome: 800 Opera: 708 FF: 783 IE: 714 But if see it in firebug, dragonfly and other debuggers i see correct 908px. I don't know where porblem. I run this fun after domloaded. Here is HTML and css of block: <div class="scroll_area" id="scroll"> <div class="area" id="area"> <div class="category"> [..] </div> </div> </div> <style> #scroll { position:realtive; width: 800px, heght: 400px; } #area { position:absolute; left: 0; top: 0; } #area .category, #area .category .text, #area .category .image{ width: 200px } </style> And that interesting. This function later work correctly, only at first run, for first calculating.

    Read the article

  • Re-Centering JQuery Tooltips when resizing the window

    - by leeand00
    I have written a function that positions a tooltip just above a textbox. The function takes two arguments: textBoxId - The ID of the textbox above which the tooltip will appear. Example: "#textBoxA" toolTipId - The ID of the tooltip which will appear above the textbox. Example: "#toolTipA" function positionTooltip(textBoxId, toolTipId){ var hoverElementOffsetLeft = $(textBoxId).offset().left; var hoverElementOffsetWidth = $(textBoxId)[0].offsetWidth; var toolTipElementOffsetLeft = $(toolTipId).offset().left; var toolTipElementOffsetWidth = $(toolTipId)[0].offsetWidth; // calcluate the x coordinate of the center of the hover element. var hoverElementCenterX = hoverElementOffsetLeft + (hoverElementOffsetWidth / 2); // calculate half the width of the toolTipElement var toolTipElementHalfWidth = toolTipElementOffsetWidth / 2; var toolTipElementLeft = hoverElementCenterX - toolTipElementHalfWidth; $(toolTipId)[0].style.left = toolTipElementLeft + "px"; var toolTipElementHeight = $(toolTipId)[0].offsetHeight; var hoverElementOffsetTop = $(textBoxId).offset().top; var toolTipYCoord = hoverElementOffsetTop - toolTipElementHeight; toolTipYCoord = toolTipYCoord - 10; $(toolTipId)[0].style.top = toolTipYCoord + "px"; $(toolTipId).hide(); $(textBoxId).hover( function(){ $(toolTipId + ':hidden').fadeIn(); }, function(){ $(toolTipId + ':visible').fadeOut(); } ); $(textBoxId).focus ( function(){ $(toolTipId + ':hidden').fadeIn(); } ); $(textBoxId).blur ( function(){ $(toolTipId+ ':visible').fadeOut(); } ); } The function works fine upon initial page load: However, after the user resizes the window the tooltips move to locations that no longer display above their associated textbox. I've tried writing some code to fix the problem by calling the positionTooltip() function when the window is resized but for some reason the tooltips do not get repositioned as they did when the page loaded: var _resize_timer = null; $(window).resize(function() { if (_resize_timer) {clearTimeout(_resize_timer);} _resize_timer = setTimeout(function(){ positionTooltip('#textBoxA', ('#toolTipA')); }, 1000); }); I'm really at a loss here as to why it doesn't reposition the tooltip correctly as it did when the page was initially loaded after a resize.

    Read the article

  • Determining when scrolled to bottom of a page with Javascript

    - by chimerical
    I'm trying to determine when I've scrolled to the bottom of the page (without using any JS library), but so far, I'm a bit confused over which one of the following to use. The most promising one I've seen is window.scrollY, but even when scrolled to the bottom of the page, it never matches the value of window.innerHeight. What's the best way to do this? window.innerWidth window.innerHeight window.outerWidth window.outerHeight window.scrollX window.scrollY document.body.scrollWidth document.body.scrollHeight document.body.scrollTop document.body.scrollLeft document.body.offsetTop document.body.offsetLeft document.body.offsetWidth document.body.offsetHeight

    Read the article

  • Get content in iframe to use as much space as it needs

    - by Mark
    I'm trying to write a simple JavaScript based modal dialog. The JavaScript function takes the content, puts it in a new iframe and adds the iframe to the page. Works great so far, the only problem is that the content of the dialog (e.g. a table) gets wrapped, although plenty of space is available on the page. I'd like the content of the dialog, a table in my case, to use as much space as it needs, without wrapping any lines. I tried lots of combinations of setting width/style.width on the iframe and the table. Nothing did the trick. Here the code to show the iframe dialog: function SimpleDialog() { this.domElement = document.createElement('iframe'); this.domElement.setAttribute('style', 'border: 1px solid red; z-index: 201; position: absolute; top: 0px; left: 0px;'); this.showWithContent = function(content) { document.getElementsByTagName('body')[0].appendChild(this.domElement); this.domElement.contentDocument.body.appendChild(content); var contentBody = this.domElement.contentDocument.body; contentBody.style.padding = '0px'; contentBody.style.margin = '0px'; // Set the iframe size to the size of content. // However, content got wrapped already. this.domElement.style.height = content.offsetHeight + 'px'; this.domElement.style.width = content.offsetWidth + 'px'; this._centerOnScreen(); }; this._centerOnScreen = function() { this.domElement.style.left = window.pageXOffset + (window.innerWidth / 2) - (this.domElement.offsetWidth / 2) + 'px'; this.domElement.style.top = window.pageYOffset + (window.innerHeight / 2) - (this.domElement.offsetHeight / 2) + 'px'; }; } Here the test code: var table = document.createElement('table'); table.setAttribute('style', 'border: 1px solid black; width: 100%;'); table.innerHTML = "<tr><td style='font-size:40px;'>Hello world in big letters</td></tr><tr><td>second row</td></tr>"; var dialog = new SimpleDialog(); dialog.showWithContent(table); The table shows up nicely centered on the page, but the words in the first cell are wrapped to two lines. How do I get the table to use as much space as it needs (without using white-space: nowrap ;) Thanks in advance for any suggestions! -Mark

    Read the article

  • Need help with tweaking a Dropdown with three options, user selects one - a hidden div appears with correct fields

    - by Jack
    Hello Again, I posted a question on here and got an answer within minutes I'm hoping the wizards on here can help me again. Okay so I'm using a script I found online to try and add this function to a shopping cart form. Here's the setup. I have a payment method dropdown with Visa, Mastercard and Bank Withdrawal as the options. For the credit cards I have one hidden div with a certain set of fields, and for the bank I have another hidden div. Each of the divs have named ID's - #payCredit and #payBank The css for both have margin: 0px and display: none; Here's a peice of javascript I used successfuly on a shipping address checkbox `function toggleLayer( whichLayer ) { var elem, vis; if( document.getElementById ) // this is the way the standards work elem = document.getElementById( whichLayer ); else if( document.all ) // this is the way old msie versions work elem = document.all[whichLayer]; else if( document.layers ) // this is the way nn4 works elem = document.layers[whichLayer]; vis = elem.style; // if the style.display value is blank we try to figure it out here if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined) vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; vis.display = (vis.display==''||vis.display=='block')?'none':'block'; }` I was hoping I could change it slightly to meet my needs. Here's the dropdown <label>Payment Method:</label> <select name="payment" id="payment" class="dropdown3" style="width:8em"> <option selected="selected">Select</option> <option value="Visa" onclick="javascript:toggleLayer('payCredit');">Visa</option> <option value="MasterCard" onclick="javascript:toggleLayer('payCredit');">Mastercard</option> <option value="Direct" onclick="javascript:toggleLayer('payBank');">Direct Withdraw</option> </select></li> The current result is that it kinda works. I can open the dropdown and select Visa and it appears, if I select Visa again it disappears, if I select Visa and then select bank, both appear. You can see what i'm working on here - http://test.sharevetcare.com/bestfriends/cart3.html

    Read the article

  • find Image correct width and height

    - by Jeny
    now i get the image's width and height when onload function of img . my problem is, the image original width = 500px but document.getElementId(id).offsetWidth gives only 300px and also for height. Please help me how can i get original width and height of image

    Read the article

  • problem with sIFR 3 not displaying in IE just getting XXX

    - by user288306
    I am having a problem with sIFR 3 not displaying in IE. I get 3 larges black XXX in IE yet it displays fine in Firefox. I have checked i do have the most recent version of flash installed correctly. Here is the code on the page <div id="features"> <div id="mainmessage_advertisers"><h2>Advertisers</h2><br /><br /><h3><a href="">Reach your customers where they browse. Buy directly from top web publishers.</a></h3><br /><br /><br /><a href=""><img src="img/buyads.gif" border="0"></a></div> <div id="mainmessage_publishers"><h2>Publishers</h2><br /><br /><h3>Take control of your ad space and start generating more revenue than <u>ever before</u>.</h3><br /><br /><br /><a href=""><img src="img/sellads.gif" border="0"></a></div> </div>` Here is the code from my global.css #mainmessage_advertisers { width: 395px; height: 200px; padding: 90px 50px; border: 1px; float: left; } #mainmessage_publishers { width: 395px; height: 200px; padding: 90px 50px; float: right; } and here is what i have in my sifr.js /*********************************************************************** SIFR 3.0 (BETA 1) FUNCTIONS ************************************************************************/ var parseSelector=(function(){var _1=/\s*,\s*/;var _2=/\s*([\s>+~(),]|^|$)\s*/g;var _3=/([\s>+~,]|[^(]\+|^)([#.:@])/g;var _4=/^[^\s>+~]/;var _5=/[\s#.:>+~()@]|[^\s#.:>+~()@]+/g;function parseSelector(_6,_7){_7=_7||document.documentElement;var _8=_6.split(_1),_9=[];for(var i=0;i<_8.length;i++){var _b=[_7],_c=toStream(_8[i]);for(var j=0;j<_c.length;){var _e=_c[j++],_f=_c[j++],_10="";if(_c[j]=="("){while(_c[j++]!=")"&&j<_c.length){_10+=_c[j]}_10=_10.slice(0,-1)}_b=select(_b,_e,_f,_10)}_9=_9.concat(_b)}return _9}function toStream(_11){var _12=_11.replace(_2,"$1").replace(_3,"$1*$2");if(_4.test(_12)){_12=" "+_12}return _12.match(_5)||[]}function select(_13,_14,_15,_16){return (_17[_14])?_17[_14](_13,_15,_16):[]}var _18={toArray:function(_19){var a=[];for(var i=0;i<_19.length;i++){a.push(_19[i])}return a}};var dom={isTag:function(_1d,tag){return (tag=="*")||(tag.toLowerCase()==_1d.nodeName.toLowerCase())},previousSiblingElement:function(_1f){do{_1f=_1f.previousSibling}while(_1f&&_1f.nodeType!=1);return _1f},nextSiblingElement:function(_20){do{_20=_20.nextSibling}while(_20&&_20.nodeType!=1);return _20},hasClass:function(_21,_22){return (_22.className||"").match("(^|\\s)"+_21+"(\\s|$)")},getByTag:function(tag,_24){return _24.getElementsByTagName(tag)}};var _17={"#":function(_25,_26){for(var i=0;i<_25.length;i++){if(_25[i].getAttribute("id")==_26){return [_25[i]]}}return []}," ":function(_28,_29){var _2a=[];for(var i=0;i<_28.length;i++){_2a=_2a.concat(_18.toArray(dom.getByTag(_29,_28[i])))}return _2a},">":function(_2c,_2d){var _2e=[];for(var i=0,_30;i<_2c.length;i++){_30=_2c[i];for(var j=0,_32;j<_30.childNodes.length;j++){_32=_30.childNodes[j];if(_32.nodeType==1&&dom.isTag(_32,_2d)){_2e.push(_32)}}}return _2e},".":function(_33,_34){var _35=[];for(var i=0,_37;i<_33.length;i++){_37=_33[i];if(dom.hasClass([_34],_37)){_35.push(_37)}}return _35},":":function(_38,_39,_3a){return (pseudoClasses[_39])?pseudoClasses[_39](_38,_3a):[]}};parseSelector.selectors=_17;parseSelector.pseudoClasses={};parseSelector.util=_18;parseSelector.dom=dom;return parseSelector})(); var sIFR=new function(){var _3b=this;var _3c="sIFR-active";var _3d="sIFR-replaced";var _3e="sIFR-flash";var _3f="sIFR-ignore";var _40="sIFR-alternate";var _41="sIFR-class";var _42="sIFR-layout";var _43="http://www.w3.org/1999/xhtml";var _44=6;var _45=126;var _46=8;var _47="SIFR-PREFETCHED";var _48=" ";this.isActive=false;this.isEnabled=true;this.hideElements=true;this.replaceNonDisplayed=false;this.preserveSingleWhitespace=false;this.fixWrap=true;this.registerEvents=true;this.setPrefetchCookie=true;this.cookiePath="/";this.domains=[];this.fromLocal=true;this.forceClear=false;this.forceWidth=true;this.fitExactly=false;this.forceTextTransform=true;this.useDomContentLoaded=true;this.debugMode=false;this.hasFlashClassSet=false;var _49=0;var _4a=false,_4b=false;var dom=new function(){this.getBody=function(){var _4d=document.getElementsByTagName("body");if(_4d.length==1){return _4d[0]}return null};this.addClass=function(_4e,_4f){if(_4f){_4f.className=((_4f.className||"")==""?"":_4f.className+" ")+_4e}};this.removeClass=function(_50,_51){if(_51){_51.className=_51.className.replace(new RegExp("(^|\\s)"+_50+"(\\s|$)"),"").replace(/^\s+|(\s)\s+/g,"$1")}};this.hasClass=function(_52,_53){return new RegExp("(^|\\s)"+_52+"(\\s|$)").test(_53.className)};this.create=function(_54){if(document.createElementNS){return document.createElementNS(_43,_54)}return document.createElement(_54)};this.setInnerHtml=function(_55,_56){if(ua.innerHtmlSupport){_55.innerHTML=_56}else{if(ua.xhtmlSupport){_56=["<root xmlns=\"",_43,"\">",_56,"</root>"].join("");var xml=(new DOMParser()).parseFromString(_56,"text/xml");xml=document.importNode(xml.documentElement,true);while(_55.firstChild){_55.removeChild(_55.firstChild)}while(xml.firstChild){_55.appendChild(xml.firstChild)}}}};this.getComputedStyle=function(_58,_59){var _5a;if(document.defaultView&&document.defaultView.getComputedStyle){_5a=document.defaultView.getComputedStyle(_58,null)[_59]}else{if(_58.currentStyle){_5a=_58.currentStyle[_59]}}return _5a||""};this.getStyleAsInt=function(_5b,_5c,_5d){var _5e=this.getComputedStyle(_5b,_5c);if(_5d&&!/px$/.test(_5e)){return 0}_5e=parseInt(_5e);return isNaN(_5e)?0:_5e};this.getZoom=function(){return _5f.zoom.getLatest()}};this.dom=dom;var ua=new function(){var ua=navigator.userAgent.toLowerCase();var _62=(navigator.product||"").toLowerCase();this.macintosh=ua.indexOf("mac")>-1;this.windows=ua.indexOf("windows")>-1;this.quicktime=false;this.opera=ua.indexOf("opera")>-1;this.konqueror=_62.indexOf("konqueror")>-1;this.ie=false/*@cc_on || true @*/;this.ieSupported=this.ie&&!/ppc|smartphone|iemobile|msie\s5\.5/.test(ua)/*@cc_on && @_jscript_version >= 5.5 @*/;this.ieWin=this.ie&&this.windows/*@cc_on && @_jscript_version >= 5.1 @*/;this.windows=this.windows&&(!this.ie||this.ieWin);this.ieMac=this.ie&&this.macintosh/*@cc_on && @_jscript_version < 5.1 @*/;this.macintosh=this.macintosh&&(!this.ie||this.ieMac);this.safari=ua.indexOf("safari")>-1;this.webkit=ua.indexOf("applewebkit")>-1&&!this.konqueror;this.khtml=this.webkit||this.konqueror;this.gecko=!this.webkit&&_62=="gecko";this.operaVersion=this.opera&&/.*opera(\s|\/)(\d+\.\d+)/.exec(ua)?parseInt(RegExp.$2):0;this.webkitVersion=this.webkit&&/.*applewebkit\/(\d+).*/.exec(ua)?parseInt(RegExp.$1):0;this.geckoBuildDate=this.gecko&&/.*gecko\/(\d{8}).*/.exec(ua)?parseInt(RegExp.$1):0;this.konquerorVersion=this.konqueror&&/.*konqueror\/(\d\.\d).*/.exec(ua)?parseInt(RegExp.$1):0;this.flashVersion=0;if(this.ieWin){var axo;var _64=false;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(e){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");this.flashVersion=6;axo.AllowScriptAccess="always"}catch(e){_64=this.flashVersion==6}if(!_64){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}}}if(!_64&&axo){this.flashVersion=parseFloat(/([\d,?]+)/.exec(axo.GetVariable("$version"))[1].replace(/,/g,"."))}}else{if(navigator.plugins&&navigator.plugins["Shockwave Flash"]){var _65=navigator.plugins["Shockwave Flash"];this.flashVersion=parseFloat(/(\d+\.?\d*)/.exec(_65.description)[1]);var i=0;while(this.flashVersion>=_46&&i<navigator.mimeTypes.length){var _67=navigator.mimeTypes[i];if(_67.type=="application/x-shockwave-flash"&&_67.enabledPlugin.description.toLowerCase().indexOf("quicktime")>-1){this.flashVersion=0;this.quicktime=true}i++}}}this.flash=this.flashVersion>=_46;this.transparencySupport=this.macintosh||this.windows;this.computedStyleSupport=this.ie||document.defaultView&&document.defaultView.getComputedStyle&&(!this.gecko||this.geckoBuildDate>=20030624);this.css=true;if(this.computedStyleSupport){try{var _68=document.getElementsByTagName("head")[0];_68.style.backgroundColor="#FF0000";var _69=dom.getComputedStyle(_68,"backgroundColor");this.css=!_69||/\#F{2}0{4}|rgb\(255,\s?0,\s?0\)/i.test(_69);_68=null}catch(e){}}this.xhtmlSupport=!!window.DOMParser&&!!document.importNode;this.innerHtmlSupport;try{var n=dom.create("span");if(!this.ieMac){n.innerHTML="x"}this.innerHtmlSupport=n.innerHTML=="x"}catch(e){this.innerHtmlSupport=false}this.zoomSupport=!!(this.opera&&document.documentElement);this.geckoXml=this.gecko&&(document.contentType||"").indexOf("xml")>-1;this.requiresPrefetch=this.ieWin||this.khtml;this.verifiedKonqueror=false;this.supported=this.flash&&this.css&&(!this.ie||this.ieSupported)&&(!this.opera||this.operaVersion>=8)&&(!this.webkit||this.webkitVersion>=412)&&(!this.konqueror||this.konquerorVersion>3.5)&&this.computedStyleSupport&&(this.innerHtmlSupport||!this.khtml&&this.xhtmlSupport)};this.ua=ua;var _6b=new function(){function capitalize($){return $.toUpperCase()}this.normalize=function(str){if(_3b.preserveSingleWhitespace){return str.replace(/\s/g,_48)}return str.replace(/(\s)\s+/g,"$1")};this.textTransform=function(_6e,str){switch(_6e){case "uppercase":str=str.toUpperCase();break;case "lowercase":str=str.toLowerCase();break;case "capitalize":var _70=str;str=str.replace(/^\w|\s\w/g,capitalize);if(str.indexOf("function capitalize")!=-1){var _71=_70.replace(/(^|\s)(\w)/g,"$1$1$2$2").split(/^\w|\s\w/g);str="";for(var i=0;i<_71.length;i++){str+=_71[i].charAt(0).toUpperCase()+_71[i].substring(1)}}break}return str};this.toHexString=function(str){if(typeof (str)!="string"||!str.charAt(0)=="#"||str.length!=4&&str.length!=7){return str}str=str.replace(/#/,"");if(str.length==3){str=str.replace(/(.)(.)(.)/,"$1$1$2$2$3$3")}return "0x"+str};this.toJson=function(obj){var _75="";switch(typeof (obj)){case "string":_75="\""+obj+"\"";break;case "number":case "boolean":_75=obj.toString();break;case "object":_75=[];for(var _76 in obj){if(obj[_76]==Object.prototype[_76]){continue}_75.push("\""+_76+"\":"+_6b.toJson(obj[_76]))}_75="{"+_75.join(",")+"}";break}return _75};this.convertCssArg=function(arg){if(!arg){return {}}if(typeof (arg)=="object"){if(arg.constructor==Array){arg=arg.join("")}else{return arg}}var obj={};var _79=arg.split("}");for(var i=0;i<_79.length;i++){var $=_79[i].match(/([^\s{]+)\s*\{(.+)\s*;?\s*/);if(!$||$.length!=3){continue}if(!obj[$[1]]){obj[$[1]]={}}var _7c=$[2].split(";");for(var j=0;j<_7c.length;j++){var $2=_7c[j].match(/\s*([^:\s]+)\s*\:\s*([^\s;]+)/);if(!$2||$2.length!=3){continue}obj[$[1]][$2[1]]=$2[2]}}return obj};this.extractFromCss=function(css,_80,_81,_82){var _83=null;if(css&&css[_80]&&css[_80][_81]){_83=css[_80][_81];if(_82){delete css[_80][_81]}}return _83};this.cssToString=function(arg){var css=[];for(var _86 in arg){var _87=arg[_86];if(_87==Object.prototype[_86]){continue}css.push(_86,"{");for(var _88 in _87){if(_87[_88]==Object.prototype[_88]){continue}css.push(_88,":",_87[_88],";")}css.push("}")}return escape(css.join(""))}};this.util=_6b;var _5f={};_5f.fragmentIdentifier=new function(){this.fix=true;var _89;this.cache=function(){_89=document.title};function doFix(){document.title=_89}this.restore=function(){if(this.fix){setTimeout(doFix,0)}}};_5f.synchronizer=new function(){this.isBlocked=false;this.block=function(){this.isBlocked=true};this.unblock=function(){this.isBlocked=false;_8a.replaceAll()}};_5f.zoom=new function(){var _8b=100;this.getLatest=function(){return _8b};if(ua.zoomSupport&&ua.opera){var _8c=document.createElement("div");_8c.style.position="fixed";_8c.style.left="-65536px";_8c.style.top="0";_8c.style.height="100%";_8c.style.width="1px";_8c.style.zIndex="-32";document.documentElement.appendChild(_8c);function updateZoom(){if(!_8c){return}var _8d=window.innerHeight/_8c.offsetHeight;var _8e=Math.round(_8d*100)%10;if(_8e>5){_8d=Math.round(_8d*100)+10-_8e}else{_8d=Math.round(_8d*100)-_8e}_8b=isNaN(_8d)?100:_8d;_5f.synchronizer.unblock();document.documentElement.removeChild(_8c);_8c=null}_5f.synchronizer.block();setTimeout(updateZoom,54)}};this.hacks=_5f;var _8f={kwargs:[],replaceAll:function(){for(var i=0;i<this.kwargs.length;i++){_3b.replace(this.kwargs[i])}this.kwargs=[]}};var _8a={kwargs:[],replaceAll:_8f.replaceAll};function isValidDomain(){if(_3b.domains.length==0){return true}var _91="";try{_91=document.domain}catch(e){}if(_3b.fromLocal&&sIFR.domains[0]!="localhost"){sIFR.domains.unshift("localhost")}for(var i=0;i<_3b.domains.length;i++){if(_3b.domains[i]=="*"||_3b.domains[i]==_91){return true}}return false}this.activate=function(){if(!ua.supported||!this.isEnabled||this.isActive||!isValidDomain()){return}this.isActive=true;if(this.hideElements){this.setFlashClass()}if(ua.ieWin&&_5f.fragmentIdentifier.fix&&window.location.hash!=""){_5f.fragmentIdentifier.cache()}else{_5f.fragmentIdentifier.fix=false}if(!this.registerEvents){return}function handler(evt){_3b.initialize();if(evt&&evt.type=="load"){if(document.removeEventListener){document.removeEventListener("DOMContentLoaded",handler,false);document.removeEventListener("load",handler,false)}if(window.removeEventListener){window.removeEventListener("load",handler,false)}}}if(window.addEventListener){if(_3b.useDomContentLoaded&&ua.gecko){document.addEventListener("DOMContentLoaded",handler,false)}window.addEventListener("load",handler,false)}else{if(ua.ieWin){if(_3b.useDomContentLoaded&&!_4a){document.write("<scr"+"ipt id=__sifr_ie_onload defer src=//:></script>");document.getElementById("__sifr_ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){handler();this.removeNode()}}}window.attachEvent("onload",handler)}}};this.setFlashClass=function(){if(this.hasFlashClassSet){return}dom.addClass(_3c,dom.getBody()||document.documentElement);this.hasFlashClassSet=true};this.removeFlashClass=function(){if(!this.hasFlashClassSet){return}dom.removeClass(_3c,dom.getBody());dom.removeClass(_3c,document.documentElement);this.hasFlashClassSet=false};this.initialize=function(){if(_4b||!this.isActive||!this.isEnabled){return}_4b=true;_8f.replaceAll();clearPrefetch()};function getSource(src){if(typeof (src)!="string"){if(src.src){src=src.src}if(typeof (src)!="string"){var _95=[];for(var _96 in src){if(src[_96]!=Object.prototype[_96]){_95.push(_96)}}_95.sort().reverse();var _97="";var i=-1;while(!_97&&++i<_95.length){if(parseFloat(_95[i])<=ua.flashVersion){_97=src[_95[i]]}}src=_97}}if(!src&&_3b.debugMode){throw new Error("sIFR: Could not determine appropriate source")}if(ua.ie&&src.charAt(0)=="/"){src=window.location.toString().replace(/([^:]+)(:\/?\/?)([^\/]+).*/,"$1$2$3")+src}return src}this.prefetch=function(){if(!ua.requiresPrefetch||!ua.supported||!this.isEnabled||!isValidDomain()){return}if(this.setPrefetchCookie&&new RegExp(";?"+_47+"=true;?").test(document.cookie)){return}try{_4a=true;if(ua.ieWin){prefetchIexplore(arguments)}else{prefetchLight(arguments)}if(this.setPrefetchCookie){document.cookie=_47+"=true;path="+this.cookiePath}}catch(e){if(_3b.debugMode){throw e}}};function prefetchIexplore(_99){for(var i=0;i<_99.length;i++){document.write("<embed src=\""+getSource(_99[i])+"\" sIFR-prefetch=\"true\" style=\"display:none;\">")}}function prefetchLight(_9b){for(var i=0;i<_9b.length;i++){new Image().src=getSource(_9b[i])}}function clearPrefetch(){if(!ua.ieWin||!_4a){return}try{var _9d=document.getElementsByTagName("embed");for(var i=_9d.length-1;i>=0;i--){var _9f=_9d[i];if(_9f.getAttribute("sIFR-prefetch")=="true"){_9f.parentNode.removeChild(_9f)}}}catch(e){}}function getRatio(_a0){if(_a0<=10){return 1.55}if(_a0<=19){return 1.45}if(_a0<=32){return 1.35}if(_a0<=71){return 1.3}return 1.25}function getFilters(obj){var _a2=[];for(var _a3 in obj){if(obj[_a3]==Object.prototype[_a3]){continue}var _a4=obj[_a3];_a3=[_a3.replace(/filter/i,"")+"Filter"];for(var _a5 in _a4){if(_a4[_a5]==Object.prototype[_a5]){continue}_a3.push(_a5+":"+escape(_6b.toJson(_6b.toHexString(_a4[_a5]))))}_a2.push(_a3.join(","))}return _a2.join(";")}this.replace=function(_a6,_a7){if(!ua.supported){return}if(_a7){for(var _a8 in _a6){if(typeof (_a7[_a8])=="undefined"){_a7[_a8]=_a6[_a8]}}_a6=_a7}if(!_4b){return _8f.kwargs.push(_a6)}if(_5f.synchronizer.isBlocked){return _8a.kwargs.push(_a6)}var _a9=_a6.elements;if(!_a9&&parseSelector){_a9=parseSelector(_a6.selector)}if(_a9.length==0){return}this.setFlashClass();var src=getSource(_a6.src);var css=_6b.convertCssArg(_a6.css);var _ac=getFilters(_a6.filters);var _ad=(_a6.forceClear==null)?_3b.forceClear:_a6.forceClear;var _ae=(_a6.fitExactly==null)?_3b.fitExactly:_a6.fitExactly;var _af=_ae||(_a6.forceWidth==null?_3b.forceWidth:_a6.forceWidth);var _b0=parseInt(_6b.extractFromCss(css,".sIFR-root","leading"))||0;var _b1=_6b.extractFromCss(css,".sIFR-root","background-color",true)||"#FFFFFF";var _b2=_6b.extractFromCss(css,".sIFR-root","opacity",true)||"100";if(parseFloat(_b2)<1){_b2=100*parseFloat(_b2)}var _b3=_6b.extractFromCss(css,".sIFR-root","kerning",true)||"";var _b4=_a6.gridFitType||_6b.extractFromCss(css,".sIFR-root","text-align")=="right"?"subpixel":"pixel";var _b5=_3b.forceTextTransform?_6b.extractFromCss(css,".sIFR-root","text-transform",true)||"none":"none";var _b6="";if(_ae){_6b.extractFromCss(css,".sIFR-root","text-align",true)}if(!_a6.modifyCss){_b6=_6b.cssToString(css)}var _b7=_a6.wmode||"";if(_b7=="transparent"){if(!ua.transparencySupport){_b7="opaque"}else{_b1="transparent"}}for(var i=0;i<_a9.length;i++){var _b9=_a9[i];if(!ua.verifiedKonqueror){if(dom.getComputedStyle(_b9,"lineHeight").match(/e\+08px/)){ua.supported=_3b.isEnabled=false;this.removeFlashClass();return}ua.verifiedKonqueror=true}if(dom.hasClass(_3d,_b9)||dom.hasClass(_3f,_b9)){continue}var _ba=false;if(!_b9.offsetHeight||!_b9.offsetWidth){if(!_3b.replaceNonDisplayed){continue}_b9.style.display="block";if(!_b9.offsetHeight||!_b9.offsetWidth){_b9.style.display="";continue}_ba=true}if(_ad&&ua.gecko){_b9.style.clear="both"}var _bb=null;if(_3b.fixWrap&&ua.ie&&dom.getComputedStyle(_b9,"display")=="block"){_bb=_b9.innerHTML;dom.setInnerHtml(_b9,"X")}var _bc=dom.getStyleAsInt(_b9,"width",ua.ie);if(ua.ie&&_bc==0){var _bd=dom.getStyleAsInt(_b9,"paddingRight",true);var _be=dom.getStyleAsInt(_b9,"paddingLeft",true);var _bf=dom.getStyleAsInt(_b9,"borderRightWidth",true);var _c0=dom.getStyleAsInt(_b9,"borderLeftWidth",true);_bc=_b9.offsetWidth-_be-_bd-_c0-_bf}if(_bb&&_3b.fixWrap&&ua.ie){dom.setInnerHtml(_b9,_bb)}var _c1,_c2;if(!ua.ie){_c1=dom.getStyleAsInt(_b9,"lineHeight");_c2=Math.floor(dom.getStyleAsInt(_b9,"height")/_c1)}else{if(ua.ie){var _bb=_b9.innerHTML;_b9.style.visibility="visible";_b9.style.overflow="visible";_b9.style.position="static";_b9.style.zoom="normal";_b9.style.writingMode="lr-tb";_b9.style.width=_b9.style.height="auto";_b9.style.maxWidth=_b9.style.maxHeight=_b9.style.styleFloat="none";var _c3=_b9;var _c4=_b9.currentStyle.hasLayout;if(_c4){dom.setInnerHtml(_b9,"<div class=\""+_42+"\">X<br />X<br />X</div>");_c3=_b9.firstChild}else{dom.setInnerHtml(_b9,"X<br />X<br />X")}var _c5=_c3.getClientRects();_c1=_c5[1].bottom-_c5[1].top;_c1=Math.ceil(_c1*0.8);if(_c4){dom.setInnerHtml(_b9,"<div class=\""+_42+"\">"+_bb+"</div>");_c3=_b9.firstChild}else{dom.setInnerHtml(_b9,_bb)}_c5=_c3.getClientRects();_c2=_c5.length;if(_c4){dom.setInnerHtml(_b9,_bb)}_b9.style.visibility=_b9.style.width=_b9.style.height=_b9.style.maxWidth=_b9.style.maxHeight=_b9.style.overflow=_b9.style.styleFloat=_b9.style.position=_b9.style.zoom=_b9.style.writingMode=""}}if(_ba){_b9.style.display=""}if(_ad&&ua.gecko){_b9.style.clear=""}_c1=Math.max(_44,_c1);_c1=Math.min(_45,_c1);if(isNaN(_c2)||!isFinite(_c2)){_c2=1}var _c6=Math.round(_c2*_c1);if(_c2>1&&_b0){_c6+=Math.round((_c2-1)*_b0)}var _c7=dom.create("span");_c7.className=_40;var _c8=_b9.cloneNode(true);for(var j=0,l=_c8.childNodes.length;j<l;j++){_c7.appendChild(_c8.childNodes[j].cloneNode(true))}if(_a6.modifyContent){_a6.modifyContent(_c8,_a6.selector)}if(_a6.modifyCss){_b6=_a6.modifyCss(css,_c8,_a6.selector)}var _cb=handleContent(_c8,_b5);if(_a6.modifyContentString){_cb=_a6.modifyContentString(_cb,_a6.selector)}if(_cb==""){continue}var _cc=["content="+_cb.replace(/\</g,"&lt;").replace(/>/g,"&gt;"),"width="+_bc,"height="+_c6,"fitexactly="+(_ae?"true":""),"tunewidth="+(_a6.tuneWidth||""),"tuneheight="+(_a6.tuneHeight||""),"offsetleft="+(_a6.offsetLeft||""),"offsettop="+(_a6.offsetTop||""),"thickness="+(_a6.thickness||""),"sharpness="+(_a6.sharpness||""),"kerning="+_b3,"gridfittype="+_b4,"zoomsupport="+ua.zoomSupport,"filters="+_ac,"opacity="+_b2,"blendmode="+(_a6.blendMode||""),"size="+_c1,"zoom="+dom.getZoom(),"css="+_b6];_cc=encodeURI(_cc.join("&amp;"));var _cd="sIFR_callback_"+_49++;var _ce={flashNode:null};window[_cd+"_DoFSCommand"]=(function(_cf){return function(_d0,arg){if(/(FSCommand\:)?resize/.test(_d0)){var $=arg.split(":");_cf.flashNode.setAttribute($[0],$[1]);if(ua.khtml){_cf.flashNode.innerHTML+=""}}}})(_ce);_c6=Math.round(_c2*getRatio(_c1)*_c1);var _d3=_af?_bc:"100%";var _d4;if(ua.ie){_d4=["<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" id=\"",_cd,"\" sifr=\"true\" width=\"",_d3,"\" height=\"",_c6,"\" class=\"",_3e,"\">","<param name=\"movie\" value=\"",src,"\"></param>","<param name=\"flashvars\" value=\"",_cc,"\"></param>","<param name=\"allowScriptAccess\" value=\"always\"></param>","<param name=\"quality\" value=\"best\"></param>","<param name=\"wmode\" value=\"",_b7,"\"></param>","<param name=\"bgcolor\" value=\"",_b1,"\"></param>","<param name=\"name\" value=\"",_cd,"\"></param>","</object>","<scr","ipt event=FSCommand(info,args) for=",_cd,">",_cd,"_DoFSCommand(info, args);","</","script>"].join("")}else{_d4=["<embed class=\"",_3e,"\" type=\"application/x-shockwave-flash\" src=\"",src,"\" quality=\"best\" flashvars=\"",_cc,"\" width=\"",_d3,"\" height=\"",_c6,"\" wmode=\"",_b7,"\" bgcolor=\"",_b1,"\" name=\"",_cd,"\" allowScriptAccess=\"always\" sifr=\"true\"></embed>"].join("")}dom.setInnerHtml(_b9,_d4);_ce.flashNode=_b9.firstChild;_b9.appendChild(_c7);dom.addClass(_3d,_b9);if(_a6.onReplacement){_a6.onReplacement(_ce.flashNode)}}_5f.fragmentIdentifier.restore()};function handleContent(_d5,_d6){var _d7=[],_d8=[];var _d9=_d5.childNodes;var i=0;while(i<_d9.length){var _db=_d9[i];if(_db.nodeType==3){var _dc=_6b.normalize(_db.nodeValue);_dc=_6b.textTransform(_d6,_dc);_d8.push(_dc.replace(/\%/g,"%25").replace(/\&/g,"%26").replace(/\,/g,"%2C").replace(/\+/g,"%2B"))}if(_db.nodeType==1){var _dd=[];var _de=_db.nodeName.toLowerCase();var _df=_db.className||"";if(/\s+/.test(_df)){if(_df.indexOf(_41)){_df=_df.match("(\\s|^)"+_41+"-([^\\s$]*)(\\s|$)")[2]}else{_df=_df.match(/^([^\s]+)/)[1]}}if(_df!=""){_dd.push("class=\""+_df+"\"")}if(_de=="a"){var _e0=_db.getAttribute("href")||"";var _e1=_db.getAttribute("target")||"";_dd.push("href=\""+_e0+"\"","target=\""+_e1+"\"")}_d8.push("<"+_de+(_dd.length>0?" ":"")+escape(_dd.join(" "))+">");if(_db.hasChildNodes()){_d7.push(i);i=0;_d9=_db.childNodes;continue}else{if(!/^(br|img)$/i.test(_db.nodeName)){_d8.push("</",_db.nodeName.toLowerCase(),">")}}}if(_d7.length>0&&!_db.nextSibling){do{i=_d7.pop();_d9=_db.parentNode.parentNode.childNodes;_db=_d9[i];if(_db){_d8.push("</",_db.nodeName.toLowerCase(),">")}}while(i<_d9.length&&_d7.length>0)}i++}return _d8.join("").replace(/\n|\r/g,"")}}; sIFR.prefetch({ src: 'swf/sifr/helvetica.swf' }); sIFR.activate(); sIFR.replace({ selector: 'h2, h3', src: 'swf/sifr/helvetica.swf', wmode: 'transparent', css: { '.sIFR-root' : { 'color': '#000000', 'font-weight': 'bold', 'letter-spacing': '-1' }, 'a': { 'text-decoration': 'none' }, 'a:link': { 'color': '#000000' }, 'a:hover': { 'color': '#000000' }, '.span': { 'color': '#979797' }, 'label': { 'color': '#E11818' } } }); sIFR.replace({ selector: 'h4', src: 'swf/sifr/helvetica.swf', wmode: 'transparent', css: { '.sIFR-root' : { 'color': '#7E7E7E', 'font-weight': 'bold', 'letter-spacing': '-0.8' }, 'a': { 'text-decoration': 'none' }, 'a:link': { 'color': '#7E7E7E' }, 'a:hover': { 'color': '#7E7E7E' }, 'label': { 'color': '#E11818' } } }); sIFR.replace({ selector: '#cart p', src: 'swf/sifr/helvetica-lt.swf', wmode: 'transparent', css: { '.sIFR-root' : { 'color': '#979797', 'font-weight': 'bold', 'letter-spacing': '-0.8' }, 'a': { 'text-decoration': 'none' }, 'a:link': { 'color': '#979797' }, 'a:hover': { 'color': '#000000' }, 'label': { 'color': '#979797' } } }); Thank you in advance for your help!

    Read the article

  • Javascript stockticker : not showing data on php page

    - by developer
    iam not getting any javascript errors , code is getting rendered properly only, but still server not displaying data on the page. please check the code below . <style type="text/css"> #marqueeborder { color: #cccccc; background-color: #EEF3E2; font-family:"Lucida Console", Monaco, monospace; position:relative; height:20px; overflow:hidden; font-size: 0.7em; } #marqueecontent { position:absolute; left:0px; line-height:20px; white-space:nowrap; } .stockbox { margin:0 10px; } .stockbox a { color: #cccccc; text-decoration : underline; } </style> </head> <body> <div id="marqueeborder" onmouseover="pxptick=0" onmouseout="pxptick=scrollspeed"> <div id="marqueecontent"> <?php // Original script by Walter Heitman Jr, first published on http://techblog.shanock.com // List your stocks here, separated by commas, no spaces, in the order you want them displayed: $stocks = "idt,iye,mill,pwer,spy,f,msft,x,sbux,sne,ge,dow,t"; // Function to copy a stock quote CSV from Yahoo to the local cache. CSV contains symbol, price, and change function upsfile($stock) { copy("http://finance.yahoo.com/d/quotes.csv?s=$stock&f=sl1c1&e=.csv","stockcache/".$stock.".csv"); } foreach ( explode(",", $stocks) as $stock ) { // Where the stock quote info file should be... $local_file = "stockcache/".$stock.".csv"; // ...if it exists. If not, download it. if (!file_exists($local_file)) { upsfile($stock); } // Else,If it's out-of-date by 15 mins (900 seconds) or more, update it. elseif (filemtime($local_file) <= (time() - 900)) { upsfile($stock); } // Open the file, load our values into an array... $local_file = fopen ("stockcache/".$stock.".csv","r"); $stock_info = fgetcsv ($local_file, 1000, ","); // ...format, and output them. I made the symbols into links to Yahoo's stock pages. echo "<span class=\"stockbox\"><a href=\"http://finance.yahoo.com/q?s=".$stock_info[0]."\">".$stock_info[0]."</a> ".sprintf("%.2f",$stock_info[1])." <span style=\""; // Green prices for up, red for down if ($stock_info[2]>=0) { echo "color: #009900;\">&uarr;"; } elseif ($stock_info[2]<0) { echo "color: #ff0000;\">&darr;"; } echo sprintf("%.2f",abs($stock_info[2]))."</span></span>\n"; // Done! fclose($local_file); } ?> <span class="stockbox" style="font-size:0.6em">Quotes from <a href="http://finance.yahoo.com/">Yahoo Finance</a></span> </div> </div> </body> <script type="text/javascript"> // Original script by Walter Heitman Jr, first published on http://techblog.shanock.com // Set an initial scroll speed. This equates to the number of pixels shifted per tick var scrollspeed=2; var pxptick=scrollspeed; var marqueediv=''; var contentwidth=""; var marqueewidth = ""; function startmarquee(){ alert("hi"); // Make a shortcut referencing our div with the content we want to scroll marqueediv=document.getElementById("marqueecontent"); //alert("marqueediv"+marqueediv); alert("hi"+marqueediv.innerHTML); // Get the total width of our available scroll area marqueewidth=document.getElementById("marqueeborder").offsetWidth; alert("marqueewidth"+marqueewidth); // Get the width of the content we want to scroll contentwidth=marqueediv.offsetWidth; alert("contentwidth"+contentwidth); // Start the ticker at 50 milliseconds per tick, adjust this to suit your preferences // Be warned, setting this lower has heavy impact on client-side CPU usage. Be gentle. var lefttime=setInterval("scrollmarquee()",50); alert("lefttime"+lefttime); } function scrollmarquee(){ // Check position of the div, then shift it left by the set amount of pixels. if (parseInt(marqueediv.style.left)>(contentwidth*(-1))) marqueediv.style.left=parseInt(marqueediv.style.left)-pxptick+"px"; //alert("hikkk"+marqueediv.innerHTML);} // If it's at the end, move it back to the right. else{ alert("marqueewidth"+marqueewidth); marqueediv.style.left=parseInt(marqueewidth)+"px"; } } window.onload=startmarquee; </script> </html> Below is the server displayed page. I have updated with screenshot with your suggestion, i made change in html too, to check what is showing by child dev

    Read the article

  • Patching this Code to apply dynamic (iPhone) background position

    - by Brian
    I posted a question previously that got off topic, I'm reposting with better code that I have VERIFIED is compatible with iPhone (it works with mine anyway!) I just want to apply background-position coordinates to the body element and call the script conditionally for iPhone, iPod, & iPad. Here's my conditional call for those devices: var deviceAgent = navigator.userAgent.toLowerCase(); var agentID = deviceAgent.match(/(iphone|ipod|ipad)/); if (agentID) { // do something } else { //do this } Now, I've found this excellent script that sets the "top: x" dynamically on the basis of scroll position. Everyone has told me (and ALL of the tutorials and Google search results as well) that it's impossible to set scroll position dynamically for iPhone because of the viewport issue. HOWEVER, they are wrong because if you scroll to the bottom of the page and view this javascript demo on iPhone, you can scroll and the <div style="background-position: fixed; top: x (variable)"></div> div DOES stay centered on iPhone. I really hope this question helps alot of people, I thought it was impossible, but it's NOT... I just need help stitching it together! The original code (you can test it on iPhone yourself) is here: http://stevenbenner.com/2010/04/calculate-page-size-and-view-port-position-in-javascript/ So I just need help getting the following code to apply the dynamic "background-position: 0 x" to the BODY tag where x is centered and relative to the viewport position. Also, needs to be nested inside the above code that is conditional for iPhone and similar devices. // Page Size and View Port Dimension Tools // http://stevenbenner.com/2010/04/calculate-page-size-and-view-port-position-in-javascript/ if (!sb_windowTools) { var sb_windowTools = new Object(); }; sb_windowTools = { scrollBarPadding: 17, // padding to assume for scroll bars // EXAMPLE METHODS // center an element in the viewport centerElementOnScreen: function(element) { var pageDimensions = this.updateDimensions(); element.style.top = ((this.pageDimensions.verticalOffset() + this.pageDimensions.windowHeight() / 2) - (this.scrollBarPadding + element.offsetHeight / 2)) + 'px'; element.style.left = ((this.pageDimensions.windowWidth() / 2) - (this.scrollBarPadding + element.offsetWidth / 2)) + 'px'; element.style.position = 'absolute'; }, // INFORMATION GETTERS // load the page size, view port position and vertical scroll offset updateDimensions: function() { this.updatePageSize(); this.updateWindowSize(); this.updateScrollOffset(); }, // load page size information updatePageSize: function() { // document dimensions var viewportWidth, viewportHeight; if (window.innerHeight && window.scrollMaxY) { viewportWidth = document.body.scrollWidth; viewportHeight = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but explorer mac viewportWidth = document.body.scrollWidth; viewportHeight = document.body.scrollHeight; } else { // explorer mac...would also work in explorer 6 strict, mozilla and safari viewportWidth = document.body.offsetWidth; viewportHeight = document.body.offsetHeight; }; this.pageSize = { viewportWidth: viewportWidth, viewportHeight: viewportHeight }; }, // load window size information updateWindowSize: function() { // view port dimensions var windowWidth, windowHeight; if (self.innerHeight) { // all except explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // explorer 6 strict mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; }; this.windowSize = { windowWidth: windowWidth, windowHeight: windowHeight }; }, // load scroll offset information updateScrollOffset: function() { // viewport vertical scroll offset var horizontalOffset, verticalOffset; if (self.pageYOffset) { horizontalOffset = self.pageXOffset; verticalOffset = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict horizontalOffset = document.documentElement.scrollLeft; verticalOffset = document.documentElement.scrollTop; } else if (document.body) { // all other Explorers horizontalOffset = document.body.scrollLeft; verticalOffset = document.body.scrollTop; }; this.scrollOffset = { horizontalOffset: horizontalOffset, verticalOffset: verticalOffset }; }, // INFORMATION CONTAINERS // raw data containers pageSize: {}, windowSize: {}, scrollOffset: {}, // combined dimensions object with bounding logic pageDimensions: { pageWidth: function() { return sb_windowTools.pageSize.viewportWidth > sb_windowTools.windowSize.windowWidth ? sb_windowTools.pageSize.viewportWidth : sb_windowTools.windowSize.windowWidth; }, pageHeight: function() { return sb_windowTools.pageSize.viewportHeight > sb_windowTools.windowSize.windowHeight ? sb_windowTools.pageSize.viewportHeight : sb_windowTools.windowSize.windowHeight; }, windowWidth: function() { return sb_windowTools.windowSize.windowWidth; }, windowHeight: function() { return sb_windowTools.windowSize.windowHeight; }, horizontalOffset: function() { return sb_windowTools.scrollOffset.horizontalOffset; }, verticalOffset: function() { return sb_windowTools.scrollOffset.verticalOffset; } } };

    Read the article

  • http server implentation, the page does not show properly

    - by none
    well, as i am doing a small project of coding an http server. the code is at http://code.google.com/p/reactor/ the current puzzle is when asked to parse a page with java script and css. As an http server it just sends a page (copied from another website) and it parsed inproperly. when a simple html page is been parse , by my firefox, it shows ok, however when parsing a more complex page(css+javascript) the page is all wired like this : ???? ????? if(getCookie('pais999')==null){varisToplayerDouble="True";isToplayerDouble=(isToplayerDouble=="True")?true:falsevarToplayerCookieName='pais999';varTopLayerCookieExpiredDays=1;varToplayerLink='http://xads.zedo.com/ads2/c?a=239671;g=0;c=455000000;i=0;x=7168;n=455;s=0;k=http://www.pais.co.il/Pais/Games/Lotto/';varToplayerImpression='http://l4.zedo.com/log/p.gif?a=239671;c=455000000;x=7168;n=455;e=i;i=0;s=0;z='+Math.random();varToplayerBigPath='pais/January2007/98one_toplayer.swf';varToplayerSmallPath='pais/January2007/98one_reminder.swf';varToplayerBigWidth=1005;varToplayerBigHeight=500;varToplayerSmallWidth=100;varToplayerSmallHeight=100;varToplayerBigLeft=(0==0)?resWidth/2-ToplayerBigWidth/2:resWidth/2-ToplayerBigWidth/2+0varToplayerBigTop=0;varToplayerSmallLeft=resWidth-ToplayerSmallWidth-0;varToplayerSmallTop=0;varSecondsToChangeBigToSmall=15;}elseif(getCookie('NF999')==null){varisToplayerDouble="True";isToplayerDouble=(isToplayerDouble=="True")?true:falsevarToplayerCookieName='NF999';varTopLayerCookieExpiredDays=1;varToplayerLink='http://xads.zedo.com/ads2/c?a=238663;g=0;c=455000000;i=0;x=7168;n=455;s=0;k=http://www.new-pharm.co.il/SkiGame/?ToolID=OLJD8O';varToplayerImpression='http://l4.zedo.com/log/p.gif?a=238663;c=455000000;x=7168;n=455;e=i;i=0;s=0;z='+Math.random();varToplayerBigPath='NewFarm/Ski/995ONE_TopLayer_550x360.swf';varToplayerSmallPath='NewFarm/Ski/995ONE_Reminder_100x100.swf';varToplayerBigWidth=550;varToplayerBigHeight=360;varToplayerSmallWidth=100;varToplayerSmallHeight=100;varToplayerBigLeft=(0==0)?resWidth/2-ToplayerBigWidth/2:resWidth/2-ToplayerBigWidth/2+0varToplayerBigTop=0;varToplayerSmallLeft=resWidth-ToplayerSmallWidth-0;varToplayerSmallTop=0;varSecondsToChangeBigToSmall=15;}elseif(1==0){}$("divToplayerBig").style.width=ToplayerBigWidth;$("divToplayerBig").style.height=ToplayerBigHeight;$("divToplayerBig").style.left=resWidth/2-ToplayerBigWidth/2;$("divToplayerSmall").style.width=ToplayerSmallWidth;$("divToplayerSmall").style.height=ToplayerSmallHeight;$("divToplayerSmall").style.right=ToplayerSmallWidthvartopOff=0;if(ToplayerBigTop0)topOff=resHeight-ToplayerBigHeight+ToplayerBigTop;varisMain=false;#divToplayerBig{position:absolute;right:20px;bottom:1px;}bodydiv#divToplayerBig{position:fixed;}#divToplayerSmall{position:absolute;right:20px;bottom:10px;}bodydiv#divToplayerSmall{position:fixed;}????|??????LIVE|???????????|ONE???????|ONETV |????'??|BigONE|?????????| CrazyONE | where the source code of the html is : ONE:???:??????????????????????????? ????  ????? if(getCookie('pais999')==null){varisToplayerDouble="True";isToplayerDouble=(isToplayerDouble=="True")?true:falsevarToplayerCookieName='pais999';varTopLayerCookieExpiredDays=1;varToplayerLink='http://xads.zedo.com/ads2/c?a=239671;g=0;c=455000000;i=0;x=7168;n=455;s=0;k=http://www.pais.co.il/Pais/Games/Lotto/';varToplayerImpression='http://l4.zedo.com/log/p.gif?a=239671;c=455000000;x=7168;n=455;e=i;i=0;s=0;z='+Math.random();varToplayerBigPath='pais/January2007/98one_toplayer.swf';varToplayerSmallPath='pais/January2007/98one_reminder.swf';varToplayerBigWidth=1005;varToplayerBigHeight=500;varToplayerSmallWidth=100;varToplayerSmallHeight=100;varToplayerBigLeft=(0==0)?resWidth/2-ToplayerBigWidth/2:resWidth/2-ToplayerBigWidth/2+0varToplayerBigTop=0;varToplayerSmallLeft=resWidth-ToplayerSmallWidth-0;varToplayerSmallTop=0;varSecondsToChangeBigToSmall=15;}elseif(getCookie('NF999')==null){varisToplayerDouble="True";isToplayerDouble=(isToplayerDouble=="True")?true:falsevarToplayerCookieName='NF999';varTopLayerCookieExpiredDays=1;varToplayerLink='http://xads.zedo.com/ads2/c?a=238663;g=0;c=455000000;i=0;x=7168;n=455;s=0;k=http://www.new-pharm.co.il/SkiGame/?ToolID=OLJD8O';varToplayerImpression='http://l4.zedo.com/log/p.gif?a=238663;c=455000000;x=7168;n=455;e=i;i=0;s=0;z='+Math.random();varToplayerBigPath='NewFarm/Ski/995ONE_TopLayer_550x360.swf';varToplayerSmallPath='NewFarm/Ski/995ONE_Reminder_100x100.swf';varToplayerBigWidth=550;varToplayerBigHeight=360;varToplayerSmallWidth=100;varToplayerSmallHeight=100;varToplayerBigLeft=(0==0)?resWidth/2-ToplayerBigWidth/2:resWidth/2-ToplayerBigWidth/2+0varToplayerBigTop=0;varToplayerSmallLeft=resWidth-ToplayerSmallWidth-0;varToplayerSmallTop=0;varSecondsToChangeBigToSmall=15;}elseif(1==0){}$("divToplayerBig").style.width=ToplayerBigWidth;$("divToplayerBig").style.height=ToplayerBigHeight;$("divToplayerBig").style.left=resWidth/2-ToplayerBigWidth/2;$("divToplayerSmall").style.width=ToplayerSmallWidth;$("divToplayerSmall").style.height=ToplayerSmallHeight;$("divToplayerSmall").style.right=ToplayerSmallWidthvartopOff=0;if(ToplayerBigTop0)topOff=resHeight-ToplayerBigHeight+ToplayerBigTop;varisMain=false;#divToplayerBig{position:absolute;right:20px;bottom:1px;}bodydiv#divToplayerBig{position:fixed;}div#divToplayerBig{right:auto;bottom:auto;left:expression((-20-divToplayerBig.offsetWidth+(document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth)+(ignoreMe2=document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft))+'px');top:expression((0-divToplayerBig.offsetHeight-topOff+(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight)+(ignoreMe=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop))+'px');}#divToplayerSmall{position:absolute;right:20px;bottom:10px;}bodydiv#divToplayerSmall{position:fixed;}div#divToplayerSmall{right:auto;bottom:auto;left:expression((-20-divToplayerSmall.offsetWidth+(document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth)+(ignoreMe2=document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft))+'px');top:expression((0-divToplayerSmall.offsetHeight+(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight)+(ignoreMe=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop))+'px');}varisTopTrans=(ToplayerBigPath.indexOf("transparent")-1)?false:true;varisRemTrans=(ToplayerSmallPath.indexOf("transparent")-1)?false:true;vartop1session=3;vartop2session=5;InitToplayer(isTopTrans,isRemTrans);window.onload=StartToplayer;????|??????LIVE|???????????|ONE???????|ONETV |????'??|BigONE|?????????|  CrazyONE |????????????????????????????????????????????????????????19/01/07  19:30?????????????????????-?????:?????????????????????????19/01/07  18:43??????????????:??????????????????????19/01/07  17:41???:??????????????????????????????????19/01/07  16:49?????:??????"?????????????/?????1:2,??????"??????19/01/07  16:45????????????????????????????,?????2.5???????????????19/01/07  16:37???????:???"?????????????????-19:30?????????????19/01/07  14:32?????"?????????-18:30?????????"????????,????'??????19/01/07  14:45????????????????????????????????"?:??????????????19/01/07  14:37??????????:??????????????????????????????0:019/01/07  13:46varswfPeleSmall=newSWFObject("http://images.one.co.il/images/PeleEmulator/emulator_pelephone_01a.swf","peleSmall",160,470,"6","#FFFFFF");swfPeleSmall.addParam("quality","high");swfPeleSmall.addParam("wmode","transparent");swfPeleSmall.write("divPeleSmall");varswfPeleBig=newSWFObject("http://images.one.co.il/images/PeleEmulator/emulator_pelephone_02d.swf","peleBig",400,470,"6","#FFFFFF");swfPeleBig.addParam("quality","high");swfPeleBig.addParam("wmode","transparent");swfPeleBig.write("divWithBig");???:???????????????????????????????????????-ONE????????????????????????????????????????????.????????,???????????1:2,?????????????:"???????????"DisplayFlash("W_S_round_border_pic.swf","156","201","1","style=position:absolute");?????????????????????????(??????)?????????                          19/01/20077:26???????????????(????)????????????????????????????6:3,5:7?-5:7???????????????????????,???????23?????.?????,????????????????????????????????,???????????????????????????????????????????,????????????????????.??????????????????????????,??????????????????????????.????????????????????????????-1:1?????????.?????????????????????????????'?????????????????????????????.?????????????.???????????????????????????????(16???????),???????????????????????????????????????3???????,???????????????????????.????????- (only part of of the page presentation in firefox and page source html) why is it happening? what is midding in the http response? StringBuffer tResponse = new StringBuffer(); tResponse.append("HTTP/1.1 200 OK\n"); tResponse.append("Date: "+new Date().toString() +'\n'); tResponse.append("server: http-reactor/0.1-dev\n"); tResponse.append("last-Modified:"+ d.toString() +'\n'); tResponse.append("Content-Type: text/html; charset=windows-1255\n"); tResponse.append("Accept-Language: he; q=1.0, en; q=0.5:); tResponse.append("Content-Length: "+tFileContent.length()+'\n'); tResponse.append('\n'); tResponse.append(tFileContent); public StringBuffer FetchData(String FileName) throws FileNotFoundException{ StringBuffer tFileContent = new StringBuffer(); if (FileName.contains("../")) throw new SecurityException(); if (FileName.equals("/")) FileName = "\\index.html"; FileName.replace('/', '\\'); File f = new File(_root + FileName); Scanner scanner = new Scanner(f); while(scanner.hasNext()) tFileContent.append(scanner.next()); return generateResponse(tFileContent,f.lastModified()); } private StringBuffer generateResponse(StringBuffer tFileContent, long l) { StringBuffer tResponse = new StringBuffer(); Date d = new Date(l); tResponse.append("HTTP/1.1 200 OK\n"); tResponse.append("Date: "+new Date().toString() +'\n'); tResponse.append("server: http-reactor/0.1-dev\n"); tResponse.append("last-Modified:"+ d.toString() +'\n'); tResponse.append("Content-Type: text/html; charset=windows-1255\n"); tResponse.append("Accept-Language: he; q=1.0, en; q=0.5:); tResponse.append("Content-Length: "+tFileContent.length()+'\n'); tResponse.append('\n'); tResponse.append(tFileContent); return tResponse; }

    Read the article

  • audio onprogress in chrome not working

    - by user351709
    Hi I am having a problem getting onprogress event for the audio tag working on chrome. it seems to work on fire fox. http://www.scottandrew.com/pub/html5audioplayer/ works on chrome but there is no progress bar update. When I copy the code and change the src to a .wav file and run it on fire fox it works perfectly. <style type="text/css"> #content { clear:both; width:60%; } .player_control { float:left; margin-right:5px; height: 20px; } #player { height:22px; } #duration { width:400px; height:15px; border: 2px solid #50b; } #duration_background { width:400px; height:15px; background-color:#ddd; } #duration_bar { width:0px; height:13px; background-color:#bbd; } #loader { width:0px; height:2px; } .style1 { height: 35px; } </style> <script type="text/javascript"> var audio_duration; var audio_player; function pageLoaded() { audio_player = $("#aplayer").get(0); //get the duration audio_duration = audio_player.duration; $('#totalTime').text(formatTimeSeconds(audio_player.duration)); //set the volume } function update(){ //get the duration of the player dur = audio_player.duration; time = audio_player.currentTime; fraction = time/dur; percent = (fraction*100); wrapper = document.getElementById("duration_background"); new_width = wrapper.offsetWidth*fraction; document.getElementById("duration_bar").style.width = new_width + "px"; $('#currentTime').text(formatTimeSeconds(audio_player.currentTime)); $('#totalTime').text(formatTimeSeconds(audio_player.duration)); } function formatTimeSeconds(time) { var minutes = Math.floor(time / 60); var seconds = "0" + (Math.floor(time) - (minutes * 60)).toString(); if (isNaN(minutes) || isNaN(seconds)) { return "0:00"; } var Strseconds = seconds.substr(seconds.length - 2); return minutes + ":" + Strseconds; } function playClicked(element){ //get the state of the player if(audio_player.paused) { audio_player.play(); newdisplay = "||"; }else{ audio_player.pause(); newdisplay = ">"; } $('#totalTime').text(formatTimeSeconds(audio_player.duration)); element.value = newdisplay; } function trackEnded(){ //reset the playControl to 'play' document.getElementById("playControl").value=">"; } function durationClicked(event){ //get the position of the event clientX = event.clientX; left = event.currentTarget.offsetLeft; clickoffset = clientX - left; percent = clickoffset/event.currentTarget.offsetWidth; duration_seek = percent*audio_duration; document.getElementById("aplayer").currentTime=duration_seek; } function Progress(evt){ $('#progress').val(Math.round(evt.loaded / evt.total * 100)); var width = $('#duration_background').css('width') $('#loader').css('width', evt.loaded / evt.total * width.replace("px","")); } function getPosition(name) { var obj = document.getElementById(name); var topValue = 0, leftValue = 0; while (obj) { leftValue += obj.offsetLeft; obj = obj.offsetParent; } finalvalue = leftValue; return finalvalue; } function SetValues() { var xPos = xMousePos; var divPos = getPosition("duration_background"); var divWidth = xPos - divPos; var Totalwidth = $('#duration_background').css('width').replace("px","") audio_player.currentTime = divWidth / Totalwidth * audio_duration; $('#duration_bar').css('width', divWidth); } </script> </head> <script type="text/javascript" src="js/MousePosition.js" ></script> <body onLoad="pageLoaded();"> <table> <tr> <td valign="bottom"><input id="playButton" type="button" onClick="playClicked(this);" value=">"/></td> <td colspan="2" class="style1" valign="bottom"> <div id='player'> <div id="duration" class='player_control' > <div id="duration_background" onClick="SetValues();"> <div id="loader" style="background-color: #00FF00; width: 0px;"></div> <div id="duration_bar" class="duration_bar"></div> </div> </div> </div> </td> </tr> <tr> <td> </td> <td> <span id="currentTime">0:00</span> </td> <td align="right" > <span id="totalTime">0:00</span> </td> </tr> </table> <audio id='aplayer' src='<%=getDownloadLink() %>' type="audio/ogg; codecs=vorbis" onProgress="Progress(event);" onTimeUpdate="update();" onEnded="trackEnded();" > <b>Your browser does not support the <code>audio</code> element. </b> </audio> </body>

    Read the article

  • Using max-width = 100% and max-height = 100% on an image, calculate the display width/height

    - by NatalieMac
    I am creating a slideshow for images of various sizes to display centered vertically and horizontally within a canvas area. In my CSS, I set the width and height of the image to 100% so that each image would proportionally fill the canvas. I want the canvas to auto-size itself to fit within the viewer's screensize as the original size of the images is quite large (up to 800 pixels tall). I am using jQuery 1.4, and using the height of the image to calculate the top value for absolute positioning it to the middle of the canvas. I have tried using jQuery to get the .height(), innerHeight(), and outerHeight(), but it always gets the full size of the image. I extracted the DOM element from the jQuery object and tried using .width, .offsetWidth, and .clientWidth, but that too always seems to return the full size of the image. Firebug displays the correct dimensions, so I know there's some way of calculating the actual display height of the image, I just can't figure out what it is. How do you get the actual display height of an image if you've set max-height = 100%? I didn't want to have to calculate and set the height of each image in the js, but if I have to, I will. It just seems like I should be able to set the canvas size and have the images auto-adjust.

    Read the article

  • Why does a non-dynamically created iframe shim show, but a dynamically created one does not?

    - by Carter
    I have a custom control that is made up of a text field and the ajax control toolkit dateextender. In IE6 I'm hitting the z-index bug where the calendar is showing behind select boxes. If I have the shim sitting in the control, initially hidden, it seems to display fine when the calendar is shown, but when I try to dynamically create the shim on showing it doesn't appear. I've tried bgiframe and some examples I found on SO, no luck. Here is my javascript code currently... var dateEditorShim; function dateEditor_OnShown(dateControl, emptyEventArgs) { var shimWidth = dateControl._width; var shimHeight = dateControl._height; //var dateEditorShim; //dateEditorShim = document.getElementById(dateEditorShimId); dateEditorShim = document.createElement('iframe'); dateEditorShim.setAttribute('src', 'javascript:"";'); dateEditorShim.setAttribute('frameBorder', '0'); dateEditorShim.style.width = dateControl._popupDiv.offsetWidth; dateEditorShim.style.height = dateControl._popupDiv.offsetHeight; dateEditorShim.style.top = dateControl._popupDiv.style.top; dateEditorShim.style.left = dateControl._popupDiv.style.left; dateControl._popupDiv.style.zIndex = 999; dateEditorShim.style.zIndex = 998; dateEditorShim.style.display = "block"; } function dateEditor_OnHiding(dateControl, emptyEventArgs) { var shimWidth = 0; var shimHeight = 0; //var dateEditorShim; //dateEditorShim = document.getElementById(dateEditorShimId); dateEditorShim.style.width = 0; dateEditorShim.style.height = 0; dateEditorShim.style.top = 0; dateEditorShim.style.left = 0; dateEditorShim.style.display = "none"; } You'll notice I have a commented out bit of code that gets an iframe that is embedded into the page, as I said, in this case the iframe at least shows up, but when I dynamically create it like the code above currently, it doesn't. I'm trying to figure out why. Any ideas?

    Read the article

1 2  | Next Page >