function rozmebaby(obj,backme){
	if(!obj)
		return false;
	if(backme){
		obj.className =	obj.className.replace(/rozdiv/g,'');
	}
	else{
		obj.className =	obj.className + ' rozdiv';	
	}
}

cnrcr = 1;
cnrcr2 = 0;
cceva = new Array('1_1','1_2','1_3','1_4','2_1','2_2','2_3');
function changeto(nr1,nr2){
	if(nr1 !==cnrcr ){
		other = nr1 ==1 ? 2 : 1;
		if(m = $('o_'+nr1)){
			m.className =	m.className.replace(/nodisp/g,'');
		}

		if(m = $('o_'+other)){
			m.className =	m.className + ' nodisp';	
		}
		if(m = $('t_'+nr1)){
			m.className =	m.className.replace(/nodisp/g,'');
		}

		if(m = $('t_'+other)){
			m.className =	m.className + ' nodisp';	
		}
		if(m = $('s_'+nr1)){
			m.className =	m.className.replace(/nodisp/g,'');
		}

		if(m = $('s_'+other)){
			m.className =	m.className + ' nodisp';	
		}		
		cnrcr = nr1;
		cnrcr2 = 0;
		changeto(nr1,5);
	}
	if(nr2 && (nr2 !== cnrcr2)){
		for(i=0; i< cceva.length; i++){
			mo = $('h_'+ cceva[i]);
			n = $('t_'+ cceva[i]);
			if(mo){
				if(cceva[i] == cnrcr+'_'+nr2 ){
					mo.className =	mo.className.replace(/nodisp/g,'');				
					if(n)
						n.className =	' it';									
				}			
				else{
					mo.className =	mo.className.replace(/nodisp/g,'') + ' nodisp';				
					if(n)
						n.className =	'';	
							
				}
			}
		}
		cnrcr2 = nr2;
			
	}
}

function boldit(id,type){
	if(type==2){
		id.className='';	
	}
	else{
		id.className='bld';			
	}
}

function jumpto(linq){
	if(opener && !opener.closed){
		opener.location = linq;
		opener.focus();
		return false;	
	}
	else{
		return true;	
	}
}

var com_w = null;

function openpop(url) {
		lungim = 700;
		inalt = 700;
		progP = com_w;
/* centru*/
		pnt_n = 1;			
		progP = window.open( url, 'compop', 'toolbar=0,scrollbars='+pnt_n+',location=0,statusbar=1,menubar=0,resizable=1,width='+lungim+',height='+inalt+',left = 40,top = 62' );
		progP.focus();
/* miscarea inversa */
		com_w = progP;	
}


function seecomments(id,com){
	if(!com)
		openpop('comentarii/'+id);	
	else if(com === true)
		openpop('comentarii/'+id+'#comment');	
	else		
		openpop('comentarii/'+id+'#com_'+com);	
}

function select_wanted(index,valo){
	if($(index) && $(index).options){
		h = $(index);
		for (i = h.options.length - 1; i>=0; i--) {
			if (h.options[i].value == valo) {
				h.options[i].selected = true;
			}
			else{
				h.options[i].selected = false;
			}
		}
	}
}

function $(id){
	if(m = document.getElementById(id))
		return m;
	return false;
}

function $$(id){
	if(m = document.getElementById(id))
		return m.style;
	return false;
}

function $$$(id){
	if(m = document.getElementById(id))
		return m.value;
	return false;
}

