try{document.execCommand("BackgroundImageCache",false,true)}catch(e){};$(function(){Site.init()});var Site={tabindex:3,init:function(){Site.layout('body')},layout:function(e){var $element=$(e);if($.browser.msie){$('form.fancy input.auto, form.fancy input.datepicker',$element).each(function(){$t=$(this);$t.wrap("<div class='iconinput' style='background-image:"+$t.css('background-image')+";'/>").css({backgroundImage:'none',paddingRight:'0'})})}$('#footer .menu_built',$element).each(function(){var maxheight=0;$(this).children('.menu_col').each(function(){var h=$(this).height();if(h>maxheight){maxheight=h}});$(this).children('.menu_col').css({height:maxheight+'px'})});$('.menulist',$element).each(function(){var maxheight=0;$(this).find('.menugroup').each(function(){var h=$(this).height();if(h>maxheight){maxheight=h}});$(this).find('.menugroup').css({height:maxheight+'px'});maxheight+=10;$(this).parents('.menudisplay:first').css({height:maxheight+'px'})});$('#menu .menudisplay',$element).hide().each(function(){$(this).prepend("<a href='#close' class='close'>Close</a>")});$('#menu .close',$element).click(function(){var rel=$(this).attr('rel');return Site.menus.toggle(rel)});$('#toplinks a, .bcrumb_wrap a',$element).click(function(){var rel=$(this).attr('rel');return Site.menus.toggle(rel)});$('.tagselect a',$element).click(function(){var $field=$(this).parents('li:first').find('input');var $add=$(this).text();$field.val($field.val()+$add+', ');$field.trigger('change');return false});$('#toplinks a',$element).each(function(){$(this).attr('tabindex',Site.tabindex);Site.tabindex++});$('.tooltip,.bodycontent abbr',$element).tooltip({track:true,delay:0,showURL:false,fade:0,showBody:" - "});$("a.fancybox",$element).fancybox();$('ul,ol',$element).find('li:last').addClass('last-child');$('form',$element).each(function(){var $f=$(this);$f.validate({errorElement:"span",submitHandler:function(myform){myform.submit()}})});$('#keywordsearch',$element).click(function(){var val=$(this).val();if(val=='Enter Keyword'){$(this).val('').css('color','#333')}}).blur(function(){var val=$(this).val();if(val==''){$(this).val('Enter Keyword').css('color','#A4A4A4')}});$('#button_all_time',$element).fadeTo(0,'0.5').click(function(){$(this).fadeTo('fast','1');$('#button_pop_month').fadeTo('fast','0.5');$('#pop_all_time').slideDown();$('#pop_monthly').slideUp()});$('#button_pop_month',$element).click(function(){$(this).fadeTo('fast','1');$('#button_all_time').fadeTo('fast','0.5');$('#pop_all_time').slideUp();$('#pop_monthly').slideDown()});$('.datepicker',$element).datepicker({dateFormat:'dd MM yy',duration:'',minDate:new Date(1960,1-1,1),changeYear:true,changeMonth:true});$('div.dialog',$element).each(function(){var $e=$(this);$.metadata.setType("class");var w=$e.metadata().w;var h=$e.metadata().h;$e.dialog({autoOpen:false,modal:true,zIndex:400000,shadow:false,width:(w?parseInt(w,10):400),height:(h?parseInt(h,10):'auto'),title:$e.attr('title'),dragStart:function(event,ui){$('iframe',$e).not('.hidden').hide()},dragStop:function(event,ui){$('iframe',$e).not('.hidden').show()},resizeStart:function(event,ui){$('iframe',$e).not('.hidden').hide()},resizeStop:function(event,ui){$('iframe',$e).not('.hidden').show()}})});$('a.dialog',$element).click(function(){var rel=$(this).attr('rel');var link=$(this).attr('href');Site.dialog(rel,link);return false});$('table.sortable',$element).tablesorter({widgets:['zebra']});Site.credits()},dialog:function(rel,link){var external=$("#"+rel).hasClass('external');if(external){$("#"+rel).show().html("<iframe src='"+link+"' name='"+rel+"' width='100%' height='100%' frameborder='0' border='0'></iframe>").dialog('open');return}if(link){if(link.indexOf('http')>=0){$("#"+rel).html("");$.get(link,function(result){$("#"+rel).html(result).show().dialog('open');Site.layout("#"+rel);result=null});return}}$("#"+rel).show().dialog('open')},menus:{toggle:function(rel){var $element=$('#menu .drop_'+rel).parents('.menudisplay:first');if($element.length){var $close=$('.close',$element);$close.attr('rel',rel);$('#menu .menudisplay').not($element).hide();$element.css('position','static');if($element.is(':visible')){$close.fadeOut('fast');$element.slideUp()}else{$close.fadeIn('slow');$element.slideDown()}return false}else{return true}}},credits:function(){$(window).konami(function(){$('body').append('<div id="konami"><div id="konamic" class="external dialog {w:500, h:550}"></div></div>');Site.layout('#konami');Site.dialog('konamic','/?/home/credits')})}};(function($){$.fn.konami=function(callback,code){if(code==undefined)code="38,38,40,40,37,39,37,39,66,65";return this.each(function(){var kkeys=[];$(this).keydown(function(e){kkeys.push(e.keyCode);if(kkeys.toString().indexOf(code)>=0){$(this).unbind('keydown',arguments.callee);callback(e)}},true)})}})(jQuery);


