/*More Dropdown Menu*/
var IE = (document.all) ? 1 : 0;
var DOM = (document.getElementById) ? 1 : 0;
var NS4 = (document.layers) ? 1 : 0;
var MAC = ((navigator.appVersion.indexOf("PPC") >0) || (navigator.appVersion.indexOf("Mac") >0)) ? 1 : 0;
var ua = '$User_Agent';
var OPERA = (ua.indexOf("Opera") > 0) ? 1 : 0;

function find(str,s1,s2,s3) { 
	if (str.indexOf(s1)>=0) return true; if (s2){if (str.indexOf(s2)>=0) return true;} if (s3){if (str.indexOf(s3)>=0) return true;} return false; 
}
	
function getCoordinates(obj) {
    var point = { x: 0, y: 0 };
    while(obj) {
        point.x += obj.offsetLeft;
        point.y += obj.offsetTop;
        obj = obj.offsetParent;
        }
    return point;
    }

function whereami(anchorid) {
    var locarr = new Array();
    if(NS4) {
        if (document.anchors[anchorid]){
            locarr[0] = document.anchors[anchorid].x;
            locarr[1] = document.anchors[anchorid].y;
            }
        }
    else if(DOM) {
        var myanchor = document.getElementById(anchorid);
        var coordinates = getCoordinates(myanchor)
        if (myanchor){
            locarr[0] = coordinates.x;
            locarr[1] = coordinates.y;
            }
        }
    else {
	var myanchor = psuedoGetElementById(anchorid);
    var coordinates = getCoordinates(myanchor)
    if(myanchor.offsetLeft&&myanchor.offsetTop){
        locarr[0] = coordinates.x;
        locarr[1] = coordinates.y;
        }
    }
	return locarr;
	}

var cDomain=".pgatour.com";
var tour_code="nat";

function pullDownObj(){

    this.property = function(){};
    this.characterPixel = 7;
    this.bulletMargin = 22;
    this.lineHeight = 17;
    this.menus = Array();
    this.isOver = false;
    this.timer = null;
    this.activeMenu = null;
			
    this.add = function( name, menuItems, vLoc, hLoc, alignment ){
        this.menus[this.menus.length] = name;
        maxChar = 0;
        this.html =  '<table width="100%" border="0" cellspacing="1" cellpadding="9" bgcolor="#000000">';
        this.html+=  '<tr><td class="dropdown">';
        this.html+=   '<div class="list_leftnav">';
        this.html+=    '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
        for( var i=0; i<menuItems.length; i++ ){
            tempArray = pdItems[i].split('|');
            label = tempArray[0];
            url = tempArray[1];
            target = tempArray[2];
            if( target ) target = ' target="' + target + '"';
            
            maxChar = Math.max( maxChar, label.length );
            
            this.html+= '<tr height="17">';
            this.html+= '<td valign="middle"><img src="http://i.pgatour.com/pgatour/.element/img/1.0/main/pd_arrow_' +tour_code + '.gif" width="6" height="6" border="0"></td>';
            this.html+= '<td valign="middle">&nbsp;<a href="'+ url +'" '+ target +' >'+ label + '</a></td>';
            this.html+= '</tr>';
        }

        this.html+='</table>';
        this.html+='</div>';
        this.html+='</table>';
        this.html+='</div>';			
        
        // Width & Height of Menu DIV
        mWidth = maxChar * this.characterPixel + this.bulletMargin;
        mHeight = this.lineHeight * menuItems.length  + 20;
        
        if( alignment == 'center' ){mLeft = hLoc - ( mWidth / 2  );}
        else if( alignment == 'right' ){mLeft = this.hMax - mWidth;}
        else{mLeft = hLoc;}
        
        this.html = '<div onMouseOver="pullDown.OverLayer();" onMouseOut="pullDown.OutLayer();" id="pullDown_' +name + '" style="visibility:hidden; position:absolute; z-index:50; top:147px; left:' +mLeft +'px; width: ' +mWidth + 'px; height: ' +mHeight + 'px; overflow:hidden;">' +
        this.html +
        '</div>';		
        
        document.write( this.html );
    }
    
    this.expand = function( name ){
        divName = 'pullDown_' + name;
        clearTimeout(this.timer);
        if( this.activeMenu != name ){
            this.hideAll();
            document.getElementById(divName).style.visibility = 'visible';
            this.activeMenu = name;
            }
        }

    this.OverLayer = function(){
        clearTimeout(this.timer);
        this.isOver = true;
        }
    
    this.OutLayer = function(){
        clearTimeout(this.timer);
        isOver = false;
        this.timer = setTimeout("pullDown.hideAll()",500);
        }
    
    this.hideAll = function(){
        this.activeMenu = null;
        for( i=0; i<this.menus.length; i++ ){
            document.getElementById('pullDown_'+this.menus[i]).style.visibility = 'hidden';
            }
        }
    }
			
    var gna=whereami('globalnav_anchor');

    var pullDown      = new pullDownObj();
    pullDown.hMax = 985;

    var pdItems = Array(
        "Charity|http://www.pgatour.com/charity",
        "PGA TOUR exemptions|http://www.pgatour.com/players/pgatour-exempt",
        "Free Newsletter|http://www.pgatour.com/customize/newsletter",
        "Charity Challenge|http://www.pgatour.com/partners/astrazeneca",
        "Tickets|http://www.pgatour.com/tournaments/tickets",
        "Saturday Pro-Am|http://www.saturdayseries.com|_blank",
        "Wireless|http://www.pgatour.com/multimedia/wireless",
        "World Golf Hall of Fame|http://www.wghof.com/|_blank",
        "PGA TOUR Partners Club|http://www.sportsline.com/redir?url=3119|_blank"
        );

    pullDown.add( 'more', pdItems, gna[1], 800, 'left' );		

