﻿// JScript File
// do not edit this javascript unless cleared through multimedia

// ------------------------
// Browser / OS Detection -
// ------------------------
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 = navigator.userAgent;
var OPERA = (ua.indexOf("Opera") > 0) ? 1 : 0;
var SAF = (navigator.appVersion.indexOf("Safari") >0) ? 1 : 0;

if (ua.indexOf("AOL") > 0) {
	var s_prop9="AOL"; // for Omniture
	var dclk_seg="aol"; // for Doubleclick
    }

// --------------------------
// Cookie releated functions
// --------------------------

function setCookie (name, value, expires) {
	if (!expires) expires = new Date();
	document.cookie = name + "=" + value + "; expires=" + expires.toGMTString() +";domain=.sportsline.com; path=/";
}

function readCookie(name) {
    if(document.cookie == '') { 
	return false; 
    } else { 
	var firstChar, lastChar;
	var theBigCookie = document.cookie;
	name = name + '=';
	firstChar = theBigCookie.indexOf(name);	
	if (firstChar != -1) {
	    firstChar += name.length;
	    lastChar = theBigCookie.indexOf(';', firstChar); 
	    if(lastChar == -1) lastChar = theBigCookie.length;
	    return unescape(theBigCookie.substring(firstChar, lastChar));
	} else {return false;}
    }	
} 

function killCookie(name, path, domain) {
  var theValue = readCookie(name);
  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
  }
} 

function getValue(cookieName,name) {
	cookieValue=readCookie(cookieName)
	findString=name;
	if (cookieValue) {
		namePos=cookieValue.indexOf(findString,0);
		if (namePos==-1) {return false;}
		valueStart=(cookieValue.indexOf('&',namePos+1)+1);
		valueEnd=cookieValue.indexOf('&',valueStart+1);
		if (valueEnd==-1)  valueEnd=cookieValue.length;
		valueIs=cookieValue.substring(valueStart,valueEnd)
		if (namePos!=null) {return valueIs;}
	}
	else {return false;}
}


// --------------------------
// window opening functions -
// --------------------------
function openScroll(url,name,width,height) {
    popupWin = window.open(url, name, 'menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,width=' +width +',height=' +height +',left=50,top=50');
}

function openPopup(url,name,width,height) {
	popupWin = window.open(url, name, 'menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,width=' +width +',height=' +height +',left=50,top=50');
}

function SW(url, name, type) {//translate legacy popup function to new openPopup
	var swArray = new Array([],[508,494],[494,331],[550,400],[523,360],[532,412],[610,550],[494,550]);
	for (var i=0; i < swArray.length; i++) {
  		var swWidth = swArray[type][0];
		var swHeight = swArray[type][1];
	}
  openPopup(url,name,swWidth,swHeight);
}

// ----------------------
// Bookmark Pages
// ----------------------
function bookmarkThisPage(hrefObject, bookmarkLabel){
    hrefObject.href=document.location.href;   // Some browsers do a "bookmark link" feature, so the href must have the location to bookmark -- this makes sure it does
    if(window.sidebar && window.sidebar.addPanel){
        // Add to Mozilla's sidebar/ bookmarks
        window.sidebar.addPanel( bookmarkLabel, document.location.href, '' );
    }
    else if(window.external && (navigator.platform == 'Win32' ||(window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1))){
        // Add to IE's favorites
        window.external.AddFavorite(document.location.href, bookmarkLabel);
    }
    else if(window.opera && window.print)
    {
        // Opera
        return true;
    }
    else if(document.layers){
        // Fall back into an alert box if it seems Crtl+D is the bookmarking shortcut (Netscape)
        window.alert( 'Please click OK then press Ctrl+D to create a bookmark' );
    }
    else{
        // Fall back into another alert box.
        window.alert('Please use your browser\'s bookmarking facility to create a bookmark');
    }
    return false;
}

function externalWrite( string ) {
    document.write( string );
}

