function initialiseLogging(){jQuery.fn.log=function(b){try{if(console!=null){console.log("%s: %o",b,this)}}catch(a){}$("#logging").append(b+"
");return this};$("body").prepend("
");$(window).keypress(function(a){if(a!=null&&a.which==93&&a.ctrlKey){$("#logging").toggle()}else{if(window.event!=null&&window.event.keyCode==29&&window.event.ctrlKey==true){$("#logging").toggle()}else{}}})}function Dim(){this.width=0;this.height=0}function getDocumentDimension(){var a=new Dim();if(typeof window.innerWidth!="undefined"){a.width=window.innerWidth;a.height=window.innerHeight}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){a.width=document.documentElement.clientWidth;a.height=document.documentElement.clientHeight}else{a.width=document.getElementsByTagName("body")[0].clientWidth;a.height=document.getElementsByTagName("body")[0].clientHeight}}return a}function getStyleProp(a,e){var c=$("");$(document.body).append(c);c.addClass(a);var b=c.css(e);c.remove();return b}function getStylePropAsInt(b,c){var a=getStyleProp(b,c);return parseInt(a.substring(0,a.indexOf("px")))}function stripUrl(d){var c=d.toLowerCase().indexOf("url(");var a=d.indexOf(")",c);if(c>=0&&a>c){var b=d.substring(c+4,a);if(b.indexOf('"')>=0||b.indexOf('"')){b=b.substring(1,b.length-1)}return b}else{return d}}function log(b){try{$("").log(b)}catch(a){}$("#logging").append(b+"
")}function removeCSS(a){}function loadCSS(b){var a=document.getElementsByTagName("head")[0];$(document.createElement("link")).attr({type:"text/css",href:b,rel:"stylesheet",media:"screen"}).appendTo(a)}function isIPhone(){if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){return true}}function isIPad(){return navigator.platform=="iPad"}function isIE(){return navigator.appName=="Microsoft Internet Explorer"}function loadjscssfile(a,b){if(b=="js"){var c=document.createElement("script");c.setAttribute("type","text/javascript");c.setAttribute("src",a)}else{if(b=="css"){var c=document.createElement("link");c.setAttribute("rel","stylesheet");c.setAttribute("type","text/css");c.setAttribute("href",a)}}if(typeof c!="undefined"){document.getElementsByTagName("head")[0].appendChild(c)}}function hsv2rgb(h,d,c){var e,m,k,g,j,b,a,l;h%=360;if(c==0){return({r:0,g:0,v:0})}d/=100;c/=100;h/=60;g=Math.floor(h);j=h-g;b=c*(1-d);a=c*(1-(d*j));l=c*(1-(d*(1-j)));if(g==0){e=c;m=l;k=b}else{if(g==1){e=a;m=c;k=b}else{if(g==2){e=b;m=c;k=l}else{if(g==3){e=b;m=a;k=c}else{if(g==4){e=l;m=b;k=c}else{if(g==5){e=c;m=b;k=a}}}}}}e=Math.floor(e*255);m=Math.floor(m*255);k=Math.floor(k*255);return({r:e,g:m,b:k})}function rgb2hsv(c,k,h){var j,b,g,d,e,a,b;c/=255;k/=255;h/=255;j=Math.min(Math.min(c,k),h);b=Math.max(Math.max(c,k),h);if(j==b){return({h:undefined,s:0,v:b*100})}g=(c==j)?k-h:((k==j)?h-c:c-k);d=(c==j)?3:((k==j)?5:1);e=Math.floor((d-g/(b-j))*60)%360;a=Math.floor(((b-j)/b)*100);b=Math.floor(b*100);return({h:e,s:a,v:b})}function RGBtoHex(b,a,c){return toHex(b)+toHex(a)+toHex(c)}function toHex(a){if(a==null){return"00"}a=parseInt(a);if(a==0||isNaN(a)){return"00"}a=Math.max(0,a);a=Math.min(a,255);a=Math.round(a);return"0123456789ABCDEF".charAt((a-a%16)/16)+"0123456789ABCDEF".charAt(a%16)};