/*News Tab Toggle*/
function toggleTab(id) {
    var headlinesMenu = document.getElementById("headlinesMenu");
    var elementsMenu = headlinesMenu.getElementsByTagName("li");
	var headlinesItem = document.getElementById('headlinesItem');
    var elementsItem = headlinesItem.getElementsByTagName('li');

    for (var i = 0; i < elementsMenu.length; i++) {
        var link = elementsMenu[i].getElementsByTagName("a");
        if (i == id) {
            elementsMenu[i].style.backgroundColor = "#D5DFE7";
            link[0].style.color = "#02366F";
            elementsItem[i].style.visibility = "visible";
        }
        else {
            elementsMenu[i].style.backgroundColor = "transparent";
            link[0].style.color = "#fff";
            elementsItem[i].style.visibility = "hidden";
        }
    }
}

function toggleLeaderboardTab(id) {
	var tabId = id % 3;
	var leaderboardTabTBody = document.getElementById('leaderboardTabTBody');
	var leaderboardTabRows = leaderboardTabTBody.getElementsByTagName('tr');

	var leaderboardTabs = leaderboardTabRows[0].getElementsByTagName('td');
	for (var i = 0; i < leaderboardTabs.length; i+=2) {
		if (i == tabId*2) {
			leaderboardTabs[i].className = 'tabSet-on';
		} else {
			leaderboardTabs[i].className = 'tabSet-off';
		}
	}
	var spacerTabs = leaderboardTabRows[1].getElementsByTagName('td');
	for (var i = 0; i < spacerTabs.length; i+=2) {
		if (i == tabId*2) {
			spacerTabs[i].className = 'tabSetFoot-on';
		} else {
			spacerTabs[i].className = 'tabSetFoot-off';
		}
	}

	var HTTP = new Object();
	HTTP._factories = [
			function() { return new XMLHttpRequest(); },
			function() { return new ActiveXObject("Msxml2.XMLHTTP"); },
			function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
	];

	HTTP._factory = null;

	HTTP.newRequest = function() {
		if (HTTP._factory != null) return HTTP._factory();

		for (var i = 0; i < HTTP._factories.length; i++) {
			try {
				var factory = HTTP._factories[i];
				var request = factory();
				if (request != null) {
					HTTP._factory = factory;
					return request;
				}
			} catch (e) {
				// nop
			}
		}

		HTTP._factory = function() {
			throw new Error("XMLHttpRequest not supported");
		}
		HTTP._factory();
	}

	var request = HTTP.newRequest();
	request.onreadystatechange = function() {
		if (request.readyState == 4 && request.status == 200) {
			var leaderboardDiv = document.getElementById('tabSet_leaderboard_div');
			leaderboardDiv.innerHTML = request.responseText;
		}
	}

	if (id == 0) {
		request.open("GET", '/.element/ssi/sect/1.0/stats/r/body/moneyLeaders.html', true);
	} else if (id == 1) {
		request.open("GET", '/.element/ssi/sect/1.0/stats/s/body/moneyLeaders.html', true);
	} else if (id == 2) {
		request.open("GET", '/.element/ssi/sect/1.0/stats/h/body/moneyLeaders.html', true);
	} else if (id == 3) {
		request.open("GET", '/.element/ssi/sect/1.0/leaderboard/r/body/top5Leaderboard.html', true);
	} else if (id == 4) {
		request.open("GET", '/.element/ssi/sect/1.0/leaderboard/s/body/top5Leaderboard.html', true);
	} else if (id == 5) {
		request.open("GET", '/.element/ssi/sect/1.0/leaderboard/h/body/top5Leaderboard.html', true);
	} else {
		// Default: go for PGA Tour moneylist
		request.open("GET", '/.element/ssi/sect/1.0/stats/r/body/moneyLeaders.html', true);
	}

	request.send(null);
}


