var $background=1;$(function()
{$("a.unsubscribe").live('click',function(ev){ev.preventDefault();ev.stopPropagation();$username=$(this).attr('id');$.post("subscribe.php?u="+$username+"&k="+$("#cache").val(),function($data)
{if($data=="0")
{$("a.unsubscribe").text("Subscribe").removeClass("unsubscribe").addClass("subscribe");}});});$("a.subscribe").live('click',function(ev){ev.preventDefault();ev.stopPropagation();$username=$(this).attr('id');$.post("subscribe.php?s="+$username+"&k="+$("#cache").val(),function($data)
{if($data=="0")
{$("a.subscribe").text("Unsubscribe").removeClass("subscribe").addClass("unsubscribe");}});});$("a.userInfo").live('click',function(ev){ev.preventDefault();ev.stopPropagation();$username=$(this).html();$("#user-info-text").html("");$("#user-info-text").load("userinfo.php",{user:$username});$("#user-info").dialog({height:420,width:605,title:$username,modal:true});});$("input:submit").button();$("#openchat").click(function(){$("#chatwindow").toggle();if(!($("#chatwindow").is(":visible")))
{$.post("chatusers.php?a=clear",{},function(){});}
else
{$.post("chatusers.php?a=show",{},function(data){$(".userbox").html(data);});$.post("chat.php",{},function(data){$("#screen").html(data);});}});$("#message-box").keyup(function(event){if(event.keyCode==13){$.post("chat.php",{message:$("#message-box").val()},function(data)
{$("#screen").html(data);$("#message-box").val("");});}});$(".video").click(function(){$.fancybox({'padding':0,'autoScale':false,'transitionIn':'none','transitionOut':'none','title':this.title,'width':640,'height':385,'href':this.href.replace(new RegExp("watch\\?v=","i"),'v/'),'type':'swf','swf':{'wmode':'transparent','allowfullscreen':'true'}});return false;});});function update()
{if($("#chatwindow").is(":visible"))
{$last=$("#screen .message:first-child").attr("id");$.post("chat.php",{last:$last},function(data){$("#screen").prepend(data);});$.post("chatusers.php?a=show",{},function(data){$(".userbox").html(data);});}
setTimeout('update()',4500);}
function chatonline()
{$.post("chatonline.php",{},function(data){$("#chatCount").html(data);});setTimeout('chatonline()',10000);}
