
/*
    $(function(){
            $('#tabs').tabs({
    select: function(event, ui) {
        var url = $.data(ui.tab, 'load.tabs');
        if (url.indexOf('ajax') + 1){
            alert(url);
            $(ui.panel).load(url);
        }
        
        if( url ) {
            location.href = url;
            return false;
        }
        return true;
    }, remote: true });
            $('#dialog_link, ul#icons li').hover(
                function() { $(this).addClass('ui-state-hover'); },
                function() { $(this).removeClass('ui-state-hover'); }
                );
    });
*/


function reloadPage(){
      window.location.replace(window.location.href);
}

function site_login(){
      var i=0;
      if (!$('#login').val()){
        i++;
        $('#login').css("background-color", 'red');

      }

      if (!$('#passwd').val()){
        $('#passwd').css("background-color", 'red');
        i++;
      }

      if (!i){
        $('#formlogin').hide('slow');
        $.post("/ajax.php?mod=user",
        { login: $('#login').val(), passwd:$('#passwd').val()},
        function(data){
          var text ='';
          if (data.result){
            text='Пожалуста , подождите...<br><br><span id="domain_iframe" style="border:0px;"></span>';
            $('#message').html(text).css({'left':'50%',
              'margin-left':'-130px',
              'text-align':'center'}).show();
              for (var i in data.domain){
                    
                $("#domain_iframe").append('<iframe src="http://'+data.domain[i]+'/ajax.php?sid='+data.sid+'" style="width:0px;height:0px;border:0px"></iframe><br>');
                          //  alert(data.domain[i]);
              }
              setTimeout("reloadPage()", 6000);
                //   window.location.replace(window.location.href);
          }else{
            text = 'Неверное сочетание логина и пароля <br><a href="#" onclick="$(\'#message\').hide();$(\'#formlogin\').show();" style="color:#FFF">Попробывать еще раз</a>';
          }
                    
                    

        }, 'json'
            );
      }
      return false;
    }

    $(document).ready(function () {
      $('.txt').click(
      function(){
        $(this).css("background-color", 'white') ;
      }
        );
 });
 
 
if(typeof(avto)=="undefined"){
  avto=function(){};
}

avto.form= function(){}


avto.form.list_model=function(brand_id){
  $.get('/ajax.php', {'mod':'car','cmd':'listmodel', 'id':brand_id}, function(data){ $('#model').html(data)});
}

function addPhoto(){
$("#photoarea").append('<br><input type="file" name="photo[]" value="">');
}

function viewPhoto(id){
    alert($('image.viewphoto').attr('src'));
    $('img.viewphoto').removeClass('viewphoto');
    $('#img_'+id).removeClass('noviewphoto').addClass('viewphoto');
}
