
function createxmlhttp()
{
    xmlhttpobj = false;
    try{//Create an object, have to try one by one because there is no standart for browers made by different companies.
        xmlhttpobj = new XMLHttpRequest();
    }catch(e){
        try{
            xmlhttpobj=new ActiveXObject("MSXML2.XMLHTTP");
        }catch(e2){
            try{
                xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e3){
                xmlhttpobj = false;
            }
        }
    }

    return xmlhttpobj; 
}



function rateContent(resourceID, contentID, userID, rating) {


	var xmlhttpobj = createxmlhttp();
	var divName = 'ratingTBL';

	if (xmlhttpobj)
	{
		xmlhttpobj.open("get","rateContent.asp?resourceID="+resourceID+"&contentID="+contentID+"&userID="+userID+"&rating="+rating+"&number="+Math.random(),true); 
		xmlhttpobj.send(null);
							
		xmlhttpobj.onreadystatechange=function()
		{  			
			if (xmlhttpobj.readyState==4)
			{
			if (xmlhttpobj.status==200)
				{
					var html = xmlhttpobj.responseText;
					document.getElementById(divName).innerHTML=html;
				}
				else
				{
					document.getElementById(divName).innerHTML="No data to display.";
				}
			}
			else
			{
				document.getElementById(divName).innerHTML="Processing. Please wait ...";//server is processing
			}
		}
	}

}


function rateProvider(providerID, userID, rating, comment) {


	var xmlhttpobj = createxmlhttp();
	var divName = 'ratingTBL';

	if (xmlhttpobj)
	{
		xmlhttpobj.open("get","rateProvider.asp?providerID="+providerID+"&userID="+userID+"&rating="+rating+"&comment="+comment+"&number="+Math.random(),true); 
		xmlhttpobj.send(null);
							
		xmlhttpobj.onreadystatechange=function()
		{  			
			if (xmlhttpobj.readyState==4)
			{
			if (xmlhttpobj.status==200)
				{
					var html = xmlhttpobj.responseText;
					document.getElementById(divName).innerHTML=html;
				}
				else
				{
					document.getElementById(divName).innerHTML="No data to display.";
				}
			}
			else
			{
				document.getElementById(divName).innerHTML="Processing. Please wait ...";//server is processing
			}
		}
	}

}

