function menuStart(){
	var nodeID=["navPrimary"];
	for(var j=0;j<nodeID.length;j++){
		if(document.getElementById(nodeID[j])){
		 	var node = document.getElementById(nodeID[j]).getElementsByTagName("div");
			for (var i=0; i<node.length; i++){
				node[i].onmouseover=function(){ this.className+="over"; };
				node[i].onmouseout=function(){ this.className=this.className.replace(new RegExp("over\\b"),""); };
			}
		}
	}
}
function writeLayer(ID,sText,parentID){
	if (document.getElementById){
		x = document.getElementById(ID);
		x.innerHTML = '';
		x.innerHTML = sText;
	}	else if (document.all){
		x = document.all[ID];
		x.innerHTML = sText;
	}
}
String.prototype.trim = function() {
  var x=this;
  x=x.replace(/^\s*(.*)/, "$1");
  x=x.replace(/(.*?)\s*$/, "$1");
  return x;
}

// Market Spectrum
function onMap(str){
	rExp = /:/;
	str2 = str.replace(rExp, '<br>');
	writeLayer("mapText",str2.toString());
	window.status=str;
	return true;
} 
function offMap(){
	writeLayer("mapText","<strong>Market Spectrum</strong><br />Mouse Over For Intraday Sector Performance");
	window.status="";
	return true;
}
function clickMap(hpParam, toolName){
	popUpTool('/marketmap/'+hpParam, toolName,'yes','yes',0,0);
	return true;
}

function popUpWindow(URL, NAME, HEIGHT1, WIDTH1, SCROLL, RESIZE1, TOOLBAR, MENUBAR){
	hwstring="scrollbars=" + SCROLL + ",width=" + WIDTH1 + ",height=" + HEIGHT1 + ",resizable=" + RESIZE1 + ",toolbar=" + TOOLBAR + ",menubar=" + MENUBAR;
	var newwin = window.open(URL, NAME, hwstring);
}

function newsAlert(url) {
	var popMsg = "You are leaving the Select Sector SPDR website (www.sectorspdrs.com).  This link is provided for informational purposes only and the web pages beyond this point are not maintained by ALPS Distributors, Inc., its affiliates or the Select Sector SPDR Trust.";
    var leaveSite = confirm(popMsg);
    if (leaveSite == true) 
	{
		//var newWindow = window.open(url, '_blank'); 
		//newWindow.focus(); 
		var name='news';
		popUpWindow(url, name, 800, 900, 'yes', 'yes', 'no', 'no');
	}
}

// Find X, Y of obj
function objXY(obj) {
  if(obj.offsetParent) {
    for(var posX=0,posY=0;obj.offsetParent;obj=obj.offsetParent){
      posX+=obj.offsetLeft;
      posY+=obj.offsetTop;
    }
    return [posX,posY];
  }else{
    return [obj.x,obj.y];
  }
}
