/*
function $(elid) {
     return document.getElementById(elid);
}
*/

var IE = document.all?true:false

function onetab(id){
	if(document.getElementById(id).style.display == 'none'){
		document.getElementById(id).style.display = 'block';
	}else{
		document.getElementById(id).style.display = 'none';
	}
}
function $$(elid) {
     return document.createElement(elid);
}
 
function  embedFlash(fileName, lib, tm, w, h,divid, nam)
{
	if (nam=="undefined")
	nam=""

var flob='<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="'+w+'" height="'+h+'" id="picture_'+nam+'"   align="middle">';
flob+='<param name="allowScriptAccess" value="sameDomain" />';
flob+='<param name="movie" value="'+fileName+'?' + tm + '" />';
flob+='<param name="quality" value="high" />';
flob+='<PARAM NAME=FlashVars VALUE="'+lib+'">';
flob+='<PARAM NAME=wmode VALUE="transparent">';
flob+='<param name="allowFullScreen" value="true" />';
flob+='<param name="AllowScriptAccess" value="always" />';
flob+='<param name="bgcolor" value="#eaeff4" />';
flob+='<embed src="'+fileName+'?' + tm + '" quality="high" AllowScriptAccess="always" allowFullScreen="true" wmode="transparent" FlashVars="'+lib+'" bgcolor="#eaeff4" width="'+w+'" height="'+h+'" name="picture_'+nam+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
flob+='</object>';
	if(divid && document.getElementById(divid))
		document.getElementById(divid).innerHTML = flob;
	else 
		document.write(flob);
}

var test = '';
var old;
var memold;
var subold;
var scrollis = false;
max_select_options_without_scroll = 50;

if(document.layers){
	window.captureEvents(Event.MOUSEUP);
	window.onmousedown = do_out;
}else{
	document.onmouseup = do_out;
}
function show_layer(x){
	if(document.layers){
		document.layers[x].display = "block";
	}else{
		var pp = getById(x);
    	var ap = getById(x+'_href');
		pp.style.display = "block";
	}
}
function hide_layer(x){
	if(document.layers){
		document.layers[x].display = "none";
	}else{
		var pp = getById(x);
    	var ap = getById(x+'_href');
		if(pp) pp.style.display = "none";
	}
}
function _scr_true(){
	scrollis = true;
}
function _scr_false(){
	scrollis = false;
}
function do_menu(x){
	var pp = getById(x);
	if(!old) old = memold;
	if(old != x){
 		var allcnt = 0;
		var childs = pp.childNodes;
		for(i=0; i<childs.length; i++) if(childs[i].nodeType==1) allcnt++;
		if(allcnt > max_select_options_without_scroll){
			pp.style.height = '207px';
			pp.style.overflow = 'auto';
			pp.style.overflow.x = 'hidden';
			pp.style.overflow.y = 'scroll';
		}
		pp.onmouseover = _scr_true;
		pp.onmouseout = _scr_false;
		show_layer(x);
		old=x;
	}else old = "";
}
function do_check(x){
	if(old && old!=x){
		hide_layer(old);
		show_layer(x);
		old = x;
	}
}
function do_out(){
	if(!scrollis){
		if(old){
			hide_layer(old);
		}
		memold = old; old="";
	}
}
function fxpos(x) {
    var ph = getById(x+'_href');
	var pp = getById(x);
    pp.style.left = ph.offsetWidth-15 + 'px';
}

function openselect(f_num,f_html){
	var ap = getById(f_num);
	if(ap){
		ap.innerHTML = f_html;
		ap.blur();
	}
	scrollis = false;
	return false;
}

function getById(id){
	return document.getElementById(id);
}

