// lottery24.net javascript functions
// mouseover lottery24_net

//////////////////////////////////////
function ChangeLanguage(handle,script)
//////////////////////////////////////
{
    document.location.href = '/' + handle.value.toLowerCase() + '/' + script;
}

///////////////////////////////
function _ShowHideMenu(id, add)
///////////////////////////////
{
    if ( document.getElementById(id).style.display == 'none' ) {
        document.getElementById(id).style.display = 'inline';
        if ( bLeftFrame )
            document.getElementById('StatusFrame').style.top = MaxHeight + add * 19 + "px";
    }   else {
        document.getElementById(id).style.display = 'none';
        document.getElementById('StatusFrame').style.top = MaxHeight + "px";
    }
}


//////////////////////////////
function Hover(row_ref,action)
//////////////////////////////
{
    return;
    var pattern = new RegExp('R([0-9]+)_(1|2)');
    var matches = row_ref.id.match(pattern);
    //alert(document.getElementById('R'+matches[1]+'_'+'1').className);
    if ( action ) {
        document.getElementById('R'+matches[1]+'_'+'1').className = 'HMenuText';
        document.getElementById('R'+matches[1]+'_'+'2').className = 'HMenuText';
    } else {
        document.getElementById('R'+matches[1]+'_'+'1').className = 'MenuText';
        document.getElementById('R'+matches[1]+'_'+'2').className = 'MenuText';
    }
    //alert(document.getElementById('R'+matches[1]+'_'+'1').className);
}

var act = 1;

//////////////////////////////////////
function _LoginField(field, orig, out)
//////////////////////////////////////
{
    if ( out ) {
        if ( field.value != '' && field.name != 'fx_userpwd' )
            return;
        if ( field.name != 'fx_userpwd' ) {
            field.value = orig;
            return;
        }

        field.style.display = 'none';
        dummy_pwd = document.getElementById('ID_dummy');
        dummy_pwd.style.display = 'inline';
        dummy_pwd.value = orig;
        return;
    }
    if ( field.name == 'dummy_password' ) {
        field.blur();
        field.style.display = 'none';
        real_pwd = document.getElementById('ID_pwd');
        real_pwd.style.display = 'inline';
        real_pwd.focus();
        return;
    }
    if ( field.value == orig ) {
        if ( field.name != 'fx_userpwd' )
            field.value = '';
        field.focus();
    }
    return;
}

//////////////////////
function OpenPartner(message, link)
//////////////////////
{
    if ( message != '' ) {
        if ( confirm(message) ) {
            newWindow = window.open(link);
            newWindow.focus();
        }
    } else {
        newWindow = window.open(link);
        newWindow.focus();
    }

    return false;
}

/////////////////////////////////
function _Exec_Charge(theMessage, MinTransfer)
/////////////////////////////////
{
    if ( !MinTransfer )
        MinTransfer = 10;

    fx_ToPay = document.charge.fx_ToPay.value;
    fx_ToPay = fx_ToPay.replace(',','.');
    if ( !IsNumeric(fx_ToPay) || (fx_ToPay == '') || (fx_ToPay < MinTransfer) ) {
        alert(theMessage);
        return false;
    }
    return true;
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.,";
   var IsNumber=true;
   var Char;

   for ( i = 0; i < sText.length && IsNumber == true; i++ ) {
      Char = sText.charAt(i);
      if ( ValidChars.indexOf(Char) == -1 )
         IsNumber = false;
    }
    return IsNumber;
}

/*=========================
   S W A P  P I C T U R E
 =========================*/
function swap_img(img, button) {
    img = "/images/"+ img;
    document.getElementById(button).src = img;
    return false;
}

function _HighLightBoth(common_id,action)
{
    var Left = document.getElementById('Left_'+common_id);
    var Right = document.getElementById('Right_'+common_id);
    var Over = 'active';
    var Out = 'wlink';
    var Color = eval(action);


    if ( Left )
        Left.className  = Color;
    if ( Right )
        Right.className = Color;
}

/*=========================
    DISABLE SELECT TEXT
 ========================*/
function disableSelect(txt) {
  var element = document.getElementById(txt);
  element.onselectstart = function () { return false; } // ie
  element.onmousedown = function () { return false; } // mozilla
}

/*========================================================
 O P E N   P O P U P   O N   C E N T E R  O F  S C R E E N
==========================================================*/
function popupCenter(width, height, attrib,url) {
    var xpos = (screen.width - width) / 2;
    var ypos = (screen.height - height) / 2;
    var pageAttrib = attrib ? "toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1" : "";
    var NewWind = window.open( url,'remote','width='+width+',height='+height+',left='+xpos+',top='+xpos+',screenX='+xpos+',screenY='+ypos+','+pageAttrib);
    if (NewWind.opener == null) {
        NewWind.opener = window;
  }
    NewWind.focus();
  //window.onError = HideError;
    return false;
}

function HideError(e)
{
    return false;
}