function ShowPopup(hoveritem)
{
	hp = document.getElementById("hoverpopup");
	
	// Set popup to visible
	hp.style.top = hoveritem.offsetTop - 55;
	hp.style.left = hoveritem.offsetLeft + 40;

	hp.style.visibility = "Visible";
}

function HidePopup()
{
	hp = document.getElementById("hoverpopup");
	hp.style.visibility = "Hidden";	
}

function drawPercentBar(percent) 
{
  	width = 60;
//  	width = 35;
    var pixels = width * (percent / 100); 
    background = '#fff'; 
    document.write("<div style=\"position: relative; line-height: 1em; background-color:#fff; border: 1px solid #CECFCE; width: " 
                   + width + "px\" title=\"Sheriff Rating "+ percent +" % \"class=\"trigger\">"); 
    document.write("<div style=\"height:4px; width: " + pixels + "px; background-color:#01DF00;\"></div>"); 
    document.write("<div style=\"position: absolute; text-align: center; padding-top: .25em; width: " 
                   + width + "px; top: 0; left: 0\"></div>"); 
    document.write("</div>"); 
} 

function drawCustomPercentBar(percent,width,height,id)
{
    var pixels = width * (percent / 100); 
    background = '#fff'; 
    document.write("<div style=\"position: relative; height:"+ height +"px; background-color:#fff; border: 1px solid #CECFCE; width: " 
                   + width + "px\" title=\"Sheriff Rating "+ percent +" % \"class=\"trigger\" id=\"rating_"+ id +"\">"); 
    document.write("<div style=\"height:" + height+ "px; width: " + pixels + "px; background-color:#01DF00;\"></div>"); 
    document.write("<div style=\"position: absolute; text-align: center; padding-top: .25em; width: " 
                   + width + "px; top: 0; left: 0\"></div>"); 
    document.write("</div>");
}

function addSmilie(smilie, Feedback, smilieField) {
	var revisedMessage;
	var currentMessage = document.Feedback.elements[smilieField].value;
	revisedMessage = currentMessage+smilie;
	document.Feedback.elements[smilieField].value=revisedMessage;
	document.Feedback.elements[smilieField].focus();
	return;
}

function updateClickCount(id,table){
	var xmlhttp;
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your browser does not support XMLHTTP!");
	}
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4) {												
		}
	}
	var url = BASE_URL+"/ajaxBusinessClickCount.php?id="+id+"&table="+table;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function updateWebsiteClickCount(id,table){
	var xmlhttp;
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your browser does not support XMLHTTP!");
	}
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4) {												
		}
	}
	var url = BASE_URL+"/ajaxWebsiteClickCount.php?id="+id+"&table="+table;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}