var moveThis;
var centerDivX;
var centerDivY;
var docArray = new Array();

//var lv1 = "-222px";
var lv2 = "-152px";
var rv = "16px";
	
var cDiv = '';
var hDiv = '';

var i;
var w;
var d;

var chkBrws = 'IE';

var macOSFlag = 0;
var divArray = new Array('extraLinkDiv','partLinkDiv','termsLinkDiv');
var subMenuArray = new Array('newsSubNav','sportsSubNav','entertainSubNav');

function apvDwd(pid,title,pl,t) 
{
	if(!pl) {pl='';}
		var w = window.open("http://video.ap.org/vws/search/aspx/ap.aspx?f="+pid+"&g="+title+"&p="+pl+"&t="+t,"apvDwd","width=788,height=598,status=1,scrollbars=1,resizable=1");
}

function NewWindow(stadiumName,myname, w, h, scroll) 
{
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		var pageName = "displaySection.cfm?Which="+myname+"&StadiumName="+stadiumName;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
		winName = window.open('', 'winName', winprops)
		winName.location.href = pageName;
		
		if (parseInt(navigator.appVersion) >= 4) { winName.window.focus(); }
}
		
function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
	var u2 = 'http://www.heraldsun.com'+theURL;
  	window.open(u2,winName,features);
}
	
function win(fileName) 
{
     myFloater = window.open('','myWindow','scrollbars=yes,status=no,width=400,height=250')
     myFloater.location.href = fileName;
	 myFloater.focus();
}

function chkMail(wObject)
{
	if (wObject.value.indexOf('@') == -1 || wObject.value.indexOf('.') == -1)
	{
		alert("Please enter a valid email address.");
		wObject.focus();
		return(false);
	}
	else
	{
		if (wObject.value.indexOf(";") != -1)
		{
			alert("Multiple e-mail addresses are not allowed.");
			return(false);
		}
		else
		{
		  if (wObject.value.indexOf("@aol.com") != -1)
		  {
		  	alert("AOL email addresses are not allowed in the to field.  Please manually send this article.");
		  	return(false);
		  }
		}
	}  
	
	
	return(true);
}

function doBrswChk()
{

	if (navigator.userAgent.indexOf('Firefox') != -1)
	{
		chkBrws = 'Firefox';
	}
	else
	{
		if (navigator.userAgent.indexOf('Opera') != -1)
		{
			chkBrws = 'Opera';
		}
	}
	
	
	/*
	if (navigator.userAgent.indexOf('Opera') !=-1)
	{
		alert("Incompatible Browser Detected\n\nDue to issues beyond our control, \nwww.heraldsun.com may not function correctly in Opera. \n\nPlease try another browser.");
	}
	
	if (navigator.appVersion.indexOf('Macintosh') != -1)
	{
		 macOSFlag = 1;
	}
	*/
	
}


//doBrswChk();


/*
function hideApDiv()
{
	if (chkBrws != 'IE')
	{
		alert("hello");		
	}
	
}
*/

function expandDiv(wObj)
{
	if (document.all)
		divLoc = eval(document.all[wObj]);
	else
		divLoc = eval(document.getElementById(wObj));
		
	if (divLoc.style.visibility == 'hidden' || divLoc.style.visibility == '')
	{
		divLoc.style.position = "relative";
		divLoc.style.visibility = "visible";
	}
	else
	{
		divLoc.style.position = "absolute";
		divLoc.style.visibility = "hidden";
	}
	
	
}
	
function resetDivs(y)
{
	
	
	
	if (cDiv == '')
		return(false);
	else
	{		
		var divLoc;
		
		for (var x=0;x<divArray.length;x++)
		{
			if (document.all)
				divLoc = eval(document.all[divArray[x]]);
			else
				divLoc = eval(document.getElementById(divArray[x]));
		
		
			
			if (divLoc.style.left != y)
			{
				if (cDiv==divLoc)
					cDiv='';
				
				divLoc.style.left = y;
				
			}	
			divLoc.style.zIndex = 1;	
		}
	}	
}

function resetSubNavs()
{
	for (var p=0;p <subMenuArray.length;p++)
	{

		if (document.all)
			divLoc = eval(document.all[subMenuArray[p]]);
		else
			divLoc = eval(document.getElementById(subMenuArray[p]));
	
		divLoc.style.visibility = 'hidden';
	}

}