function ch_tab (nobj, holder, sel_cl, unsel_cl){
	if (sel_cl==""||sel_cl==undefined)
		sel_cl='listNewsParent_item_select';
	if (unsel_cl==""||unsel_cl==undefined)
		 unsel_cl='listNewsParent_item';
	var j=1
	var t = getById(nobj+"_"+ j) ;
	var sel = getById(nobj+"_"+holder);
	while (t&& t!="undefined"){
		if (sel.id==(nobj+'_'+j)){
            if(unsel_cl && t.className == unsel_cl)
    		 	t.className = sel_cl;
		 	getById(nobj+"_div_"+ j).style.display = 'block';
		}else{
            if(sel_cl && t.className == sel_cl)
    		 	t.className = unsel_cl;
 		 	getById(nobj+"_div_"+ j).style.display = 'none';
		}
		j++;
		t = getById(nobj+"_"+ j);
	}
    if(sel)
    	sel.blur();
}
function open_ajax(url,open_handler,params) {
	if(window.ActiveXObject) {
		h = new ActiveXObject("Microsoft.XMLHTTP");
        h.onreadystatechange = function() { if(h.readyState == 4) open_handler(h,params); }
		h.open('GET',url,true);
		h.send();
	} else {
		h = new XMLHttpRequest();
		h.onreadystatechange = function() { if(h.readyState == 4) open_handler(h,params); }
		h.open('GET',url,true);
		h.send(null);
	}
}

function open_sajax (url,open_handler,params) {
	if(window.ActiveXObject) {
		h = new ActiveXObject("Microsoft.XMLHTTP");
		h.open('GET',url,false);
		h.send();
		if(params) open_handler(h,params);
	} else {
		h = new XMLHttpRequest();
		h.open('GET',url,false);
		h.send(null);
		if(params) open_handler(h,params);
	}
}



function OpensPopup(popupurl,windowwidth,windowheight,content){
	var popWidth = 0;
	var popHeight= 0;
	popWidth = 870;
	if(windowwidth  == "") windowwidth = 670;
	if(windowheight == "") windowheight = 262;
	popHeight=Math.round((popWidth*windowheight)/(parseFloat(windowwidth)+0.01));
	if(windowwidth > popWidth || windowheight > popHeight){
		windowwidth  = popWidth;
		windowheight = popHeight;
	}
    var URL = popupurl;
    var windowName = "EnlargedImage";
	{if(windowheight != "0") windowheight = parseInt(windowheight) + 80;}
    var features = "top=10,left=10,width=" + windowwidth + ",height=" + windowheight + ",menubar=no,location=no,resizable=yes,scrollbars=no,toolbar=no,status=yes";
    popEnlarge = window.open (URL, windowName, features);
    if(content){
        popEnlarge.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /><title>Превью</title></head><body>');
        popEnlarge.document.write(content);
        popEnlarge.document.write('<'+'/'+'body><'+'/'+'html>');
    }
    popEnlarge.focus();
}





















function visclipb(id){
	if(!getById(id+'_div')) return;
	if(getById(id+'_div').style.display == 'none'){
		getById(id+'_div').style.display = 'block';
	}else{
		getById(id+'_div').style.display = 'none';
	}
	if(getById(id+'_fin')) getById(id+'_fin').style.display = 'none';
}

function sendtoflash(){
	var id='blogcode'
    if(!getById(id+'_inp') || !getById(id+'_inp').value) 
		return '';

	getById('blogcode_fin').style.display="block"
	return getById(id+'_inp').value;

}

function che(id){
	if(!getById(id)) return;
	//getById(id).style.display = (getById(id).style.display == 'none')?'block':'none';
    if(getById(id).style.display == 'none'){
        jQuery('#'+id).slideDown("slow");
    }else{
        jQuery('#'+id).slideUp("slow");
    }
}
function cheimg(id){
	if(!getById(id)) return;
	getById(id).style.display = (getById(id).style.display == 'none')?'block':'none';
	if(getById(id+'_img')) getById(id+'_img').src = (getById(id).style.display != 'none')?getById(id+'_img').src.replace("/down","/up"):getById(id+'_img').src.replace("/up","/down");
}
function chesty(obj,id){
	if(!getById(id)) return;
	getById(id).style.display = (getById(id).style.display == 'none')?'block':'none';
	obj.className = getById(id).style.display != 'none' ? 'cinema_li' : 'cinema_l';
}

