// JavaScript Document

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function popWindow(type, urlargs){
	if (type == "privacy") {
		window.open('http://www.nci.nih.gov/common/popUps/popPrivacy.aspx','','scrollbars=no,resizable=yes,width=300,height=300');				
	} else if (type == "livehelp") {
		window.open('http://www.nci.nih.gov/common/popUps/popLiveHelp.aspx','LiveHelp','scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes,width=425,height=500');				
	} else if (type == "definition") {
		urlargs = urlargs.replace(/\s/g, '+');
		window.open('http://www.nci.nih.gov/common/popUps/popDefinition.aspx?term=' + urlargs,'','scrollbars=yes,resizable=yes,width=336,height=300');
	} else if (type == "defbyid") {
		window.open('http://www.nci.nih.gov/common/popUps/popDefinition.aspx?id=' + urlargs,'','scrollbars=yes,resizable=yes,width=336,height=300');
	} else if (type == "file") {
		window.open(urlargs, '', 'scrollbars=yes,resizable=yes,width=550,height=550');
	} else if (type == "fullbrowser") {
		window.open(urlargs, '', 'menubar=yes,location=yes,status=yes,toolbar=yes,titlebar=yes,scrollbars=yes,resizable=yes,width=675,height=510');
    } else if (type == "small") {
		window.open(urlargs, '', 'scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,titlebar=no,width=200,height=100,left=400,screenX=400,top=300,screenY=300');
	}
}

function dynPopWindow(url, name, windowAttributes)
{
	options = '';
	optWidth = 'width=500';
	optHeight = 'height=500';
	optScrollbar = 'scrollbars=yes';
	optResizable = 'resizable=yes';
	optMenubar = 'menubar=yes';
	optLocation = 'location=yes';
	optStatus = 'status=yes';
	optToolbar = 'toolbar=yes';
	
	windowOptions = windowAttributes.split(',');

	for(i = 0; i < windowOptions.length; i++)
	{
		attribute = windowOptions[i].substring(0, windowOptions[i].indexOf('=')).toLowerCase();
		
		if(attribute == 'width'){
			optWidth = windowOptions[i];
		} else if(attribute == 'height'){
			optHeight = windowOptions[i];
		} else if(attribute == 'scrollbars'){
			optScrollbar = windowOptions[i];	
		} else if(attribute == 'resizable'){
			optResizable = windowOptions[i];	
		} else if(attribute == 'menubar'){
			optMenubar = windowOptions[i];	
		} else if(attribute == 'location'){
			optLocation = windowOptions[i];	
		} else if(attribute == 'status'){
			optStatus = windowOptions[i];	
		} else if(attribute == 'toolbar'){
			optToolbar = windowOptions[i];	
		}
	}
	
	options = optWidth + ',' + optHeight + ',' + optScrollbar + ',' + optResizable + ',' + optMenubar + ',' + optLocation + ',' + optStatus + ',' + optToolbar;
	
	window.open(url, name, options);
	
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial()
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n</HE>\n<BODY>\n';

var printReadyElem = document.getElementById("printReady");

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady function");
return;
}

html += '\n</BO>\n</HT>';

var printWin = window.open("","printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
}
}
