	// Defining Object
	function PR() { 
		pAjax.call(this);
		//pAjax.setDebugMode(true);
	}

	var _p = PR.prototype = new pAjax;  // Extending AJAX Object on PR    

	_p.execAction = function () {               // Command action: Action that creates and send the request
		// Creates the request
        if(!this.dc) {
            clearResults();
            this.dc=0;
        }
		var oRequest = this.prepare("GetPR", pAjaxRequest.GET);
		oRequest.setParam("value1", document.getElementById("url").value);
		oRequest.setParam("value2", this.dc);
		this.dc++;
        oRequest.execute();
	}
	
	_p.onLoad = function () {                   // Callback: Function that handles the response of request
		var data = this.getResponse();
        //alert(data[2]);
        if(data[2]){
            addRow(data[0],data[1]);
            window.scrollBy(0,5000);
            this.execAction();
        }else{
            this.dc=null;
            document.getElementById("status").innerHTML="<div class='indicator'>Done.</div>";	
        }
	}
	_p.onInit = function () {
		//document.getElementById("status").value="init";
	}
	
	_p.onCreate = function () {
		document.getElementById("status").innerHTML="create";	
	}		
	
	_p.onChange = function () {
		document.getElementById("status").innerHTML="<div class='indicator'><br />Working<br /><br /><img src='images/working.gif' /></div>";
	}			
    

    function clearResults(){
        //alert("clear");
        var tbl = document.getElementById("results");
        tbl.width="390px";
        var lastRow = tbl.rows.length;
        for (i=lastRow-1;i>=0;i--){
            tbl.deleteRow(i);
        } 
        
        
        var row = tbl.insertRow(0);
        // left cell
        var cellLeft = row.insertCell(0);
        cellLeft.width="60%";
        var textNode = document.createTextNode("");
        cellLeft.appendChild(textNode);
        // middle cell
        var cellMiddle = row.insertCell(1);
        cellMiddle.width="30%";
        var textNode = document.createTextNode("");
        cellMiddle.appendChild(textNode);
        // right cell
        var cellRight = row.insertCell(2);
        cellRight.width="10%";
        var textNode = document.createTextNode("");
        cellRight.appendChild(textNode);
    
    }
    
    function addRow(dcip,pr){
        //alert("add");
        var tbl = document.getElementById("results");
        var lastRow = tbl.rows.length;
        var row = tbl.insertRow(lastRow);
        // left cell
        var cellLeft = row.insertCell(0);
        var textNode = document.createTextNode(dcip);
        cellLeft.appendChild(textNode);

        // middle cell
        var cellMiddle = row.insertCell(1);
        var textNode = document.createTextNode("");
        cellMiddle.appendChild(textNode);


        // right cell
        var cellRight = row.insertCell(2);
        var primg=document.createElement("img");
        primg.src="images/pr" + pr + ".gif";
        cellRight.appendChild(primg);
    }

	// Creating PR Object
	var mypr = new PR;
