activeIcon = "";

window.onload = function(){
       var elemSpan = document.createElement("span");
        elemSpan.id = "spanOutput";
       elemSpan.className = "spanTextDropdown";
        document.body.appendChild(elemSpan);
   }

function SendData(mylist,textid) {
	golos_textid =textid;
	var url = "textrate_new.asp";
	var myrate = mylist.options[mylist.selectedIndex].value;
	var strParams = 'textid='+textid+'&rate='+myrate ;
	var loader1=new net.ContentLoader(url,ShowAnswer,ErrText,"POST",strParams);
}

function ShowAnswer (){
	   data=this.req.responseText;
	   if (data=='Done'){
	   textic = "Ваш голос учтен!"
	   } else {
	   textic = "Вы оценивали это произведение!"
	   }
	      document.all["golos"+golos_textid].innerHTML = textic;
 }

function ErrText() {
	alert ("Error!!!");
}

function SendForLinks(textid,linktypeid){
	golos_textid =textid;
	activeIcon = document.all["icon"+textid + "_" + linktypeid];	
	var url = "show_textlinks.asp";
	var strParams = 'textid='+textid+'&linktypeid='+linktypeid ;
	document.getElementById("spanOutput").innerHTML = "<img src=\"images/loader.gif\" width=\"32\" height=\"32\">";
	SetElementPosition(activeIcon);	
	var loader1=new net.ContentLoader(url,ShowLinks,ErrText,"POST",strParams);
}

function BadLink(textlinkid){
	//alert (textlinkid);
	badlink_textid =textlinkid;	
	var url = "bad_links.asp";
	var strParams = 'textlinkid='+badlink_textid;	
	var loader2=new net.ContentLoader(url,ShowBadLinks,ErrText,"POST",strParams);
}

function ShowBadLinks (){
	   data=this.req.responseText;	
	   if (data=='Done'){   
	   textic = "Принято!";	 
	   }  
	   document.all["badlink"+badlink_textid].innerHTML = textic;
 }

function ShowLinks (){
	data=this.req.responseText;
	document.getElementById("spanOutput").innerHTML = data;
}

function SetElementPosition(theTextBoxInt){
        var selectedPosX = 0;
        var selectedPosY = 0;
        var theElement = theTextBoxInt;
        if (!theElement) return;
        var theElemHeight = theElement.offsetHeight;
        while(theElement != null){
          selectedPosX += theElement.offsetLeft;
          selectedPosY += theElement.offsetTop;
          theElement = theElement.offsetParent;
        }
        xPosElement = document.getElementById("spanOutput");
        xPosElement.style.left = selectedPosX-20;
        //if(theTextBoxInt.obj.matchTextBoxWidth)
          //xPosElement.style.width = theElemWidth;
        xPosElement.style.top = selectedPosY + theElemHeight+10;
        xPosElement.style.display = "block";

      }