// **************************************************************************
// VIDEO PLAYER CODE

// this is for opening pop-up windows
function CNN_openPopup( url, name, widgets, openerUrl )
{
	var host = location.hostname;
	try {
		window.top.name = "opener";
	} catch (e) {}
	var popupWin = window.open( url, name, widgets );
	if(popupWin) {cnnHasOpenPopup = 1;}
	if ( popupWin && popupWin.opener ) {
		if ( openerUrl )
		{
			popupWin.opener.location = openerUrl;
		}
	}
	if ( popupWin) {
		popupWin.focus();
	}
}


// Cookies
function WM_browserAcceptsCookies() {
	var WM_acceptsCookies = false;
	if ( document.cookie == '' ) {
		document.cookie = 'WM_acceptsCookies=yes'; // Try to set a cookie.
		if ( document.cookie.indexOf( 'WM_acceptsCookies=yes' ) != -1 ) {
			WM_acceptsCookies = true;
		} // If it succeeds, set variable
	} else { // there was already a cookie
		WM_acceptsCookies = true;
	}

	return ( WM_acceptsCookies );
}

function WM_setCookie( name, value, hours, path, domain, secure ) {
	if ( WM_browserAcceptsCookies() ) { // Don't waste your time if the browser doesn't accept cookies.
		var numHours = 0;
		var not_NN2 = ( navigator && navigator.appName
					&& (navigator.appName == 'Netscape')
					&& navigator.appVersion
					&& (parseInt(navigator.appVersion) == 2) ) ? false : true;

		if ( hours && not_NN2 ) { // NN2 cannot handle Dates, so skip this part
			if ( (typeof(hours) == 'string') && Date.parse(hours) ) { // already a Date string
				numHours = hours;
			} else if ( typeof(hours) == 'number' ) { // calculate Date from number of hours
				numHours = ( new Date((new Date()).getTime() + hours*3600000) ).toGMTString();
			}
		}

		document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=' + numHours):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':''); // Set the cookie, adding any parameters that were specified.
	}
} // WM_setCookie

function WM_readCookie( name ) {
	if ( document.cookie == '' ) { // there's no cookie, so go no further
		return false;
	} else { // there is a cookie
		var firstChar, lastChar;
		var theBigCookie = document.cookie;
		firstChar = theBigCookie.indexOf(name);	// find the start of 'name'
		var NN2Hack = firstChar + name.length;
		if ( (firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=') ) { // if you found the cookie
			firstChar += name.length + 1; // skip 'name' and '='
			lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').
			if (lastChar == -1) lastChar = theBigCookie.length;
			return unescape( theBigCookie.substring(firstChar, lastChar) );
		} else { // If there was no cookie of that name, return false.
			return false;
		}
	}
} // WM_readCookie

function WM_killCookie( name, path, domain ) {
	var theValue = WM_readCookie( name ); // We need the value to kill the cookie
	if ( theValue ) {
		document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:''); // set an already-expired cookie
	}
} // WM_killCookie


var agt		= navigator.userAgent.toLowerCase();
var versInt	= parseInt(navigator.appVersion);
var is_aol	= (agt.indexOf("aol") != -1);
var cnnDomainArray = location.hostname.split( '.' );
var cnnSiteWideCurrDate = new Date();
var cnnHasOpenPopup = 0;

