function GetXmlHttpObject2() {
	var xmlHttp=null;
	try {
 		// Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
 	}
	catch (e) {
 		//Internet Explorer
 		try {
  			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
 		catch (e) {
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
 	}
	return xmlHttp;
}
function rate($type, $id, $rating, $user, $owner, $Uvalue, $Dvalue, $updated) {
	if($rating == 'u') {
		document.getElementById($type+'-up-'+$id).innerHTML = $Uvalue+1;
		$Uvalue = $Uvalue+1;
		if($updated == 'yes') {
			document.getElementById($type+'-down-'+$id).innerHTML =  $Dvalue-1;
			$Dvalue = $Dvalue - 1;
		}
		document.getElementById($type+'-thumbUp-'+$id).innerHTML =  '<img src="/images/thumb-up-s.png" width="17" height="30" border="0" />';
		document.getElementById($type+'-thumbDown-'+$id).innerHTML =  '<a onclick="rate(\''+$type+'\','+$id+',\'d\','+$user+','+$owner+','+$Uvalue+','+$Dvalue+',\'yes\');"><img src="/images/thumb-down.png" width="17" height="30" border="0" /></a>';				
	} else {
		document.getElementById($type+'-down-'+$id).innerHTML =  $Dvalue+1;
		$Dvalue = $Dvalue+1;
		if($updated == 'yes') {
			document.getElementById($type+'-up-'+$id).innerHTML =  $Uvalue-1;
			$Uvalue = $Uvalue - 1;
		}
		document.getElementById($type+'-thumbDown-'+$id).innerHTML =  '<img src="/images/thumb-down-s.png" width="17" height="30" border="0" />';
		document.getElementById($type+'-thumbUp-'+$id).innerHTML =  '<a onclick="rate(\''+$type+'\','+$id+',\'u\','+$user+','+$owner+','+$Uvalue+','+$Dvalue+',\'yes\');"><img src="/images/thumb-up.png" width="17" height="30" border="0" /></a>';
	}
	
	xmlHttp=GetXmlHttpObject2();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	
	var url="/scripts/thumbers.php";
	url=url+"?type="+$type;
	url=url+"&id="+$id;
	url=url+"&rating="+$rating;
	url=url+"&user="+$user;
	url=url+"&owner="+$owner;
	url=url+"&sid="+Math.random();
		
	xmlHttp.onreadystatechange= function() {
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		 	//alert(xmlHttp.responseText);
		} 					
	}

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
