$(function() {
               // $('#container-1').tabs();
               $('#container-1').tabs({ fxFade: true, fxSpeed: 'fast' });

          $('#pricebox ul').addClass("hide_box");
          $('#articles_new').addClass("hide_box");
            $('#articles').addClass("hide_box");

          $("#left_side h5").click(function () {
              //$('#pricebox ul').toggleClass("hide_box");
              $(this).next().toggleClass("hide_box");
          });

                     $('.top_text').innerfade({
                        animationtype: 'fade',
                        speed: 500,
                        timeout: 5000,
                        type: 'random',
                        containerheight: '50px'
                    });
   $("li.tm4 ul").css({ 'display' : 'none'}); //Add background color + image on hovered list item   
  $("li.tm4").hover(function() { //Hover over event on list item
    $(this).css({ 'background' : ''}); //Add background color + image on hovered list item

    //$(this).find("ul").fadeIn("slow");
    $(this).find("ul").fadeIn(300); //Show the subnav
} , function() { //on hover out...
    $(this).css({ 'background' : 'none'}); //Ditch the background
    $(this).find("ul").fadeOut(100); //Hide the subnav
});
      //$('#box_index > ul').tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 2000);

     //  $("#cat li:contains('СПЕЦПРЕДЛОЖЕНИЕ')").append('<div class="categories">Мебель</div>');
       //нашел спецпредложения и добавил после них hahaha

 //$('.sort a').click(function() {

 //$(this).css({'background-position' : '0 1px'});
 //});

                         $('#v1').click(function() {
                        $(this).addClass("current_style");
                        $('#v2').removeClass("current_style");
                        $('.project_item').css({'display' : 'block'});
                        //$('.view2').css({'display' : 'none'});
                        $('.view2').css({'overflow' : 'hidden'});
                        $('.view2').css({'height' : '0px'});
                        });

                        $('#v2').click(function() {
                        $(this).addClass("current_style");
                        $('#v1').removeClass("current_style");
                        $('.project_item').css({'display' : 'none'});
                        //$('.view2').css({'display' : 'block'});
                        $('.view2').css({'overflow' : 'visible'});
                        $('.view2').css({'height' : 'auto'});
                        });

//add text for menu left

//if ($("#CatNavi li:contains('Подсветки для картин')")){
 // $(this).append('<span id="specials"></span>');
//}

//$("#CatNavi li a:contains('Подсветки для картин')").append('<span id="specials"></span>');
//$("#CatNavi li:contains('Распродажа уличных светильников и фонарей')").parrent().append('<div id="t1"></div>');

//$('#specials').prev().toggleClass("hide_box");

//$("#CatNavi li:contains('Распродажа уличных светильников и фонарей')").append('<li class="t1">Мебель</li>');


//add style for current item on page
var pp = $(document).getUrlParam("on_page");
if (pp==null){
  $('#pp10').css({'background-position' : '0 -3px'});
   }

if (pp=='10'||pp=='20'||pp=='50') {
//$('#pp10').css({'background-position' : '0 55px'});
$('#pp'+pp).css({'background-position' : '0 -3px'});

}


// for page http://megalux.ru/index.php?manufacturers_id=5
var pp2 = $(document).getUrlParam("manufacturers_id");
var pp3 = $(document).getUrlParam("cat");
if (pp2=='5' || pp3=='17' || pp2=='14'){
$('.spec1').css({'display' : 'none'})
$('.p3').css({'display' : 'none'})
$('.p2').css({'display' : 'none'})
$('.p2').next().css({'display' : 'none'});
$('#items li').css({'max-height' : '99%'});

}



//$("'span#cc2':contains('освещение')").css("text-decoration", "underline");
//alert('Size: ' + $('#cc21').size());




var ss1 = $('table.ulsv').size();
//alert (ss1);
if (ss1=='1'){
$('.spec1').css({'display' : 'none'})
$('.p3').css({'display' : 'none'})
$('.p2').css({'display' : 'none'})
$('.price').css({'display' : 'none'})
}



//$("#bc *:contains('ulichnoe-osveschenie')").append('11111111');

//if ($("#bc a").html().infexOf('ulichnoe-osveschenie')) {
//alert ('fine')
//}
//alert($("#bc a").size());
/*
$("#bc a").each(function(k,v){
if (v.innerHTML.indexOf('ulichnoe')) {

$('.spec1').css({'display' : 'none'})
$('.p3').css({'display' : 'none'})
$('.p2').css({'display' : 'none'})

}
});

  var z2 = $(document).getUrlParam("ulichnoe-osveschenie");
  if (z2=='ulichnoe-osveschenie'){
$('.spec1').css({'display' : 'none'})
$('.p3').css({'display' : 'none'})
$('.p2').css({'display' : 'none'})
$('.p2').next().css({'display' : 'none'});
}

  */


/*
toggle for index page
*/
$('#container-2 h2').append(' <u>(показать/скрыть1)</u>');
$('#container-2 h3').append(' <u>(показать/скрыть)</u>');
$('#container-2 h4').append(' <u>(показать/скрыть)</u>');

jQuery.fn.fadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle'}, speed, easing, callback);
};


$('#container-2 h2').next().css({"display":"none"});
$('#container-2 h3').next().css({"display":"none"});
$('#container-2 h4').next().css({"display":"none"});

$("#container-2 h2").click(function () {
$(this).next().fadeToggle(300);
//$(this).next().css({"display":"block"});
});


$("#container-2 h3").click(function () {
//$(".text_s").css({"display":"none"});
$(this).next().fadeToggle(300);

});



$("#container-2 h4").click(function () {
//$(".text_s").css({"display":"none"});
$(this).next().fadeToggle(300);

});





/**

add style if resolution is differentozzz

http://css-tricks.com/resolution-specific-stylesheets/
**/

function adjustStyle(width) {
    width = parseInt(width);
    if (width < 1024) {
        $("#top_menu li").css({"padding":"0 7px"});
        $(".colmask").css({"width":"1000px"});
    }
    //else if ((width >= 701) && (width < 900)) {
  //  $("#size-stylesheet").attr("href", "css/medium.css");
   else {
       $("#top_menu li").css({"padding":"0 15px"});
       $(".colmask").css({"width":"100%"});
   }
}

$(function() {
    adjustStyle($(this).width());
 $(window).resize(function() {
      adjustStyle($(this).width());
  });

});











/*
if ($("#cc2:('(раздел Уличное освещение)')"))
{

$('.spec1').css({'display' : 'none'})
$('.p3').css({'display' : 'none'})
$('.p2').css({'display' : 'none'})

}

if  ($('.uslv')!== null')
{
$('.spec1').css({'display' : 'none'})
$('.p3').css({'display' : 'none'})
$('.p2').css({'display' : 'none'})

}
*/


//alert (pp);  null
 /*
 if (pp=='10') {
 $('#pp10').css({'background-position' : '0 1px'});
 }

 if (pp=='20') {
  $('#pp20').css({'background-position' : '0 1px'});
 }

 if (pp=='50') {
  $('#pp50').css({'background-position' : '0 1px'});
 }
 */





 });


