var hostedOverlay=null;var commentTpl=$.template('<li class="${altClass}"><div class="user"><div class="avatar"><a href="${profile_url}"><img src="${avatar}" width="20px" height="20px"/></a></div><a href="${profile_url}" class="userlink">${name}</a> <span>${date}</span></div><div class="comment"><p>${comment}</p></div></li>');function initHostedTriggers(){$(".hosted-trigger").overlay({onBeforeLoad:function(){$("#mediadisp").hide();hostedOverlay=this},expose:{color:"#aaa",loadSpeed:"fast",opacity:0.6},top:"center",target:"#hosted-overlay",closeOnClick:false,api:true})}function closeHostedForm(){hostedOverlay.close();$("#mediadisp").show()}function displayUnwrappedSWF(D,C,A,B){flashembed("mediadisp",{src:D,width:C,height:A,bgcolor:B})}function displaySWF(K,B,D,L,O,F,I,H,N,A,M,G){if(G==1){displayUnwrappedSWF("http://"+F+"/media/"+K,D,L,O)}else{if(typeof(userSource)!="undefined"&&userSource=="forum"){var J="http://"+F+"/gamewrap32.swf";var E='"src": "'+J+'","width": "'+D+'","height": "'+L+'","bgcolor": "'+O+'"';var C='"quality":"high","menu":"false","eswf": "'+K+'", "eid": "'+B+'", "wroot": "'+F+'","sroot": "'+I+'","eb": "'+H+'"';if(A.length>0){if(E.length>0){E+=","}E+=A}if(M.length>0){if(C.length>0){C+=","}C+=M}C="{"+C+"}";E="{"+E+"}";flashembed("mediadisp",$.parseJSON(E),$.parseJSON(C))}else{if(typeof(fbuid)!="undefined"&&typeof(fbsid)!="undefined"){var J="http://"+F+"/fbgamewrap32.swf";var E='"src": "'+J+'","width": "'+D+'","height": "'+L+'","bgcolor": "'+O+'"';var C='"quality":"high","menu":"false","eswf": "'+K+'", "eid": "'+B+'", "wroot": "'+F+'","sroot": "'+I+'","eb": "'+H+'","fbuid": "'+fbuid+'","fbkey": "'+fbkey+'","fbsid": "'+fbsid+'"';if(A.length>0){if(E.length>0){E+=","}E+=A}if(M.length>0){if(C.length>0){C+=","}C+=M}C="{"+C+"}";E="{"+E+"}";flashembed("mediadisp",$.parseJSON(E),$.parseJSON(C))}else{fbEnsureInit(function(){var V=FB.getSession();var S="";var R=V?V.uid:0;var P=V?V.session_key:"";var T="http://"+F+"/fbgamewrap32.swf";var U='"src": "'+T+'","width": "'+D+'","height": "'+L+'","bgcolor": "'+O+'"';var Q='"quality":"high","menu":"false","eswf": "'+K+'", "eid": "'+B+'", "wroot": "'+F+'","sroot": "'+I+'","eb": "'+H+'","fbuid": "'+R+'","fbkey": "'+S+'","fbsid": "'+P+'"';if(A.length>0){if(U.length>0){U+=","}U+=A}if(M.length>0){if(Q.length>0){Q+=","}Q+=M}Q="{"+Q+"}";U="{"+U+"}";flashembed("mediadisp",$.parseJSON(U),$.parseJSON(Q))})}}}}function voteMedia(B,A){$("#vote-msg").show();$("#vote-msg").html(_msg.voting);$.getJSON(masterSiteUrl+"ajaxService?callback=?",{cmd:"voteMedia",id:B,vote:A,rnd:Math.random()},function(C){if(C.results[0].success){$("#rating").html(C.results[0].rating_new);$("#stars").css("width",""+(C.results[0].rating_new*30)+"px");$("#vote-msg").html(_msg.thanks_for_voting).animate({opacity:1},3000).fadeOut("slow")}else{if(C.results[0].error!=""){$("#vote-msg").html(C.results[0].error)}else{$("#vote-msg").html(_msg.error)}}})}function passMedia(B,A){$("#pass-game").fadeOut(300,function(){$(this).remove()});$("#fail-game").fadeOut(300,function(){$(this).remove()});setTimeout(function(){if(A=="pass"){$("#game-vote").html('<div class="pass-full"></div>')}else{if(A=="fail"){$("#game-vote").html('<div class="fail-full"></div>')}}},300);$.getJSON(masterSiteUrl+"ajaxService?callback=?",{cmd:"passMedia",id:B,vote:A,rnd:Math.random()})}function hideCurrentStars(){$("#stars").hide()}function displayCurrentStars(){$("#stars").show()}function getMediaComments(){$(".comment-cont").loadmask("Loading...");$.getJSON(masterSiteUrl+"ajaxService?callback=?",{cmd:"findForumComments",mediaid:mediaid},function(A){if(A.comments.length>0){$("#comments").find("ul").html("");$.each(A.comments,function(C,D){var B="";if(C%2!=0){B="alt"}if(!D.profile_url){D.profile_url=defaultAvatar}$("#comments").find("ul").append(commentTpl,{name:D.name,avatar:D.avatar,comment:D.comment,altClass:B,profile_url:D.profile_url})})}$("#comments").show();$(".comment-cont").unmask()})}function addFavouriteMedia(A){$.getJSON(masterSiteUrl+"ajaxService?callback=?",{cmd:"addFavouriteMedia",mediaid:A},function(B){$("#fav").html("Added")})};