// initialize global variables
var detectableWithVB = false;
var pluginFound = false;

function detectWindowsMedia() {
	pluginFound = detectPlugin( 'Windows Media' );
	// if not found, try to detect with VisualBasic
//	if ( !pluginFound && detectableWithVB ) {
//		pluginFound = detectActiveXControl( 'MediaPlayer.MediaPlayer.1' );
//	}
	if ( !pluginFound && detectWMPSupport() ) {
		pluginFound = true;
	}
	return pluginFound;
}

function detectWMPSupport(){

    var wmp64 = "MediaPlayer.MediaPlayer.1";
    var wmp7 = "WMPlayer.OCX.7";
    if((window.ActiveXObject && navigator.userAgent.indexOf('Windows') != -1) || window.GeckoActiveXObject)
    {
        if(createActiveXObject(wmp7)){
            return true;

        }else{
            if(createActiveXObject(wmp64)){
                return true;
            }else{
                return false;
            }
        }
    }else{
        return false;
    }
}

function createActiveXObject(id){
  var error;
  var control = null;

  try{
    if (window.ActiveXObject){
      control = new ActiveXObject(id);
    }else if (window.GeckoActiveXObject){
      control = new GeckoActiveXObject(id);
    }
  }
  catch (error){;}
  return control;
}

function detectPlugin() {
	// allow for multiple checks in a single pass
	var daPlugins = arguments;
	// consider pluginFound to be false until proven true
	var pluginFound = false;
	// if plugins array is there and not fake
	if ( navigator.plugins && navigator.plugins.length > 0 ) {
		var pluginsArrayLength = navigator.plugins.length;
		// for each plugin...
		for ( var pluginsArrayCounter = 0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
			// loop through all desired names and check each against the current plugin name
			var numFound = 0;
			for ( var namesCounter = 0; namesCounter < daPlugins.length; namesCounter++ ) {
				// if desired plugin name is found in either plugin name or description
				if ( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) ||
					(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
					// this name was found
					numFound++;
				}
			}
			// now that we have checked all the required names against this one plugin,
			// if the number we found matches the total number provided then we were successful
			if ( numFound == daPlugins.length ) {
				pluginFound = true;
				// if we've found the plugin, we can stop looking through at the rest of the plugins
				break;
			}
		}
	}
	return pluginFound;
} // detectPlugin


// Here we write out the VBScript block for MSIE Windows
if ( (navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1) ) {
	document.writeln( '<script language="VBscript">' );

	document.writeln( '\'do a one-time test for a version of VBScript that can handle this code' );
	document.writeln( 'detectableWithVB = False' );
	document.writeln( 'If ScriptEngineMajorVersion >= 2 then' );
	document.writeln( '  detectableWithVB = True' );
	document.writeln( 'End If' );

	document.writeln( '\'this next function will detect most plugins' );
	document.writeln( 'Function detectActiveXControl( activeXControlName )' );
	document.writeln( '  on error resume next' );
	document.writeln( '  detectActiveXControl = False' );
	document.writeln( '  If detectableWithVB Then' );
	document.writeln( '     detectActiveXControl = IsObject( CreateObject( activeXControlName ) )' );
	document.writeln( '  End If' );
	document.writeln( 'End Function' );

	document.writeln( '\'and the following function handles QuickTime' );
	document.writeln( 'Function detectQuickTimeActiveXControl()' );
	document.writeln( '  on error resume next' );
	document.writeln( '  detectQuickTimeActiveXControl = False' );
	document.writeln( '  If detectableWithVB Then' );
	document.writeln( '    detectQuickTimeActiveXControl = False' );
	document.writeln( '    hasQuickTimeChecker = false' );
	document.writeln( '    Set hasQuickTimeChecker = CreateObject( "QuickTimeCheckObject.QuickTimeCheck.1" )' );
	document.writeln( '    If IsObject( hasQuickTimeChecker ) Then' );
	document.writeln( '      If hasQuickTimeChecker.IsQuickTimeAvailable( 0 ) Then ' );
	document.writeln( '        detectQuickTimeActiveXControl = True' );
	document.writeln( '      End If' );
	document.writeln( '    End If' );
	document.writeln( '  End If' );
	document.writeln( 'End Function' );

	document.writeln( '\'and the following function handles RealOne' );
	document.writeln( 'Function detectRealOneActiveXControl()' );
	document.writeln( '  on error resume next' );
	document.writeln( '  detectRealOneActiveXControl = False' );
	document.writeln( '  If detectableWithVB Then' );
	document.writeln( '    detectRealOneActiveXControl = False' );
	document.writeln( '    hasRealOneVersionPlugin = false' );
	document.writeln( '    Set hasRealOneVersionPlugin = CreateObject( "IERPCtl.IERPCtl.1" )' );
	document.writeln( '    If IsObject( hasRealOneVersionPlugin ) Then' );
	document.writeln( '      If hasRealOneVersionPlugin.RealPlayerVersion Then ' );
	document.writeln( '        detectRealOneActiveXControl = True' );
	document.writeln( '      End If' );
	document.writeln( '    End If' );
	document.writeln( '  End If' );
	document.writeln( 'End Function' );

	document.writeln( '<\/scr' + 'ipt>' );
}



