var site = 'http://hackerskill.net'; var resource = 'http://resource.hackerskill.net';
//var site = 'http://hackerskill'; var resource = 'http://hackerskill/resource';
$(document).ready(function() {
$('.resize img').each(function() {var ratio = 0; var i = 1; var owidth = $(this).width(); var oheight = $(this).height(); var width = $(this).width(); var height = $(this).height(); var is_resized = 0;
if(width > 700){ ratio = 700 / width; $(this).css("width", 700); $(this).css("height", height * ratio); height *= ratio; width *= ratio;  is_resized=1; }
if(height > 700){ ratio = 700/ height; $(this).css("height", 700); $(this).css("width", width * ratio); height *= ratio; width *= ratio; is_resized =1; }
if(is_resized) { $(this).attr("title","* คลิกที่รูปเพื่อ ขยาย/ย่อ"); $(this).css("cursor", "help"); }
$(this).click(function() { if(is_resized) { i++; if(i >= 2) { $(this).animate({ height: oheight, width: owidth }, 1500); i=0;} else { $(this).animate({ height: height, width: width }, 1500);} }});});
$('body a').tooltip({track: true,delay: 0,showURL: false,showBody: "",fade: 250});
$('body acronym').tooltip({track: true,delay: 0,showURL: false,showBody: "",fade: 250});
$('body img').tooltip({track: true,delay: 0,showURL: false,showBody: "",fade: 250 });
if($.cookie("topmenu") == '0') { $('#dmemcontext').css("display", "none"); }
$('.dmemswitch').click(function() { $('#dmemcontext').css("display", "relative"); $('#dmemcontext').toggle('blind','',350);if($.cookie("topmenu") == '1'){$.cookie("topmenu", '0');}else{$.cookie("topmenu", '1');}return false; });
$('.upshrink_ic').click(function() { $('#current_header_ic').toggle('bounce','',350); return false; });
var isvote = 0, isapp = 0;
$('#votepic').hover(function(){if(isvote==0){$(this).attr("src", resource+"/MidNight/images/vote2.gif");} }, function() {if(isvote==0){$(this).attr("src", resource+"/MidNight/images/vote1.gif");}});
$('img.apppic').hover(function(){if(isapp==0){$(this).attr("src", resource+"/MidNight/images/app2.gif");} }, function() {if(isapp==0){$(this).attr("src", resource+"/MidNight/images/app1.gif");}});
$('img.bm').hover(function(){$(this).attr("src", resource+"/MidNight/images/bm2.gif");}, function() {$(this).attr("src", resource+"/MidNight/images/bm1.gif");});
$('#votepic').click(function(){ if(isvote == 0) {isvote=1; $.get(site+'/rate/'+$('#tid').text()); $(this).attr("src", site+"/Themes/MidNight/images/vote3.gif"); $('.vtitle').html('<br>โหวตไม่ได้นะจ๊ะ'); $('.vtopresult').text(parseInt($('.vresult').text())+1); $('.vresult').text(parseInt($('.vresult').text())+1); } return false; });
$('.bbc_hl').hover(function(){$(this).css("background-image", "url("+resource+"/MidNight/images/bbc/bbc_hoverbg.gif)");}, function() {$(this).css("background-image", "url("+resource+"/MidNight/images/bbc/bbc_bg.gif)");});
$('img.reflect').reflect(); });
function approve(mid, id, user, color, session) { $.get(site+'/approve/'+mid+'/'+session, function(data){ if(data == 'refresh') { location.reload(); } }); user = '<a href="'+site+'/profile/'+id+'" title="ดูรายละเอียดของ '+user+'" style="color: '+color+';">'+user+'</a>'; $('.app2_'+mid).html('<img src="'+resource+'/MidNight/images/app3.gif"><br>ถูกใจใช่เลย!!</a>'); if($('.app_'+mid).html() != '') {$('.app_'+mid).html($('.app_'+mid).html()+', '+user); } else { $('.app_'+mid).html("<acronym title='ถูกใจ'><img src='"+resource+"/MidNight/images/approve.gif' alt=''>ถูกใจ (1) :</acronym> "+user); } $("a#click").onclick = function() { return false; } }
function bookmark(tid) {$.get(site+'/bookmarks/add/'+tid); $('.bm_'+tid).html('<img src="'+resource+'/MidNight/images/bm3.gif"><br>เก็บเข้าคลังเรียบร้อย!!</a>'); }