function selectText(element){var text=document.getElementById(element);if($.browser.msie){var range=document.body.createTextRange();range.moveToElementText(text);range.select();}else if($.browser.mozilla||$.browser.opera){var selection=window.getSelection();var range=document.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}else if($.browser.safari){var selection=window.getSelection();selection.setBaseAndExtent(text,0,text,1);}}
function lform(){if($('#lf').length==0){$('.m').prepend('<div id="lf"><img src="http://s.disqy.com/s/ajax.gif"></div>');$('#lf').load('http://disqy.com/parts/inlogform.php',function(){$('#lf img').remove();});}else{$('#lf').remove();}}
function addSite()
{$('#av').hide();$('.aerror').remove();$('#hh').append('<img src="http://s.disqy.com/s/ajax1.gif">');$.ajax({type:"GET",url:"http://disqy.com/inc/video-data.php",data:$('#av').serialize(),success:function(msg){$('#hh img').remove();obj=$.parseJSON(msg);if(typeof obj.exists!='undefined')
{window.location='http://disqy.com/'+obj.exists+'&exists=true';}else if(typeof obj.error!='undefined'&&obj.error!=null)
{$('#av').fadeIn();$('#av').append('<div class="aerror">'+obj.error+'</div>');}else if(typeof obj.finden!='undefined')
{$('#av').fadeIn();$('#av').append('<div class="aerror">'+obj.finden+'</div>');}else
{window.location='http://disqy.com/'+obj.full+'&exists=false';}}});}
function attach(i,id)
{switch(i){case 1:var el='hh';break;case 2:var el='hp';break;}
if($('#'+el).length==0){$('.'+el).append('<div id="'+el+'"><img src="http://s.disqy.com/s/ajax.gif" style="float:right;margin: 9px 0 0;"></div>');$('#'+el).load('/parts/aform.php?f='+i+'&id='+id,function(){$('#'+el+' img').remove()});}else
{$('#'+el).remove();}}
function addPlaylist(type,id,vid)
{$('#av').hide();$('.aerror').remove();$('#hp').append('<img src="http://s.disqy.com/s/ajax1.gif">');if(id==null&&type==5)
{$.ajax({type:"GET",url:"http://disqy.com/inc/ajax-request.php?type="+type+"&video_id="+vid,data:$('#av').serialize(),success:function(msg){$('#hp img').remove();obj=$.parseJSON(msg);if(typeof obj.succ==='undefined')
{$('#av').append('<div class="aerror">'+obj.err+'</div>');$('#av').fadeIn();}else
{$('.plists').append('<div class="pli"><input type="checkbox" checked onclick="addPlaylist(6,'+obj.id+','+vid+')" id="b'+obj.id+'"><span onclick="addPlaylist(6,'+obj.id+','+vid+')">'+obj.name+'</span></div>');$('#pl').val('');$('#av').fadeIn();}}});}else
{$.ajax({type:"GET",url:"http://disqy.com/inc/ajax-request.php?type="+type+"&id="+id+"&video_id="+vid,success:function(msg){$('#hp img').remove();obj=$.parseJSON(msg);if(typeof obj.succ==='undefined')
{$('#av').append('<div class="aerror">'+obj.err+'</div>');$('#av').fadeIn();}else
{if(obj.w=='check'){$('#b'+id).attr('checked',true);}else
{$('#b'+id).attr('checked',false);}
$('#av').fadeIn();}}});}}
function fav(id,t)
{if(t==0){$.ajax({type:"GET",url:"http://disqy.com/inc/ajax-request.php?type=2",data:"id="+id,success:function(html)
{$('.v').append(html);$('.v').addClass('vu').removeClass('v');}});}else{$.ajax({type:"GET",url:"http://disqy.com/inc/ajax-request.php?type=4",data:"id="+id,success:function(html){$('.vu').append(html);$('.vu').addClass('v').removeClass('vu');}});}}
function sC(vid,type)
{$('#commentform').hide();$('.aerror').remove();$('#new-comment').append('<img src="http://s.disqy.com/s/ajax.gif">');$.ajax({type:"POST",url:"http://disqy.com/inc/ajax-request.php?type=7&area="+type+"&video_id="+vid,data:$('#commentform').serialize(),success:function(msg){$('#new-comment img').remove();obj=$.parseJSON(msg);if(typeof obj.succ==='undefined')
{$('#new-comment').append('<div class="error">'+obj.err+'</div>');$('#commentform').fadeIn();}else
{$('#new-comment').html(obj.succ);}}});}
function scrollalert(pid,page,count)
{var st=$('.pl').attr('scrollTop');var sh=$('.pl').attr('scrollHeight');var wh=$('.pl').attr('clientHeight');var so=10;if(st>=(sh-(wh+so))&&$('.fload').length==0)
{$('#content').append('<div class="fload"></div>');$.get('/inc/ajax-request.php?type=8&pid='+pid+'&count='+count+'&page='+page,function(html){obj=$.parseJSON(html);$('#content').append(obj.videos);$('.fload').remove();if(obj.next_page>0){clearTimeout(to);scrollalert(pid,obj.next_page,count);}else{clearTimeout(to);}});}
var to=setTimeout('scrollalert('+pid+','+page+','+count+');',1500);}
function sV(e,h,t,tiny,full)
{$('.ms div').remove();$('.ms').load('/inc/form-video.php?h='+h+'&e='+e,function(){$('.ms div').fadeIn()});$('#vi').load('/inc/new-share.php?t='+t+'&tiny='+tiny+'&full='+full,function(){});}
function show(id,h,e,full)
{if($('#v'+id+' #hvid').length==0){$.get('/inc/expand.php?id='+id+'&h='+h+'&e='+e+'&full='+full,function(html){$('#v'+id).append(html);});}else
{$('#v'+id+' #hvid').remove();}}
function react(id){$('#react').val(id);for(i=1;i<=9;i++){if(i!=id){$('#t'+i).removeClass('rcd').addClass('rc');}
else{$('#t'+i).removeClass('rc').addClass('rcd');}}}
