var ProductHtml = 'Loading...';
var RangeHtml = '';
var xmlhttp
try
{
	xmlhttp =  new XMLHttpRequest();
}
catch(e)
{
}

function transferDiv(srcDivID, dstDivID )
{
	var srcobj = document.layers ? document.layers[srcDivID] :
      document.getElementById ?  document.getElementById(srcDivID) :
      document.all[srcDivID];
      
      var dstobj = document.layers ? document.layers[dstDivID] :
      document.getElementById ?  document.getElementById(dstDivID) :
      document.all[dstDivID];
      
      dstobj.innerHTML = srcobj.innerHTML;
}

function transferDivNew(srcDiv, dstDiv)
{
	if (document.all)
	{    	
		document.all[dstDiv].innerHTML = document.all[srcDiv].innerHTML;
	}
  	else if (document.getElementById)
    	{
		document.getElementById(dstDiv).innerHTML = document.getElementById(srcDiv).innerHTML;

	}
}

function SetPanelHeight(height)
{
	if (height != '')
	{
		var footerpos = +height - 112;
		document.write('<style>.MainPanel {height:' + height + 'px;} .footer{top:' + footerpos + 'px;}</style>');
	}
}

function HideMenu()
{
	nd();
}
function ManageStateChange()
{

	//Sometimes this code produces an error because 'loading' does not exist.
	//If it does not exist there is nothing that the code can do therefore I have left the catch blank (for now). Peter Oakley 2006 12 28 .
	try{
          var Elt = document.getElementById('loading');

          switch(xmlhttp.readyState)
          {

               case 1:
                    Elt.style.display="block";
                    break;
               case 2:
                    Elt.style.display="block";
                    break;
               case 3:
                    Elt.style.display="block";
                    break;
               case 4:
                    if (xmlhttp.status == 200) {
                        var Content =  document.getElementById('content');
                        Content.innerHTML = xmlhttp.responseText;
                        Elt.style.display = "none";
                        }
                    break;
           }
        }
        catch(E)
        {
        }
        

}
function GetData(id)
{
        xmlhttp.open('GET', '/LotusApps/GetProduct.aspx?NodeId=' + id, true);
        xmlhttp.onreadystatechange = ManageStateChange;
    	xmlhttp.send(null);
}

function GetRangeData(id)
{
	var xmlhttp =  new XMLHttpRequest();
	xmlhttp.onreadystatechange = function() {
    		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        		RangeHtml = xmlhttp.responseText;
    		}
	}
	xmlhttp.open('GET', '/LotusApps/GetRangeLinks.aspx?NodeId=' + id, true);
	xmlhttp.send(null);
}

function flashPup(URL) {
  var width = 400;
  var height = 400;
  var x = Math.round((screen.availWidth - width) / 2);
  var y = Math.round((screen.availHeight - height) / 2);
  posString = 'left=' + x + ',top=' + y;
  window.open(URL,
              'w' +(new Date()).getTime(),
              'width=' + width + ',height=' + height + ',' + posString);
} 

function writeFlashWindow(strName) {
 top.consoleRef=window.open('','child',
  'width=350,height=250'
   +',menubar=0'
   +',toolbar=1'
   +',status=0'
   +',scrollbars=1'
   +',resizable=1')
 top.child.document.writeln(
  '<html><head><title></title></head>'
   +'<body bgcolor=white onLoad="self.focus()">'
   + getFlashparams(strName)
   +'</body></html>'
 )
 top.child.document.close()
}

function getFlashparams(strName)
{ 
    var result = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' + 	'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="550" height="400" align="middle">' +
   	'<param name="allowScriptAccess" value="sameDomain" /> ' +
   	'<param name="movie" value="' + strName +'" /> ' +
   	'<param name="quality" value="high" />' +
   	'<param name="bgcolor" value="#ffffff" />' +
	'<embed src="' + strName +'" quality="high" bgcolor="#ffffff" width="550" height="400" name="' + strName + 
	'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"  pluginspage="http://www.macromedia.com/go/getflashplayer" /><object>';
}

function ShowMenu(contenu, thumbImg)
{
	if (thumbImg != '')
		{
		  contenuHTML = '<table border=0 cellspacing=1 cellpadding=0 class="popupwindow">' +
						'<tr>' +
						'<td bgcolor=#FFFFFF><img src="' + thumbImg + '" width="50" hspace="5"/></td><td bgcolor=#FFFFFF height=30 valign=top class="abstract">&nbsp;' + contenu + '</td>' +
						'</tr>' +
						'</table>';
		}
		else
		{
      		contenuHTML = '<table border=0 cellspacing=1 cellpadding=0 class="popupwindow">' +
						'<tr>' +
						'<td bgcolor=#FFFFFF height=30 valign=top class="abstract">&nbsp;' + contenu + '</td>' +
						'</tr>' +
						'</table>';
    		}
		alert(contenuHTML);
}

window.onload = init;

function init() {
	try {
		GetData(NodeId)
		GetRangeData(NodeId);
	}
	catch(e)
	{
	}
}
