<!--
// Written by Dexter Zafra at www.ex-designz.net
//Handle Check Username Availability Using Ajax
 var http = createRequestObject();
 function createRequestObject() 
     {
           var xmlhttp;
	 try 
                 { 
                    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
                 }
	  catch(e) 
                 {
	    try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	    catch(f) { xmlhttp=null; }
	    }
	        if(!xmlhttp&&typeof XMLHttpRequest!="undefined") 
                        {
	  	   xmlhttp=new XMLHttpRequest();
	           }
		   return  xmlhttp;
 }



function sndRating(idnum,rateval,ccc) 
  {
	var dvelement = document.getElementById('dv'+idnum);
             dvelement.innerHTML = "<img src='progressimgred.gif'>";
            try
              {
                 http.open('GET', 'ratingprocess.asp?id='+idnum+'&rateval='+rateval+'&c='+ccc);
                 http.onreadystatechange = handleResponseText;
	    http.send(null);
	 }
	    catch(e){}
	    finally{}
 }




function handleResponseText() 
  {
     try
         {
             if((http.readyState == 4)&& (http.status == 200))
                {
    	          var response = http.responseText;
                       var update = new Array();

                    if(response.indexOf('|') != -1) 
                       {
                          update = response.split('|');
                          var drelement = document.getElementById('dv'+update[0]);
                          var voteres = document.getElementById('vot'+update[0]);
                          var totalvote = document.getElementById('tv'+update[0]);
                          var starimg = document.getElementById('star'+update[0]);
						  var golink = document.getElementById('golink'+update[0]);
						  var thx = document.getElementById('thx'+update[0]);
                          drelement.style.display ='none';
                          voteres.innerHTML = update[2];
                          totalvote.innerHTML = update[3];
                          starimg.innerHTML = update[4].toString();
						  golink.innerHTML = update[5];
						  thx.innerHTML = update[6];
             }
	        }
        }
	catch(e){alert("an error occured");}
	finally{}
}












// OTHER FUNCTIONS

//function Submitform()
//{

//var http = null;
//  var http = null;
 // if(window.XMLHttpRequest)
 //  http = new XMLHttpRequest();
 // else if (window.ActiveXObject)

//http = new ActiveXObject("Microsoft.XMLHTTP");
  
	
 //           try
 //             {


//var dvelement = document.getElementById('posted');
//dvelement.innerHTML = "<CENTER><img src='/img/movewait.gif'></CENTER>";
//  http.open('POST', 'processpost.asp', true);
//  http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
//  http.send("pID=" + document.getElementById('pID').value + "&comment=" + encodeURIComponent(document.getElementById('comment').value) + //"&author=" + encodeURIComponent(document.getElementById('author').value));
//  http.onreadystatechange = handleResponseTexta;
//	    http.send(null);
//	 }
//	    catch(e){}
//	    finally{}


//document.commentform.comment.value='';


//function handleResponseTexta()
//  {
//    if((http.readyState == 4)&& (http.status == 200))

//document.getElementById('posted').innerHTML = (http.responseText);

//  }

//}




function hidediv(divname)
{
   var mydiv = document.getElementById(divname);

   if (mydiv == null)
   {
      alert("Sorry can't find your div");
   }
   //div found
   mydiv.style.visibility="hidden";
}


function showdiv(divname)
{
   var mydiv = document.getElementById(divname);
   if (mydiv == null)
   {
      alert("Sorry can't find your div");
   }
   //div found
   mydiv.style.visibility="visible";
}

//.......................................................................................................................................//////////////////////////////////////////////////////////////////////


   var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
hidediv('com');
var dvelement = document.getElementById('posted');
dvelement.innerHTML = "<CENTER><img src='/img/movewait.gif'></CENTER>";

      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('posted').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function get(obj) {
      //var poststr = "mytextarea1=" + encodeURI( document.getElementById("mytextarea1").value ) +
                   // "&mytextarea2=" + encodeURI( document.getElementById("mytextarea2").value );
var poststr = "pID=" + document.getElementById('pID').value + "&comment=" + encodeURIComponent(document.getElementById('comment').value) + "&author=" + encodeURIComponent(document.getElementById('author').value);

      makePOSTRequest('processpost.asp', poststr);
	  document.commentform.comment.value='';
   }

