// JavaScript Document
$(document).ready(function(){
//add cookies
var COOKIE_NAME = 'test_cookie';
var options = { path: '/', expires: 10 };//10 days
                 
//AUTO COLLAPSE'S TOGGLED ELEMENT
$(".categs").show(); 
//CHANGES THE BUTTON FROM OPEN TO CLOSED AND VIS-VERSA
$(".trigger").toggle(function(){

// set cookie by number of days
if($.cookie(COOKIE_NAME + "first")) {
  if($.cookie(COOKIE_NAME + "first")=='un-hide'){
        $("#first").show();
  }
}

//set cookies
$.cookie(COOKIE_NAME + $(this).next("div").attr("id"), $.cookie(COOKIE_NAME + $(this).next("div").attr("id"))=='un-hide'?'hide':'un-hide', options);
                        
$(this).addClass("active");
}, function () {

//set cookies
$.cookie(COOKIE_NAME + $(this).next("div").attr("id"), $.cookie(COOKIE_NAME + $(this).next("div").attr("id"))=='hide'?'un-hide':'hide', options);
                   
$(this).removeClass("active");
});
 
//SLIDES CONTAINER UP AND DOWN ON CLICK
$(".trigger").click(function(){
$(this).next("#first").slideToggle("slow");

if($(this).next("#first").attr("id") =='first'){
	 if($.cookie(COOKIE_NAME + "first")=='un-hide')
      window.location = "http://www.napati.ro/produse/imbracaminte/Copii 0-2 ani/Toate/pag-1";
  }
return false;
}
);

//SLIDES CONTAINER UP AND DOWN ON CLICK
$(".trigger").click(function(){

$(this).next("#second").slideToggle("slow");
if($(this).next("#second").attr("id") =='second'){
	if($.cookie(COOKIE_NAME + "second")=='un-hide')
      window.location = "http://www.napati.ro/produse/imbracaminte/Fetite 2-6 ani/Toate/pag-1";
  }
return false;
}
);

//SLIDES CONTAINER UP AND DOWN ON CLICK
$(".trigger").click(function(){

$(this).next("#third").slideToggle("slow");
if($(this).next("#third").attr("id") =='third'){
	if($.cookie(COOKIE_NAME + "third")=='un-hide')
      window.location = "http://www.napati.ro/produse/imbracaminte/Baieti 2-6 ani/Toate/pag-1";
  }
return false;
}
);

//SLIDES CONTAINER UP AND DOWN ON CLICK
$(".trigger").click(function(){

$(this).next("#forth").slideToggle("slow");
if($(this).next("#forth").attr("id") =='forth'){
	if($.cookie(COOKIE_NAME + "forth")=='un-hide')
      window.location = "http://www.napati.ro/produse/imbracaminte/Copii peste 6 ani/Toate/pag-1";
  }
return false;
}
);

$(".trigger").click(function(){

$(this).next("#fifth").slideToggle("slow");
if($(this).next("#fifth").attr("id") =='fifth'){
	if($.cookie(COOKIE_NAME + "fifth")=='un-hide')
      window.location = "http://www.napati.ro/produse/ingrijire/Copii BIO Zi de zi/Toate/pag-1";
  }
return false;
}
);

$(".trigger").click(function(){

$(this).next("#sixt").slideToggle("slow");
if($(this).next("#sixt").attr("id") =='sixt'){
	if($.cookie(COOKIE_NAME + "sixt")=='un-hide')
      window.location = "http://www.napati.ro/produse/ingrijire/Copii BIO La baie/Toate/pag-1";
  }
return false;
}
);

$(".trigger").click(function(){

$(this).next("#seventh").slideToggle("slow");
if($(this).next("#seventh").attr("id") =='seventh'){
	if($.cookie(COOKIE_NAME + "seventh")=='un-hide')
      window.location = "http://www.napati.ro/produse/ingrijire/Curatenie BIO/Toate/pag-1";
  }
return false;
}
);

$(".trigger").click(function(){

$(this).next("#tenth").slideToggle("slow");
if($(this).next("#tenth").attr("id") =='tenth'){
	if($.cookie(COOKIE_NAME + "tenth")=='un-hide')
      window.location = "http://www.napati.ro/produse/ingrijire/Mami BIO/pag-1";
  }
return false;
}
);

$(".trigger").click(function(){

$(this).next("#eight").slideToggle("slow");
if($(this).next("#eight").attr("id") =='eight'){
	if($.cookie(COOKIE_NAME + "eight")=='un-hide')
      window.location = "http://www.napati.ro/produse/mancare/Piureuri/Toate/pag-1";
  }
return false;
}
);

//re-display based on cookies that set
if($.cookie(COOKIE_NAME + "first")) {
  if($.cookie(COOKIE_NAME + "first")=='un-hide'){
        $("#first").show();
  }
}
if($.cookie(COOKIE_NAME + "second")) {
  if($.cookie(COOKIE_NAME +"second")=='un-hide'){
  	$("#second").show();
  }
}

if($.cookie(COOKIE_NAME + "third")) {
  if($.cookie(COOKIE_NAME + "third")=='un-hide'){
        $("#third").show();
  }
}
if($.cookie(COOKIE_NAME + "forth")) {
  if($.cookie(COOKIE_NAME +"forth")=='un-hide'){
  	$("#forth").show();
  }
}

if($.cookie(COOKIE_NAME + "fifth")) {
  if($.cookie(COOKIE_NAME +"fifth")=='un-hide'){
  	$("#fifth").show();
  }
}

if($.cookie(COOKIE_NAME + "sixt")) {
  if($.cookie(COOKIE_NAME +"sixt")=='un-hide'){
  	$("#sixt").show();
  }
}

if($.cookie(COOKIE_NAME + "seventh")) {
  if($.cookie(COOKIE_NAME +"seventh")=='un-hide'){
  	$("#seventh").show();
  }
}

if($.cookie(COOKIE_NAME + "eight")) {
  if($.cookie(COOKIE_NAME +"eight")=='un-hide'){
  	$("#eight").show();
  }
}

if($.cookie(COOKIE_NAME + "tenth")) {
  if($.cookie(COOKIE_NAME +"tenth")=='un-hide'){
  	$("#tenth").show();
  }
}

});