function changeOpac(opacity, id) {
var object = document.getElementById(id).style;object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 
function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

function chSty(id){
   id.filter = "";
   id.opacity = "";	
}

function showb_rotate(){
	interval_SB = window.setInterval(showb_for, 5000);
}


function showb_for(){
	if(CurSB==Nrdiv){
		no_showb_for();
	}
	showb_next(2);
	
}

function no_showb_for(){
	window.clearInterval(interval_SB);
}


function showb_next(type){
	if(CurSB==1){
		var layprev = Nrdiv;
		var laynext = 2;
			
	}
	else if(CurSB<Nrdiv) {
		var layprev = (CurSB-1);
		var laynext = ++CurSB;		
	}
	else if (CurSB==Nrdiv) {
		var layprev = (Nrdiv-1);
		var laynext = 1;	
	}

	if (type == 1){
		showBrw(layprev);
	}
	else {
		showBrw(laynext);
	}
}
interval_SB = '';

function showBrw(div){
	if(Nrdiv <2)
		return false;
	
	tru = false;	
	var divNr=Nrdiv;
	for(i=1; i<=divNr; i++) {
		if(i==div) { 
			if(el = document.getElementById('sb'+div)){
				el.style.visibility="visible";
				changeOpac(20, 'sb'+div+''); 
				document.getElementById('cerc'+div).className='cerc_neg';
				tru = true;
			}
			CurSB = div;	
		} 
		else { 
			if(el = document.getElementById('sb'+i)){		
				el.style.visibility="hidden";	
				document.getElementById('cerc'+i).className='cerc';			
			}
		}
	}
	if(tru)
	opacity('sb'+div+'', 20, 100, 500);
	obje = document.getElementById('sb'+div).style;
	setTimeout('chSty(obje)', 500);
}

function pre_del(nr,mes,ind){
	
	mes = mes ? mes : 'Sigur stergi?';
	ind = ind ? ind : 'indicedelete';
	if(nr && confirm(mes)){
		$(ind).value = nr;
		document.formus.submit();
	}

}

function pag_text_size(id,cat){
	maxx = 18;
	minn = 10;
	if(s = $$(id)){
		if(s.fontSize) {
         var f = parseInt(s.fontSize.replace("px",""));
		} else {
         var f = 12;
		}
		if( ((cat>0) && f<maxx ) || ((cat<0) && f>minn )){
			f += cat;
			s.fontSize = f+"px"		
		}
	}
}

function pag_pics(inapoi){
	if($('sbmic') && $('sbmic1')){
		cur = window['cur'] ? window['cur'] : 1;
		if(inapoi)
			cur = $(String('sbmic')+ String(cur-1)) ? cur-1 : 'max';
		else
			cur = $(String('sbmic')+ String(Number(cur)+Number(1))) ? Number(cur)+Number(1) : 1;
		if(cur=='max'){
			cur = 1;
			for(i=1;i<100;i++)
				cur = $('sbmic'+i) ? i : cur;
			
		}
		for(i=1;i<100;i++){
			if(nn=$('sbmic'+i)){
				nn.style.visibility = i==cur ? 'visible' : 'hidden';			
			}
			else{
				break;
			}
		}
			
	}
}


function flaptwo(autor,dedesc,deinc,victim){

	if($(autor) && $(victim)){	
		var deschidere = (dedesc && deinc) ? ($(autor).innerHTML == dedesc) : !window['opti_deschismenu_'+autor+'_'+victim] ;
		
		
		if(deschidere){
			if(dedesc && deinc){
				$(autor).innerHTML = deinc;
			}
			$$(victim).display = '';	
			//cu ascundere restul
			window['opti_deschismenu_'+autor+'_'+victim] = true;

		}
		else{
			window['opti_deschismenu_'+autor+'_'+victim] = false;			
			if(dedesc && deinc){			
				$(autor).innerHTML = dedesc;
			}
			$$(victim).display = 'none';				
		}
	}
	else{
		alert('zozo')	;
	}
	
}



function control_nr(inpobj,afisobj,limit){
	nr = limit - inpobj.value.length;
	if(nr<0){
		inpobj.value = inpobj.value.substr(0,limit);
		return false;
	}	
	else{
		afisobj.innerHTML = nr;
	}
}


var libermen = true;



function opti_tab(prefixvictim,sel,nrvictim,clasasel,clasanosel,prefixindic,clasaindsel,clasaindnosel,cu_inchidere,factor_alungire ){

	if((factor_alungire >0) && !libermen){
			return;
	}

	for(i = 1; i <= nrvictim; i++){
		var m = $(prefixvictim + i);
		var ind = $(prefixindic + i);
		
		if(!m){
			continue;
		}
	
		m.className = clasasel ? m.className.replace(clasasel,'') : m.className;	
		m.className = clasanosel ? m.className.replace(clasanosel,'') : m.className;			
		if(ind){
			ind.className = clasaindsel ? ind.className.replace(clasaindsel,'') : ind.className;	
			ind.className = clasaindnosel ? ind.className.replace(clasaindnosel,'') : ind.className;	
		}
			
		if(i == sel){

			var tre_inchis = cu_inchidere && window['opti_deschistab_'+prefixvictim+'_'+sel];
			
			if(!tre_inchis){
		
				m.className = clasasel ?  m.className + ' ' + clasasel : m.className;
		
				if(factor_alungire){
					libermen = false;
					m.style.overflow = 'hidden';
					m.style.height = '1px';	
					m.style.display = '';				
					for(ji=0;ji<11;ji++){
						if(ji<10)
							setTimeout("eval('$$(\""+ m.id +"\").height = \""+(ji*3*factor_alungire)+"px\"')",ji*20);				
						else{
							setTimeout("eval('$$(\""+ m.id +"\").height = \"auto\"')",ji*20);
							setTimeout("eval('$$(\""+ m.id +"\").overflow = \"visible\"')",ji*20);
							setTimeout("eval('libermen = true')",ji*30);
						}
					}
				}
			
			
			
			
			
			
				if(ind){
					
					ind.className = clasaindsel ? ind.className + ' ' + clasaindsel : ind.className;
				}
				window['opti_deschistab_'+prefixvictim+'_'+sel] = true;
			}
			else{
				m.className = clasanosel ?  m.className + ' ' + clasanosel : m.className;
				if(ind){
					ind.className = clasaindnosel ? ind.className + ' ' + clasaindnosel : ind.className;
				}	
				window['opti_deschistab_'+prefixvictim+'_'+sel] = false;
			}
		}	
		else{
			if(clasanosel){
				m.className = m.className + ' ' + clasanosel;
			}
			if(ind && clasaindnosel){
				ind.className = ind.className + ' ' + clasaindnosel;
			}			
			window['opti_deschistab_'+prefixvictim+'_'+i] = false;			
		}
	}
}