
function http()
{
	var http ;
	if(window.XMLHttpRequest)
	{
		http = new XMLHttpRequest() ;
	}
	else if(window.ActiveXObject)
	{
		http = new ActiveXObject("Microsoft.XMLHTTP") ;
	}	
	
	return http ;
}

window.onload = function() {

	for(j = 1 ; j <= 13 ; j++)
	{
		var elem = document.getElementById("vote_logm" + j) ;
		if(elem)
		{
			for(var i = 0 ; i < elem.childNodes.length ; i++)
			{
				var node = elem.childNodes[i] ;
				if(node.nodeType == 1)
				{
					node.onclick = function() { 
												var idP = this.attributes.getNamedItem('id').value ; 
												var idPoints = idP.split(":") ;	
												var url = "/voting/model/" + idPoints[0] + "?points=" + idPoints[1] ;
												var xhdr = http() ;
												this.parentNode.style.display = "none" ;
												if(xhdr)
												{
													xhdr.open("GET" , url , true) ;
													xhdr.send(null) ;
												}
								   };
				}
			}
		}
	}

	for(j = 1 ; j <= 12 ; j++)
	{
		var elem = document.getElementById("vote_logy" + j) ;
		if(elem)
		{
			for(var i = 0 ; i < elem.childNodes.length ; i++)
			{
				var node = elem.childNodes[i] ;
				if(node.nodeType == 1)
				{
					node.onclick = function() { 
												var idP = this.attributes.getNamedItem('id').value ; 
												var idPoints = idP.split(":") ;	
												var url = "/voting/model/" + idPoints[0] + "?points=" + idPoints[1] ;
												var xhdr = http() ;
												this.parentNode.style.display = "none" ;
												if(xhdr)
												{
													xhdr.open("GET" , url , true) ;
													xhdr.send(null) ;
												}
								   };
				}
			}
		}
	}

	datum = new Date() ;
	if(datum.getMonth() == 0 || datum.getMonth() == 1)
	{
		var elem1 = document.getElementById("voteextra") ;
		var elem2 = document.getElementById("vote") ;
		if(elem1 && elem2)
		{
			if(elem1.style.display == "none" && elem2.style.display == "none")
			{
				elem1.style.display = "block" ;
				elem2.style.display = "none" ;
			}
		}
	}
	else
	{
		var elem = document.getElementById("vote") ;
		if(elem)
		{
			elem.style.display = "block" ;
		}
	}
};