var bigfont = '';
function fontreplace(){
  if(getById('text_header')) getById('text_header').style.fontSize = (!bigfont) ? '14px' : '12px';
  if(getById('text_body')){
    getById('text_body').style.fontSize = (!bigfont) ? '14px' : '12px';
    var childs = getById('text_body').childNodes;
    for(i=0; i<childs.length; i++)	if(childs[i].tagName == 'P') childs[i].style.fontSize = (!bigfont) ? '14px' : '12px';
  }
  bigfont = (!bigfont) ? 1 : '';
}

function headlog(){
	if(!getById('logged')||!getById('login_block')) return;
	if(getById('headuname')){
        getById('headuname').innerHTML = username;
        getById('headuname').href = 'http://my.open.ua/id'+uid+'.html';
    }
	if(getById('userprofavatar')){
        if(uid > 0 && getById('userprofavatar_href'))
            getById('userprofavatar_href').href = 'http://my.open.ua/id'+uid+'.html';
        getById('userprofavatar').src = avatarsrc;
    }
	getById('logged').style.display = (uid >0)?'block':'none';
	getById('login_block').style.display = (uid >0)?'none':'block';
}
function addartrate(id){
	var params = new Array();
	params[0] = id;
	params[1] = 1;
	open_sajax('/xml/userev/addrate/?absnum='+id+'&rate=1&killcache='+vdate.getTime()+'x'+Math.round((Math.random()* 1000000)),addrateh_handle,params);
}
/*Добавление в "рейтинга"*/
function opnaddrate(event,id,rate){
	var params = new Array();
	params[0] = id;
	params[1] = rate;
	opnlogin.appendlogin(event,addrateh,null,params);
}
function addrateh(params){
	if(!prodmyrate && confirm("Вы хотите поставить рейтинг "+params[1]+"?"))	open_sajax('/xml/userev/addrate/?absnum='+params[0]+'&rate='+params[1]+'&killcache='+vdate.getTime()+'x'+Math.round((Math.random()* 1000000)),addrateh_handle,params);
}
function addrateh_handle(h,params){
	if(h.status == 200 && h.responseXML){
		status = h.responseXML.getElementsByTagName("status")[0].firstChild.nodeValue;
		if(params[0] < 0){
			prodmyrate = h.responseXML.getElementsByTagName("prodmyrate")[0].firstChild.nodeValue;
            prodrate = h.responseXML.getElementsByTagName("prodrate")[0].firstChild.nodeValue;
			prodratecount = h.responseXML.getElementsByTagName("prodratecount")[0].firstChild.nodeValue;
            if(status == 3)	alert('Вы уже голосовали. Ваша оценка ' + prodmyrate + '.');
		}else{
			if(status == 9)	alert('Вы уже голосовали за этот материал.');
            artrate[params[0]] = h.responseXML.getElementsByTagName("artratecount")[0].firstChild.nodeValue;
		}
		if(status == 0 || status == 3){
			isloginuser();
		}
	}
}
/*END Добавление в "рейтинга"*/

/* Добавление в "профайл", перезапись "добаввить/удалить" очень много вариантов */
function myprofile(event,id,isdir){
	var params = new Array();
	params['id'] = id;
	if(isdir) params['isdir'] = 1;
	opnlogin.appendlogin(event,addpro,null,params);
}
function addpro(params){
	id = params['id'];
	url = '/xml/userev/addprof.xml?&art='+id;
	if(params['isdir']) url += '&isdir=1';
	if(opnlogin.isauthornon) url += '&mode=add';
	open_sajax(url+'&killcache='+vdate.getTime()+'x'+Math.round((Math.random()* 1000000)),addprof_handle,id);
}
function addprof_handle(handler,id) {
	if (handler.status == 200) {
		x = handler.responseXML.getElementsByTagName("res")[0].firstChild.nodeValue;
		if(x == 0) 	inprofile[id] = id;
		else 		inprofile[id] = null;
	}
}
function replacefileviews(ids){
    if(!ids || !filesviews || !filesviews[ids]) return;
    if($('video_counter_'+ids+'_1')) $('video_counter_'+ids+'_1').innerHTML = filesviews[ids];
    if($('video_counter_'+ids+'_2')) $('video_counter_'+ids+'_2').innerHTML = filesviews[ids];
}
function update_counter(id,count){
    filesviews[id] = count;
    replacefileviews(id);
}

