// CREATING AJAX HTTP OBJECT
function getHTTPObject() 
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try 
	{
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } 
	catch (e) 
	{
      try 
	  {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } 
	  catch (E) 
	  {
        xmlhttp = false;
      }
    }
  @else
  	xmlhttp = false;
  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
  {
    try 
	{
      xmlhttp = new XMLHttpRequest();
    } 
	catch (e) 
	{
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object

// Functions to Use AJAX SCRIPT



function getprofile(width)
{
	//alert(width);
	//return false;
  var url = "getstate.asp?rnd="+ Math.random() +"&w="+width;
  var http1 = getHTTPObject();
  http1.open("GET", url, true);
  http1.onreadystatechange = function() 
  {
	if(http1.readyState == 4) 
	{
		var res = (http1.responseText);
		document.getElementById("profile_fill").innerHTML = res.split("~!~!~")[0];
		document.getElementById("size_fill").innerHTML = res.split("~!~!~")[1];
		document.getElementById("rating_fill").innerHTML = res.split("~!~!~")[2];
		//prompt(url);
		//if(res[2]!=""){getProposalsDetail(res[2],'','');}
		
		if(document.getElementById('profile').value!="0") getsize(document.getElementById('profile').value);
	}
  }

  http1.send(null);
}
 
function getsize(profile)
{
	//alert(width);
	//return false;
  var url = "getstate.asp?rnd="+ Math.random() +"&p="+profile;
  http.open("GET", url, true);
  http.onreadystatechange = function() 
  {
	if(http.readyState == 4) 
	{
		var res = (http.responseText);
		document.getElementById("size_fill").innerHTML = res.split("~!~!~")[0];
		document.getElementById("rating_fill").innerHTML = res.split("~!~!~")[1];
		//prompt(url);	
		if(document.getElementById('size').value!="0") getrating(document.getElementById('size').value);
	}
  }

  http.send(null);
}

function getrating(size)
{
  var url = "getstate.asp?rnd="+ Math.random() +"&s="+size;
  var http2 = getHTTPObject();  
  http2.open("GET", url, true);
  http2.onreadystatechange = function() 
  {
	if(http2.readyState == 4) 
	{
		var res = (http2.responseText);
		document.getElementById("rating_fill").innerHTML = res;
		//alert(res[2]);
		//if(res[2]!=""){getProposalsDetail(res[2],'','');}
	}
  }

  http2.send(null);
}
