
var inmeniu;

/**
 *
 * @access public
 * @return void
 **/


function mouseLeaves (element, evt) {
if (typeof evt.toElement != 'undefined' && evt.toElement && typeof
element.contains != 'undefined') {
return !element.contains(evt.toElement);
}
else if (typeof evt.relatedTarget != 'undefined' && evt.relatedTarget) {
return !contains(element, evt.relatedTarget);
}
}

function contains (container, containee) {
while (containee) {
if (container == containee) {
return true;
}
containee = containee.parentNode;
}
return false;
}


function chcolor(mee){
document.getElementById('picker_'+mee.id).style.background=mee.value;
return;
}

function rand( min, max ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Leslie Hoare
    // *     example 1: rand(1, 1);
    // *     returns 1: 1
    if( max ) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    } else {
        return Math.floor(Math.random() * (min + 1));
    }
}

function del(divid){
document.getElementById(divid).style.margin='0';
document.getElementById(divid).innerHTML='';
document.getElementById(divid).style.display='none';
document.getElementById(divid).style.visibility='hidden';

return false;
}

function newsub(){

var theForm = document.getElementsByName('pav')[0].form, z = 0, names=new Array(), values=new Array();
for(z=0; z<theForm.length; z++){if(theForm[z].name!='pav' && theForm[z].name!='subids' && theForm[z].type!='submit'){
names[z]=theForm[z].id;
values[z]=theForm[z].value;
}}
var rnd=rand(1,99999999);
var past=document.getElementById('subs').innerHTML;
var nnsub=past+'<div id="'+rnd+'"><input type="text" name="nsubtitle[]" id="i'+rnd+'" /> (<a href="" onclick="return del(\''+rnd+'\');">X</a>)</div>';
document.getElementById('subs').innerHTML=nnsub;
for(z=0; z<names.length; z++){if(names[z]!='' && names[z]!=undefined){document.getElementById(names[z]).value=values[z];}}
return false;
}

function ratesiena(siena, rate){
var nowis=document.getElementById('nowis'+siena).innerHTML;
document.getElementById('ratesiena'+siena).innerHTML='<img src="'+'images/ajax-loader.gif" />';
if(rate=='0')newis=nowis-1;
if(rate=='1')newis=nowis-(-1);
if(newis>'0')update='<span class="pos">+'+newis+'</span>';
if(newis=='0')update='<span class="pos">0</span>';
if(newis<'0')update='<span class="neg">'+newis+'</span>';
document.getElementById('ratesiena'+siena).innerHTML=update;
ajaxget(mainurl+'/klubai/ajax.php', 'type=ratesiena&siena='+siena+'&rate='+rate, 'noreport');
}


function rateforumas(forumas, rate){
var nowis=document.getElementById('nowis'+forumas).innerHTML;
document.getElementById('rateforumas'+forumas).innerHTML='<img src="'+'images/ajax-loader.gif" />';
if(rate=='0')newis=nowis-1;
if(rate=='1')newis=nowis-(-1);
if(newis>'0')update='<span class="pos">+'+newis+'</span>';
if(newis=='0')update='<span class="pos">0</span>';
if(newis<'0')update='<span class="neg">'+newis+'</span>';
document.getElementById('rateforumas'+forumas).innerHTML=update;
ajaxget(mainurl+'/klubai/ajax.php', 'type=rateforumas&forumas='+forumas+'&rate='+rate, 'noreport');

}

function ratemedziaga(medziaga, rate){
var nowis=document.getElementById('nowis'+medziaga).innerHTML;
document.getElementById('ratemedziaga'+medziaga).innerHTML='<img src="'+'images/ajax-loader.gif" />';
if(rate=='0')newis=nowis-1;
if(rate=='1')newis=nowis-(-1);
if(newis>'0')update='<span class="pos">+'+newis+'</span>';
if(newis=='0')update='<span class="pos">0</span>';
if(newis<'0')update='<span class="neg">'+newis+'</span>';
document.getElementById('ratemedziaga'+medziaga).innerHTML=update;
ajaxget(mainurl+'/klubai/ajax.php', 'type=ratemedziaga&medziaga='+medziaga+'&rate='+rate, 'noreport');
}

function showmicon(id){document.getElementById('showmeniu'+id).style.visibility='visible';return true;}
function hidemicon(id){document.getElementById('showmeniu'+id).style.visibility='hidden';return true;}

function showmeniu(id){document.getElementById('umeniu'+id).style.visibility='visible';
document.getElementById('showmeniu'+id).className='showmeniu showmeniu2';
var inmeniu=true;
return true;
}

function hidemeniu(id){document.getElementById('umeniu'+id).style.visibility='hidden';
document.getElementById('showmeniu'+id).className='showmeniu';
var inmeniu=false;
return true;
}

function isstoti()
{
 var qq=confirm("Ar tu tikrai nori išstoti iš šio klubo?");
 if (qq==true){return true;}else{return false;}
}

function trinti(){
 var qq=confirm("Ar tu tikrai nori ištrinti?");
 if (qq==true){return true;}else{return false;}
}

function mesti(){
 var qq=confirm("Ar tu tikrai nori išmesti šį narį iš klubo?");
 if (qq==true){return true;}else{return false;}
}

var tmout = 0;

function smiles_out(div_name){


	tmout = setTimeout('document.getElementById(\''+div_name+'\').style.display=\'none\'', 500);


}

function smiles_on(div_name){

	clearTimeout(tmout);
	document.getElementById(div_name).style.display='';


}