function myprofilerepl(id){
	
	var div = id.replace("-","");

	if(inprofile[id] == id && uid > 0){
		if(getById('myprofile_'+div)){
			if(getById('myprofile_'+div).parentNode.className == 'to_profile') 
				getById('myprofile_'+div).parentNode.className = 'to_profile to_profile_minus';
			if(getById('myprofile_'+div).parentNode.className == 'list4Add') 
				getById('myprofile_'+div).parentNode.className = 'list4Remove';

	if(getById('myprofile_'+div).innerHTML != '&nbsp;' && getById('myprofile_'+div).innerHTML.length != 1&&getById('myprofile_'+div).className != 'fixreplprofile'){
				getById('myprofile_'+div).innerHTML = '<i></i> Удалить';
				getById('myprofile_'+div).title = 'Удалить из профайла '+(getById('myprofile_'+div).name ? getById('myprofile_'+div).name : '');
				getById('myprofile_'+div).parentNode.className = 'box_end_link_rem';
				}
				
	if(getById('myprofile_'+div).className == 'fixreplprofile') 
				{
				getById('myprofile_'+div).innerHTML = 'Удалить <ins>-</ins>';
				getById('myprofile_'+div).title = 'Удалить из профайла '+(getById('myprofile_'+div).name ? getById('myprofile_'+div).name : '');
				}
				
			if(getById('myprofile_'+div).className == 'list3Profile')	
			getById('myprofile_'+div).className = 'list3Profile_m';
		}
		
	if(getById('myprofile_sm_'+div)){	
				if(getById('myprofile_sm_'+div).innerHTML != '&nbsp;' && getById('myprofile_sm_'+div).innerHTML.length != 1){
				getById('myprofile_sm_'+div).innerHTML = '<i></i>';
				getById('myprofile_sm_'+div).title = 'Удалить из профайла '+(getById('myprofile_sm_'+div).name ? getById('myprofile_sm_'+div).name : '');
				
				getById('myprofile_sm_'+div).className = 'arrow_rem';
				}
			}
	if(getById('myprofile_list_'+div)){	
				if(getById('myprofile_list_'+div).innerHTML != '&nbsp;' && getById('myprofile_list_'+div).innerHTML.length != 1){
				getById('myprofile_list_'+div).innerHTML = '<i></i> Удалить';
				getById('myprofile_list_'+div).title = 'Удалить из профайла '+(getById('myprofile_list_'+div).name ? getById('myprofile_list_'+div).name : '');
				
				getById('myprofile_list_'+div).parentNode.className = 'box_end_link_list_rem';
				}
			}			

	if(getById('myprofile_item_'+div)){	
				if(getById('myprofile_item_'+div).innerHTML != '&nbsp;' && getById('myprofile_item_'+div).innerHTML.length != 1){
				getById('myprofile_item_'+div).innerHTML = 'Удалить';
				getById('myprofile_item_'+div).title = 'Удалить из профайла '+(getById('myprofile_item_'+div).name ? getById('myprofile_item_'+div).name : '');
				
				getById('myprofile_item_'+div).parentNode.className = 'to_profile_minus';
				}
			}			


		if(getById('myprofile2_'+div)){
			getById('myprofile2_'+div).innerHTML = 'Удалить'
			;getById('myprofile2_'+div).title = 'Удалить из профайла '+(getById('myprofile2_'+div).name ? getById('myprofile2_'+div).name : '');}
		if(getById('myprofile2_'+div) && getById('myprofile2_'+div).className == 'fixreplprofile') getById('myprofile2_'+div).innerHTML += ' <ins>-</ins>';
		if(getById('myprofile2_'+div) && getById('myprofile2_'+div).className == 'list3ProfileLeft'){
			getById('myprofile2_'+div).className = 'list3ProfileLeft_m';
			getById('myprofile2_'+div).innerHTML = 'Удалить из профайла';
		}
		if(getById('footprof_'+div)){ getById('footprof_'+div).innerHTML = 'Удалить'; getById('footprof_'+div).title = 'Удалить из профайла '+(getById('footprof_'+div).name ? getById('footprof_'+div).name : '');}
		if(getById('prof_img_'+div))getById('prof_img_'+div).src = getById('prof_img_'+div).src.replace(/plus\.|minus\./,"minus.");
	}else{
	
		if(getById('myprofile_'+div)){
			if(getById('myprofile_'+div).parentNode.className == 'to_profile to_profile_minus') 
				getById('myprofile_'+div).parentNode.className = 'to_profile';
			if(getById('myprofile_'+div).parentNode.className == 'list4Remove') 
				getById('myprofile_'+div).parentNode.className = 'list4Add';
			if(getById('myprofile_'+div).innerHTML != '&nbsp;' && getById('myprofile_'+div).innerHTML.length != 1){
					getById('myprofile_'+div).innerHTML = '<i></i> В профайл'; 
					getById('myprofile_'+div).title = 'Добавить в профайл '+(getById('myprofile_'+div).name ? getById('myprofile_'+div).name : '');
					}
			if(getById('myprofile_'+div).className == 'fixreplprofile') 
				getById('myprofile_'+div).innerHTML += ' <ins>+</ins>';
			if(getById('myprofile_'+div).className == 'list3Profile_m')	
				getById('myprofile_'+div).className = 'list3Profile';
		}
		if(getById('myprofile_sm_'+div)){					
			if(getById('myprofile_sm_'+div).innerHTML != '&nbsp;' && getById('myprofile_sm_'+div).innerHTML.length != 1){
					getById('myprofile_sm_'+div).innerHTML = '<i></i>'; 
					getById('myprofile_sm_'+div).title = 'Добавить в профайл '+(getById('myprofile_sm_'+div).name ? getById('myprofile_sm_'+div).name : '');
					getById('myprofile_sm_'+div).className = 'arrow_add';
					}
					
}		

		if(getById('myprofile_list_'+div)){					
			if(getById('myprofile_list_'+div).innerHTML != '&nbsp;' && getById('myprofile_list_'+div).innerHTML.length != 1){
					getById('myprofile_list_'+div).innerHTML = '<i></i> В профайл'; 
					getById('myprofile_list_'+div).title = 'Добавить в профайл '+(getById('myprofile_list_'+div).name ? getById('myprofile_list_'+div).name : '');
					getById('myprofile_list_'+div).parentNode.className = 'box_end_link_list';
					}
					
}	

		if(getById('myprofile_item_'+div)){					
			if(getById('myprofile_item_'+div).innerHTML != '&nbsp;' && getById('myprofile_item_'+div).innerHTML.length != 1){
					getById('myprofile_item_'+div).innerHTML = 'В профайл'; 
					getById('myprofile_item_'+div).title = 'Добавить в профайл '+(getById('myprofile_item_'+div).name ? getById('myprofile_item_'+div).name : '');
					getById('myprofile_item_'+div).parentNode.className = 'to_profile';
					}
					
}	

	if(getById('myprofile2_'+div)){
			getById('myprofile2_'+div).innerHTML = 'В профайл'; 
			getById('myprofile2_'+div).title = 'Добавить в профайл '+(getById('myprofile2_'+div).name ? getById('myprofile2_'+div).name : '');}
		if(getById('myprofile2_'+div) && getById('myprofile2_'+div).className == 'fixreplprofile') 
			getById('myprofile2_'+div).innerHTML += ' <ins>+</ins>';
		if(getById('myprofile2_'+div) && getById('myprofile2_'+div).className == 'list3ProfileLeft_m'){
			getById('myprofile2_'+div).className = 'list3ProfileLeft';
			getById('myprofile2_'+div).innerHTML = 'Добавить в профайл';
		}
		if(getById('footprof_'+div)){
			getById('footprof_'+div).innerHTML = 'В профайл'; 
			getById('footprof_'+div).title = 'Добавить в профайл '+(getById('footprof_'+div).name ? getById('footprof_'+div).name : '');}
		if(getById('prof_img_'+div))
			getById('prof_img_'+div).src = getById('prof_img_'+div).src.replace(/plus\.|minus\./,"plus.");
	}
}
/* END Добавление в "профайл", перезапись "добаввить/удалить" очень много вариантов */