// ________________________________________________________________ LaunchVideo


function LaunchVideo( videoPath ) {
	var videoDate = "";
	var cnnVideoDatePathRegExp = /(\d{4})\/(\d{2})\/(\d{2})/;
	var cnnVideoDatePathArray = cnnVideoDatePathRegExp.exec( videoPath );

	if ( cnnVideoDatePathArray )
	{
		var originalDate = new Date( parseInt( cnnVideoDatePathArray[1] ), parseInt( cnnVideoDatePathArray[2] ) - 1, parseInt( cnnVideoDatePathArray[3] ) );
		var expireDate = new Date( originalDate.getTime() + ( 7 * 24 * 60 * 60 * 1000 ) );
		var expireYear = new String( expireDate.getFullYear() );
		var expireMonth = new String( expireDate.getMonth() + 1 );
		var expireDay = new String( expireDate.getDate() );

		if ( expireMonth.length < 2 ) {
			expireMonth = '0' + expireMonth;
		}

		if ( expireDay.length < 2 ) {
			expireDay = '0' + expireDay;
		}

		videoDate = expireYear + '/' + expireMonth + '/' + expireDay;
	}

	cnnVideo( 'play', '/video' + videoPath.substring( 0, ( videoPath.length - 1 ) ), videoDate );
}

function cnnVideo( mode, arg, expiration )
{
	var playerURL    = '/video/player/player.html';
	var detectURL    = '/video/player/detect.exclude.html';
	var noplugURL    = '/video/player/pages/detection/noplugin.html';
	var expireURL    = '/video/player/player.html';
	var openURL      = detectURL;
	var cnnVideoArgs = '';

	if ( detectWindowsMedia() )
	{
		var cnnPassedDetection = new String( WM_readCookie( 'cnnVidPlug' ) ).toLowerCase();

		if ( cnnPassedDetection == "activex" || cnnPassedDetection == "native" )
		{
			openURL = playerURL;
		}
	}
	else
	{
		openURL = noplugURL;
	}

	switch ( mode )
	{
		case 'play':

			var cnnExpireDate = new Date( new Date().getTime() - 24*60*60*1000 );
			var dateStringRegExp = /^(\d{4})\/(\d{2})\/(\d{2})$/;
			var dateStringArray = dateStringRegExp.exec( expiration );

			if ( dateStringArray && expiration)
			{
				cnnExpireDate = new Date( dateStringArray[1], dateStringArray[2] - 1, dateStringArray[3] );
			} else {
				cnnExpireDate = cnnSiteWideCurrDate;
			}

			if ( cnnExpireDate.getTime() < cnnSiteWideCurrDate.getTime() )
			{
				if ( cnnPassedDetection == "activex" || cnnPassedDetection == "native" )
					{
						openURL = expireURL;
				} else {
						openURL = detectURL;
				}
				cnnVideoArgs = 'url=/video/player/static/404';
			}
			else
			{
				cnnVideoArgs = 'url=' + arg;
			}

			break;

		case 'browse':
			cnnVideoArgs = 'section=' + arg;
			break;

		default:
			cnnVideoArgs = 'section=/ALL';
			break;

	}
	if(openURL.indexOf('http://')==-1)
	{
		//openURL='http://www.pgatour.com'+openURL;	/** OMITTED::To Test On Dev & Ref **/
	}

	CNN_openPopup( openURL+'?'+cnnVideoArgs, 'CNNVideoPlayer', 'scrollbars=no,resizable=no,width=770,height=570' );

}

