﻿/*  Used to swap the menu images
----------------------------------------------------------------*/
/*  usage:
    onmouseover="SwapMenuImage('navOdds', 'over')" onmouseout="SwapMenuImage('navOdds', 'out')" */
        
function SwapMenuImage(MenuItemName, Action)
{  
  var MenuImageOff = document.getElementById(MenuItemName + "Off");
  var MenuImageOn = document.getElementById(MenuItemName + "On");
  
  if (MenuImageOff != null && MenuImageOn != null)
  {
      if (Action == "over")
      {
        MenuImageOff.style.visibility = "visible";
        MenuImageOn.style.visibility = "hidden";
      }
      else
      {
        MenuImageOff.style.visibility = "hidden";
        MenuImageOn.style.visibility = "visible";
      }
   }
}
    


/*	Empty Function for use with Onclick 
----------------------------------------------------------------*/

/*	usage: 
	href="javascript:voidThis()" onClick="SomeFunction()" */

function voidThis() {}


/*	Empty Function for use with Onclick 
----------------------------------------------------------------*/
function navigatePage(menu,link){
// alert("navigatePage:" + link); Doesn't appear that this function is used. 
}


/*	Opens Pop Up to Handicapping Store
----------------------------------------------------------------*/
function OpenHandicappingStoreMain()
{      
	//window.open(BaseURLSSL + "Authenticated/equibaseHandiStore.asp","","help=no,toolbar,resizable=yes, status=yes, width=665px, height=480px, scrollbars=yes");	
	window.open(BaseURLSSL + "HandicappingStore.aspx","","help=no,toolbar,resizable=yes, status=yes, width=665px, height=480px, scrollbars=yes");
}

function OpenHandicappingProducts(){

	var oTrack = GetSelectedTrack();
	var track_abbr = oTrack.GetAbbr();
	var racedate = oTrack.GetRaceDate();
    
    var RaceType = GetRaceType();
    
    if (RaceType == "H") {
        track_type = "HA"
    } else {
        track_type = "TB"
    }
    
    //var link = BaseURLSSL +  "Authenticated/equibaseHandiStore.asp?track_abbr=" + track_abbr + "&racedate=" + racedate + "&tracktype=" + track_type;
    var link = BaseURLSSL +  "HandicappingStore.aspx?track_abbr=" + track_abbr + "&racedate=" + racedate + "&tracktype=" + track_type;

	window.open(link ,"","help=no,toolbar,resizable=yes, status=yes, width=665px, height=480px, scrollbars=yes");
}


/*	Opens Wager Window and Video Streaming Window
----------------------------------------------------------------*/
function topCallsToNavigation(type){

	if (typeof BaseURL == "undefined") {
		BaseURL = "/";
	}
	var programFrame = BaseURL + 'authenticated/program/default.aspx';
	var link = BaseURL + 'Authenticated/loggedinmain.aspx?direction=';
	var programIsCurrentPage = (top.bottomframe != null && top.bottomframe.location.toString().toLowerCase().indexOf(programFrame) >= 0);
	
	try{
		switch(type){
			case "WAGERWINDOW":
				if (programIsCurrentPage) {
					popWagerWindow();
					return;
				} else {
					link += escape(programFrame + "?popUp=wager");
				}
				break;
			/*
			case "STREAMING":
				if (programIsCurrentPage) {
					popMediaPlayerWindow();
					return;
				} else {
					link += escape(programFrame + "?popUp=video");
				}
				break;
			*/
			case "STREAMING":
			    if (programIsCurrentPage)
			    {
		            popLiveMediaPlayer("", "");
		            return;
		        } 
		        else 
		        {
		            link += escape(programFrame + "?popUp=video");
		        }
			    break;
		}
	}
	catch(ex){}
	top.location=link
}

/*	Opens Program Window
----------------------------------------------------------------*/	
function openProgram(){
	var varStr="'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=700'"
	var target="http://www.winnercomm.com/tvg_programguide/apr03/"
	popWin=window.open(target,"win",varStr);
}

// **************************************************** NOTE *****************************************************
// WARNING: Leave this write and close here to avoid scrolling page causing a refresh until that issue is resolved
document.write('<div style="position:absolute;">&nbsp</div>');
document.close();
// **************************************************** NOTE *****************************************************