/* тоже полезная штука */
function vidm(n,t,y){
	c = new Array (2,0,1,1,1,2);
	return ((!y)?"<b>"+n+"</b> ":"")+t[(n%100>4 && n%100<20)? 2:c[Math.min(n%10,5)]];
}

// перезаписываем елементы для юзера
function isloginuser(){
	headlog();
	for(var id in inprofile) myprofilerepl(id);
	for(var id in indossier){
		if(getById('funclubr_a_'+id) && indossier[id]!= null && uid > 0) 		getById('funclubr_a_'+id).innerHTML =  '<i></i>Выйти' ;
		else if(getById('funclubr_a_'+id) && (indossier[id]== null || uid < 1))	getById('funclubr_a_'+id).innerHTML =  '<i></i>Стать фаном' ;
	}

    // мои кинотеатры
	for(var id in insinema){
		if(getById('a_cinema_'+id) && insinema[id]!= null && uid > 0){
			getById('a_cinema_'+id).innerHTML =  'Удалить из Моих кинотеатров <img height="17" width="19" alt="" src="/user/img/_kino/cinema/minus.gif" />';
		}else if(getById('a_cinema_'+id) && (insinema[id]== null || uid < 1)){
			getById('a_cinema_'+id).innerHTML =  'Добавить в Мои кинотеатры <img height="17" width="19" alt="" src="/user/img/_kino/cinema/plus.gif" />';
		}
	}

    // мои места
	for(var id in inmusplaces){
		if(getById('a_musplaces_'+id) && inmusplaces[id]!= null && uid > 0){
			getById('a_musplaces_'+id).innerHTML =  'Удалить из Моих мест <img height="17" width="19" alt="" src="/user/img/_kino/cinema/minus.gif" />';
		}else if(getById('a_musplaces_'+id) && (inmusplaces[id]== null || uid < 1)){
			getById('a_musplaces_'+id).innerHTML =  'Добавить в Мои места <img height="17" width="19" alt="" src="/user/img/_kino/cinema/plus.gif" />';
		}
	}

	for(var id in artrate){
      	if(getById('artrate_'+id)) 	    getById('artrate_'+id).innerHTML = artrate[id];
        if(getById('artrate2_'+id)) 	getById('artrate2_'+id).innerHTML = artrate[id];
	}

	if(prodrate && getById('prodrate')) getById('prodrate').innerHTML = prodrate;

    if(prodratecount && getById('prodratecount')){
		var gols = new Array('голос','голоса','голосов');
		getById('prodratecount').innerHTML = vidm(prodratecount,gols);
	}

	if(prodmyrate > 0){
		if(getById('prodmyrate')) 		getById('prodmyrate').innerHTML = (uid>0)?prodmyrate:0;
		if(getById('rton_'+prodmyrate))
		if(uid>0) 	getById('rton_'+prodmyrate).className = getById('rton_'+prodmyrate).className + ' on on'+prodmyrate;
		else 		getById('rton_'+prodmyrate).className = getById('rton_'+prodmyrate).className.replace(' on on'+prodmyrate,"");
		if(getById('blockingrate')) 	getById('blockingrate').style.display = (uid>0)?'block':'none';
	}
}