function navScrollFunc()
{
	
	if (i <eval(w-10))
	{
		i = i+10;
		
		d.style.zIndex = 2;		
		d.style.left = i+'px';
		setTimeout('navScrollFunc()','1');
	}
	else
	{
		
		cDiv = d;
		d.style.left = rv;
		return(true);
	}
}

function disableTopAd()
{
	try
	{
			
		setTimeout('hideDiv("adDiv1")','20000');
		
	}
	catch (e){}
		

}

function swapClass(tb,cn)
{
	tb.className = cn;

}

function showSubMenu(x)
{

	resetSubNavs();
	
	if (x)
	{
		if (document.all)
			divLoc = eval(document.all[x]);
		else
			divLoc = eval(document.getElementById(x));
	
		divLoc.style.visibility = 'visible';
	}	
}

function showNavDiv(x)
{
	var divLoc;
	
	
	//retract divs
	resetDivs(lv2);
	
	if (document.all)
		divLoc = eval(document.all[x]);
	else
		divLoc = eval(document.getElementById(x));
	
	if (cDiv != divLoc)
	{
		resetSubNavs();
		//Expand Divs
		divLoc.style.zIndex = 2;	
		cDiv = divLoc;
		
		
		//i=parseInt(divLoc.style.left);
		i=parseInt(lv2);
		w=parseInt(rv);
		d=divLoc;
		
		navScrollFunc();
		
		
	}
	
}
	



	

	
function chgBG(w,x)
{
	try
	{
		w.style.background = x;
	}
	
	catch (e){}
}

function hideDiv(w)
{
	try
	{
		if (document.getElementById)
		{
			document.getElementById(w).style.visibility = 'hidden';
			document.getElementById('logo').src='http://www.heraldsun.com/images/hscom/hslogoL.gif';
			document.getElementById('srchDiv').style.visibility = 'visible';
			
		}
		else
		{
			if (document.all)
			{
				document.all[w].style.visibility = 'hidden';
				document.all['logo'].src='http://www.heraldsun.com/images/hscom/hslogoL.gif';
				document.all['srchDiv'].style.visibility = 'visible';
			}
		}	
	}
	
	catch (e){}
}

function pageJump(w,wObj)
{
	
	var objForm = eval('document.'+wObj);
	objForm.sRow.value = w;
	objForm.submit(); 
}

function grabObj(w)
{

}


/*	
function grabObj(w)
{
	var docObj =document.getElementById(w);
	
	
	centerDivX = eval(docObj.clientWidth/2);
	//centerDivY = eval(docObj.clientHeight/2);
	centerDivY =10;
		
	moveThis = docObj;
	moveThis.style.zIndex = 1;
	moveThis.style.cursor = 'move';
}

function dropObj()
{
	saveInfo(moveThis);
	try
	{
		moveThis.style.cursor = 'default';
		moveThis.style.zIndex = 0;
			
	}
	catch(e){}
	
	moveThis = '';
}
	
function findDocObj(fObj)
{
	for (var i=0;i<docArray.length;i++)
	{
		if (docArray[i])
		{	
				
			if (docArray[i][0] == fObj)
				return(i);
		}
	}
	return(docArray.length);
}

function saveInfo(wObj)
{
	if (wObj)
	{
		var aIndex=findDocObj(wObj);
		docArray[aIndex] = new Array();
		docArray[aIndex][0] = wObj;
		docArray[aIndex][1] = wObj.style.left;
		docArray[aIndex][2] = wObj.style.top;
		
		//alert(docArray[aIndex][2]);
	}
}
	
function moveDiv()
{
	return(false);
	var Xpos = 0;
	var Ypos = 0;
		
		try
		{
			Xpos = event.clientX;
			Ypos = event.clientY;
		}
		catch (y)
		{
			Xpos = e.pageX;
			Ypos = e.pageY;
		}
	
		//document.getElementById('divTable').innerHTML = "x:"+Xpos+"; y:"+Ypos;
		
		try
		{
			moveThis.style.left = eval(Xpos-centerDivX);
			moveThis.style.top = eval(Ypos-centerDivY);
			
		}
		catch (e){}
}
	
document.onmousemove = moveDiv;
document.onmouseup = dropObj;
//document.onclick = grabObj;
*/


