function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function openIFrame(DIVIF,obj,DIVIFFrame,url,altezza,l,w,instd){
	var tab,row,td
	tab=obj
	while (tab.nodeName!="TABLE" && tab.nodeName!="HTML"){
		  tab=tab.parentNode
	}
	row=obj
	while (row.nodeName!="TR" && row.nodeName!="HTML"){
		  row=row.parentNode
	}
    td=obj
	while (td.nodeName!="TD" && td.nodeName!="HTML"){
		  td=td.parentNode
	}
    //alert(row.nextSibling.nextSibling)
    //alert(findPosY(row.nextSibling.nextSibling))
    //alert(findPosX(row))
	if(tab.nodeName!="HTML" && row.nodeName!="HTML"){
	    document.getElementById(DIVIF).style.visibility='visible';
        var prossimariga=row.nextSibling
        if(row.nextSibling.nodeName!="TR")
            prossimariga=prossimariga.nextSibling
	    document.getElementById(DIVIF).style.top=findPosY(prossimariga);
        if(l==null)
	        document.getElementById(DIVIF).style.left=findPosX(row);
        else
            document.getElementById(DIVIF).style.left=l;
        if(w==null)
            document.getElementById(DIVIF).style.width=row.offsetWidth;
        else
            document.getElementById(DIVIF).style.width=w;
        if(instd!=null){
	        document.getElementById(DIVIF).style.left=findPosX(td);
            document.getElementById(DIVIF).style.width=td.offsetWidth;
        }
	    document.getElementById(DIVIF).style.height=altezza;
	}else{alert("no")}
	if(DIVIFFrame!=null)
		document.getElementById(DIVIFFrame).src=url
}

function CloseIFrame(doc,DIVIF,DIVIFFrame){
	    doc.getElementById(DIVIFFrame).src="";
	    doc.getElementById(DIVIF).style.visibility="hidden";
	    doc.getElementById(DIVIF).style.top=0;
	    doc.getElementById(DIVIF).style.left=0;
	    doc.getElementById(DIVIF).style.width=0;
	    doc.getElementById(DIVIF).style.height=0;
}