var req = createXMLHttpRequest();
var str = '';

function createXMLHttpRequest() 
{
  // will store the reference to the XMLHttpRequest object
  var xmlHttp;
  // this should work for all browsers except IE6 and older
  try
  {
    // try to create XMLHttpRequest object
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    // assume IE6 or older
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
                                    "MSXML2.XMLHTTP.5.0",
                                    "MSXML2.XMLHTTP.4.0",
                                    "MSXML2.XMLHTTP.3.0",
                                    "MSXML2.XMLHTTP",
                                    "Microsoft.XMLHTTP");
    // try every prog id until one works
    for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) 
    {
      try 
      { 
        // try to create XMLHttpRequest object
        xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {}
    }
  }
  // return the created object or display an error message
  if (!xmlHttp)
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttp;
}

function overlay2() 
{
	var docHeight = document.height || document.body.offsetHeight;
	
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}

	el = document.getElementById("overlay");
	el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
	el2 = document.getElementById("lightbox");
	el2.style.visibility = (el2.style.visibility == "visible") ? "hidden" : "visible";
	if(el.style.visibility == "visible")
	{
		el.style.display="block";
		//document.getElementById("overlay").style.height=yWithScroll+"px";	
		document.getElementById("lightbox").style.top=document.documentElement.scrollTop + 20 + "px";
		
	}
	else
	{
		el.style.display="none";
		//document.body.style.overflow="auto";
		document.getElementById("overlay").style.height="100%";
		document.getElementById("outerContainer").style.width="350px";
		document.getElementById("outerContainer").style.height="150px";
	}
	
	if(el2.style.visibility == "visible")
	{
		el2.style.display="block";
	}
	else
	{
		el2.style.display="none";
	}
	
}

function getRDValue(radioObj) 
{
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) 
	{
		if(radioObj[i].checked) 
		{
			return radioObj[i].value;
		}
	}
	return "";
}

function changeChkValue(chkObj)
{
	if(document.getElementById(chkObj).checked)
	{
		document.getElementById(chkObj).value='1';
	}
	else
	{
		document.getElementById(chkObj).value='0';
	}
}

function addBookmark(title,url) 
{
	if (window.sidebar) 
	{ 
		window.sidebar.addPanel(title, url,""); 
	} 
	else if( document.all ) 
	{
		window.external.AddFavorite( url, title);
	} 
	else if( window.opera && window.print ) 
	{
		return true;
	}
}

function getQuoteE()
{
	if(document.getElementById("stockQ").value == "")
	{
		alert("Please enter a symbol!");
		document.getElementById("stockQ").focus();
		return false;
	}
	else
	{
		var s = document.getElementById("stockQ").value;
		
		window.open('http://finance.yahoo.com/q?s='+s, 'StockWin','');
	}		
}

var NewBox = null; 

function infobox(strURL, strWidth, strHeight) 
{ 
	if (NewBox != null && !NewBox.closed) 
		NewBox.close(); 
 
	var strOptions=""; 
	
	strOptions="toolbar=0,directories=0,status=1,menubar=0,resizable=1,"+ 
    "scrollbars=1,location=0,height="+strHeight+",width="+strWidth; 
 
	NewBox = window.open(strURL, 'NewBox', strOptions); 
	NewBox.focus(); 
}

