/**
 * 
 */
var fixK = "";

var prefixUrl = "https://wp2.eurobet.it";

//var prefixUrl = "http://151.9.233.4/wps";

/**
 *
 */
function popUp(strURL, strType, strHeight, strWidth)
{
  var strOptions = "";

  if ( strType == "console" )
  {
    strOptions = "resizable,status,scrollbars,height=" + strHeight + ",width=" + strWidth;
  }

  if ( strType == "fixed" )
  {
    strOptions = "status,height=" + strHeight + ",width=" + strWidth;
  }

  if ( strType == "elastic" )
  {
    strOptions = "toolbar,menubar,scrollbars,resizable,location,height=" + strHeight + ",width=" + strWidth;
  }

  window.open(strURL, 'newWin', strOptions);
}

function newPopUp(strURL, nameWin, strType, strHeight, strWidth)
{
  var strOptions = "";

  if ( strType == "console" )
  {
    strOptions = "resizable,status,scrollbars,height=" + strHeight + ",width=" + strWidth;
  }

  if ( strType == "fixed" )
  {
    strOptions = "status,height=" + strHeight + ",width=" + strWidth;
  }

  if ( strType == "elastic" )
  {
    strOptions = "toolbar,menubar,scrollbars,resizable,location,height=" + strHeight + ",width=" + strWidth;
  }

  window.open(strURL, nameWin, strOptions);
}

function callSportPage()
{
  closeAllChildren();
  
  this.location.href = 'sport?action=sport_main_comm';
}

function callHorsePage()
{
  closeAllChildren();
  
  this.location.href = 'vbox?action=horse_intro_comm&hi=h';
}

function callHomePagePsr()
{
  closeAllChildren();
  
  this.location.href = 'vbox?action=horse_psr_intro_comm';
}

function openPoker()
{
  closeAllChildren();
  
  this.location.href = "http://www.eurobetpoker.it";
}
function openBingo()
{
  closeAllChildren();
  
  this.location.href = "vbox?action=bingo_main_comm";
}

function openLottery()
{
  closeAllChildren();
  
  this.location.href = 'vbox?action=ltt_main_comm';
}

function openSkillGames()
{
  closeAllChildren();

  this.location.href = "vbox?action=skill_main_comm";
}

function openCasinoGames()
{
  closeAllChildren();
  
  this.location.href = "vbox?action=casino_main_comm";
}

function shopFinder()
{
  popUp("http://www.eurobet.it/shopfinder/", "console", 800, 900);
}

function openGratta()
{
  //popUp("http://www.eurobet.it/sbit.go?page=gratta&lang=5&sid=5&ms=MS&site=5&newsite=1" + fixK, "console", 800, 900);
	
  closeAllChildren();
  
  this.location.href = 'vbox?action=ltt_grattaevinci';
}

function openSE()
{
  closeAllChildren();
  
  this.location.href = 'http://web.eurobet.it/vbox?action=se_main_comm';
}

function openWFL()
{
  closeAllChildren();
  
  this.location.href = 'http://web.eurobet.it/vbox?action=wfl_main_comm';
}

function openFixedOddGames()
{
  closeAllChildren();
  
  this.location.href = 'vbox?action=fog_main_comm';
  //this.location.href = 'http://www.eurobetgiochi.it/';
}

function showSummary()
{
  try
  {
    var url = "vbox?action=horse_sum_main";

    summary = window.open(url,'summary','toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=800,height=768');
  }
  catch (dom)
  {
  }
}

function showFogStats(gameType)
{
  try
  {
    var url = "vbox?action=fog_stats_main&gameType="+gameType;

    summary = window.open(url,'summary','toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=1020,height=768');
  }
  catch (dom)
  {
  }
}

function authoriseAccount()
{
  try
  {
    var url = "sport?action=authorise_account";

    pixFrame.window.location.href = url;
  }
  catch(dom)
  {
  }
}

function redirectUser(redir)
{
  closeAllChildren();

  this.location.href = redir;
}

function loadAllFrame()
{
}

function showAccount()
{
  try
  {
	var url = "vbox?action=movements" + 
		      '&licenseType=0' +
		      '&gameType=0';

	account = window.open(url,'account','toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=800,height=600');
  }
  catch (dom)
  {
  }
}

function openAccount()
{
  closeAllChildren();
	  
  this.location.href = 'vbox?action=reg_main_comm';
}

function openPromo()
{
	  closeAllChildren();
	  
	  this.location.href = 'sport?action=sport_ext_comm&ext_page=promozioni.html';
}

function openGuide()
{
  popUp("http://www.eurobet.it/guida", "console", 750, 1000);
}

function openDeposito()
{
  popUp("http://www.eurobet.it/guida/pagamento.html", "console", 750, 1000);
}

function loadBalance()
{
  try
  {
    var url = "vbox?action=load_balance";

    pixFrame.window.location.href = url;
  }
  catch(dom)
  {
  }
}

function updateBalance(bal)
{
  topFrame.window.updateBalance(bal);
}

function checkMessages()
{
  popUp(prefixUrl + "/payit.go?stage=40000&splash=1&dummy=0&mstage=1&channel=sb&" + fixK, "console", 600, 600);
}

function openSite()
{
  closeAllChildren();
  
  this.location.href = 'sport?action=site_comm';
}

function logout()
{
  closeAllChildren();
  
  this.location.href = 'sport?action=logout_comm';
}

function betradar()
{
  closeAllChildren();
	
  this.location.href = 'sport?action=livecenter';
}

