// JavaScript Document

    var g_PopupIFrame;

    function IsIE6()
    {

        //return ( navigator.appName=="Microsoft Internet Explorer" );
		var ua =navigator.userAgent;
		return  (ua.match(/MSIE 6/) != null);

    }

    
function closeTooltip(id) {
	document.getElementById( 'tooltip_' +  id).style.display = "none";
	
	if (IsIE6())
        {

            g_PopupIFrame =  document.getElementById("iframe_"+id);			
			document.body.removeChild(g_PopupIFrame);
            g_PopupIFrame = null;

        }
}

function showTooltip(obj, event, id, summaryid, autoheight, title1, title2, invert, funcHideSelects ) {
	// obj: Object. Under this will be located the tooltip.
	// event: window event (onclick)
	// id: String. This string contains the id for this tooltip.
	// summaryid: String. This string contains the text (HTML) to be showed inside the tooltip.
	// autoheight: Boolean. Default: false. If it is true, to adjust table height to its content.
	// title1, title2: String. These strings contain the text (HTML) for titles located at the top of the div. 
	// invert: Boolean. If it's true, the tooltip is showed to the right of the clicked element.
	// funcHideSelects: Name of function (Hide selects showed over the tooltip - IE 6 bug only)
	//					funcHideSelects('hidden') - Hide selects or drop-downs.
	//					funcHideSelects('visible') - Show selects or drop-downs.
	
	if (document.getElementById('tooltip_' + id) ) 
		if ( document.getElementById('tooltip_' + id).style.display == 'block')
			return;
	
	
	var textTooltip = '<table  class="table_tooltip" border="0" cellpadding="0" cellspacing="0" ';
	
	if ( (autoheight != null) && (!autoheight) )
			textTooltip = textTooltip + ' height="400" ';
	else			
			textTooltip = textTooltip + ' height="auto" ';
	textTooltip = textTooltip + ' width="450">'
						 + '<tbody><tr class="tooltip_top">'
	
	var codeCloseTooltip = 'javascript:{closeTooltip("' + id + '")';
	
	if (funcHideSelects)
			codeCloseTooltip = codeCloseTooltip +  ';funcHideSelects.apply(null,new Array("visible") )}';
	else
			codeCloseTooltip = codeCloseTooltip +  '}';

	if (invert)
			textTooltip = textTooltip + '	<td><img src="/public/common/tooltip_top_invert' + (IsIE6()?'_IE6':'') + '.gif"  width="428"></td>'
							+ '	<td><a href=\'' + codeCloseTooltip + '\'>'
							+ ' <img src="/public/common/tooltip_close_invert.gif" border="0"  width="22"></a></td>';	
							
	else
						 
			textTooltip = textTooltip + '	<td><img src="/public/common/tooltip_top' + (IsIE6()?'_IE6':'') + '.gif" width="428"></td>'
							+ '	<td><a href=\'' + codeCloseTooltip + '\'>'
							+ ' <img src="/public/common/tooltip_close.gif" border="0"  width="22"></a></td>';
	
	textTooltip = textTooltip + ' </tr>'
							+ '<tr class="tooltip_middle">'
							+ '	<td colspan="2" >';
	if (title1 != null) 
			textTooltip = textTooltip + '		<strong>' + title1 + '</strong>' + '<br>';
							
	if ( (title1 != null) && (title2 != null) )
			textTooltip = textTooltip +  '		<br>';
			
	if (title2 != null) 
			textTooltip = textTooltip + '		<span class="title_underline">' + title2 + '</span>' ;							
							
	textTooltip = textTooltip + '		<div class="tooltip_div" ';
	
	if ( (autoheight != null) && (autoheight) )
			textTooltip = textTooltip + ' style="height:auto;" ';
			
	//alert("textTooltip = " + textTooltip);
	
	textTooltip = textTooltip + ' >'
							+ summaryid + '	</div>'
							+ ' </td>'
							+ '</tr>'				
							+ '<tr class="tooltip_bottom">	'			
							+ '	<td colspan="2"><img src="/public/common/tooltip_bottom.gif" width="450"></td>'
							+ '</tr>	'		
						    + '</tbody></table>';
							
	//textTooltip = textTooltip + ' <A  name="anAnchor_' + id + '"></A> ';
	
	// assign attributes to DIV element and append
    // it to web document tree
	var divPopup=document.getElementById('tooltip_' + id);
    if(!divPopup){
           var divPopup = document.createElement('div');
           divPopup.setAttribute('id', 'tooltip_' +  id);
           divPopup.className='div_tooltip';
           divPopup.innerHTML = textTooltip;
           document.getElementsByTagName('body')[0].appendChild(divPopup);    
         }
    
	var root = document.documentElement || document.body;
			
	posX = (event.x)?event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft:event.pageX;
	posY = (event.y)?event.clientY + document.documentElement.scrollTop + document.body.scrollTop:event.pageY; 
		
		 
	// move pop-up DIV element
	divPopup.style.position = "absolute";
    
	divPopup.style.top = posY + 15 + 'px';
	
	if (invert)
			divPopup.style.left = posX  + 'px' ;	
	else
			divPopup.style.left = posX - 440 + 'px' ;


	// Specify position.
	divPopup.style.position="absolute";

	// funcHideSelects(0) - Hide selects or drop-downs.
	if (funcHideSelects)
		funcHideSelects.apply(null, ['hidden']);
	
	if (IsIE6())
        {
        //Increase default zIndex of div by 1, so that DIV appears before IFrame
        divPopup.style.zIndex=divPopup.style.zIndex+1;

        var iFrame = document.createElement("IFRAME");
        iFrame.setAttribute("src", "");
		iFrame.setAttribute("id", "iframe_"+id);

        //Match IFrame position with divPopup
        iFrame.style.position="absolute";
        iFrame.style.left =divPopup.style.left;
		iFrame.style.top =posY + 30 +'px';
		iFrame.style.width = "450px";
		
        iFrame.style.height =divPopup.offsetHeight +'px';

        document.body.appendChild(iFrame);

        divPopup.style.visibility ="visible";
		
		// Show tooltip.
		divPopup.style.display="block";
		iFrame.style.height =divPopup.scrollHeight-15;
		iFrame.style.filter ="progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
		iFrame.frameBorder = 0;

        }	
	else
		{
			divPopup.style.visibility ="visible";
			divPopup.style.display="block";
		}

}


function corvirtusSummaryPrint(title1, title2, inTextToPrint)
{		
	my_window= window.open ("",	"CorvirtusSummary","status=0,location=0,width=550,height=550,resizable=yes,scrollbars=yes"); 
	
	//my_window.document.write("<html><head><link rel='stylesheet' type='text/css' href='/public/css/interface.css'></head>");
	my_window.document.write("<html>");
	my_window.document.write("<body>");	
	
	//my_window.document.write("<button onclick='window.print();'>Print</button>");
	
	my_window.document.write("<form><input type=button name=print value=\"Print Page\" onClick=\" javascript:window.print()\" ></form>");
	
	my_window.document.write("<h2>" + title1 + "</h2>");
	my_window.document.write("<U>Corvirtus " + title2 + "</U><br />");
	
	my_window.document.write(inTextToPrint.innerHTML);
	
	my_window.document.write("</body></html>");

	my_window.document.close();

}