function doVoteMainOpen() {
	pupVoteMainWin = window.open('/vote/', 'votemain', 'location,width=400,height=550,menubar=0,resizable=1,scrollbars=1');
	pupVoteMainWin.moveTo(Math.round((document.documentElement.clientWidth-400)*0.5),Math.round((document.documentElement.clientHeight-450)*0.5));
	pupVoteMainWin.focus();
	return pupVoteMainWin;
}

var globalElementsCache = [];
function e(id) {
	if (globalElementsCache[id]) { return globalElementsCache[id]; };
	if (!document.getElementById(id)) { return false; };
	globalElementsCache[id] = document.getElementById(id);
	return globalElementsCache[id];
};

function goToUrl(url) {
	document.location.href = url;	
};

function blockButton(id,time) {
	var obj = e(id);
	if (!obj||!obj.value) { return; }
	obj.value = obj.value.replace (/(.+?) \(([0-9]+)\)$/,'$1');
	if (time<=0) { obj.disabled = false; return; };
	obj.value = obj.value + ' ('+time+')';
	obj.disabled = true;
	time--;
	setTimeout('blockButton("'+id+'","'+time+'")',1000);
};

function blockIsShown(id) {
	if (!e(id)) { return false; };
	if (e(id).style.display == "none") { return false; }
	else { return true; };
};
function blockShow (id) {
	if (!e(id)) { return false; };
	var citem = e(id);
	if (citem.style.display!="") {
		citem.style.display = "";
		return 1;
	};
	return 0;
};
function blockHide (id) {
	if (!e(id)) { return false; };
	var citem = e(id);
	if (citem.style.display!="none") {
		citem.style.display = "none";
		return 1;
	};
	return 0;
};
function toggle (id,obj,sText,hText,force,setcookie) {
	if (!id) { return; }
	if (!(id instanceof Array)) { id = new Array(id); };
	for (i=0;i<id.length;i++) {
		if (!e(id[i])) { continue; }
		var citem = e(id[i]);
		citem.style.display = (((citem.style.display == "none" || force==1) && force!=2) ? "" : "none");
		if (setcookie)
			{ cookieSet('cp_toggle'+id[i],((citem.style.display == "") ? 1 : 0),-1); };
	};
	if (citem && obj && obj.innerHTML)
		{ obj.innerHTML = ((citem.style.display == "") ? hText : sText); };
};
function toggleRestore(id,obj,sText,hText) {
	if (!(id instanceof Array)) { id = new Array(id); };
	cookies = document.cookie;
	mask = 'toggle'+id[0]+'=([01]{1})';
	if (tog = cookies.match(mask,'')) {
		toggle(id,obj,sText,hText,(tog[1]=='1'?1:2));
	};
};

function cookieSet(name,value,minutes) {
	var expires = '';
	if (minutes>0) {
		var date = new Date();
		date.setTime(date.getTime()+(minutes*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	else if (minutes==-1)
		{ expires = "; expires=Wed, 15 May 2020 07:10:09 UTC"; }
	else { expires = ""; };
	document.cookie = name+"="+value+expires+"; path=/";
};
function cookieRead(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	};
	return null;
};