function show_critics_reviews(type)
{
	if ('critics_reviews'==type)	
	{
		getById('critics_reviews').style.display = 'block';
		getById('users_reviews').style.display = 'none';
		location.href = location.href+'#acritics_reviews';
		
	}
	else
	{
		getById('users_reviews').style.display = 'block';
		getById('critics_reviews').style.display = 'none';
		location.href = location.href+'#ausers_reviews';
	}
}

// пустая
function nulled(){
	var url = '/exec/null.php';
	if(window.ActiveXObject) {
		h = new ActiveXObject("Microsoft.XMLHTTP");
		h.open('GET',url,false);
		h.send();
	} else {
		h = new XMLHttpRequest();
		h.open('GET',url,false);
		h.send(null);
	}
}


// добавление кинотеатра
function addcinema_handle(handler,id) {
	if (handler.status == 200) {
		res = handler.responseXML.getElementsByTagName("res")[0].firstChild.nodeValue;
		if(res == 0) 	insinema[id] = id;
		else 		insinema[id] = null;
	}
}
function addcinema(id){
	vdate = new Date();
	var url = '/exec/ajax/addcinema.php?cinema='+id;
	if(opnlogin.isauthornon) url += '&mode=add';
	open_sajax(url+'&killcache'+vdate.getTime(),addcinema_handle,id);
}
function delreloadcinema(id){
	addcinema(id);
	window.location.href = window.location.href;
}


