// При  получении фокуса  тест в  элементе  Input   исчезает,  при   потере фокуса если   первоначальный  текст не изменился или элемент пуст   то  появляется  первоначальный  текст
var home_dir="http://forexnews.com.ua/";


var Input_focus_blur=Class.create();
Input_focus_blur.prototype={
 initialize:function(element,text){
  this.element=$(element);
  this.text=text;
  this.element.value=this.text;
  Event.observe(this.element,'focus',this.Ev_focus.bindAsEventListener(this));
  Event.observe(this.element,'blur',this. Ev_blur.bindAsEventListener(this));

},
    Ev_focus:function(event){
     if(this.element.value==this.text)
        this.element.value='';
    },

    Ev_blur:function(event){
     if(this.element.value=='')
       this.element.value=this.text;
    }
}

//------------------------------------------------------------------------------
// Выделяет строку  в таблице flag- определяет  показывать  ли выделение или убрать   (если не задан то показывать , если  передать любое значение то скрывать  )
  function tr_select(_this,flag){
     if(flag==null)
     _this.style.backgroundColor='#ececec';
     else
     _this.style.backgroundColor='';

  }
//------------------------------------------------------------------------------

  function info_ind(_this, _title, _country){

   Windows.closeAll();
   win = new Window({title:"Индикатор "+_title,className:"alphacube", showEffectOptions: {duration: 0.4}, width: 400, height:200})
   var param=$H({title:_title,country:_country});
   win.setAjaxContent(home_dir+'include/calendar_inicators.php',{method:'get',parameters:param},true);
   win.setZIndex(100);
   win.show();

}

//------------------------------------------------------------------------------
function  quotations_online(){
  /*updater= new Ajax.PeriodicalUpdater(
  'content_cot',
   home_dir+'include/quotations_online.php',
  {
    method:'POST',
    frequency:120
  }
  );*/
}


window.onload=function(){
//quotations_online();
}

//------------------------------------------------------------------------------
function  all_quotations_online(pid){
 /* var params=$H({pid:pid,sid:$('sid').value});
  updater= new Ajax.PeriodicalUpdater(
  'all_quotations',
   home_dir+'include/all_quotations_online.php',
  {
    method:'POST',
    frequency:120,
    parameters:params
  }
  );*/
}


window.onload=function(){
//quotations_online();
}
//------------------------------------------------------------------------------
function registry_user(){


  if($('login').value!='Ваш E-mail'&&$('www').value!='Адрес сайта'){
      Element.hide($('mess'));
      var params=$H({email:$('login').value,www:$('www').value});
      new Ajax.Request(home_dir+'include/quotations_registry_user.php',{method:'POST',parameters:params,onSuccess:onAjaxLoad});
  }
  else{
    $('login').value='Ваш E-mail';
    $('www').value='Адрес сайта';
    $('mess').innerHTML="<font color='#f86517'>Проверти правильность введенных данных</font>";
    Element.show($('mess'));

  }


}

function onAjaxLoad(transport){
    $('login').value='Ваш E-mail';
    $('www').value='Адрес сайта';
    $('mess').innerHTML=transport.responseText;
    Element.show($('mess'));
}
//------------------------------------------------------------------------------

function quotations_authorization(){

if($('login').value!='Ваш логин'&&$('passw').value!='Ваш пароль'){
      Element.hide($('mess'));
      var params=$H({login:$('login').value,passw:$('passw').value});
      new Ajax.Request(home_dir+'include/quotations_authorization.php',{method:'POST',parameters:params,onSuccess:onQuotations_authorization});
  }
  else{
   // $('login').value='Ваш логин';
    //$('passw').value='Ваш пароль';
    $('mess').innerHTML="<font color='#f86517'>Проверти правильность введенных данных</font>";
    Element.show($('mess'));

  }
}

function onQuotations_authorization(transport){
   // $('login').value='Ваш логин';
   // $('passw').value='Ваш пароль';
     if(transport.responseText==0){
    $('mess').innerHTML="<font color='#f86517'>Проверти правильность введенных данных</font>";
    Element.show($('mess'));
    }
    else
    window.location.href=home_dir+'include/geometry_quotations_informer.php';
}
//------------------------------------------------------------------------------
  function createSlider(minValue,maxValue,t_Value,s_h,s_t,s_v) {
        var values = [];
        for (var n = minValue; n <= maxValue; n++) values.push(n);
      s= new Control.Slider(
          s_h,
          s_t,
          {
            range: $R(minValue,maxValue),
            values: values,
            onChange: function(value) {
              $(s_v).innerHTML = value;
              send_data_infor($(s_v).id,$(s_v).innerText);
            },
            onSlide: function(value) {
              $(s_v).innerHTML = value;
            }
          }
        );
        s.setValue(t_Value);
}

function onChange_slider(){
alert('END');
}
//------------------------------------------------------------------------------
function show_hide_fon(_this,id_r1,id_r2){


    if(_this.id=='rc_fon'){

    $(id_r1).style.display='block';
    $(id_r2).style.display='none';
    }
    else{
    $(id_r2).style.display='block';
    $(id_r1).style.display='none';
    }
}

//------------------------------------------------------------------------------
function show_hide(id){
if(document.getElementById(id).style.display=='none'||document.getElementById(id).style.display=='')
   document.getElementById(id).style.display='block'
    else
    document.getElementById(id).style.display='none'

}

//------------------------------------------------------------------------------

function send_data_infor(el_name,el_value){
 var params=$H({el_name:el_name,el_value:el_value});
 new Ajax.Request(
     home_dir+'include/geometry_quotations_informer.php',{
     parameters:params,
     method:'POST',
     onSuccess:onReturn
    }
 );

}

function onReturn(transport){
var time = new Date();
var dt = '' + time.getHours() + time.getMinutes() + time.getSeconds();
$('img_inf').src=home_dir+"uploads/informer/user_informer/img_"+$('pid').value+".png?dt="+dt;
status=(transport.responseText);
}



//------------------------------------------------------------------------------
  function info_ind_techam(_this, _title){

  
   Windows.closeAll();
   win = new Window({title:_title,className:"alphacube", showEffectOptions: {duration: 0.4}, width: 400, height:200})
   var param=$H({title:_title});
   win.setAjaxContent(home_dir+'include/tech_am_inicators.php',{method:'get',parameters:param},true);
   win.setZIndex(100);
   win.show();

}

//------------------------------------------------------------------------------


//------------------------------------------------------------------------------


function  add_content(id, code){
 $(id).innerHTML+=code; 
}




