/**************************************************

Joshua K Roberson
Extra and random small but useful functions

**************************************************/

// Popup window
function extras_popUp(URL, w, h, scroll) {
  day = new Date();
  id = day.getTime();
  if(w == 0 || w > screen.width)  w = screen.width;
  if(h == 0 || h > screen.height) h = screen.height;
  LeftPos = (screen.width) ? (screen.width-w)/2 : 0;
  TopPos  = (screen.height) ? (screen.height-h)/2 : 0;
  settings = 'resizable=1,toolbar=0,location=0,statusbar=0,menubar=0,width='+w+',height='+h+',top='+TopPos+',left='+LeftPos+',scrollbars='+scroll;
  eval("page" + id + " = window.open(URL, '" + id + "', '"+settings+"');");
  return false;
}


// Inject Stock Chart indo element after the 'onload' body event
// <body onload="extras_loadStockChart();"><div id="ajax_stockChart"></div>
function extras_loadStockChart() {
    var headTag = document.getElementsByTagName("head").item(0);
    if(headTag != null) { // Write to element if exists
	var scriptTag = document.createElement("script");
	scriptTag.src = 'http://studio-5.financialcontent.com/hart?Account=oilandgasinvestor&Module=stockquote3&Output=jscallback&Callback=extras_stockChartLoader';
	headTag.appendChild( scriptTag );
    }
}
function extras_stockChartLoader (HTML,JS) {
    var obj = document.getElementById('ajax_stockChart');
    if(obj != null) { // Write to element if exists
	obj.innerHTML = HTML;
	eval(JS);
    }
}
