	var msnrr_rated = true;
	function UCI(section, imgId)
	{
		var elmImg = document.getElementById(imgId);
		if (elmImg.disabled)
			return;
		elmImg.src = section.getAttribute("i");
	}
	
	function URI(imgId)
	{
		var elmImg = document.getElementById(imgId);
		if (elmImg.disabled)
			return;
		var originalImg = elmImg.getAttribute("originalImg");
		elmImg.src = originalImg;
	}		
	
	function UR(imgPath, imgId, value, cv, area)
	{
		var map = document.getElementsByName(imgId + "Map")[0];
		if (map)
		{
			var hp = map.getAttribute("hp");
			var ct = map.getAttribute("ct");
			var ci = map.getAttribute("ci");
			var key = map.getAttribute("key");
			var hc = map.getAttribute("hc");
			var rtxt = (map.getAttribute("rtxt")?map.getAttribute("rtxt").replace(/%userrating%/gi, area.getAttribute("v")):null);
			var dc = readCookie("ntvvote");
			dc = dc.substring(0,dc.length-1);
			var mc1 = readCookie("MC1");
			if (mc1.length>0) {
				mc1 = mc1.replace("GUID=","");
			}
			var elmImg = document.getElementById(imgId);
			var usrKey = key.replace(/ /g, '_');
			if (!elmImg.disabled)
			{
				if (document.cookie.indexOf(key + "=") < 0)
				{
					var attr, usr = 0;
					var usrrat = document.getElementById("rrur_" + imgId);
					if(usrrat.expires == '')
					{
						try
						{
							usrrat.load(ct);
							attr = usrrat.getAttribute('r' + hc);
							if (attr)
								usr = attr.indexOf(' ' + usrKey + ' ') + 1;
							else
								attr = '';
						}
						catch(e)
						{ }
					}
					var img = document.getElementById("rrir_" + imgId);
					img.src = hp + "&points=" + cv + "&mainurl=" + ct + ci + "&pid=" + hc + "&mc1=" + mc1;
					SetCookie("ntvvote",dc + "; " + hc + "=" + cv + ";");
					if(usrrat.expires == '' && usr < 1)
					{
						try
						{
							usrrat.setAttribute('r' + hc, attr + ' ' + usrKey + ' ');
							usrrat.save(ct);
						}
						catch(e)
						{ }
					}
					if (elmImg)
					{
						elmImg.setAttribute("originalImg", imgPath);
						elmImg.src = imgPath;
					}
				}
				var div = document.getElementById("divUCnt" + imgId);
				if (div)
					div.style.display = "none";
				div = document.getElementById("rrdivthanks" + imgId);
				if (div)
					div.style.display = "";
				if (div)
				{
					div.innerHTML = "&#160;&#160;&#160;Toplam&#160;<b>" + totalUsers +"</b>&#160;ziyaretçiden&#160;<b>" + usrRating + "</b>&#160;puan";
					div.style.display = "";
				}

				Disable(imgId, rtxt, null);
				
				return false;
			}
		}
	}
	
	function Disable(imgId, rtxt, dval)
	{
		var elmImg = document.getElementById(imgId);
		if (elmImg)
		{
			elmImg.disabled = true;
			elmImg.style.cursor = "default";
			var map = document.getElementsByName(imgId + "Map")[0];
			if (map)
			{
				for(i = 0; i < map.childNodes.length; i++)
				{
					var area = map.childNodes[i];
					if (area.nodeName == "AREA")
					{
						if(rtxt != null)
							area.setAttribute("alt", rtxt.replace(/%userrating%/gi, dval));
						area.removeAttribute("href");
					}
				}
			}
		}
	}
	
	function UGR(imgId)
	{
		var map = document.getElementsByName(imgId + "Map")[0];
		if (map)
		{
			var key = map.getAttribute("key");
			var rtxt = (map.getAttribute("rtxt")?map.getAttribute("rtxt"):null);
			var dc = readCookie("ntvvote");
			var search = key + "=";
			var pos = dc.indexOf("; " + search);
			if (pos == -1) 
			{
				pos = dc.indexOf(search);
				if (pos == -1) return;
			} 
			else
			{
				pos += 2;
			}
			var pos2 = dc.indexOf(";", pos);
			if (pos2 == -1)
				pos2 = dc.length;
			var val = unescape(dc.substring(pos + search.length, pos2));
			var elmImg = document.getElementById(imgId);
			if (elmImg && val)
			{
				var div = document.getElementById("divUCnt" + imgId);
				if (div)
				{
					div.innerHTML = "&#160;&#160;&#160;Toplam&#160;<b>" + totalUsers +"</b>&#160;ziyaretçiden&#160;<b>" + usrRating + "</b>&#160;puan";
					div.style.display = "none";
				}
				
				var a = GetMapArea(imgId, val);
				if (a)
				{
					elmImg.setAttribute("originalImg", a.getAttribute("i"));
					elmImg.src = a.getAttribute("i");
					Disable(imgId, rtxt, a.getAttribute("v"));
				}
			}
		}
	}
	
	function GetMapArea(imgId, idx)
	{
		var map = document.getElementsByName(imgId + "Map")[0];
		if (map)
		{
			var a = 1;
			for(i = 0; i < map.childNodes.length; i++)
			{
				var area = map.childNodes[i];
				if (area.nodeName == "AREA" && a++==idx)
					return area;
			}
		}
	}
	
	function WriteRatings()
	{
		if (msnrr_rated)
		{
			var div = document.getElementById("userRatingTotal");
			if (div)
			{
				div.innerHTML = "&#160;&#160;&#160;Toplam&#160;<b>" + totalUsers +"</b>&#160;ziyaretçiden&#160;<b>" + usrRating + "</b>&#160;puan";
				div.style.display = "";
			}
		}			
	}