var xmlHttp
var content=''; 

//----------------------Software Download Script ---------------------------------------

function verify_soft_download(curobj, subobjstr, opt_position, id1, id2, id3, page_url, techid)
{
var where_to = confirm("By clicking 'OK' you confirm that software has been downloded and one licence has been used");

if (where_to == true)
{
   window.location=page_url;
   showDescription(curobj, subobjstr, opt_position, id1, id2, id3, '../soft_count.php', techid);
   overlayclose(subobjstr);
}
}
//-------------------------------------------------------------------------------------

function test_it(){
alert('works');
}

function showDescription(curobj, subobjstr, opt_position, id1, id2, id3, page_url, techid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
	var url=page_url
	url=url+"?id1="+id1
	url=url+"&id2="+id2
    url=url+"&id3="+id3
	url=url+"&techid="+techid
	url=url+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)					

}

//---------------- Overlay -----------------------------

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position, id1, id2, id3, page_url, techid){

content=subobjstr;

showDescription(curobj, subobjstr, opt_position, id1, id2, id3, page_url, techid);

if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

//-------------------------------------------------------- 

function stateChanged()

{ 
var subobjstr=content;

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		
		document.getElementById(subobjstr).innerHTML=xmlHttp.responseText 
			
		} 
}


function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
	else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
	return objXMLHttp
} 

