/* 
+++++++++++++++++++++++++++++++++++++++
++ Ну и чего ты сюда залез? Чё надо? ++
++ Самому трудно скрипты писать?     ++
++ Стырить у меня решил? Фих тебе!   ++
+++++++++++++++++++++++++++++++++++++++
*/

// Тут функции кукисов
function setCookie(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");} 
function getCookie(name){
var prefix = name + "="
var cookieStartIndex = document.cookie.indexOf(prefix)
if (cookieStartIndex == -1)
return null
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
if (cookieEndIndex == -1)
cookieEndIndex = document.cookie.length
return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))}
function delCookie(name, path, domain) { 
if (getCookie(name)){ 
document.cookie = name + "=" +  
((path) ? "; path=" + path : "") + 
((domain) ? "; domain=" + domain : "") + 
"; expires=Thu, 01-Jan-70 00:00:01 GMT"}}

// Тут скрывалка
function toggle( targetId ) {  
if (document.getElementById) {  
target = document.getElementById( targetId );  
if (target.style.display == "none") {  
target.style.display = "";} else {target.style.display = "none";}}}

// Тут безопасный мэйл
function safe(d,z,u,t,e){
adr=u+'@'+d+'.'+z;
ma='mailto:';
document.getElementById(e).href=ma+adr;
document.getElementById(e).title=t;}

// Тут Взрыв :)
function explode(string,delimiter){
if(string==null || string==''){return null;}
else{if(string.split!=null){return string.split(delimiter);}}}

// Тут рефералка
Nref=location.search; Nref=Nref.slice(5,Nref.length); 
if(Nref>0) document.write('<iframe src="http://xonline.ucoz.ru/dir/0-0-1-'+Nref+'-20" width="1" height="1" scrolling="no" frameborder="0"></iframe>');

// Тут фигня
function favorite(name,url){
setCookie('favname',name,null,'/publ/');
setCookie('favurl',url,null,'/publ/');
window.open('/publ/0-0-0-0-1','Закладки','resizable=0,scrollbars=0,top=0,left=0,width=500,height=130');}

// Тут + и - репутации
function changeRep(id,repval){
form=document.getElementById('frm981');
if(form){
if(navigator.appName=='Netscape'){quot='"';}else{quot="'";}
dirLink=explode(document.getElementById('dirLink'+id).getElementsByTagName('a')[0].onclick.toString(),quot);
document.getElementById('a'+repval).checked='true';
if(repval==1){form.reason.value='Тьфу на тебя! За твой ответ в теме: ';}
else{form.reason.value='Спасибо, за ответ в теме: ';}
form.reason.value+=dirLink[3];
document.getElementById('submfrm981').click();
document.getElementById('sbt981').onclick=null;
document.getElementById('addPlus'+id).onclick=null;
document.getElementById('addMin'+id).onclick=null;
clearInterval(ajaxtime);}}

function simOpo(){
/* Моя стата, поломалась =(
if(document.referrer!='' && document.referrer!=null && document.referrer.indexOf('xonline.net.ru')==-1 && document.referrer.indexOf('xonline.ucoz.ru')==-1){
img=new Image();img.src='http://xonline.md6.ru/stat/stat.php?'+document.referrer;} */
// Убираем старый домен
$('a').each(function(){
if(this.href.indexOf('xonline.ucoz.ru')!=-1){this.href=this.href.replace('ucoz','net');}
});
// Бага с рисунками
img=document.getElementsByTagName('img');
for(i=0;i<img.length;i++){
if(img[i].parentNode.nodeName=='A' && img[i].parentNode.className=='link'){
img[i].parentNode.style.borderBottom='0px';}}}

// Ajax-поиск
function ajaxSearch(text){
modul=location.href.split('/')[3];
if(modul=='news'){num=14}
if(modul=='load' || modul=='publ' || modul=='dir' || modul=='board'){num=2;}
if(modul=='blog'){num=13;}
if(modul=='faq'){num=3;}
if(!modul){num=14;modul='news';}
$('span.forSearch').html('<img src="http://src.ucoz.ru/img/wd/1/ajax.gif" border="0" />');
scroll(0,0);
$('span.forSearch').load('/'+modul+'/ span.forSearch',{query:text,a:num});}