function openup() {
var url = "http://www.hi5tools.com/hi5layouts/aprev.php?id=" + document.getElementById("hidden").value + "&fid=" + document.getElementById("fid").value
window.open(url, 'Preview', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 112,top = 84');

}


function showstar(n) {
var i =0;
var one = document.getElementById("oneliner");
var lines = new Array("Ugly", "It's ok", "I Like it", "Super", "Fantastic!");
while (i < 5) {
var el = document.getElementById("star" + i);
if ((n+1)>i) { 
el.src = "http://www.hi5tools.com/hi5layouts/images/star.gif";
}
else {
el.src = "http://www.hi5tools.com/hi5layouts/images/star_bg.gif";
}
i+=1;
}
one.innerHTML = lines[n];
}


function clearstars(o) {
var i =0;
var n = o;
while (i < 5) {
var el = document.getElementById("star" + i);
if ((n)>i) { 
el.src = "http://www.hi5tools.com/hi5layouts/images/star.gif";
}
else {
el.src = "http://www.hi5tools.com/hi5layouts/images/star_bg.gif";
}
i+=1;
}
}
function setstar(el) {
var score = el+1;
stars = score;
var str = "id=" + pid + "&score=" + score + "&ms=" + new Date().getTime();
var file = "http://www.hi5tools.com/hi5layouts/vote.php";
voteXML(file, str);
}


function voteXML(file,str)

    {


var url = file;		
// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp2=new XMLHttpRequest();
		xmlhttp2.onreadystatechange = voteChange;
		xmlhttp2.open("POST", url, true);
		xmlhttp2.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlhttp2.send(str);
	}
	// code for IE
	else if (window.ActiveXObject)
	{
		xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
		if (xmlhttp2)
		{
			xmlhttp2.onreadystatechange = voteChange;
			xmlhttp2.open("POST", url, true);
			xmlhttp2.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
			xmlhttp2.send(str);
		}
	}
      

    }

function voteChange()
{

if (xmlhttp2.readyState==4)
  {
  if (xmlhttp2.status==200)
    {


data = xmlhttp2.responseText;
if (parseInt(data) == 1) {
var d = document.getElementById("oneliner");
d.innerHTML = "<b>Thanks for voting</b>";
document.getElementById("nr").innerHTML = parseInt(document.getElementById("nr").innerHTML) + 1;
var out = "";
var o= 0;
var star = document.getElementById("stars");
while (o<5) {
if (o<stars) { out += "<img src=\"http://www.hi5tools.com/hi5layouts/images/star.gif\">"; }
else { out += "<img src=\"http://www.hi5tools.com/hi5layouts/images/star_bg.gif\">"; }
o+=1;
}
star.innerHTML = out;
}
else {
var d = document.getElementById("oneliner");
d.innerHTML = "<b>You have already voted</b>";

}
	}

  }
} 

function addsmiley(val) {
	
document.getElementById("mmsg").value += " "  + val;	
}