function verifyCombo(tS)
{
  tV = tS.value;

  if ( tV != 999 )
  {
    switch ( tV.toLowerCase() )
    {
      case 'checkresults':
				
        tH = "/sbit.go?page=checkresults&" + fixK;
				
        break;
				
      case 'betlist':

        popupPage("sport?action=movements&licenseType=0&gameType=0", 1000, 600, "glob_cas", 0, 0, 'yes', 'yes', 'yes');
				
        tS.selectedIndex = tS.options[0];
				
        return;
				
        break;
				
      case 'statement':

        popupPage("sport?action=statelines", 1000, 600, "glob_cas", 0, 0, 'yes', 'yes', 'yes');
				
        tS.selectedIndex = tS.options[0];
				
        return;

        break;
				
      case 'balance':
				
        tH = "/sbit.go?page=balance&" + fixK;
				
        break;
				
      case 'checkbet':
				
        tH = "/sbit.go?page=checkbet&" + fixK;
				
        break;
				
      case 'clientlist':
				
        popupPage("sport?action=cl_list_comm", 1000, 700, "glob_cas", 0, 0, 'yes', 'yes', 'yes');
				
        tS.selectedIndex = tS.options[0];
				
        return;

        break;
				
      case 'newclient':
				
        //popupPage(prefixUrl + "/payit.go?stage=7500&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');
    	  
                                
        popupPage("vbox?action=reg_main_comm",600,600,"glob_cas",0,0,'yes','yes');
				
        tS.selectedIndex = tS.options[0];
				
        return;
				
        break;
				
      case 'invoice':
				
        popupPage(prefixUrl + "/payit.go?stage=7000&dispatch=list&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');
				
        tS.selectedIndex = tS.options[0];
				
        return;
				
        break;
				
      case 'contratto':
        /* RDS - 03/07/2009 - Cambio altezza e larghezza della popUp per consentire una migliore visione su IE */
        popupPage(prefixUrl + "/payit.go?stage=50000&channel=sb&"+fixK,750,900,"glob_cas",0,0,'yes','yes');
				
        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'interaccount':

        popupPage(prefixUrl + "/payit.go?stage=5000&iastage=1&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'bannerlist':

        popupPage(prefixUrl + "/oaaffit.go?astage=3000&tpaff=1&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'createtrackingcode':

        popupPage(prefixUrl + "/oaaffit.go?astage=1&tpaff=1&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'trafficreport':

        popupPage(prefixUrl + "/oaaffit.go?astage=100&tpaff=1&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'commissionreport':

        popupPage(prefixUrl + "/oaaffit.go?astage=1000&tpaff=1&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'financialreport':

        popupPage(prefixUrl + "/oaaffit.go?astage=2000&tpaff=1&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'messages':
				
        checkMessages();
				
        tS.selectedIndex = tS.options[0];
				
        return;
				
        break;
				
      case 'deposit':

        popupPage(prefixUrl + "/payit.go?stage=6&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
        
      case 'transferdesk':
    	
    	popupPage(prefixUrl + "/payit.go?stage=500002&channel=MS&Bonus_scheme_value=&splash=1&dummy=0&mstage=1&"+fixK,600,600,"glob_cas",0,0,'yes','yes');
    	  
    	return;
    	
    	break;
				
      case 'withdraw':

        popupPage(prefixUrl + "/payit.go?stage=1006&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'cashier':

        popupPage(prefixUrl + "/payit.go?stage=30000&dummy=0&splash=1&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
					
      case 'details':

        popupPage(prefixUrl + "/payit.go?stage=10006&dummy=0&splash=1&channel=sb&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'voucher':

        popupPage(prefixUrl + "/payit.go?stage=1100&agstage=1&PayM=101&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'redeembonus':

        popupPage(prefixUrl + "/payit.go?stage=41000&bstage=1&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
				
      case 'mlm':

        tH = "/sbit.go?page=multilevel&"+fixK;

        break;
				
      case 'news':

        popupPage("sport?action=news_comm", 650, 600, "glob_cas", 0, 0, 'yes', 'yes', 'yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;

      case 'smsservice':

        popupPage(prefixUrl + "/payit.go?stage=10070&channel=MS&Bonus_scheme_value=&splash=1&dummy=0&"+fixK,600,600,"glob_cas",0,0,'yes','yes');

        tS.selectedIndex = tS.options[0];

        return;

        break;
      case 'betpress':
    	
    	  tH = "vbox?action=betpress_main";

          break;
      case 'respgambling':
    	  
    	  popupPage(prefixUrl + "/payit.go?stage=10006&channel=MS&ustage=45&"+fixK,600,600,"glob_cas",0,0,'yes','yes');
	 
          tS.selectedIndex = tS.options[0];

          break;
      default:
				
        tH = "";
    }
		
    location.href = tH;
  }
  else
  {
    tS.selectedIndex = tS.options[0];
  }
}

function popupPage(pURL, wd, ht, winname, xp, yp, rs, st, res)
{
  args = "width=" + wd + ","
  args += "height=" + ht + ","
  args += "location=0,";
  args += "menubar=0,scrollbars=";
  args += rs=="yes"?"1,":"0,";
  args += "resizable=";
  args += res=="yes"?"1,":"0,";
  args += "status=";
  args += st=="yes"?"1,":"0,";
  args += "titlebar=0,";
  args += "toolbar=0,";
  args += "hotkeys=0,";
  args += "fullscreen=0,";
  args += "left=" + xp + ",";
  args += "top=" + yp;

  aP = window.open(pURL,winname,args);

  if ( (document.window != null) && (! aP.opener) )
  {
    aP.opener = document.window;
  }
	
  if ( parseInt(navigator.appVersion) >= 4 )
  {
    aP.focus();
  }
}

