/*
var FULL_SCREEN = false;

function setPosJoinDiv()
{
  ret1 = getWindowScroll();
  scrollX = ret1[0];
  scrollY = ret1[1];
  
  ret2 = getWindowSize();
  w = ret2[0];
  h = ret2[1];
    
  elDiv = byID('joinDiv');
  if (elDiv)
  {
    width = parseInt(elDiv.style.width);
    height = parseInt(elDiv.style.height);
    if (FULL_SCREEN)
    {
      elDiv.style.width = (w-0) + 'px';
      elDiv.style.height = (h-0) + 'px';
      elDiv.style.top = (0 + scrollY) + 'px'; // вычисляем центр документа по X
      elDiv.style.left = (0 + scrollX) + 'px';		// вычисляем центр документа по Y
      var elTbl = byID('joinTable');
      if (elTbl) { elTbl.style.height = (parseInt(elDiv.style.height) - 10) + 'px'; }
      
    }
    else
    {
      elDiv.style.top = ((h/2)-(height/2) + scrollY) + 'px'; // вычисляем центр документа по X
      elDiv.style.left = ((w/2)-(width/2) + scrollX) + 'px';		// вычисляем центр документа по Y
    }
  }
}

function showJoinDiv(full)
{
  if (full == 1) { FULL_SCREEN = true; } else { FULL_SCREEN = false; }
  var elDiv = byID('joinDiv');
  if (elDiv) { elDiv.style.display = ''; }
  setPosJoinDiv();
  return false;
}

function closeDiv()
{
  var elDiv = byID('joinDiv');
  if (elDiv) { elDiv.style.display = 'none'; }
}

function WinScroll()
{
  var elDiv = byID('joinDiv');
  if (elDiv) { if (elDiv.style.display != 'none') { setPosJoinDiv(0); } }
}

function WinScroll2()
{
  window.scrollTo(0,0);
}

//window.onscroll = WinScroll;
addScrollEvent(WinScroll);
*/

function openReg()
{
		$.blockUI({ 
		  message: $('#register_dialog'), 
		  fadeIn: 500, 
      fadeOut: 500,
      
      /*
      overlayCSS: {
        opacity: '.4'
      },
      */
      css: { 
        top:  ($(window).height() - $('#register_dialog').height()) /2 + 'px', 
        left: ($(window).width() - $('#register_dialog').width()) /2 + 'px'
        }

		}); 
}

function showNEEDSELECTDIV(value)
{
  if ($('#NEEDSELECTDIV').length)
  {
    if (value == 'NEEDSELECT')
    {
      $('#'+CUR_GEOIP).hide();
      $('#stoimost_'+CUR_GEOIP).hide();
      $('#NEEDSELECTDIV').show();
    }
    else
    {
      $('#NEEDSELECTDIV').hide();
      $('#'+CUR_GEOIP).show();
      $('#stoimost_'+CUR_GEOIP).show();
    }
  }
}

function ch_link_stoim()
{
  $('#NEEDSELECTDIV').hide();
  if ($('#mts_sel_oper_'+CUR_GEOIP).length)
  {
    var value = $('#mts_sel_oper_'+CUR_GEOIP).val();
    //alert(value);
    tmp = value.split(':');
    if (tmp.length > 1) 
    {
      value = tmp[0]; 
      cntsms = tmp[1];
      $('.countsms_alter').html(cntsms);
      $('.countsms_alter').show();
      $('.countsms_main').hide();
    }
    else
    {
      $('.countsms_alter').hide();
      $('.countsms_main').show();
    }
    if (value == 'other')
    {
      $('.link_stoim_mts').hide();
      $('.link_stoim_other').show();
    }
    else
    {
      $('.link_stoim_other').hide();
      $('.link_stoim_mts').show();
    }
    
    if ($('#SHOWFULLLINKFORALL').length)
    {
      $('.link_stoim_other').hide();
      $('.link_stoim_mts').show();
    }
    
    // ******
    showNEEDSELECTDIV(value);
    // ******
    
  }
}

