//********************** Global lang
var lang = "en_US";
//********************** Content Shedding Variables
var useFlashNewsApp = true;
//********************** Home Page Summary Scoreboard Config
var staticSB = 0;
var ptOn = 0;
var sbOn = 1;
var ajaxRefresh = 300000;
var newsRefresh = 900000;
var messageRefresh = 900000;
var sumScoreboardYear = 2007;
//***************div hiding and showing********************************
function isDiv(theDiv){
if (document.getElementById){
if (document.getElementById(theDiv)) return true;
}
if (eval("document."+((document.all)?"all."+theDiv:theDiv))) return true;
return false;
}
function divStyle(theDiv)
{
if (document.getElementById) return document.getElementById(theDiv).style;
return eval("document."+((document.all)?"all."+theDiv+".style":theDiv));
}
function clipDiv(thisDiv,cT,cR,cB,cL)
{
if (document.all || document.getElementById) divStyle(thisDiv).clip = "rect("+cT+" "+cR+" "+cB+" "+cL+")";
else
{
divStyle(thisDiv).clip.top = cT;
divStyle(thisDiv).clip.bottom = cB;
divStyle(thisDiv).clip.left = cL;
divStyle(thisDiv).clip.right = cR;
}
}
function showDiv(thisDiv)
{
if (document.getElementById) node=document.getElementById(thisDiv).style.visibility='visible';
else divStyle(thisDiv).visibility = "visible"
}
function hideDiv(thisDiv)
{
if (document.getElementById) node = document.getElementById(thisDiv).style.visibility='hidden';
else divStyle(thisDiv).visibility=(document.all)?"hidden":"hide";
}
//***************launch flash scoreboard********************************
var flashWindow = "";
var launchPage;
var windowHeight = 283; //minimized with ad
//***************launch flash scoreboard********************************
var ttWindow = "";
var launchPage;
var ttWindowHeight;
function launchTT(lang,view,crt,syn,debug){
if (hasReqestedFlashVersion && NPRuntime){
if (view == "draw"){
ttWindowHeight = 665;
}
else{
ttWindowHeight = 448;
//ttWindowHeight = 665;
}
launchPage = "/en_US/tracker/ttFrame.html?";
var d = new Date()
var t = d.getTime()
launchPage += "ts=" + t;
launchPage += (lang.length>1)?"&lang="+lang:"&lang=en_US";
launchPage += (syn)?"&syn="+syn:"&syn=none";
launchPage += "&wh=" + ttWindowHeight;
launchPage += "&mode=" + view;
launchPage += "&ref=" + document.location.host + document.location.pathname;
launchPage += (debug.indexOf("debug")>-1)?"&db=true":"&db=false";
launchPage += (crt)?"&crt="+crt:"&crt=none";
//alert(launchPage);
if (ttWindow.closed || ttWindow==""){
ttWindow = window.open(launchPage,"ttWindow","width=850,height=" + ttWindowHeight + ",top=0,left=0,statusbar=0")
if (ttWindow.opener == null) ttWindow.opener=self;
}
ttWindow.focus();
}
else{
document.location.href = "/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
function launch(which,crt){
var court = crt?crt:"";
if (which == 'draw') {
launchTT('en_US','draw','','','');
} else {
//location.href = 'http://www.usopen.org/en_US/scores/draws/ms/index.html?promo=slamtracker';
//} else {
launchTT('en_US','score','','','',true);
//location.href = "http://www.usopen.org/en_US/scores/index.html";
}
}
//***************launch flash scoreboard from 3rd party page********************************
var ttWindow = "";
var launchPage;
var ttWindowHeight;
function launchTT3rd(lang,view,crt,syn,debug){
if (hasReqestedFlashVersion && NPRuntime){
if (view == "draw"){
ttWindowHeight = 665;
}
else{
ttWindowHeight = 448;
//ttWindowHeight = 665;
}
launchPage = "http://2008.usopen.org/en_US/tracker/ttFrame.html?";
var d = new Date()
var t = d.getTime()
launchPage += "ts=" + t;
launchPage += (lang.length>1)?"&lang="+lang:"&lang=en_US";
launchPage += (syn)?"&syn="+syn:"&syn=none";
launchPage += "&wh=" + ttWindowHeight;
launchPage += "&ref=" + document.location.host + document.location.pathname;
launchPage += (debug.indexOf("debug")>-1)?"&db=true":"&db=false";
launchPage += (crt)?"&crt="+crt:"&crt=none";
//alert(launchPage);
if (ttWindow.closed || ttWindow==""){
ttWindow = window.open(launchPage,"ttWindow","width=850,height=" + ttWindowHeight + ",top=0,left=0,statusbar=0")
if (ttWindow.opener == null) ttWindow.opener=self;
}
ttWindow.focus();
}
else{
document.location.href = "http://2008.usopen.org/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
function launch3rd(which,crt){
var court = crt?crt:"";
if (which == 'draw') {
launchTT3rd('en_US','draw','','','');
} else {
//location.href = 'http://www.usopen.org/en_US/scores/draws/ms/index.html?promo=slamtracker';
//} else {
launchTT3rd('en_US','score','','','',true);
//location.href = "http://www.usopen.org/en_US/scores/index.html";
}
}
/******************************Video Console */
var vcWindow = "";
function launchVC(video_ref,video_width,video_height,video_title,debug,syn){
var vcLaunchPage = "/en_US/console/console.html?";
// if (video_ref == 'rtmp://cp32053.live.edgefcs.net/live/usopen2008-video@3155?AMEX') {
// document.location.href='/en_US/news/media/live.html';
// return false;
// } //if
if (hasReqestedFlashVersion && NPRuntime){
var d = new Date()
var t = d.getTime()
vcLaunchPage += "ts=" + t;
vcLaunchPage += '&video=' + video_ref;
vcLaunchPage += (video_width)?"&video_width="+video_width:"&video_width=";
vcLaunchPage += (video_height)?"&video_height="+video_height:"&video_height=";
vcLaunchPage += (video_title)?"&video_title="+video_title:"&video_title=";
vcLaunchPage += (debug && debug.indexOf("debug")>-1)?"&db=true":"&db=false";
vcLaunchPage += (syn)?"&syn="+syn:"&syn=";
vcLaunchPage += "&ref=" + document.location.host + document.location.pathname;
//vcLaunchPage += (alt)?"&alt="+alt:"&alt=";
if (vcWindow.closed || vcWindow==""){
vcWindow = window.open(vcLaunchPage,"vcWindow","width=730,height=692,top=0,left=0")
if (vcWindow.opener == null) vcWindow.opener=self;
} else {
vcWindow.document.getElementById("usoPlayer").newVideo(video_ref,video_width,video_height,video_title);
}
vcWindow.focus();
} else {
//user doesn't have flash9:
document.location.href = "/en_US/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
function launchVC3rd(video_ref,video_width,video_height,video_title,debug,syn){
var vcLaunchPage = "http://2008.usopen.org/en_US/console/console.html?";
// if (video_ref == 'rtmp://cp32053.live.edgefcs.net/live/usopen2008-video@3155?AMEX') {
// document.location.href='http://www.usopen.org/en_US/news/media/live.html';
// return false;
// } //if
if (hasReqestedFlashVersion && NPRuntime){
var d = new Date()
var t = d.getTime()
vcLaunchPage += "ts=" + t;
vcLaunchPage += '&video=' + video_ref;
vcLaunchPage += (video_width)?"&video_width="+video_width:"&video_width=";
vcLaunchPage += (video_height)?"&video_height="+video_height:"&video_height=";
vcLaunchPage += (video_title)?"&video_title="+video_title:"&video_title=";
vcLaunchPage += (debug && debug.indexOf("debug")>-1)?"&db=true":"&db=false";
vcLaunchPage += (syn)?"&syn="+syn:"&syn=";
vcLaunchPage += "&ref=" + document.location.host + document.location.pathname;
//vcLaunchPage += (alt)?"&alt="+alt:"&alt=";
if (vcWindow.closed || vcWindow==""){
vcWindow = window.open(vcLaunchPage,"vcWindow","width=730,height=692,top=0,left=0")
if (vcWindow.opener == null) vcWindow.opener=self;
} else {
vcWindow.document.getElementById("usoPlayer").newVideo(video_ref,video_width,video_height,video_title);
}
vcWindow.focus();
} else {
//user doesn't have flash9:
document.location.href = "http://2008.usopen.org/en_US/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
/***************************** Launch Pulse */
function launchPulse(){
window.open("http://pulse.usopen.org/pulse/Main.html","Pulse","height=559,width=970,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,location=no");
//window.open("http://play.pulselive.com/pulse/Main.html","Pulse","height=559,width=970,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,location=no");
}
/***************************** On Load Event */
function addLoadEvent(func)
{
var oldonload = window.onload;
if (typeof window.onload != 'function')
{
window.onload = func;
}
else
{
window.onload = function()
{
if (oldonload)
{
oldonload();
}
func();
}
}
}
/************************** NS Resize Script */
if (isNav){
origWidth = innerWidth;
origHeight = innerHeight;
}
function resizeDetected(){
if (isNav){
if (innerWidth != origWidth || innerHeight != origHeight){
location.href = location.href;
}
}
}
/***************************** pulldown redirect */
function _go(fName,sName) {
if (eval("document." + fName + "." + sName + ".options[document." + fName + "." + sName + ".selectedIndex].value"))
location.href=eval("document." + fName + "." + sName + ".options[document." + fName + "." + sName + ".selectedIndex].value");
}
//************************** Next/Prev measure
// @param dir - values are "next" or "print", using "next" to measure both next and previous clicks
var newsImg = new Image();
function nextPrevMeasure(dir){
var rannum = Math.random();
var site = "www";
if(location.hostname){
site = location.hostname + "";
}
var loc = document.location + "";
loc = loc.substring(loc.indexOf("/en_US"),loc.indexOf(".html"));
var pag = loc + "_" + dir + ".html";
//chnaged 2-6-06 - var url = "/images/uc.GIF?pag=" + pag + "&site=" + site + "&misc=" + rannum;
var url = "http://www.usopen.org/images/uc.GIF?pag=" + pag + "&site=" + site + "&misc=" + rannum;
//alert(url);
newsImg.src = url;
}
/***************************** search direct */
var search = true; //change to true to turn on search
function go_search(large){
if (search){
if (large) {
document.getElementById("ksearch3").submit();
} else {
document.getElementById("ksearch2").submit();
}
} else {
location.href = "/en_US/search/index.html";
}
}
/**************************** IBM banner reanimation */
function reanimate(){
document.getElementById("ibm_ban").src = "/images/nav/top/ibmRibbon.gif";
}
/***************************** Surfaid external navigation */
function openExternal(lnk,newWindow,w,h,shared){
if (lnk.indexOf("http://" == -1)){
switch(lnk){
case "ibm": lnk = "http://www.ibm.com/"; break;
default: break;
}
}
//remove http for reporting and measure click
if (window.sa_onclick && !shared){
var rptLnk = lnk;
if (rptLnk.indexOf("http://") == 0){
rptLnk = rptLnk.substring(7);
}
sa_onclick('http://www.usopen.org/click/'+rptLnk);
}
if (newWindow){
if (w && h){
newWindow = window.open(lnk,"consoleWindow","width=" + w + ",height=" + h + ",resizable=yes,status=yes,toolbar=yes,menubar=yes,location=yes");
}
else{
newWindow = window.open(lnk,"newWindow","menubar=1,toolbar=1,location=1,directories=1,status=1,scrollbars=1,resizable=1");
}
}
else {
document.location.href = lnk;
}
}
/***************************** Express to the Open and Wilson's Science lab Navigation */
function openExpress() {
if (window.sa_onclick){
sa_onclick('http://www.usopen.org/click/www.usta.com/amtrak/index.html');
}
window.open("http://www.usta.com/amtrak/index.html","expressWindow","width=650,height=500,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
}
function openWilson() {
// sa_onclick('http://www.usopen.org/click/www.usta.com/wilsonlab/wilson_index.html');
window.open("http://www.usta.com/wilsonlab/wilson_index.html","expressWindow","width=700,height=450,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
}
/***************************** Continental Searchbox navigation */
function goCont(){
if (window.sa_onclick){
sa_onclick('http://www.usopen.org/click/www.usopen.org/en_US/bios/nations/continental_form.html');
}
document.fltsrch.submit();
}
/***************************** Newsletter Signup navigation */
function goNews(){
if (window.sa_onclick){
sa_onclick('http://www.usopen.org/click/www.usopen.org/en_US/interactive/sms/newsletter_signup.html');
}
document.ccoptin.submit();
}
/***************************** PDF navigation */
function openPDF(loc) {
if(loc) {
if (window.sa_onclick){
sa_onclick('http://www.usopen.org'+loc);
}
window.open(loc);
}
}
/***************************** Image navigation */
function openImg(loc) {
if(loc) {
if (window.sa_onclick){
sa_onclick('http://www.usopen.org'+loc);
}
window.open(loc);
}
}
/**************************** IBM banner link */
function openIBMFlash(nav) {
if(nav) {
var url = "www-03.ibm.com/innovation/us/adv/start/index.shtml?maven_playerId=ibmplayer&maven_referralPlaylistId=6cfb6f022b4a2447008824bb497ccd3cb9a568b3&maven_referralObject=441209546#&promo=" + nav;
} else {
var url = "www-03.ibm.com/innovation/us/adv/start/index.shtml?maven_playerId=ibmplayer&maven_referralPlaylistId=6cfb6f022b4a2447008824bb497ccd3cb9a568b3&maven_referralObject=441209546#";
}
if (window.sa_onclick){
sa_onclick("http://www.usopen.org/click/" + url);
}
window.open("http://"+url,'ibmflash','resizable=1,scrollbars=1,location=1,toolbar=1,status=1,');
//window.open("http://"+url,'ibmflash','height=570,width=760,resizable=0,scrollbars=0,location=0,toolbar=0,status=0,left=100,top=100,screenX=100,screenY=100');
}
//for loading videos in hidden iframe, prevents new window from opening
function loadVideo(vidFile){
frames['videoLaunch'].location.href = vidFile;
}
/****************************** swap bullet and dash images in left nav */
function onBullet(index) {
var imgElement = "bullet"+index;
document.getElementById(imgElement).src="/images/nav/left/uo01000r1.gif";
}
function offBullet(index) {
var imgElement = "bullet"+index;
document.getElementById(imgElement).src="/images/nav/left/uo01000n1.gif";
}
function onDash(index) {
var imgElement = "dash"+index;
document.getElementById(imgElement).src="/images/nav/left/uo07610r1.gif";
}
function offDash(index) {
var imgElement = "dash"+index;
document.getElementById(imgElement).src="/images/nav/left/uo07610n1.gif";
}
//************************************************************
// Client-side access to querystring name=value pairs
// Version 1.2.3
// 22 Jun 2005
// Adam Vandenberg
//************************************************************
function Querystring(qs) { // optionally pass a querystring to parse
this.params = new Object()
this.get=Querystring_get
if (qs == null)
qs=location.search.substring(1,location.search.length)
if (qs.length == 0) return
// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
qs = qs.replace(/\+/g, ' ')
var args = qs.split('&') // parse out name/value pairs separated via &
// split out each name=value pair
for (var i=0;i<args.length;i++) {
var value;
var pair = args[i].split('=')
var name = unescape(pair[0])
if (pair.length == 2)
value = unescape(pair[1])
else
value = name
this.params[name] = value
}
}
function Querystring_get(key, default_) {
// This silly looking line changes UNDEFINED to NULL
if (default_ == null) default_ = null;
var value=this.params[key]
if (value==null) value=default_;
return value
}
var qsParse = new Querystring();
// ###################################
// ## function: printArticle
// ## inputs: divcount - number of page divs
// ## title - page title
// ## previewURL - base href (optional)
// ## desc: open a new window and
// ## display the article div content
// ###################################
function printArticle(divcount, title, previewURL) {
// Set the parameters and open a new window
printWindow = window.open('','print_window','menubar=yes,toolbar=yes,scrollbars=yes,width=720,height=600');
// Write the header and doc info to the new window
printWindow.document.write('<html><head><title>'+ title +'</title><style type="text/css">body,td,select,input{font-family : Arial, Helvetica, sans-serif;} .stext{font-size : 11px;font-family : Arial, Helvetica, sans-serif;}</style>');
if (previewURL)
{
printWindow.document.write('<base href="'+ previewURL +'" />');
}
printWindow.document.write('</head><body topmargin="0" marginheight="0" marginwidth="0">');
printWindow.document.write(document.getElementById("print").innerHTML);
printWindow.document.write('<table cellpadding="5" cellspacing="0" border="0"><tr><td>');
// Based on the divCnt loop through the divs and add their content to the window
for (x=0; x < divcount; x++) {
if (eval('document.getElementById("' + x + '")') != null) {
eval('printWindow.document.write(document.getElementById("' + x + '").innerHTML)');
}
}
// close the table and document
printWindow.document.write('</td></tr>');
printWindow.document.write('<tr><td class="stext"><br/><br/></td></tr>');
printWindow.document.write('</table>');
printWindow.document.write('</body></html>');
printWindow.document.close();
// call a function to record a page view
popupMeasure('print');
// call the print function
// auto print disabled per jda 8/3/05
// printWindow.print();
}
/*****************************************
function to change tabs on the home page
*****************************************/
function changeTab(container,which){
container = document.getElementById(container);
var imgCollection = container.getElementsByTagName('IMG');
if (document.getElementById(which)) {
var newTab = document.getElementById(which);
}
if (newTab.className.indexOf("Selected") == -1) {
newClass = which.substring(0,2)+"Selected";
newTab.className = newClass;
}
for (x=0; x<imgCollection.length; x++) {
if (imgCollection[x] != newTab) {
if ((imgCollection[x].className) && (newTab.className.indexOf("Selected") != -1)) {
imgCollection[x].className = "";
}
}
}
}
