// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} function posRight() {return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();}
/* http://www.codedigest.com/CodeDigest/75-String-ReplaceAll-function-in-JavaScript.aspx */
String.prototype.ReplaceAll = function(stringToFind,stringToReplace) { var temp = this; var index = temp.indexOf(stringToFind); while(index != -1) { temp = temp.replace(stringToFind,stringToReplace); index = temp.indexOf(stringToFind); } return temp; }
/* print_r */
function print_r(G,F,I,C){C=C||0;F=F||10;I=I||" ";if(C>F){return"[WARNING: Too much recursion]\n"}var D,A="",H=typeof G,B="";if(G===null){A+="(null)\n"}else{if(H=="object"){C++;for(D=0;D<C;D++){B+=I}if(G&&G.length){H="array"}A+="("+H+") :\n";for(D in G){try{A+=B+"["+D+"] : "+print_r(G[D],F,I,(C+1))}catch(E){return"[ERROR: "+E+"]\n"}}}else{if(H=="string"){if(G==""){G="(empty)"}}A+="("+H+") "+G+"\n"}}return A}var_dump=print_r
/* isNumeric */
function isNumeric(n) { return !isNaN(parseFloat(n)) && isFinite(n); }
/* debug log ($.log(message)) */
jQuery.log = function(message) { window.console ? console.debug(message) : alert(message) };
/* var_dump debug log ($.dump(message)) */
jQuery.dump = function(message) { window.console ? console.debug(print_r(message)) : alert(print_r(message)) };
/* pad a string */
function pad(number, length) { var str = '' + number; while (str.length < length) { str = '0' + str; } return str; }
