	
	function SetProportions() {

		iLinksTopHeight = document.getElementById("TopLinks").offsetHeight;
		if (document.getElementById("BottomLinks"))
		{
			iLinksBottomHeight = document.getElementById("BottomLinks").style.display == "none" ? 0 : document.getElementById("BottomLinks").offsetHeight;
		} else {
			iLinksBottomHeight = 0;
		}
		iOffsetHeight = document.documentElement.clientHeight;
		document.getElementById("Iframe").style.height = (iOffsetHeight - iLinksTopHeight - iLinksBottomHeight) + "px";
		
	}
		
	function QualityHover(obj,sText) {
		obj.src = obj.src.replace(/\-light/gi,"");
		document.getElementById("QualityText").innerHTML = "<span class=\"color3\">"+sText+"</span>";
	}

	function QualityOut(obj) {
		obj.src = obj.src.replace(/\.gif/gi,"-light.gif");
		document.getElementById("QualityText").innerHTML = "quality:";
	}

	function ActionsHover(obj,sText) {
		document.getElementById("ActionsText").innerHTML = "<span class=\"color3\">"+sText+"</span>";
	}

	function ActionsOut(obj) {
		document.getElementById("ActionsText").innerHTML = "actions:";
	}

	function ShowHideBottomLinks() {
		document.getElementById("BottomLinks").style.display = document.getElementById("BottomLinks").style.display == "none" ? "block" : "none";
		SetProportions();
	}

	$(document).ready(function() {
		SetProportions();
		$(window).bind("resize",SetProportions);
	});


function RateLink(iID,iRate) {
	if (!protectMembers()) return false;
	$.ajax({
		type: "POST",
		url:ROOT_URL+"pro-video-links.asp?rnd="+new Date().getTime(),
		data:{ act:"rate",id:iID,rate:iRate },
		success: function(msg){
			var aResults = msg.split(",");
			document.getElementById("QualResultsRed").innerHTML = aResults[1];
			document.getElementById("QualResultsGreen").innerHTML = aResults[0];
			
			document.getElementById("QualityPane").style.width = aResults[0]==0 ? "1px" : aResults[0]+"%";
			//if (window.console) console.log(aResults[0],getColor(+aResults[0]));
			document.getElementById("QualityPane").style.backgroundColor = "#"+getColor(+aResults[0]);

			document.getElementById("QualResults").style.display = "inline";
			document.getElementById("RateLinkCont").style.display = "none";
		}
	});
}

function getColor(e) {
	var a=[{b:0,c:"cc0101"},{b:30,c:"ffcc00"},{b:60,c:"99cc01"}];
	for (var i=a.length;i--;) {
		var o=a[i];
		if (e>=o.b) return o.c;
	}
}
