$(document).ready(function() {
  $('.fulltext a[href^="http://"]').click(function(){$(this).attr('target','_blank');});
  $('#item-id-4 a[href^="http://"]').click(function(){$(this).attr('target','_blank');});
  $('.fulltext a[href*="go.php"]').click(function(){$(this).attr('target','_blank');});
  //$('a[href^="http://"]').click(function(){$(this).attr('target','_blank');});
  $('a[rel="nofollow"]').click(function(){$(this).attr('target','_blank');});
});






function ch_reg( t )
{
  var value = false;
  if( t==1 )
  {
    value = $('input[name="name"]').val();
    if( !value || value=='' )
    {
      $("#insert_ajax").html('<p>Поле логіну не може бути пустим!</p>');
      return false;
    }
    if( value.length<5 )
    {
      $("#insert_ajax").html('<p>Нік повинен містити не менше ніж 5 символів!</p>');
      return false;
    }
  }
  if( t==2 )
  {
    value = $('input[name="email"]').val();
    if( !value || value=='' )
    {
      $("#insert_ajax").html('<p>Поле e-mail не може бути пустим!</p>');
      return false;
    }
  }

  $.get(dle_root + "engine/ajax/check_reg.php",{check: t,value: value}, function(data)
    {
      $("#insert_ajax").fadeOut(500, function()
        {
          $(this).html(data);
          $(this).fadeIn(500);
        }
      );
    }
  );
}




function AW(wid, size) { $(function() {$('#'+wid).dialog({show: "fade", hide: "fade", autoOpen: true, width: size,});}); }

function refresh_me(obj)
{
  var rndval = new Date().getTime();
  var delimiter = '.php';
  img = $(obj).attr("src");
  img = img.split ( delimiter );
  img = img[0];
  $(obj).attr("src", img+'.php?rndval='+rndval );
}

function switch_items( id, d )
{
  $('.left-items ul li').removeClass('active');
  d.addClass('active');
  $('#left-item-parts .inviz').removeClass('inviz');
  $('#left-item-parts #item-id-1').addClass('inviz');
  $('#left-item-parts #item-id-2').addClass('inviz');
  $('#left-item-parts #item-id-3').addClass('inviz');
  $('#left-item-parts #item-id-4').addClass('inviz');
  $('#item-id-'+id).removeClass('inviz');
}

  function foto_slider()
  {
    var inv = $("#photo .inviz:not(.not_show)");
    var visidle = $("#photo .foto-slider:not(.inviz)");

        visidle.addClass('inviz');
        visidle.addClass('not_show');

    if( $("#photo .inviz:not(.not_show)").length<1 ){ $("#photo .not_show").removeClass('not_show'); }

    //inv.last().removeClass('inviz');
    inv.each( function(index){
      $(this).removeClass('inviz');
      return false;
    } );

    if( $(".foto-slider:not(.inviz)").length<1 )
    {
      $(".inviz").each( function(index){
        $(this).removeClass('inviz');
        return false;
      } );
    }
  }