// добавление места
function addmusplaces_handle(handler,id) {
	if (handler.status == 200) {
		res = handler.responseXML.getElementsByTagName("res")[0].firstChild.nodeValue;
		if(res == 0) 	inmusplaces[id] = id;
		else 		inmusplaces[id] = null;
	}
}
function addmusplaces(id){
	vdate = new Date();
	var url = '/exec/ajax/addmusplaces.php?musplaces='+id;
	if(opnlogin.isauthornon) url += '&mode=add';
	open_sajax(url+'&killcache'+vdate.getTime(),addmusplaces_handle,id);
}
function delreloadmusplaces(id){
	addmusplaces(id);
	window.location.href = window.location.href;
}



// добавление в фаны
function addfunclub_handle(handler,id) {
	if (handler.status == 200) {
		res = handler.responseXML.getElementsByTagName("res")[0].firstChild.nodeValue;
		if(res == 0) 	indossier[id] = id;
		else 		indossier[id] = null;
		//isfan = (res == '0') ? 1 : null;
		if (getById('funclublist')){
            if(handler.responseXML.getElementsByTagName("count")[0].firstChild.nodeValue > 0){
                getById('funclublist').style.display = 'block';
                getById('funclublist_all').style.display = 'block';
    			getById('funclublist').innerHTML = handler.responseXML.getElementsByTagName("funlist")[0].firstChild.nodeValue;
            }else{
                getById('funclublist').style.display = 'none';
                getById('funclublist_all').style.display = 'none';
            }
        }
	}
}
function addfunclub(id){
	vdate = new Date();
	var url = '/exec/ajax/addfunclub.php?person='+id;
	if(opnlogin.isauthornon) url += '&mode=add';
	open_sajax(url+'&killcache'+vdate.getTime(),addfunclub_handle,id);
}
// переключення вкадок на стор╕нц╕ профайла
function switch_tab(tab,num,count,className)
{
	for(var i =1;i<=count;i++)
	{
		if(document.getElementById(tab+'_'+i))
		{
			if(i==num)
			{
				document.getElementById(tab+'_'+i).className = className;
				document.getElementById(tab+'_'+i+'_body').style.display = 'block';
			}
			else
			{
				document.getElementById(tab+'_'+i).className = '';
				document.getElementById(tab+'_'+i+'_body').style.display = 'none';
			}
		}
	}
}

// Function to set a cookie.
//---------------------------------------------------------------------
function SetCookie( name, value )
{
    var argv    = SetCookie.arguments;
    var argc    = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path    = (argc > 3) ? argv[3] : null;
    var domain  = (argc > 4) ? argv[4] : null;
    var secure  = (argc > 5) ? argv[5] : false;

    document.cookie =
        name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
}
//---------------------------------------------------------------------
// Function to get a cookie.
//---------------------------------------------------------------------
function GetCookie (name)
{
    var arg  = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i    = 0;

    while (i < clen)
    {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
          return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    return null;
}
//---------------------------------------------------------------------
// Function to get a cookie.
//---------------------------------------------------------------------
function getCookieVal( offset )
{
    var endstr = document.cookie.indexOf (";", offset);

    if (endstr == -1)
        endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}