function cnnPlayVideo( url ){
	cnnOpen( url )
}

// END VIDEO PLAYER CODE ***********************

// BEGIN PHOTO GALLERY POPUP CODE

function gallery_popup(galleryURL) {
	CNN_openPopup(galleryURL, 'gallery_popup', 'scrollbars=no,resizable=no,width=754,height=620');
}

// END PHOTO GALLERY POPUP CODE


// BEGIN PRINTER-FRIENDLY CODE ******************
function printFriendly()
{
	printBanner1 = document.getElementById("printBanner");
	bannerAd1 = document.getElementById("bannerAd");
	bannerAd2 = document.getElementById("adspace-bannerAd");
	header1 = document.getElementById("header");
	pageContent1 = document.getElementById("pageContent");
	colLeft1 = document.getElementById("colLeft");
	colRight1 = document.getElementById("colRight160");
	printTools1 = document.getElementById("printTools");
	printIcon1 = document.getElementById("printIcon");
	footer1 = document.getElementById("footer");

	if (printBanner1) { printBanner1.style.display = "inline"; }
	if (bannerAd1) { bannerAd1.style.display = "none"; }
	if (bannerAd2) { bannerAd2.style.display = "none"; }
	if (header1) { header1.style.display = "none"; }
	if (pageContent1) { pageContent1.style.backgroundImage = "none"; }
	if (colLeft1) { colLeft1.style.display = "none"; }
	if (colRight1) { colRight1.style.display = "none"; }
	// if (printTools1) { printTools1.style.display = "inline"; }
	if (printIcon1) { printIcon1.style.display = "none"; }
	if (footer1) { footer1.style.display = "none"; }
	window.print();
	return;
}
function viewFriendly()
{	
	printBanner1 = document.getElementById("printBanner");
	bannerAd1 = document.getElementById("bannerAd");
	bannerAd2 = document.getElementById("adspace-bannerAd");
	header1 = document.getElementById("header");
	pageContent1 = document.getElementById("pageContent");
	colLeft1 = document.getElementById("colLeft");
	colRight1 = document.getElementById("colRight160");
	printTools1 = document.getElementById("printTools");
	printIcon1 = document.getElementById("printIcon");
	footer1 = document.getElementById("footer");

	if (printBanner1) { printBanner1.style.display = "none"; }
	if (bannerAd1) { bannerAd1.style.display = "inline"; }
	if (bannerAd2) { bannerAd2.style.display = "inline"; }
	if (header1) { header1.style.display = "inline"; }
	if (pageContent1) { pageContent1.style.backgroundImage = "inline"; }
	if (colLeft1) { colLeft1.style.display = "inline"; }
	if (colRight1) { colRight1.style.display= "inline"; }
	if (printIcon1) { printIcon1.style.display = "inline"; }
	if (printPage1) { printPage1.style.display = "none"; }
	if (footer1) { footer1.style.display = "inline"; }
	return;
};
// END PRINTER-FRIENDLY CODE ******************


/* Login box */
var networkRow = new Object();

networkRow.userField = function( action, input ){

	if( action == 'focus' ){
		input.className = 'userActive';
	}else if( action == 'blur' && ! input.value.length ){
		input.className = 'userInactive';
	}
}

networkRow.passwordField = function( action, input ){
	if( action == 'focus' ){
		input.className = 'passActive';
	} else if( action == 'blur' && ! input.value.length ){
		input.className = 'passInactive';
	}
	return;
}

// cnnOpen
function cnnOpen( url ) {
	if (url) {
		lowerUrl = url.toLowerCase().replace(' ', '');
		if (lowerUrl.indexOf('/video/video') > -1 || lowerUrl.indexOf('/video/audio') > -1) { window.location = '/video/?'+url; }
		else if (lowerUrl.indexOf('/photos/20') > -1) { window.location = '/photos/?'+url; }
		else if (lowerUrl.indexOf('/video/liveat/?') == 0) { openLiveAt(url.replace('/video/liveat/?', '')); }
		else if (lowerUrl.indexOf('/swingplex') > -1) {
			CNN_openPopup(url,'780x445','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=780,height=445');
		}
		else { window.location = url; }
	}
}
// tourOpen
function tourOpen( url ) { cnnOpen(url); }