
function remember_video_echo(playlist_id){if(document.getElementById('rv_'+playlist_id)){document.getElementById('rv_'+playlist_id).className='remember_video_on';}}
function remember_video(page_id,playlist_id){var type='';if(document.getElementById('rv_'+playlist_id).className=='remember_video_on'){type=0;}else{type=1;}
$.get("http://kimikiss.ru/ajax/remember_video/"+page_id+"/"+playlist_id+"/"+type+"/",function(data){remember_video_change(page_id,playlist_id,data);});}
function remember_video_change(page_id,playlist_id,data){var myCars=new Array();myCars[0]='Не удалось отправить голос';myCars[1]='Не удалось отправить голос';myCars[2]='Голос отдан успешно';myCars[3]='Выполните вход';myCars[4]='Не верный запрос';myCars[98]='Критическая ошибка, обратитесь к Администратору';myCars[99]='Выполните вход';var style='';if(data==2){if(document.getElementById('rv_'+playlist_id).className=='remember_video_on'){style='remember_video';}else{style='remember_video_on';}
document.getElementById('rv_'+playlist_id).className=style;}else{alert('Выполните вход');}}
function online_status_first(){online_status_loop();setInterval(online_status_loop,120000);}
function online_status_loop(){$.get("http://kimikiss.ru/ajax/refresh_online/");updateLiveInternetCounter();}
function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;}
function lightsoff(){$('body').append('<div id="lightsoff-background"></div>');var page_size=getPageSize();$('#lightsoff-background').css({backgroundColor:"#000",opacity:0.9,width:page_size[2],height:page_size[1]}).show();$('#lightsoff-background').click(function(){$('#lightsoff-background').fadeOut(function(){$('#lightsoff-background').remove();});return false;});return false;}
function vidLoc(id,link,type,play)
{var close=false;var title='';var lights_off='';if(document.getElementById('ep'+link).className=='eps'){if(link>0){if(link%2!=0){document.getElementById('ep'+link).className='ep1';}else{document.getElementById('ep'+link).className='ep2';}}
close=true;}else{document.getElementById('ep'+link).className='eps';}
title='<b style="color: #FFFFFF;">'+document.getElementById('vt_'+link).innerHTML+'</b><br />';if(close==false){if(type==1){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 493px; background-color: #000000; z-index: 2000; position: relative;text-align: center;">'+title+'<OBJECT width="640" height="493"><PARAM name="movie" value="http://video.rutube.ru/'+id+'"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/'+id+'" type="application/x-shockwave-flash" wmode="window" width="640" height="493" allowFullScreen="true" allowScriptAccess="sameDomain" bgcolor="#000000"></EMBED><param name="bgcolor" value="#000000" /></OBJECT></div><br /><br />';}else if(type==2){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative;text-align: center;">'+title+'<object width="640" height="480" type="application/x-shockwave-flash" data="http://img.mail.ru/r/video2/uvpv2.swf?2" ><param name="movie" value="http://img.mail.ru/r/video2/uvpv2.swf?2" /><param name="flashvars" value="movieSrc='+id+'" /><param name="devicefont" value="false"/><param name="menu" value="false"/><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="bgcolor" value="#000000" /></object></div><br /><br />';}else if(type==3){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 538px; background-color: #000000; z-index: 2000; position: relative;text-align: center;"><object width="640" height="538" style="z-index: 2000; position: relative; background-color: #000000;"><param name="movie" value="'+id+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="allowFullScreen" value="true" /><param name="wmode" value="window" /><param name="allowScriptAccess" value="always" /><embed src="'+id+'" allowFullScreen="true" width="640" height="538" type="application/x-shockwave-flash" quality="high" bgcolor="#000000" align="middle" allowScriptAccess="always" allowFullScreen="true" wmode="window"></embed></object></div>';}else if(type==4){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative;text-align: center;">'+title+'<object width="640" height="480" id="object_'+play+link+'"><param name="movie" value="http://v.kiwi.kz/v/'+id+'/"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="http://v.kiwi.kz/v/'+id+'" type="application/x-shockwave-flash" width="640" height="480" allowFullScreen="true" allowScriptAccess="always"  wmode="transparent" bgcolor="#000000"></embed><param name="bgcolor" value="#000000" /></object></div><br /><br />';}else if(type==5){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative;text-align: center;">'+title+'<iframe title="YouTube video player" class="youtube-player" type="text/html" width="640" height="480" src="http://www.youtube.com/embed/'+id+'?rel=0" frameborder="0" allowFullScreen></iframe></div><br /><br />';}else if(type==6){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative;text-align: center;">'+title+'<iframe src="'+id+'" width="640" height="480" frameborder="0"></iframe></div><br /><br />';}else if(type==7){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 510px; background-color: #000000; z-index: 2000; position: relative;text-align: center;">'+title+'<embed src="http://video.sibnet.ru/shell.swf?videoid='+id+'" quality="high" bgcolor="#000000" width="640" height="510" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowfullscreen="true" allowScriptAccess="always" wmode="opaque" flashvars=""></embed></div><br /><br />';}else if(type==8){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 500px; background-color: #000000; z-index: 2000; position: relative;text-align: center;">'+title+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="640" height="500" id="test_draw" align="middle"><param name="allowFullScreen" value="true"><PARAM NAME=FlashVars VALUE="'+id+'"><param name="movie" value="http://i3.i.ua/video/vp4.swf?12" /><PARAM NAME="AllowScriptAccess" VALUE="always" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="http://i3.i.ua/video/vp4.swf?12" FlashVars="'+id+'"  quality="high" bgcolor="#000000" width="640" height="500" allowFullScreen="true" AllowScriptAccess="always" name="test_draw" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></div><br /><br />';}else if(type==9){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 500px; background-color: #000000; z-index: 2000; position: relative;text-align: center;">'+title+'<object id="videoplayer'+id+'" type="application/x-shockwave-flash" data="http://animekun.ru/flash/uppod_0_9_5_9.swf" class="embededvideo" width="640" height="480" wmode="opaque"><param name="bgcolor" value="#000000" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="opaque"><param name="movie" value="http://animekun.ru/flash/uppod_0_9_5_9.swf" /><param name="flashvars" value="st=http://animekun.ru/flash/uppod_0_9_5_9.txt&amp;file='+id+'" /></object></div><br /><br />';}else if(type==10){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 445px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object width="640" height="445"><param name="movie" value="http://vimple.ru/api/flash/loader/'+id+'" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="window" /><param name="allowFullScreen" value="true" /><embed src="http://vimple.ru/api/flash/loader/'+id+'" allowFullScreen="true" wmode="window" width="640" height="445" type="application/x-shockwave-flash" bgcolor="#000000"></embed><param name="bgcolor" value="#000000" /></object></div><br /><br />';}else if(type==11){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<iframe frameborder="0" width="640" height="480" src="'+id+'"></iframe></div><br /><br />';}else if(type==12){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object width="640" height="480" ><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.facebook.com/v/'+id+'" /><embed src="http://www.facebook.com/v/'+id+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="480" bgcolor="#000000"></embed><param name="bgcolor" value="#000000" /></object></div><br /><br />';}else if(type==13){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 505px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<iframe width="640" height="505" src="http://www.livestream.com/embed/'+id+'?layout=4&width=640&height=505&autoplay=false&hideInfo=true&showMoreVideos=false&browseMode=false&hideChannelBranding=true&mode=false&allowchat=false&lschannel=true&textLines=2" style="border:0;outline:0;background-color:#000000;" frameborder="0" scrolling="no"></iframe></div><br /><br />';}else if(type==14){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 385px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object height="385" width="640" style="z-index: 2000; position: relative; background-color: #000000;" type="application/x-shockwave-flash" data="http://video.namba.kz/swf/player/3.2.7/flowplayer-3.2.7.swf"><param value="true" name="allowfullscreen"><param value="opaque" name="wmode"><param value="always" name="allowscriptaccess"><param name="src" value="http://video.namba.kz/swf/player/3.2.7/flowplayer-3.2.7.swf" /><param value="config=http://video.namba.kz/flashvars-3.2.7.php?i='+id+'" name="flashvars"><param name="bgcolor" value="#000000" /></object></div><br /><br />';}else if(type==15){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 515px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="640" height="515" id="player" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="videoID='+id+'" /><param name="movie" value="http://openfile.ru/video/player4/player.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="http://openfile.ru/video/player4/player.swf" quality="high" bgcolor="#000000" width="640" height="515" name="player" align="middle" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" flashvars="videoID='+id+'" /></object></div><br /><br />';}else if(type==16){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 515px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="640" height="515" id="player" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="videoID='+id+'" /><param name="movie" value="http://whitecdn.org/player/76fb851c2e71150f8f38a1af23c55b86/player.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="http://whitecdn.org/player/76fb851c2e71150f8f38a1af23c55b86/player.swf" quality="high" bgcolor="#000000" width="640" height="515" name="player" align="middle" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" flashvars="videoID='+id+'" /></object></div><br /><br />';}else if(type==17){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 515px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object id="player" width="640" height="505" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ><param name="movie" value="http://www.videobb.com/e/'+id+'" ></param><param name="allowFullScreen" value="true" ></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.videobb.com/e/'+id+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505" bgcolor="#000000"></embed><param name="bgcolor" value="#000000" /></object></div><br /><br />';}else if(type==18){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object id="player" width="640" height="480" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ><param name="movie" value="http://videozer.com/embed/'+id+'" ></param><param name="allowFullScreen" value="true" ></param><param name="allowscriptaccess" value="always"></param><embed src="http://videozer.com/embed/'+id+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="480" bgcolor="#000000"></embed><param name="bgcolor" value="#000000" /></object></div><br /><br />';}else if(type==19){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 360px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="640" height="360" id="24video_player_f7c51f1e69336bb6957bc87023b6dffd_1331382" name="player"><param name="movie" value="http://www.24video.net/player/28.04.10/new24_play.swf" /><param name="quality" value="high" /><param name="flashVars" value="id='+id+'&idHtml=/video/xml/&idView=/video/view/&rootUrl=http://www.24video.net&playerCode=/video/playerCode/&playerPath=/player/28.04.10/new24_play.swf" /><param name="allowFullScreen" value="true" /><param name="AllowScriptAccess" value="always"><param name="wmode" value="opaque"><embed bgcolor="#000000" src="http://www.24video.net/player/28.04.10/new24_play.swf" name="embed" width="640" height="360" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" flashVars="id='+id+'&idHtml=/video/xml/&idView=/video/view/&rootUrl=http://www.24video.net&playerCode=/video/playerCode/&playerPath=/player/28.04.10/new24_play.swf" allowFullScreen="true" AllowScriptAccess="always" wmode="opaque"/><param name="bgcolor" value="#000000" /></object></div><br /><br />';}else if(type==20){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<embed src="http://kinostok.tv/v/'+id+'" bgcolor="#000000" wmode="transparent" FlashVars="skin=skins/minimal" width="640" height="480" allowscriptaccess="always" allowfullscreen="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" /></embed></div><br /><br />';}else if(type==21){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object width="640" height="480"><param name="video" value="http://static.video.yandex.ru/lite/asura77/4yx3fco7bf.4623/"/><param name="allowFullScreen" value="true"/><param name="scale" value="noscale"/><param name="bgcolor" value="#000000" /><embed src="http://static.video.yandex.ru/lite/asura77/4yx3fco7bf.4623/" type="application/x-shockwave-flash" width="640" height="480" allowFullScreen="true" scale="noscale" bgcolor="#000000"></embed></object></div><br /><br />';}else if(type==22){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<iframe title="Twitvid video player" class="twitvid-player" type="text/html" width="640" height="480" src="http://www.twitvid.com/embed.php?guid='+id+'&autoplay=0" frameborder="0"></iframe></div><br /><br />';}else if(type==23){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<object width="640" height="480"><param name="movie" value="http://www.megavideo.com/v/'+id+'"></param><param name="allowFullScreen" value="true"></param><param name="bgcolor" value="#000000" /><embed src="http://www.megavideo.com/v/'+id+'" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="480" bgcolor="#000000"></embed></object></div><br /><br />';}else if(type==24){document.getElementById('player'+play+link).innerHTML='<div style="width: 640px; height: 480px; background-color: #000000; z-index: 2000; position: relative; text-align: center;">'+title+'<iframe src="http://player.vimeo.com/video/'+id+'?title=0&amp;byline=0&amp;portrait=0&amp;color=000000" width="640" height="480" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div><br /><br />';}
document.getElementById('player'+play+link).innerHTML=document.getElementById('player'+play+link).innerHTML+'<a id="lightsoff" href="#" onClick="return lightsoff()">Выключить свет</a><br />';}else{document.getElementById('player'+play+link).innerHTML='';}}
function page_vote(page_id,type,vote_hash,vote_time){$.get("http://kimikiss.ru/ajax/page_votes/"+page_id+"/"+type+"/"+vote_hash+"/"+vote_time+"/",function(data){page_vote_change(page_id,data);});}
function page_vote_change(page_id,data){var color='';var myCars=new Array();myCars[0]='Не удалось отправить голос';myCars[1]='Выполните вход';myCars[2]='Голос отдан успешно';myCars[3]='Повторный голос не засчитывается';myCars[4]='Голосование на этой странице отключено';myCars[5]='Нельзя голосовать за себя';myCars[6]='Время голосования истекло';myCars[7]='Обновите страницу';myCars[98]='Критическая ошибка, обратитесь к Администратору';myCars[99]='Выполните вход';data_array=data.split('|||')
if(data_array[1]=='+'){color='page_vote_score_plus';}else if(data_array[1]=='-'){color='page_vote_score_minus';}else{color='page_vote_score_neutral';}
if(data_array[0]=='2'){document.getElementById('page_vote-'+page_id).innerHTML=data_array[1]+'&nbsp;'+data_array[2]+' &nbsp;&nbsp;('+data_array[3]+') ';document.getElementById('page_vote-'+page_id).className=color;}else{document.getElementById('page_vote-'+page_id).innerHTML=myCars[data];}
if(data_array[0]=='2'&&data_array[4]!='0'){document.getElementById('page_vote_plus1-'+page_id).innerHTML='';document.getElementById('page_vote_plus1-'+page_id).className='';document.getElementById('page_vote_plus2-'+page_id).innerHTML='';document.getElementById('page_vote_plus2-'+page_id).className='';document.getElementById('page_vote_plus3-'+page_id).innerHTML='';document.getElementById('page_vote_plus3-'+page_id).className='';document.getElementById('page_vote_minus1-'+page_id).innerHTML='';document.getElementById('page_vote_minus1-'+page_id).className='';document.getElementById('page_vote_minus2-'+page_id).innerHTML='';document.getElementById('page_vote_minus2-'+page_id).className='';document.getElementById('page_vote_minus3-'+page_id).innerHTML='';document.getElementById('page_vote_minus3-'+page_id).className='';}}
function ment_vote(ment_id,type,vote_hash,vote_time){$.get("http://kimikiss.ru/ajax/mention_votes/"+ment_id+"/"+type+"/"+vote_hash+"/"+vote_time+"/",function(data){ment_vote_change(ment_id,data);});}
function ment_vote_change(ment_id,data){var color='';var myCars=new Array();myCars[0]='Не удалось отправить голос';myCars[1]='Выполните вход';myCars[2]='Голос отдан успешно';myCars[3]='Повторный голос не засчитывается';myCars[4]='Голосование на этой странице отключено';myCars[5]='Нельзя голосовать за себя';myCars[6]='Время голосования истекло';myCars[7]='Обновите страницу';myCars[98]='Критическая ошибка, обратитесь к Администратору';myCars[99]='Выполните вход';data_array=data.split('|||')
if(data_array[1]=='+'){color='ment_vote_score_plus';}else if(data_array[1]=='-'){color='ment_vote_score_minus';}else{color='ment_vote_score_neutral';}
if(data_array[0]=='2'){document.getElementById('mention_vote-'+ment_id).innerHTML=data_array[1]+'&nbsp;'+data_array[2]+' &nbsp;&nbsp;('+data_array[3]+') ';document.getElementById('mention_vote-'+ment_id).className=color;}else{document.getElementById('mention_vote-'+ment_id).innerHTML=myCars[data];}
if(data_array[0]=='2'&&data_array[4]!='0'){document.getElementById('mention_vote_plus-'+ment_id).innerHTML='';document.getElementById('mention_vote_plus-'+ment_id).className='';document.getElementById('mention_vote_minus-'+ment_id).innerHTML='';document.getElementById('mention_vote_minus-'+ment_id).className='';}}
var imageTag=false;var theSelection=false;var clientPC=navigator.userAgent.toLowerCase();var clientVer=parseInt(navigator.appVersion);var is_ie=((clientPC.indexOf('msie')!=-1)&&(clientPC.indexOf('opera')==-1));var is_win=((clientPC.indexOf('win')!=-1)||(clientPC.indexOf('16bit')!=-1));var baseHeight;function helpline(help)
{document.forms[form_name].helpbox.value=help_line[help];}
function initInsertions()
{var doc;if(document.forms[form_name])
{doc=document;}
else
{doc=opener.document;}
var textarea=doc.forms[form_name].elements[text_name];if(is_ie&&typeof(baseHeight)!='number')
{textarea.focus();baseHeight=doc.selection.createRange().duplicate().boundingHeight;if(!document.forms[form_name])
{document.body.focus();}}}
function bbstyle(bbnumber)
{if(bbnumber!=-1)
{bbfontstyle(bbtags[bbnumber],bbtags[bbnumber+1]);}
else
{insert_text('[*]');document.forms[form_name].elements[text_name].focus();}}
function bbfontstyle(bbopen,bbclose)
{theSelection=false;var textarea=document.forms[form_name].elements[text_name];textarea.focus();if((clientVer>=4)&&is_ie&&is_win)
{theSelection=document.selection.createRange().text;if(theSelection)
{document.selection.createRange().text=bbopen+theSelection+bbclose;document.forms[form_name].elements[text_name].focus();theSelection='';return;}}
else if(document.forms[form_name].elements[text_name].selectionEnd&&(document.forms[form_name].elements[text_name].selectionEnd-document.forms[form_name].elements[text_name].selectionStart>0))
{mozWrap(document.forms[form_name].elements[text_name],bbopen,bbclose);document.forms[form_name].elements[text_name].focus();theSelection='';return;}
var caret_pos=getCaretPosition(textarea).start;var new_pos=caret_pos+bbopen.length;insert_text(bbopen+bbclose);if(!isNaN(textarea.selectionStart))
{textarea.selectionStart=new_pos;textarea.selectionEnd=new_pos;}
else if(document.selection)
{var range=textarea.createTextRange();range.move("character",new_pos);range.select();storeCaret(textarea);}
textarea.focus();return;}
function insert_text(text,spaces,popup)
{var textarea;if(!popup)
{textarea=document.forms[form_name].elements[text_name];}
else
{textarea=opener.document.forms[form_name].elements[text_name];}
if(spaces)
{text=' '+text+' ';}
if(!isNaN(textarea.selectionStart))
{var sel_start=textarea.selectionStart;var sel_end=textarea.selectionEnd;mozWrap(textarea,text,'')
textarea.selectionStart=sel_start+text.length;textarea.selectionEnd=sel_end+text.length;}
else if(textarea.createTextRange&&textarea.caretPos)
{if(baseHeight!=textarea.caretPos.boundingHeight)
{textarea.focus();storeCaret(textarea);}
var caret_pos=textarea.caretPos;caret_pos.text=caret_pos.text.charAt(caret_pos.text.length-1)==' '?caret_pos.text+text+' ':caret_pos.text+text;}
else
{textarea.value=textarea.value+text;}
if(!popup)
{textarea.focus();}}
function attach_inline(index,filename)
{insert_text('[attachment='+index+']'+filename+'[/attachment]');document.forms[form_name].elements[text_name].focus();}
function addquote(post_id,username)
{var message_name='message_'+post_id;var theSelection='';var divarea=false;if(document.all)
{divarea=document.all[message_name];}
else
{divarea=document.getElementById(message_name);}
if(window.getSelection)
{theSelection=window.getSelection().toString();}
else if(document.getSelection)
{theSelection=document.getSelection();}
else if(document.selection)
{theSelection=document.selection.createRange().text;}
if(theSelection==''||typeof theSelection=='undefined'||theSelection==null)
{if(divarea.innerHTML)
{theSelection=divarea.innerHTML.replace(/<br>/ig,'\n');theSelection=theSelection.replace(/<br\/>/ig,'\n');theSelection=theSelection.replace(/&lt\;/ig,'<');theSelection=theSelection.replace(/&gt\;/ig,'>');theSelection=theSelection.replace(/&amp\;/ig,'&');}
else if(document.all)
{theSelection=divarea.innerText;}
else if(divarea.textContent)
{theSelection=divarea.textContent;}
else if(divarea.firstChild.nodeValue)
{theSelection=divarea.firstChild.nodeValue;}}
if(theSelection)
{insert_text('[quote="'+username+'"]'+theSelection+'[/quote]');}
return;}
function mozWrap(txtarea,open,close)
{var selLength=txtarea.textLength;var selStart=txtarea.selectionStart;var selEnd=txtarea.selectionEnd;var scrollTop=txtarea.scrollTop;if(selEnd==1||selEnd==2)
{selEnd=selLength;}
var s1=(txtarea.value).substring(0,selStart);var s2=(txtarea.value).substring(selStart,selEnd)
var s3=(txtarea.value).substring(selEnd,selLength);txtarea.value=s1+open+s2+close+s3;txtarea.selectionStart=selEnd+open.length+close.length;txtarea.selectionEnd=txtarea.selectionStart;txtarea.focus();txtarea.scrollTop=scrollTop;return;}
function storeCaret(textEl)
{if(textEl.createTextRange)
{textEl.caretPos=document.selection.createRange().duplicate();}}
function colorPalette(dir,width,height)
{var r=0,g=0,b=0;var numberList=new Array(6);var color='';numberList[0]='00';numberList[1]='40';numberList[2]='80';numberList[3]='BF';numberList[4]='FF';document.writeln('<table cellspacing="1" cellpadding="0" border="0">');for(r=0;r<5;r++)
{if(dir=='h')
{document.writeln('<tr>');}
for(g=0;g<5;g++)
{if(dir=='v')
{document.writeln('<tr>');}
for(b=0;b<5;b++)
{color=String(numberList[r])+String(numberList[g])+String(numberList[b]);document.write('<td bgcolor="#'+color+'">');document.write('<a href="#" onclick="bbfontstyle(\'[color=#'+color+']\', \'[/color]\'); return false;" onmouseover="helpline(\'s\');"  onmouseout="helpline(\'tip\');"><img src="images/spacer.gif" width="'+width+'" height="'+height+'" alt="#'+color+'" title="#'+color+'" /></a>');document.writeln('</td>');}
if(dir=='v')
{document.writeln('</tr>');}}
if(dir=='h')
{document.writeln('</tr>');}}
document.writeln('</table>');}
function caretPosition()
{var start=null;var end=null;}
function getCaretPosition(txtarea)
{var caretPos=new caretPosition();if(txtarea.selectionStart||txtarea.selectionStart==0)
{caretPos.start=txtarea.selectionStart;caretPos.end=txtarea.selectionEnd;}
else if(document.selection)
{var range=document.selection.createRange();var range_all=document.body.createTextRange();range_all.moveToElementText(txtarea);var sel_start;for(sel_start=0;range_all.compareEndPoints('StartToStart',range)<0;sel_start++)
{range_all.moveStart('character',1);}
txtarea.sel_start=sel_start;caretPos.start=txtarea.sel_start;caretPos.end=txtarea.sel_start;}
return caretPos;}
var form_name='mentions';var text_name='text';var bbcode=new Array();var bbtags=new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[spoiler]','[/spoiler]');function pasteN(t){if(t!=''&&document.mentions.text)document.mentions.text.value+="[quote "+t+"][/quote]\n"}
if(document.selection||document.getSelection){Q=true}else{var Q=false}
var txt=''
function copyQ(){txt=''
if(document.getSelection&&(document.getSelection()!='')){txt='[quote]'+document.getSelection()+'[/quote]\n\n'}
else if(document.selection&&(document.selection.createRange().text!='')){txt='[quote]'+document.selection.createRange().text+'[/quote]\n\n'}}
function pasteQ(){if(document.mentions.text){document.mentions.text.value+=txt}}
function checkSumbit(){if(document.mentions.text!='')document.mentions.Submit.disabled=FALSE;else document.mentions.Submit.disabled=TRUE;}
function get_images(id){if(document.mentions.name)
var name=document.mentions.name.value;if(document.mentions.email)
var email=document.mentions.email.value;if(document.mentions.site)
var site=document.mentions.site.value;if(document.mentions.text)
var text=document.mentions.text.value;var div=document.getElementById('comments_form');var olddiv=document.getElementById('comments_form');olddiv.parentNode.removeChild(olddiv);document.getElementById('mention-block-'+id).innerHTML+='<div id="comments_form">'+div.innerHTML+'</div>';if(name)document.mentions.name.value=name;if(email)document.mentions.email.value=email;if(site)document.mentions.site.value=site;if(text)document.mentions.text.value=text;return;}
function get_selected()
{var txt='';var foundIn='';if(window.getSelection){txt=window.getSelection();foundIn='window.getSelection()';}else if(document.getSelection){txt=document.getSelection();foundIn='document.getSelection()';}else if(document.selection){txt=document.selection.createRange().text;foundIn='document.selection.createRange()';}
return txt;}
function quoteName(id)
{get_images(id);var t=document.getElementById('mention-user-'+id);if(t.innerText){to=t.innerText;}else if(t.innerHTML){to=t.innerHTML;}
var text=document.mentions.text.value;var sep='';if(text.length>3){if((text.charAt(text.length-1)+text.charAt(text.length))!="\n"){sep="\n\n";}}
document.mentions.text.focus();document.mentions.text.value+=sep+"[b]"+to+"[/b], ";}
function quoteText(id)
{var quote=new String(get_selected());qq=quote;get_images(id);var d=document.getElementById('mention-text-'+id);if(!d)return;if(quote=='')
{if(d.innerHTML){quote=d.innerHTML;quote=quote.replace(/<[^>]+>/gi,function(m){return m.toLowerCase();});}else if(d.innerText){quote=d.innerText;quote=quote.replace(/<[^>]+>/gi,function(m){return m.toLowerCase();});}}
quote=quote.replace(/\r\n/gi,"\n");quote=quote.replace(/\r/gi,"\n");quote=quote.replace(/<br[^>]*>\\n/gi,"\n");quote=quote.replace(/<br[^>]*>\n/gi,"\n");quote=quote.replace(/<br[^>]*>/gi,"\n");quote=quote.replace(/\<br \/\>\\n/gi,"\n");quote=quote.replace(/\<br \/\>\n/gi,"\n");quote=quote.replace(/\<br \/\>/gi,"\n");quote=quote.replace(/\<br\>\\n/gi,"\n");quote=quote.replace(/\<br\>\n/gi,"\n");quote=quote.replace(/\<br\>/gi,"\n");quote=quote.replace(/ sourceindex\=\"([^\"]+)\"/gi,"");quote=quote.replace(/\<i\>([^<]+)\<\/i\>/gi,"[i]$1[/i]");quote=quote.replace(/\<b\>([^<]+)\<\/b\>/gi,"[b]$1[/b]");quote=quote.replace(/\<strong\>([^<]+)\<\/strong\>/gi,"[b]$1[/b]");quote=quote.replace(/\<font class\=\"spoiler\"\>([^<]+)\<\/font\>/gi,"[spoiler]$1[/spoiler]");quote=quote.replace(/\<font class\=spoiler\>([^<]+)\<\/font\>/gi,"[spoiler]$1[/spoiler]");for($i=0;$i<20;$i++){quote=quote.replace(/\<blockquote\>([^<]+)\<\/blockquote\>/gi,"[quote]$1[/quote]");}
quote=quote.replace(/<[^>]+>/g,"");var t=document.getElementById('mention-user-'+id);if(t.innerText){to=t.innerText;}else if(t.innerHTML){to=t.innerHTML;}
var text=document.mentions.text.value;var sep='';if(text.length>3){if((text.charAt(text.length-1)+text.charAt(text.length))!="\n"){sep="\n\n";}}
if(qq=='')
{document.mentions.text.focus();document.mentions.text.value+=sep+"[quote][b]Кому: #"+id+", "+to+"[/b]:\n"+quote+"[/quote]\n\n";}else
{document.mentions.text.focus();if(document.mentions.text.value=='')document.mentions.text.value+=sep+"[quote]"+quote+"[/quote]\n\n";else document.mentions.text.value+=sep+"[quote]"+quote+"[/quote]\n\n";}}
function copyToClipboard(text,playlist_id){document.getElementById('download_input_'+playlist_id).value=text;document.getElementById('download_div_'+playlist_id).className='download_div';}
function show_rutube(id,code){location.href='#videoblock'+id;document.getElementById('videoblock'+id).innerHTML='<div style="width: 640px; height: 493px; background-color: #000000; z-index: 2000; position: relative;"><OBJECT width="640" height="493"><PARAM name="movie" value="http://video.rutube.ru/'+code+'"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/'+code+'" type="application/x-shockwave-flash" wmode="window" width="640" height="493" allowFullScreen="true" allowScriptAccess="sameDomain"></EMBED></OBJECT></div><br /><br />';document.getElementById('videoblock'+id).innerHTML=document.getElementById('videoblock'+id).innerHTML+'<div style="text-align: center;"><a id="lightsoff" href="#" onClick="return lightsoff()">Выключить свет</a></div><br />';return;}
function show_youtube(id,code){location.href='#videoblock'+id;document.getElementById('videoblock'+id).innerHTML='<br /><object width="640" height="390"><param name="movie" value="http://www.youtube.com/v/'+code+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+code+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="390"></embed></object><br /><br />';return;}
function ajax_url_loader_refresh(url,content_id,button_id){var stateObj={foo:"bar"};var save_button=$('#'+button_id).html();$('#'+button_id).html('<img src="/images/ajax-loader.gif" width="16" height="16" border="0" alt="" title="" /> Загрузка...');$('#'+content_id).load(url+' #'+content_id,function(){$('#'+button_id).html(save_button);history.pushState(stateObj,false,url);});updateLiveInternetCounter();}
function ajax_mentions_loader_refresh(url,content_id,button_id){var stateObj={foo:"bar"};var save_button=$('#'+button_id).html();$('#'+button_id).html('<img src="/images/ajax-loader.gif" width="16" height="16" border="0" alt="" title="" /> Загрузка...');get_images('save');$('#'+content_id).load(url+' #'+content_id,function(){$('#'+button_id).html(save_button);history.pushState(stateObj,false,url);});updateLiveInternetCounter();}
function ajax_smiles(name,container){var url='/smiles'+name+'.html';$('#'+container).html('<img src="/images/ajax-loader.gif" width="16" height="16" border="0" alt="" title="" /> Загрузка...');$('#'+container).load(url);}
function share42(f,u,t){if(!u)u=location.href;if(!t)t=document.title;u=encodeURIComponent(u);t=encodeURIComponent(t);document.write('<div id="share42">');var s=new Array('"#" onclick="window.open(\'http://vkontakte.ru/share.php?url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=200, top=200, width=554, height=421, toolbar=0, status=0\');return false" title="Поделиться В Контакте"','"http://www.facebook.com/sharer.php?u='+u+'&t='+t+'" title="Поделиться в Facebook"','"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl='+u+'&title='+t+'" title="Добавить в Одноклассники"','"http://www.liveinternet.ru/journal_post.php?action=n_add&cnurl='+u+'&cntitle='+t+'" title="Опубликовать в LiveInternet"','"http://share.yandex.ru/go.xml?service=moikrug&url='+u+'&title='+t+'" title="Поделиться в Мой Круг"','"http://connect.mail.ru/share?url='+u+'&title='+t+'" title="Поделиться в Моем Мире@Mail.Ru"','"http://www.livejournal.com/update.bml?event='+u+'&subject='+t+'" title="Опубликовать в LiveJournal"','"http://twitter.com/share?text='+t+'&url='+u+'" title="Добавить в Twitter"','"http://my.ya.ru/posts_add_link.xml?URL='+u+'&title='+t+'" title="Поделиться в Я.ру"','"http://zakladki.yandex.ru/newlink.xml?url='+u+'&name='+t+'" title="Добавить в Яндекс.Закладки"','"http://bobrdobr.ru/add.html?url='+u+'&title='+t+'" title="Забобрить"','"" onclick="return fav(this);" title="Сохранить в избранное браузера"','"http://www.feedburner.com/fb/a/emailFlare?loc=ru_RU&itemTitle='+t+'&uri='+u+'" title="Отправить на e-mail другу"','"#" onclick="print();return false" title="Распечатать"','"http://kimikiss.ru/rss.rss" title="Подписаться на RSS сайта"');for(i=0;i<s.length;i++)document.write('<a rel="nofollow" style="display:inline-block;width:24px;height:24px;margin:0 7px 7px 0;background:url('+f+'icons.png) -'+24*i+'px 0" href='+s[i]+' target="_blank"></a>');document.write('</div>');}function fav(a){title=document.title;url=document.location;try{window.external.AddFavorite(url,title);}catch(e){try{window.sidebar.addPanel(title,url,"");}catch(e){if(typeof(opera)=="object"){a.rel="sidebar";a.title=title;a.url=url;return true;}else{alert('Нажмите Ctrl-D, чтобы добавить страницу в закладки');}}}return false;}
function updateLiveInternetCounter(){var liCounter=new Image(1,1);liCounter.src='//counter.yadro.ru/hit?r='+
((typeof(screen)=='undefined')?'':';s'+screen.width+'*'+screen.height+'*'+(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+';u'+escape(document.URL)+';'+Math.random();}
