//<script>
var openedWin = null;
var wpercent = 100;


function fixNav() {
  // Bob H. is going to KILL me.
  imgOnSrc = "http://images.forbes.com/media/assets/home_gray.gif";
  if (document.all) {
  document.all.navImg.src =  imgOnSrc;
  }
}

function launch(url, width, height) {
	launchit(url, width, height);
	fixNav();
}

function launchit(){
	var args = launchit.arguments
	var url = args[0]
	var width = args[1]
	var height = args[2]
	
	if (!url || !width || !height) {
		alert("Error");
	} else if (width>screen.availWidth || height>screen.availHeight) {
		var targetW = screen.availWidth-8;
		wpercent = Math.floor((targetW*100)/width);
		var targetH = Math.floor((height*wpercent)/100);
		width = targetW;
		height = targetH;
		_launch(url, width, height);
	} else {
		_launch(url, width, height);
	}
}

function _launch(){
	
	closeChild()
	
	var args = _launch.arguments
	var url = args[0]
	var width = args[1]
	var height = args[2]
	var resizable = args[3] ? "yes" : "no"
	var scrollbars = args[4] ? "yes" : "no"
	var toolbar = args[5] ? "yes" : "no"
	var menubar = args[6] ? "yes" : "no"
	var status = args[7] ? "yes" : "no"
	var address = args[8] ? "yes" : "no"
	var directories = args[9] ? "yes" : "no"
	var NewX = Math.floor((screen.availWidth-(width+8))/2);
	if(NewX < 0){
		NewX = 0
	}
	var NewY = Math.floor((screen.availHeight-(height+27))/2);
	if(NewY < 0){
		NewY = 0
	}
	var params = ''
	
	params += "width="+width // 1
	params += ",height="+height // 2
	params += ",screenx="+NewX
	params += ",screeny="+NewY
	params += ",left="+NewX
	params += ",top="+NewY
	params += ",resizable="+resizable // 3
	params += ",scrollbars="+scrollbars // 4
	params += ",toolbar="+toolbar // 5
	params += ",menubar="+menubar // 6
	params += ",status="+status // 7
	params += ",location="+address // 8
	params += ",directories="+directories // 9
	
	openedWin = window.open(url, "", params);
	
}

function closeChild () {
	if (openedWin != null) {
		if (!openedWin.closed) {
			openedWin.close();
		}
	}
}
onunload = closeChild;





