function get_scaled_size(d,a,e,b,c){if(d<=e&&a<=b&&!c){return[d,a]}if(c){e+=SH;b+=SH}a*=1;d*=1;k=c?Math.max(e/d,b/a):Math.min(e/d,b/a);w=Math.floor(d*k);h=Math.floor(a*k);if(w==0){w=1}if(h==0){h=1}return[w,h]}$(document).ready(function(){$("ul.sf-menu").superfish();$("#language").bind("change",function(){$.cookie("lang",$(this).val(),{expires:365,path:"/",domain:".imageshack.us"});location.reload()});var b=function(){if(jQuery.trim($("#searchfield").val()).length){$("#searchform").attr("action","http://imageshack.us/photos/"+jQuery.trim($("#searchfield").val()));$("#searchfield").remove();$("#searchbutton img").remove();$("#searchform").submit()}};$("#searchbutton").bind("click",function(g){b()});$("#searchfield").bind("keydown",function(i){var g=(i.keyCode?i.keyCode:i.which);if(g==13){b()}}).bind("focus",function(g){if($("#searchfield").val().toLowerCase()=="search"){$("#searchfield").val("")}});var c=function(){if(jQuery.trim($("#searchfield2").val()).length){$("#searchform2").attr("action","http://imageshack.us/photos/"+jQuery.trim($("#searchfield2").val()));$("#searchfield2").remove();$("#searchbutton2 img").remove();$("#searchform2").submit()}};$("#searchbutton2").bind("click",function(g){c()});$("#searchfield2").bind("keydown",function(i){var g=(i.keyCode?i.keyCode:i.which);if(g==13){c()}}).bind("focus",function(g){if($("#searchfield2").val().toLowerCase()=="search"){$("#searchfield2").val("")}});var f=function(l){$("#login_dialog .error").hide();var i=jQuery.trim($("#l_login").val());var j=jQuery.trim($("#l_password").val());var g=($("#stay_logged_in").attr("checked"))?"true":"";if(!i.length){$("#l_no_user_error").show();return}if(!j.length){$("#l_no_pass_error").show();return}$.post("/auth.php",{username:i,password:j,stay_logged_in:g,format:"json"},function(o){if(o.status){var m=$.cookie("isvisitor");if(m!=null&&m.length>2){if(m==$.cookie("myimages")){if(pageTracker){pageTracker._trackEvent("visitor","revisits");pageTracker._trackEvent("visitor",m)}}else{if(pageTracker){pageTracker._trackEvent("visitor",$.cookie("myimages"));pageTracker._trackEvent("visitor","uniqueuser")}$.cookie("isvisitor",$.cookie("myimages"),{expires:365,path:"/",domain:".imageshack.us"})}}else{$.cookie("isvisitor",$.cookie("myimages"),{expires:365,path:"/",domain:".imageshack.us"});if(pageTracker){pageTracker._trackEvent("visitor","uniqueuser")}}l.dialog("close");var n=jQuery.trim($.cookie("wheretogo"));if(n==""){document.location.reload()}else{$.cookie("wheretogo","",{expires:-1,path:"/",domain:".imageshack.us"});location.href=n}}else{$("#l_auth_failed_error").show()}},"json")};$("#okbtn_login").bind("click",function(g){f($(this));g.stopPropagation();g.preventDefault()});var e=$("#okbtn_login").val();var a=$("#cancelbtn_login").val();var d={};$("#login_dialog").dialog({autoOpen:false,modal:true,resizable:false,width:400,buttons:d,open:function(){$(".ads").hide();$(".flash").hide();$("#l_no_user_error").hide();setTimeout(function(){$("#_l_user").focus()},100)},close:function(){$(".ads").show();$(".flash").show()}});$("#btnlogin,#btnlogin2,#menu_myimages,#signin").live("click",function(g){if($(this).attr("id")=="menu_myimages"){if($.cookie("myimages")){return}else{$.cookie("wheretogo","http://my.imageshack.us/v_images.php",{expires:365,path:"/",domain:".imageshack.us"})}}$("#login_dialog").dialog("open");$(".ui-widget-overlay").fadeTo(0,0);$(".ui-dialog-titlebar").fadeTo(0,0);$("#login_dialog").fadeTo(0,0);$(".ui-widget-overlay").fadeTo(300,0.45);$(".ui-dialog-titlebar").fadeTo(700,1);$("#login_dialog").fadeTo(700,1);g.stopPropagation();g.preventDefault()});$("#signup").live("click",function(g){location.href="http://register.imageshack.us"});$("#l_login,#l_password").bind("keydown",function(i){var g=(i.keyCode?i.keyCode:i.which);if(g==13){f($("#login_dialog"));i.stopPropagation();i.preventDefault()}});$("#dropbox_login").bind("click",function(g){$("#login_dialog").dialog("open");$(".ui-widget-overlay").fadeTo(0,0);$(".ui-dialog-titlebar").fadeTo(0,0);$("#login_dialog").fadeTo(0,0);$(".ui-widget-overlay").fadeTo(300,0.45);$(".ui-dialog-titlebar").fadeTo(700,1);$("#login_dialog").fadeTo(700,1);g.stopPropagation();g.preventDefault()})});function set_cookie(c,e,g,d){if(g){var b=new Date();b.setTime(b.getTime()+(g*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}var f=c+"="+e+a+"; path=/";if(d){f+="; domain="+d}document.cookie=f}function focussearch(b,a){if(b.value==a){b.value="";b.style.color="black"}}function enablead(){if(document.getElementById("ad")){document.getElementById("ad").style.visibility="visible"}}function disablead(){if(document.getElementById("ad")){document.getElementById("ad").style.visibility="hidden"}}function showBottomAd(a){if(document.getElementById("ymaddiv")){if(a){document.getElementById("ymaddiv").style.visibility="visible"}else{document.getElementById("ymaddiv").style.visibility="hidden"}}}(function(b){b.fn.superfish=function(m){var g=b.fn.superfish,l=g.c,f=b(['<span class="',l.arrowClass,'"> &#187;</span>'].join("")),j=function(){var c=b(this),n=d(c);clearTimeout(n.sfTimer);c.showSuperfishUl().siblings().hideSuperfishUl()},e=function(){var c=b(this),p=d(c),n=g.op;clearTimeout(p.sfTimer);p.sfTimer=setTimeout(function(){n.retainPath=(b.inArray(c[0],n.$path)>-1);c.hideSuperfishUl();if(n.$path.length&&c.parents(["li.",n.hoverClass].join("")).length<1){j.call(n.$path)}},n.delay)},d=function(c){var n=c.parents(["ul.",l.menuClass,":first"].join(""))[0];g.op=g.o[n.serial];return n},i=function(c){c.addClass(l.anchorClass).append(f.clone())};return this.each(function(){var c=this.serial=g.o.length;var p=b.extend({},g.defaults,m);p.$path=b("li."+p.pathClass,this).slice(0,p.pathLevels).each(function(){b(this).addClass([p.hoverClass,l.bcClass].join(" ")).filter("li:has(ul)").removeClass(p.pathClass)});g.o[c]=g.op=p;b("li:has(ul)",this)[(b.fn.hoverIntent&&!p.disableHI)?"hoverIntent":"hover"](j,e).each(function(){if(p.autoArrows){i(b(">a:first-child",this))}}).not("."+l.bcClass).hideSuperfishUl();var n=b("a",this);n.each(function(o){var q=n.eq(o).parents("li");n.eq(o).focus(function(){j.call(q)}).blur(function(){e.call(q)})});p.onInit.call(this)}).each(function(){var c=[l.menuClass];if(g.op.dropShadows&&!(b.browser.msie&&b.browser.version<7)){c.push(l.shadowClass)}b(this).addClass(c.join(" "))})};var a=b.fn.superfish;a.o=[];a.op={};a.IE7fix=function(){var c=a.op;if(b.browser.msie&&b.browser.version>6&&c.dropShadows&&c.animation.opacity!=undefined){this.toggleClass(a.c.shadowClass+"-off")}};a.c={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",arrowClass:"sf-sub-indicator",shadowClass:"sf-shadow"};a.defaults={hoverClass:"sfHover",pathClass:"overideThisToUse",pathLevels:1,delay:50,animation:{opacity:"show"},speed:1100,autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};b.fn.extend({hideSuperfishUl:function(){var e=a.op,d=(e.retainPath===true)?e.$path:"";e.retainPath=false;var c=b(["li.",e.hoverClass].join(""),this).add(this).not(d).removeClass(e.hoverClass).find(">ul").hide().css("visibility","hidden");e.onHide.call(c);return this},showSuperfishUl:function(){var e=a.op,d=a.c.shadowClass+"-off",c=this.addClass(e.hoverClass).find(">ul:hidden").css("visibility","visible");a.IE7fix.call(c);e.onBeforeShow.call(c);c.animate(e.animation,e.speed,function(){a.IE7fix.call(c);e.onShow.call(c)});return this}})})(jQuery);jQuery.cookie=function(b,l,o){if(typeof l!="undefined"){o=o||{};if(l===null){l="";o.expires=-1}var e="";if(o.expires&&(typeof o.expires=="number"||o.expires.toUTCString)){var f=new Date();if(typeof o.expires=="number"){f.setTime(f.getTime()+(o.expires*24*60*60*1000))}else{f.setTime(o.expires.toUTCString)}e="; expires="+f.toUTCString()}var n=o.path?"; path="+(o.path):"";var g=o.domain?"; domain="+(o.domain):"";var a=o.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(l),e,n,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var m=document.cookie.split(";");for(var j=0;j<m.length;j++){var c=jQuery.trim(m[j]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};
