
var url_form = "/ru/news/?r=votes";

function commadd() {
	msg = document.getElementById('message').value;
	if(msg.length<2) {
		alert('Ñîîáùåíèå äîëæíî áûòü èíôîðìàöèîííûì');
		return false;
	}
	document.getElementById('sess').value = lse;
	document.getElementById('submit').disabled = true;

	return true;
}


var blltxt = new Array();
var bllmt = new Array();

blltxt[1] = "óæàñíî";
blltxt[2] = "ïëîõî";
blltxt[3] = "òàê ñåáå";
blltxt[4] = "õîðîøî";
blltxt[5] = "îòëè÷íî";

var starsel = 0;
var startext = "";

function star(id,val) {
	starsel = 1;
	bllmt[val] = document.getElementById('star_'+id).innerHTML;
	for(i=1;i<=5;i++) {
		var star = document.getElementById('star'+id+'_'+i);
		if(i<=val) {
			star.className = "star2";
		} else {
			star.className = "star1";
		}
	}
	if(startext=="") {
		startext = document.getElementById('star_'+id).innerHTML;
	}
	document.getElementById('star_'+id).innerHTML = blltxt[val];
}

function star_no(id,val) {
	starsel = 0;
	setTimeout('star_no_timer("'+id+'","'+val+'")', 20);
}

function star_no_timer(id,val) {
	if(starsel==1) {
		setTimeout('star_no_timer("'+id+'","'+val+'")', 20);
		return 1;
	}
	for(i=1;i<=5;i++) {
		document.getElementById('star'+id+'_'+i).className = "star3";
	}
	document.getElementById('star_'+id).innerHTML = startext;
}

function starclx(id,val) {
	var iframe = '<form name="formvote'+id+'" id="formvote'+id+'" target="fvote'+id+'" action="'+url_form+'" method="POST">'
	+'<input name="post_id" value="'+id+'">'
	+'<input name="ball" value="'+val+'">'
	+'</form>'
	+'<iframe name="fvote'+id+'" id="fvote'+id+'" src="about:blank" style="width:100%;height:100px;"></iframe>';
	document.getElementById('starc'+id).innerHTML = iframe;
	document.getElementById('formvote'+id+'').submit();
}

function ballok(id,pr,val) {
	document.getElementById('starb'+id).innerHTML = '<div style="width:84px;height:16px;" class=star1><div style="width:'+pr+'%;height:16px;" class=star2></div></div>';
	document.getElementById('star_'+id).innerHTML = val;
}

var ua = navigator.userAgent.toLowerCase();
var isOpera = (ua.indexOf('opera')  > -1);
var isIE = (!isOpera && ua.indexOf('msie') > -1);
var myHeight = 0; 

if(typeof(window.innerWidth) == 'number') { 
	myHeight = window.innerHeight; 
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { 
	myHeight = document.documentElement.clientHeight; 
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { 
	myHeight = document.body.clientHeight; 
} 


function getDocumentHeight() { return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollHeight : document.documentElement.scrollHeight, getViewportHeight()); }
function getViewportHeight() { return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight : (document.parentWindow || document.defaultView).innerHeight; } 
function getClientWidth()    { return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth; }
function getBodyScrollTop()  { return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop); }



function setOpacity() {
	if(opac_id==0) {
		var testObj = document.getElementById('mpop');
		testObj.style.width = "100%";
		testObj.style.height = getDocumentHeight()+'px';
		testObj.style.display = "block";
		testObj.style.opacity = .6;
		testObj.style.filter = 'alpha(opacity=60)';
	}
	opac_id = 1;
}

function removeOpacity() {
	if(opac_id ==1) {
		var testObj = document.getElementById('mpop');
		testObj.style.opacity = 0;
		testObj.style.filter = 'alpha(opacity=0)';
		testObj.style.display = "none";
	}
	opac_id = 0;
}




// onclick="return mainlist('addlist');"


var mdlist = "";
var onl = 0;

document.onclick = onclickEvent;
function onclickEvent(e) {
e = e || window.event;
if(!e.target) { e.target = event.srcElement; }



	if(e.target.id=="addlist2") {
		mainlist("addlist");
	} else if(e.target.id=="mainlist2") {
		mainlist("mainlist");
	} else if(e.target.id=="citylist2") {
		mainlist("citylist");
	} else if(onl==1) {
		mainlistout(mdlist);
	}

}


function mainlist(mlist) {
	if(onl==1 && mdlist!=mlist) {
		mainlistout(mdlist);
	}
	if(onl==0) {
		mdlist = mlist;
		onl = 1;
		document.getElementById(mlist+'1').style.display = (document.getElementById(mlist+'1').style.display=="block") ? "none" : "block";
		document.getElementById(mlist+'2').style.background = (document.getElementById(mlist+'1').style.display=="block") ? "#4E4B49" : "";
		document.getElementById(mlist+'2').style.textDecoration = (document.getElementById(mlist+'1').style.display=="block") ? "none" : "underline";
		if(mdlist=="addlist") {

			document.getElementById(mlist+'3').style.background = (document.getElementById(mlist+'3').style.background=="#4E4B49") ? "" : "#4E4B49";
		}
		return false;
	} else if(onl==1) {
		mainlistout(mlist);
	}
}

function mainlistout(mlist) {
	if(onl==1) {
		document.getElementById(mlist+'1').style.display = "none";
		document.getElementById(mlist+'2').style.background = "";
		document.getElementById(mlist+'2').style.textDecoration = "underline";
		if(mdlist=="addlist") {
			document.getElementById(mlist+'3').style.background =  "";
		}
		mdlist = "";
		onl = 0;
	}
	return false;
}


/*
var htmladd = "";
var mainadd = new Array();
mainadd[0] = {l:"url0", n:"Ññûëêà 0", r:0};
mainadd[1] = {l:"url1", n:"Ññûëêà 1", r:0};
mainadd[2] = {l:"url2", n:"Ññûëêà 2", r:0};
mainadd[3] = {l:"url3", n:"Ññûëêà 3", r:1};
mainadd[4] = {l:"url4", n:"Ññûëêà 4", r:1};
mainadd[5] = {l:"url5", n:"Ññûëêà 5", r:1};
mainadd[6] = {l:"url6", n:"Ññûëêà 6", r:2};
mainadd[7] = {l:"url7", n:"Ññûëêà 7", r:2};
mainadd[8] = {l:"url8", n:"Ññûëêà 8", r:3};
mainadd[9] = {l:"url9", n:"Ññûëêà 9", r:3};

var maddid = -1;
for(i=0;i<mainadd.length;i++) {
htmladd+= "<a class=lmlink2 href=\""+mainadd[i].l+"\">"+mainadd[i].n+"</a>";
}

document.getElementById('addlist').innerHTML = htmladd;
*/