function ch_oper_div()
{
  $('#NEEDSELECTDIV').hide();
  var reallink = 'other';
  if ($('#real_oper_ch_'+CUR_GEOIP).length)
  {
    $('#'+CUR_GEOIP).find('.curent_oper').each(function(){
      $(this).hide();
      $(this).find('.msg_alert:first').hide();
    });
    
    operator_id = $('#real_oper_ch_'+CUR_GEOIP).val();
    var tmp = operator_id.split(':');
    
    if (tmp.length > 1) { operator_id = tmp[0]; reallink = tmp[1]; }
    if (operator_id == null)
    {
      $('#'+CUR_GEOIP).find('.curent_oper:first').show();
    }
    else
    {
      $('#onecountry_jid_'+operator_id).show();
      var replnumber = $('#onecountry_jid_'+operator_id).find('.realst:first').html();
      if (replnumber)
      {
        $('#stoimost_'+CUR_GEOIP).find('.link_stoim_mts').each(function(){
          $(this).attr('href',replnumber);
        });
      }
      // ******
      showNEEDSELECTDIV(operator_id);
      // ******
    }
  }
  if (reallink == 'other')
  {
    $('.link_stoim_mts').hide();
    $('.link_stoim_other').show();
  }
  else
  {
    $('.link_stoim_other').hide();
    $('.link_stoim_mts').show();
  }
}

$(document).ready(function() { 
  
  //showSelectedCountry(CUR_GEOIP);
  //ch_link_stoim();
  
	$.blockUI.defaults.css = {};
	$.blockUI.defaults.applyPlatformOpacityRules = false;
	
	$('.show_reg_dialog').click(function() { 
		openReg();
	}); 
	
	$('.close_dialog').click(function() { 
		$.unblockUI(); 
		return false; 
	}); 
	
	$('.show_warn_dialog').click(function() {
		$.blockUI({ 
	  message: $('#warn_dialog'), 
	  fadeIn: 500, 
    fadeOut: 500,
    css: { 
      top:  ($(window).height() - $('#warn_dialog').height()) /2 + 'px', 
      left: ($(window).width() - $('#warn_dialog').width()) /2 + 'px'
      }
		});
	});

	$('.show_logon_dialog').click(function() {
		$.blockUI({ 
	  message: $('#logon_dialog'), 
	  fadeIn: 500, 
    fadeOut: 500,
    css: { 
      top:  ($(window).height() - $('#logon_dialog').height()) /2 + 'px', 
      left: ($(window).width() - $('#logon_dialog').width()) /2 + 'px'
      }
		});
	});

	$('.show_forgot_dialog').click(function() {
		$.blockUI({ 
	  message: $('#forgot_dialog'), 
	  fadeIn: 500, 
    fadeOut: 500,
    css: { 
      top:  ($(window).height() - $('#forgot_dialog').height()) /2 + 'px', 
      left: ($(window).width() - $('#forgot_dialog').width()) /2 + 'px'
      }
		});
	});
	
}); 

//  +++++
var CUR_GEOIP;
function hs_ss(idCountry)
{
  if ((idCountry == 'RU') || 
      (idCountry == 'UA') ||
      (idCountry == 'KZ')) { hide('stoim_sutki'); hide('stoim_sutki_'+idCountry); } else { show('stoim_sutki'); }
}
function onl() { if (CUR_GEOIP) { hs_ss(CUR_GEOIP); } }
//addLoadEvent(onl);

function ua_rules()
{
  $(document).ready(function() { 
    
    var tmp = ''
    $(document.body).find('.short_number_send').each(function(){
      tmp = trim($(this).html());
      if ((tmp == '3151') || (tmp == '3141') || (tmp == '7654'))
      {
        $('#ua_usluga_table').show();
        $('#number_ua_' + tmp).show();
        $('#UA_usluga_podpis').show();
        //alert($(this).html());
      }
      if (tmp == '3151')
      {
        $('#UA_usluga_podpis').hide();
      }
    });
    
  });
}

