Kipling - Bem Vindo

/* 
Theme Name: Kipling
Author: Aurora Creative Business | Daniel Silvestre/Gustavo Carvalho - Front-End Engineer's
Author URI: http://www.aurora.ag

[ - INDICE - ]

	1 - Layout
	2 - Init
	3 - Events
	4 - Pages
	5 - 
	6 - 
	7 - 
	8 - 

*/

/* 1 - Layout
------------------------------------------------*/
$(function() {

  $('.wrap-logout').mouseenter(function() {
    $('.popup-login').show();
  }).mouseleave(function() {
    $('.popup-login').hide();
  });

/* Menu
	------------------------------------------------*/
  $('#menu ul li:last').css({
    margin: 0
  });
  //Cufon.replace('#menu ul li a', { fontFamily: 'VAG Rounded Std', hover: true } );

/*$('#menu ul li a.sobre').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '0 -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '0 0' }, 200);
	});
	
	$('#menu ul li a.seja-vik').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-83px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-83px 0' }, 200);
	});
	
	$('#menu ul li a.campanha').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-191px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-191px 0' }, 200);
	});
	
	$('#menu ul li a.catalogo').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-284px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-284px 0' }, 200);
	});
	
	$('#menu ul li a.lojas').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-374px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-374px 0' }, 200);
	});
	
	$('#menu ul li a.lista').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-431px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-431px 0' }, 200);
	});
	
	$('#menu ul li a.fanpage').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-575px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-575px 0' }, 200);
	});
	
	$('#menu ul li a.contato').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-653px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-653px 0' }, 200);
	});*/


/* Limits Height
	------------------------------------------------*/
  $('#home .limits').each(function() {
    $(this).css({
      height: $(this).parent().height()
    });
  });


/* Twitter
	------------------------------------------------*/
  $('#twitter ul li:first').css({
    paddingTop: 0
  });
  $('#twitter ul li:last').css({
    border: 'none'
  });


/* Featured Bottom
	------------------------------------------------*/
  $('#featured_bottom .link_featured_bottom').css({
    marginBottom: -$('#featured_bottom .link_featured_bottom').height() - 34 + 'px'
  });

/*$('#featured_bottom').bind('mouseover', function(){
		//$(this).find('.alpha').animate({ opacity : .5 },200);
		$(this).find('img').animate({ width : '150%', height : '150%', left : '-25%', top : '-25%' },200, function(){
			 $('#featured_bottom').bind('mousemove', function(e){
				var movimento = 10;
				var _width = $('#featured_bottom').width();
				var _height = $('#featured_bottom').height();
				var _top = $('#featured_bottom').offset().top;
				var _left = $('#featured_bottom').offset().left;
				var pos_x = (e.pageX - _left) - (_width / 2);
				var pos_y = (e.pageY - _top) - (_height / 2);
				$(this).find('.photo_zoom').css({top: ( - (pos_y / movimento) ) +"%", left:  ( - (pos_x / movimento) )  +"%"});
			});
		});
	}).mouseleave(function(){
		$(this).find('img').animate({ width : '100%', height : '100%', left : 0, top : 0 },200);
		$(this).find('.photo_zoom').animate({ top : 0, left : 0 },200);
		//$(this).find('.alpha').stop().animate({ opacity : 0 },300);
	});*/


/* Featured Catalog
	------------------------------------------------*/
/*$('#featured_catalog').bind('mouseover', function(){
		//$(this).find('.alpha').animate({ opacity : .5 },200);
		$(this).find('img').animate({ width : '150%', height : '150%', left : '-25%', top : '-25%' },200, function(){
			 $('#slider').bind('mousemove', function(e){
				var movimento = 10;
				var _width = $('#featured_catalog ul li').width();
				var _height = $('#featured_catalog ul li').height();
				var _top = $('#featured_catalog ul li').offset().top;
				var _left = $('#featured_catalog ul li').offset().left;
				var pos_x = (e.pageX - _width) - (_width / 2);
				var pos_y = (e.pageY - _height) - (_height / 2);
				$(this).find('.photo_zoom').css({top: ( - (pos_y / movimento) ) +"%", left:  ( - (pos_x / movimento) )  +"%"});
			});
		});
	}).mouseleave(function(){
		$(this).find('img').animate({ width : '100%', height : '100%', left : 0, top : 0 },200);
		$(this).find('.photo_zoom').animate({ top : 0, left : 0 },200);
		//$(this).find('.alpha').stop().animate({ opacity : 0 },300);
	});*/

  $("#featured_catalog #slider").easySlider({
    auto: true,
    continuous: true,
    hoverpause: true
  });

  $('.login').mouseover(function() {
    $(this).stop().animate({
      backgroundPositionY: '-26px'
    }, 200);
  }).mouseout(function() {
    $(this).stop().animate({
      backgroundPositionY: 0
    }, 200);
  });


/* Twitter
	------------------------------------------------*/


});



/* Home - Gallery featured campaign
	------------------------------------------------*/
$(function() {
  $('#slideshow li:first').addClass('active');
});

function slideSwitch() {
  var $active = $('#slideshow li.active');
  if ($active.length == 0) $active = $('#slideshow IMG:last');
  var $next = $active.next().length ? $active.next() : $('#slideshow li:first');
  $active.addClass('last-active');
  $next.css({
    opacity: 0.0
  }).addClass('active').animate({
    opacity: 1.0
  }, 2500, function() {
    $active.removeClass('active last-active');
  });
}


$(function() {
  main.timeoutCampaign = setInterval(function() {
    slideSwitch()
  }, 6000);

/*$('#featured_campaign').bind('mouseover', function(){
			clearInterval(main.timeoutCampaign);
			//$(this).find('.alpha').animate({ opacity : .5 },200);
			$(this).find('img').animate({ width : '180%', height : '180%', left : '-35%', top : '-35%' },200, function(){
				 $('#featured_campaign').bind('mousemove', function(e){
					var movimento = 15;
					var _width = $('#featured_campaign').width();
					var _height = $('#featured_campaign').height();
					var _top = $('#featured_campaign').offset().top;
					var _left = $('#featured_campaign').offset().left;
					var pos_x = (e.pageX - _left) - (_width / 2);
					var pos_y = (e.pageY - _top) - (_height / 2);
					$(this).find('.photo_zoom').css({top: ( - (pos_y / movimento) ) +"%", left:  ( - (pos_x / movimento) )  +"%"});
				});
			});
		}).mouseleave(function(){
			main.timeoutCampaign = setInterval( function(){ slideSwitch() }, 3000 );
			$(this).find('img').animate({ width : '100%', height : '100%', left : 0, top : 0 },200);
			$(this).find('.photo_zoom').animate({ top : 0, left : 0 },200);
			//$(this).find('.alpha').stop().animate({ opacity : 0 },300);
		});*/
});


/* About Elements position
	-----------------------------------------------*/
$(function() {
  //$('#sobre .bike, #seja-uma-vik .bike2').css({ right : main.marginHalfSide });
  //$('#sobre article').css({ right : ( main.marginHalfSide + 115 ) });
  if ($.browser.mozilla) {
    $('#sobre .texto-sobre').css({
      height: '530px'
    });
    $('#container-busca-lista h2').css({
      marginBottom: '34px'
    });
  }
  $('#sobre .texto-sobre').jScrollPane({}, 'sobre');

});



/* Catalog
	-----------------------------------------------*/
$(function() {
  $('#catalogo .top-catalogo').css({
    backgroundPosition: (main.marginHalfSide - 250) + 'px 428px'
  });

  /* Menu */
  $('.top-nav a.categorias').css({
    backgroundPosition: '-138px -446px'
  }).addClass('active');

  $('.top-nav a.colecoes').mouseover(function() {
    if (!$(this).hasClass('active')) $(this).stop().animate({
      backgroundPosition: '-18px -446px'
    }, 200);
  }).mouseout(function() {
    if (!$(this).hasClass('active')) $(this).animate({
      backgroundPosition: '-18px -476px'
    }, 200);
  }).click(function() {
    if ($(this).parent().parent().find('.active').hasClass('categorias')) var x = '-138px';
    if ($(this).parent().parent().find('.active').hasClass('colecoes')) var x = '-18px';
    if ($(this).parent().parent().find('.active').hasClass('cores')) var x = '-257px';

    $(this).parent().parent().find('.active').animate({
      backgroundPosition: x + ' -476px'
    }, 200, function() {
      $(this).removeClass('active')
    });
    $(this).css({
      backgroundPosition: '-18px -446px'
    }).addClass('active');
    $('#catalogo h2.title-category').slideDown(300);
    $('.list-categorias, .list-cores').fadeOut(300);
    $('#catalogo .top-catalogo').animate({
      height: '427px',
      backgroundPosition: (main.marginHalfSide - 250) + 'px 88px'
    }, 1000, 'easeInOutExpo', function() {
      $('.list-colecoes').fadeIn(300);
    });
    return false;
  });

  $('.top-nav a.categorias').mouseover(function() {
    if (!$(this).hasClass('active')) $(this).stop().animate({
      backgroundPosition: '-138px -446px'
    }, 200);
  }).mouseout(function() {
    if (!$(this).hasClass('active')) $(this).animate({
      backgroundPosition: '-138px -476px'
    }, 200);
  }).click(function() {
    if ($(this).parent().parent().find('.active').hasClass('categorias')) var x = '-138px';
    if ($(this).parent().parent().find('.active').hasClass('colecoes')) var x = '-18px';
    if ($(this).parent().parent().find('.active').hasClass('cores')) var x = '-257px';

    $(this).parent().parent().find('.active').animate({
      backgroundPosition: x + ' -476px'
    }, 200, function() {
      $(this).removeClass('active');
    });
    $(this).css({
      backgroundPosition: '-138px -446px'
    }).addClass('active');
    $('#catalogo h2.title-category').slideUp(300);
    $('.list-colecoes, .list-cores').fadeOut(300);
    $('#catalogo .top-catalogo').animate({
      height: '271px',
      backgroundPosition: (main.marginHalfSide - 250) + 'px 428px'
    }, 1000, 'easeInOutExpo', function() {
      $('.list-categorias').fadeIn(300);
    });
    return false;
  });

  $('.top-nav a.cores').mouseover(function() {
    if (!$(this).hasClass('active')) $(this).stop().animate({
      backgroundPosition: '-257px -446px'
    }, 200);
  }).mouseout(function() {
    if (!$(this).hasClass('active')) $(this).animate({
      backgroundPosition: '-257px -476px'
    }, 200);
  }).click(function() {
    if ($(this).parent().parent().find('.active').hasClass('categorias')) var x = '-138px';
    if ($(this).parent().parent().find('.active').hasClass('colecoes')) var x = '-18px';
    if ($(this).parent().parent().find('.active').hasClass('cores')) var x = '-257px';

    $(this).parent().parent().find('.active').animate({
      backgroundPosition: x + ' -476px'
    }, 200, function() {
      $(this).removeClass('active')
    });
    $(this).css({
      backgroundPosition: '-257px -446px'
    }).addClass('active');
    $('#catalogo h2.title-category').slideUp(300);
    $('.list-colecoes, .list-categorias').fadeOut(300);
    $('#catalogo .top-catalogo').animate({
      height: '215px',
      backgroundPosition: (main.marginHalfSide - 250) + 'px 428px'
    }, 1000, 'easeInOutExpo', function() {
      $('.list-cores').fadeIn(300);
    });
    return false;
  }); /* End Menu */

  $('#produto').css({
    marginLeft: main.widthWindow
  });

  //$('#resultados-lojas').css({ height : $(window).height() - 330 }).jScrollPane({}, 'lojas');

  $('#catalogo .top-catalogo .list-colecoes ul').each(function() {
    $(this).children('li:first').css({
      margin: '0 0 2px 0'
    });
  });

  $('.list-categorias ul li:eq(0)').css({
    width: '96px',
    marginRight: '49px'
  });
  $('.list-categorias ul li:eq(1)').css({
    width: '88px',
    marginRight: '51px'
  });
  $('.list-categorias ul li:eq(2)').css({
    width: '102px',
    marginRight: '61px'
  });
  $('.list-categorias ul li:eq(3)').css({
    width: '71px',
    marginRight: '55px'
  });
  $('.list-categorias ul li:eq(4)').css({
    width: '94px',
    marginRight: '39px'
  });
  $('.list-categorias ul li:eq(5)').css({
    width: '115px',
    marginRight: 0
  });

  $('.list-cores ul li:last').css({
    marginRight: 0
  });

  var li = 1;
  $('.products li').each(function() {
    //if( (li%2) != 0 ) $(this).children('a').css({ background : '#fff' });
    li++;
  });

  $('#catalogo h2.title-category').css({
    marginLeft: main.marginHalfSide
  });

  $('.avatar').each(function() {
    $(this).css({
      top: Math.floor(Math.random() * 801),
      left: Math.floor(Math.random() * 1001)
    });
  });

  $('.set-markup').css({
    display: 'none',
    width: $('.logo').width(),
    left: $('.logo').offset().left
  });

  $('#produto.wrap-limits').css({
    height: $(window).height() - 80
  });
  $('#produto limits').css({
    height: $(window).height() - 120
  });

  //$('.select-cadastro > div').jScrollPane({}, 'estado');

});


/* Contato
	------------------------------------------------*/
//Cufon.replace('#container-contato h2', { fontFamily: 'VAG Rounded Std'} );



/* 2 - Main
------------------------------------------------*/
var main = new Object(); //Namespace to Main
main.permission = true;
main.timeoutCampaign;
main.widthWindow = $(window).width();
main.marginHalfSide = (main.widthWindow - 1000) / 2;
main.offsetTopWindow = $(window).scrollTop();
main.statusCurrentPage = false;
main.menuClicked = false;

main.scrollTop = function() {
  main.offsetTopWindow = $(window).scrollTop();

  /* Setting page Vik */
  //pageVik.changePositionFeatured();
  pageCampaing.changePositionSets();

  if ($(window).scrollTop() < Page.pageHeight && Page.sidePage != 'active') {
    if (Page.sidePage != 'active') Page.setCurrentPage('home');
  }

  /* Set Current Page */
  if ($(window).scrollTop() >= Page.pageHeight && $(window).scrollTop() < Page.pageHeight * 2) {
    if (main.menuClicked == true) {
      if ($('#menu li').eq(0).hasClass('active')) Page.setCurrentPage('sobre');
    } else {
      if (Page.sidePage != 'active') Page.setCurrentPage('sobre');
    }
  }

  if ($(window).scrollTop() >= Page.pageHeight * 2 && $(window).scrollTop() < Page.pageHeight * 3) {
    if (main.menuClicked == true) {
      if ($('#menu li').eq(1).hasClass('active')) Page.setCurrentPage('seja-uma-vik');
    } else {
      if (Page.sidePage != 'active') Page.setCurrentPage('seja-uma-vik');
    }
  }

  if ($(window).scrollTop() >= Page.pageHeight * 3 && $(window).scrollTop() < ((Page.pageHeight * 3) + $('#campanha').height())) {
    if (main.menuClicked == true) {
      if ($('#menu li').eq(2).hasClass('active')) Page.setCurrentPage('campanha');
    } else {
      if (Page.sidePage != 'active') Page.setCurrentPage('campanha');
    }
  }

  if ($(window).scrollTop() >= ((Page.pageHeight * 3) + $('#campanha').height())) {
    if (main.menuClicked == true) {
      if ($('#menu li').eq(3).hasClass('active')) Page.setCurrentPage('catalogo');
    } else {
      if (Page.sidePage != 'active') Page.setCurrentPage('catalogo');
    }
  }
/*
		if( $(window).scrollTop() > $('#produto').offset().top + ( $('#produto').height() / 2 ) ){
			//pageCatalog.hideDetailProduct();
		}
		/* End Current Page */
}

/* Parallax Effects */
main.distanceParallax = function($element, settings) {
  var fold = $(window).height() + $(window).scrollTop();
  return (fold + 100) - $element.offset().top;
};

main.parallax = function() {
  var bpos = '50% ' + (-(main.distanceParallax($('#home'), 100) - 100) * .15) + 'px';
  $('#home').css({
    backgroundPosition: bpos
  });
  $('.link_catalog').css({
    top: (+(main.distanceParallax($('.link_catalog'), -100) - 100) * .25) + 'px'
  });
  $('.likes_campaign').css({
    top: (+(main.distanceParallax($('.likes_campaign'), -100) - 300) * .1) + 'px'
  });
  $('.link_share').css({
    top: (+(main.distanceParallax($('.likes_campaign'), -100) - 100) * .07) + 'px'
  });
  //$('#about .bike').css({ top : (+( main.distanceParallax($('#about .bike'), -100 ) - 100 ) * .25) + 'px' });

} /* End Parallax Effects */

/* ScrollTo */
main.scrollPage = function(el) {
  el = el.replace('#', '');
  scrollPos = $('#wrapper').find('div[id=' + el + ']').offset().top - 80;
  $('html, body').animate({
    scrollTop: scrollPos
  }, 1500, 'easeInOutExpo', function() {
    //location.hash = el;
    main.menuClicked = false;
  });
  return false;
}

var pageCatalog, pagePresentesVerLista, pageMeuCadastro;

/* Ajax */
main.ajax = function(url, type) {
  if (type == 'meu_cadastro') {
    $('.logged').css({
      background: 'url(' + base_url() + '/assets/public/images/ajax-loader.gif) no-repeat 0 0'
    });
  } else if (type == 'ver-lista ') {
    $('body, #ver-lista').css({
      background: 'url(' + base_url() + '/assets/public/images/ajax-loader.gif) no-repeat center center'
    });
  }
  $.ajax({
    url: base_url() + url + '?mode=ajax',
    dataType: "html",
    type: "GET",
    data: "&csrf_token=" + $.cookie("csrf_cookie"),
    success: function(data) {
      if (type == 'product') {
        $('.products ul li ._load').fadeOut();
        $('#produto').html(data);
        pageCatalog = new Page.Catalog(); //Instance to Page Vik
        setTimeout(pageCatalog.showDetailProduct, 1000);
      } else if (type == 'ver-lista') {
        //$('body').css({ background : '#fff' });
        $('#ver-lista').html(data).css({
          background: '#fff'
        });
        pagePresentesVerLista = new Page.Presentes(); //Instance to Page Vik
        setTimeout(pagePresentesVerLista.animateIn('#ver-lista'), 1000);
      } else if (type == 'add-to-list') {
        $('.products ul li ._load').fadeOut();
        if (data) {
          if ($("body").hasClass("logado")) {
            main.ajax('listas/minhalista', 'contador-presentes');
          }
          $('.aviso-top p').text('Produto adicionado com sucesso.');
          $('.aviso-top').animate({
            top: '0'
          }, 500);
          setTimeout(function() {
            $('.aviso-top').animate({
              top: '-20px'
            }, 500);
          }, 5000);
        } else {
          $('.aviso-top p').text('Não foi possível adicionar o produto.');
          $('.aviso-top').animate({
            top: '0'
          }, 500);
          setTimeout(function() {
            $('.aviso-top').animate({
              top: '-50px'
            }, 500);
          }, 5000);
        }
      } else if (type == 'del-to-list') {
        $('.products ul li ._load').fadeOut();
        if ($("body").hasClass("logado")) {
          main.ajax('listas/minhalista', 'contador-presentes');
        }
        $('.aviso-top p').text('Produto removido com sucesso.');
        $('.aviso-top').animate({
          top: '0'
        }, 500);
        setTimeout(function() {
          $('.aviso-top').animate({
            top: '-20px'
          }, 500);
        }, 5000);
      } else if (type == 'meu_cadastro') {
        $('#meucadastro').html(data);
        pageMeuCadastro = new Page.MeuCadastro(); //Instance to Page Vik
        setTimeout(pageMeuCadastro.animateIn(), 1000);
        $('#select-cadastro > div').css({
          width: '490px',
          height: '300px'
        }).jScrollPane({}, 'estado');
        $('.logged').css({
          background: 'none'
        });
      } else if (type == 'contador-presentes') {
        $('.my-list-home span').text(data);
      } else if (type == 'page-campanha') {
        $('#campanha').html(data);
      } else if (type == 'page-catalogo') {
        $('#catalogo').html(data);
      }
      $('.resetValue, .valueSelect').resetDefaultValue();
    }
  });
}

main.animaPermission = true;
main.animaInside = function(el, type, time) {

  var timer = setInterval(function() {
    animaInside(type)
  }, time);
  var elements = el;
  var length = 14;
  var index = 0;

  function animaInside(type) {

    if (type == 'fadeIn') {
      $(elements).eq(index).fadeIn(500);
    } else if (type == 'fadeOut') {
      $(elements).eq(index).fadeOut(500);
    } else if (type == 'slideUp') {
      $(elements).eq(index).slideUp(1000);
    } else if (type == 'slideDown') {
      $(elements).eq(index).slideDown(1000);
    }

    index++;
    if (index >= length) {
      clearInterval(timer);
      main.animaPermission = true;
      $(el).css({
        display: 'block'
      });
      //console.log(main.animaPermission);
    }

  }

}


/* Home - Set Position's from Column Left and Initialize Gallery Campain
	------------------------------------------------*/
main.positionElHome = function() {
  var mgFeat = 9;
  var offsetHome = 170;
  blogHeight = $('#featured_blog').outerHeight();
  videoHeight = $('#featured_video').height() + 9;
  catalogHeight = $('#featured_catalog').height() + 9;
  $('#featured_video').css({
    top: blogHeight + offsetHome + mgFeat + 'px'
  });
  $('#featured_catalog').css({
    top: blogHeight + videoHeight + offsetHome + mgFeat + 'px'
  });
  $('#featured_lookbook').css({
    top: blogHeight + videoHeight + catalogHeight + offsetHome + mgFeat + 'px'
  });

/* Campain
		-----------------------------------------------*/
  $('#slider-campain > ul img').css({
    width: main.widthWindow
  });
  $('#slider-campain').simpleGallery();

  $('#campanha').css({
    height: $('#slider-campain > ul img').height()
  });
  $('#catalogo .top-catalogo').css({
    backgroundPosition: '0 ' + main.marginHalfSide
  });

};

$(function() {
  //$('#home').parallax("50%", 100, 0.075, true);
  if (!$('body').hasClass('ipad')) {
    $('#home').css({
      backgroundPosition: '50% 80px'
    });
    $('#sobre').parallax("50%", 100, 0.075, true);
    $('#seja-uma-vik').parallax("50%", 100, 0.075, true);
  }

  if ($(window).width() >= 1024) {
    var posx = '80%';
  } else {
    var posx = '99%';
  }

  $('#sobre .bike').css({
    width: $(window).width()
  }).parallax(posx, 1000, 0.15, true);
  $('#seja-uma-vik .bike2').css({
    width: $(window).width()
  }).parallax(posx, 1000, 0.15, true);
  //$('#catalogo').parallax("50%", -100, 0.075, true);
});

main.closeSidePages = function() {
  switch (Page.currentPage) {
  case 'lojas':
    pageLojas.animateOut();
    break;
  case 'lista':
    pagePresentes.animateOut('#ver-lista');
    pagePresentes.animateOut('#buscar_lista');
    break;
  case 'contato':
    pageContact.animateOut();
    break;
  case 'catalogo':
    pageCatalog.hideDetailProduct();
    break;
  case 'login':
    pageLogin.animateOut();
    break;
  case 'cadastro':
    pageCadastro.animateOut();
    break;
  case 'meucadastro':
    pageMeuCadastro.animateOut();
    break;
  }
}



main.hash = function() {

  var hash_atual = location.hash;
  if (hash_atual.indexOf('#') != -1) {
    var new_hash = hash_atual.split('#');
    hash_params = new_hash[1].split('/');
    if (hash_params[0] == 'listas') {
      $('#ver-lista').css({
        display: 'block'
      });
      $('body').css({
        background: 'url(' + base_url() + '/assets/public/images/ajax-loader.gif) no-repeat center center'
      });
      $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
        display: 'none'
      });

      Page.setOldPage(Page.currentPage);
      Page.sidePage = 'active';
      main.ajax(new_hash[1], 'ver-lista');
      setTimeout(function() {
        Page.setCurrentPage('lista');
      }, 800);
    } else if (hash_params[0] == 'produto') {
      $('body').css({
        height: $(window).height(),
        background: 'url(' + base_url() + '/assets/public/images/ajax-loader.gif) no-repeat center center'
      });
      $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
        display: 'none'
      });

      Page.setOldPage(Page.currentPage);
      Page.sidePage = 'active';
      main.ajax(new_hash[1], 'product');
      setTimeout(function() {
        Page.setCurrentPage('catalogo');
      }, 800);
    }
  }

}



/* 3 - Events
------------------------------------------------*/
/* Scroll
	------------------------------------------------*/
window.onscroll = function() {
  main.scrollTop();
  if (!$('body').hasClass('ipad')) {
    main.parallax();
  }
};

/* Loaded
	------------------------------------------------*/
window.onload = function() {
  main.positionElHome();
  $('#video').attr('src', $('#video').attr('rel'));
  $('#fbframe').attr('src', $('#fbframe').attr('rel'));
  $('#twt').attr('src', $('#twt').attr('rel'));
  main.hash();
  main.ajax('listas/minhalista', 'contador-presentes');
  if (oldPageBeforeLogin) {

    setTimeout(function() {
      Page.sidePage = 'active';
      pagePresentes.animateIn('#buscar_lista');
      Page.setCurrentPage('lista');
    }, 800);

  }
}

/* Resize
	------------------------------------------------*/
window.onresize = function() {
  $('.wrap-limits').css({
    width: $(window).width()
  });
}


/* Click
	------------------------------------------------*/


$(function() {

  var over_photo_home = false,
    click_recom = false,
    click_recom2 = false;

  $('.hover_photo').mouseover(function() {
    over_photo_home = true;
  }).mouseout(function() {
    over_photo_home = false;
  });

  $('#featured_bottom img, .link_featured_bottom').mouseover(function() {
    over_photo_home = true;
    $('#featured_bottom img').stop().animate({
      opacity: .5
    }, 500);
    $('.hover_photo').stop().animate({
      backgroundPositionY: 0
    }, 200, 'easeInOutExpo');
  }).mouseout(function() {
    over_photo_home = false;
    setTimeout(function() {
      if (over_photo_home === false) {
        $('.hover_photo').stop().animate({
          backgroundPositionY: '116px'
        }, 200, 'easeInOutExpo');
        $('#featured_bottom img').stop().animate({
          opacity: 1
        }, 500);
      }
    }, 10);
  });

  var over_blog_home = false;

  $('.hover_blog').mouseover(function() {
    over_blog_home = true;
  }).mouseout(function() {
    over_blog_home = false;
  });

  $('#featured_blog').mouseover(function() {
    over_blog_home = true;
    $(this).children('.hover_blog').animate({
      backgroundPositionY: 0
    }, 200, 'easeInOutExpo');
  }).mouseout(function() {
    over_blog_home = false;
    setTimeout(function() {
      if (over_blog_home === false) {
        $('#featured_blog .hover_blog').animate({
          backgroundPositionY: '116px'
        }, 200, 'easeInOutExpo');
      }
    }, 10);
  }).click(function() {
    window.open('http://www.kiplingfanpage.com.br/', '_blank');
  });


  $('#featured_catalog').mouseover(function() {
    $('#featured_catalog .link_catalog').stop().animate({
      backgroundPositionY: '-116px'
    }, 400, 'easeInOutExpo');
  }).mouseout(function() {
    $('#featured_catalog .link_catalog').stop().animate({
      backgroundPositionY: 0
    }, 400, 'easeInOutExpo');
  }).click(function() {
    if (Page.sidePage == 'active') {
      main.closeSidePages();
      Page.sidePage = '';
    }
    main.menuClicked = true;
    $('#menu').find('.active').removeClass('active');
    $('#menu li').eq(3).children('a.mn').addClass('active');
    main.scrollPage('#catalogo');
    return false;
  });

  $('#featured_campaign').click(function() {
    if (Page.sidePage == 'active') {
      main.closeSidePages();
      Page.sidePage = '';
    }
    main.menuClicked = true;
    $('#menu').find('.active').removeClass('active');
    $('#menu li').eq(2).children('a.mn').addClass('active');
    main.scrollPage('#campanha');
    return false;
  });


  //$('#menu li a, .logo').not('#menu li:last a, #menu li:eq(4)').click(main.scrollPage);
  /* Menu Principal */
  $('#menu li a.mn, .logo').click(function() {
    if (Page.sidePage == 'active') {
      main.closeSidePages();
      Page.sidePage = '';
    }
    main.menuClicked = true;
    $(this).parent().parent().find('.active').removeClass('active');
    $(this).parent().addClass('active');
    var page = $(this).attr('href').split('/');
    main.scrollPage(page[1]);
    return false;
  });

  var login_click = function() {
      if (Page.sidePage == 'active') {
        main.closeSidePages();
        setTimeout(function() {
          Page.sidePage = 'active';
          pageLogin.animateIn();
        }, 800);
      } else {
        Page.setOldPage(Page.currentPage);
        Page.sidePage = 'active';
        pageLogin.animateIn();
      }
      setTimeout(function() {
        Page.setCurrentPage('login');
      }, 800);
      return false;
    }

  $('.login').click(login_click);

  $('#login .close').click(function() {
    Page.sidePage = '';
    Page.setCurrentPage(Page.oldPage);
    pageLogin.animateOut();
  });

  $('.my-list-home').click(function() {
    $('#ver-lista').empty().fadeIn(200).css({
      background: 'url(' + base_url() + '/assets/public/images/ajax-loader.gif) no-repeat center center'
    });
    $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').fadeOut(200);
    Page.setOldPage(Page.currentPage);
    Page.sidePage = 'active';
    main.ajax($(this).attr('href'), 'ver-lista');
    setTimeout(function() {
      Page.setCurrentPage('lista');
    }, 800);
    return false;
  });

  $('.cadastro').click(function() {
    if (Page.sidePage == 'active') {
      main.closeSidePages();
      setTimeout(function() {
        Page.sidePage = 'active';
        pageCadastro.animateIn();
      }, 800);
    } else {
      Page.setOldPage(Page.currentPage);
      Page.sidePage = 'active';
      pageCadastro.animateIn();
    }
    setTimeout(function() {
      Page.setCurrentPage('cadastro');
    }, 800);
    return false;
  });

  $('#cadastro .close').click(function() {
    Page.sidePage = '';
    Page.setCurrentPage(Page.oldPage);
    pageCadastro.animateOut();
  });

  $(".meu_cadastro, .my-profile").click(function() {
    if (Page.sidePage == 'active') {
      main.closeSidePages();
      var $this = $(this);
      setTimeout(function() {
        Page.sidePage = 'active';
        main.ajax($($this).attr('href'), 'meu_cadastro');
      }, 800);
    } else {
      Page.setOldPage(Page.currentPage);
      Page.sidePage = 'active';
      main.ajax($(this).attr('href'), 'meu_cadastro');
    }
    setTimeout(function() {
      Page.setCurrentPage('meucadastro');
    }, 800);
    return false;
  })

  $('#meucadastro .close').live('click', function() {
    Page.sidePage = '';
    Page.setCurrentPage(Page.oldPage);
    pageMeuCadastro.animateOut();
  });


  /* Contato */
  $('#menu li:last a').click(function() {
    if (Page.sidePage == 'active') {
      main.closeSidePages();
      setTimeout(function() {
        Page.sidePage = 'active';
        pageContact.animateIn();
      }, 800);
    } else {
      Page.setOldPage(Page.currentPage);
      Page.sidePage = 'active';
      pageContact.animateIn();
    }
    setTimeout(function() {
      Page.setCurrentPage('contato');
    }, 800);
    return false;
  });

  $('#contato .close').click(function() {
    Page.sidePage = '';
    Page.setCurrentPage(Page.oldPage);
    pageContact.animateOut();
  });

  /* Lojas */
  $('#menu li').eq(4).click(function() {
    if (Page.sidePage == 'active') {
      main.closeSidePages();
      setTimeout(function() {
        Page.sidePage = 'active';
        pageLojas.animateIn();
      }, 800);
    } else {
      Page.setOldPage(Page.currentPage);
      Page.sidePage = 'active';
      pageLojas.animateIn();
    }
    setTimeout(function() {
      Page.setCurrentPage('lojas');
    }, 800);
    return false;
  });

  $('#lojas .close').live('click', function() {
    Page.sidePage = '';
    Page.setCurrentPage(Page.oldPage);
    pageLojas.animateOut();
  });

  /* Lista de Presentes */
  $('#menu li').eq(5).click(function() {
    if (Page.sidePage == 'active') {
      main.closeSidePages();
      setTimeout(function() {
        Page.sidePage = 'active';
        pagePresentes.animateIn('#buscar_lista');
      }, 800);
    } else {
      Page.setOldPage(Page.currentPage);
      Page.sidePage = 'active';
      pagePresentes.animateIn('#buscar_lista');
    }
    setTimeout(function() {
      Page.setCurrentPage('lista');
    }, 800);
    return false;
  });

  $('#buscar_lista .close').click(function() {
    Page.sidePage = '';
    Page.setCurrentPage(Page.oldPage);
    pagePresentes.animateOut('#buscar_lista', 'busca_lista_close');
  });


  $('.lista_profile_link').live('click', function() {
    pagePresentes.animateOut('#buscar_lista');
    $('#ver-lista').empty().fadeIn(200).css({
      background: 'url(' + base_url() + '/assets/public/images/ajax-loader.gif) no-repeat center center'
    });
    var _url = $(this).attr('href');
    setTimeout(function() {
      main.ajax(_url, 'ver-lista');
    }, 800);
    return false;
  });

  $('#ver-lista .close').live('click', function() {
    if (click_recom2 == true) {
      $('#frm_recomendar').hide();
      click_recom2 = false;
    }
    Page.sidePage = '';
    Page.setCurrentPage(Page.oldPage);
    pagePresentes.animateOut('#ver-lista');
    return false;
  });

  $('.other-list').live('click', function() {
    pagePresentes.animateOut('#ver-lista');
    setTimeout(function() {
      pagePresentes.animateIn('#buscar_lista');
    }, 800);
    return false;
  });

  $('.my-list').live('click', function() {
    if ($('body').hasClass('logado')) {
      pagePresentes.animateOut('#buscar_lista');
      $('#ver-lista').empty().fadeIn(200).css({
        background: 'url(' + base_url() + '/assets/public/images/ajax-loader.gif) no-repeat center center'
      });
      //$('body').css({ background : 'url('+ base_url() +'assets/public/images/ajax-loader.gif) no-repeat center center' });
      setTimeout(function() {
        main.ajax('listas/visualizar/', 'ver-lista');
      }, 800);
      return false;
    } else {
      login_click();
    }
  });


  $('.products .add-to-list').css({
    backgroundPosition: '-110px -562px'
  });
  $('.products .del-to-list').css({
    backgroundPosition: '-146px -562px'
  });

  main.b_over = false; /* Detalhe Produto */
  $('.products ul li a').live({
    mouseover: function() {
      $(this).parent().children('.add-to-list').stop().animate({
        backgroundPosition: '-110px -598px'
      }, 200);
      $(this).parent().children('.del-to-list').stop().animate({
        backgroundPosition: '-146px -598px'
      }, 200);
      $(this).removeClass('_hover').addClass('_hover_');
    }
/*,
			mouseleave : function(){
				$(this).parent().children('.add-to-list').stop().animate({ backgroundPosition : '-110px -562px' }, 200);
				$(this).parent().children('.del-to-list').stop().animate({ backgroundPosition : '-146px -562px' }, 200);
				$(this).removeClass('_hover_').addClass('_hover');
			}*/
    ,
    click: function() {
      $(this).parent().children('._load').fadeIn();
      Page.sidePage = 'active';
      main.ajax($(this).attr('href'), 'product');
      //pageCatalog.showDetailProduct();
      return false;
    }
  });


  $('.products ul li a._hover_').live('mouseout', function() {
    var $this = $(this);
    setTimeout(function() {
      if (main.b_over === false) {
        $($this).parent().children('.add-to-list').stop().animate({
          backgroundPosition: '-110px -562px'
        }, 200);
        $($this).parent().children('.del-to-list').stop().animate({
          backgroundPosition: '-146px -562px'
        }, 200);
        $($this).removeClass('_hover_').addClass('_hover');
      }
    }, 10);
  });


  $('#produto .close').live('click', function() {
    if (click_recom == true) {
      $('#frm_recomendar_2').hide();
      click_recom = false;
    }
    $('body').css({
      height: 'auto'
    });
    pageCatalog.hideDetailProduct();
  });


  //main.b_over = false;
  $('.products ul .add-to-list').live('click', function() {
    if ($('body').hasClass('logado')) {
      $(this).parent().find('._load').fadeIn();
      var id_produto = $(this).attr('rel');
      id_produto = id_produto.split('/')
      $(this).removeClass('add-to-list').addClass('del-to-list');
      $('.products .del-to-list').css({
        backgroundPosition: '-146px -562px'
      });

      var url_add = $(this).attr('rel');
      var url_del = 'listas/remover/' + id_produto[2] + '';

      main.ajax(url_add, 'add-to-list');
      $(this).attr('rel', url_del);

    } else {
      login_click();
    }
  }).live('mouseover', function() {
    main.b_over = true;
    $('.popup-lista').css({
      background: 'url(' + base_url() + 'assets/public/images/popup_lista_adicionar.png) no-repeat 0 57px'
    });
    //setTimeout(function(){
    $(this).stop().animate({
      backgroundPosition: '-110px -634px'
    }, 200);
    $('.popup-lista').css({
      top: ($(this).parent().offset().top - 50),
      left: $(this).parent().offset().left + 104,
      display: 'block'
    }).stop().animate({
      backgroundPosition: '0 0'
    }, 100);
    //},200);
  }).live('mouseout', function() {
    main.b_over = false;
    $(this).stop().animate({
      backgroundPosition: '-110px -598px'
    }, 200);
    $('.popup-lista').animate({
      backgroundPosition: '0 57px'
    }, 100, function() {
      $(this).css({
        display: 'none',
        top: 0,
        left: 0
      });
    });
  });

  $('.products ul .del-to-list').live('click', function() {
    if ($('body').hasClass('logado')) {
      $(this).parent().find('._load').fadeIn();
      if ($(this).parent().parent().parent().hasClass('_ver_lista')) {
        $(this).parent().fadeOut();
      }

      var id_produto = $(this).attr('rel');
      id_produto = id_produto.split('/');
      $(this).removeClass('del-to-list').addClass('add-to-list');
      $('.products .add-to-list').css({
        backgroundPosition: '-110px -562px'
      });

      var url_del = $(this).attr('rel');
      var url_add = 'listas/adicionar/' + id_produto[2] + '';

      main.ajax(url_del, 'del-to-list');
      $(this).attr('rel', url_add);

/*
				$(this).attr('rel','listas/adicionar/'+ id_produto[2]+''); 
				main.ajax( $(this).attr('rel'), 'del-to-list' );
				*/

    } else {
      login_click();
    }
  }).live('mouseover', function() {
    main.b_over = true;

    $('.popup-lista').css({
      background: 'url(' + base_url() + 'assets/public/images/popup_lista_remover.png) no-repeat 0 57px'
    });

    //setTimeout(function(){
    $(this).stop().animate({
      backgroundPosition: '-146px -634px'
    }, 200);
    $('.popup-lista').css({
      top: ($(this).parent().offset().top - 50),
      left: $(this).parent().offset().left + 104,
      display: 'block'
    }).stop().animate({
      backgroundPosition: '0 0'
    }, 100);
    //},200);
  }).live('mouseout', function() {
    main.b_over = false;
    $(this).stop().animate({
      backgroundPosition: '-146px -598px'
    }, 200);
    $('.popup-lista').animate({
      backgroundPosition: '0 57px'
    }, 100, function() {
      $(this).css({
        display: 'none',
        top: 0,
        left: 0
      });
    });
  });




  $('.list-colecoes a, .list-categorias a, .list-cores a').click(function() {
    if (main.animaPermission === true) {

      var _rel = $(this).attr('rel').split(' ');
      $('.products li').fadeOut(300);

      if ($(this).parent().hasClass('title') || $(this).parent().hasClass('cor') || $(this).parent().hasClass('cat')) var rel = $(this).attr('rel');
      else var rel = _rel[1] + '.' + _rel[0];


      setTimeout(function() {
        if ($('.products li.' + rel).length > 0) {
          $('.products .sem-produtos').fadeOut();

          //console.log(main.animaPermission);
          main.animaInside($('.products li.' + rel), 'fadeIn', 100);
          main.animaPermission = false;


          $('.pagi').html('');
          $('.products ul').eq(0).css({
            marginTop: 0
          });
          main.paginationProducts = 1;

          var qtdLI = $('.products li.' + rel).length;
          var pages = Math.ceil(qtdLI / 15);
          $('.pagi').css({
            width: 22 * pages,
            position: 'absolute',
            left: ($(window).width() / 2),
            marginLeft: -(22 * pages) / 2
          });
          if (pages > 1) {
            for (i = 1; i <= pages; i++) {
              $('.pagi').append('<a href="#" class="ir" rel="' + i + '">' + i + '</a>');
            }
          }
          $('.pagi').fadeIn();
          $('.pagi a:first').addClass('active');
          $('.pagi a:last').css({
            margin: 0
          });

        } else {
          $('.products .sem-produtos').fadeIn();
          $('.pagi').fadeOut().html('');
        }
      }, 400);

      //$('.products li.' + _rel).delay(500).fadeIn(400);			
      $('.title-category').text($(this).attr('param'));

      if ($(this).parent().parent().parent().hasClass('list-cores')) {
        $('.marcar_cor').animate({
          left: ($(this).offset().left - main.marginHalfSide) + 1
        }, 800, 'easeInOutExpo');
      }

      if ($(this).parent().parent().parent().hasClass('list-categorias')) {
        $(this).parent().parent().parent().find('.active').removeClass('active');
        $(this).addClass('active');
      }

    }

    //pageCatalog.hideProducts( _rel );
    return false;
  });


  main.paginationProducts = 1;
  $('.pagi a').live('click', function() {

    if (!$(this).hasClass('active')) {

      $(this).parent().find('.active').removeClass('active');
      $(this).addClass('active');

      if ($(this).attr('rel') > main.paginationProducts) {

        var rel = $(this).attr('rel') - main.paginationProducts;
        var pos_ = '-=' + (698 * rel) + 'px';

      } else if ($(this).attr('rel') < main.paginationProducts) {

        if ($(this).attr('rel') == 1) {
          var pos_ = 0;
        } else {
          var rel = main.paginationProducts - $(this).attr('rel');
          var pos_ = '+=' + (698 * rel) + 'px';
        }

      }

      main.paginationProducts = $(this).attr('rel');

      $('.products ul').eq(0).animate({
        marginTop: pos_
      }, 1000, 'easeInOutExpo', function() {
        $('html, body').animate({
          scrollTop: $('.products').offset().top - 100
        }, 1500, 'easeInOutExpo');
      });

    }

    return false;

  });


  $('#produto ul.buttons li a').live({
    click: function() {
      if ($(this).hasClass('share') && click_recom == false) {
        $('#frm_recomendar_2').show();
        click_recom = true;
      } else {
        $('#frm_recomendar_2').hide();
        click_recom = false;
      }
    }
/*,
			mouseover: function() {
				$(this).stop().animate({ backgroundPositionY : '-260px' },200);
			},
			mouseout: function() {
				$(this).stop().animate({ backgroundPositionY : '-234px' },200);
			}*/
  });

  $('#produto ul.buttons li a.shop').live({
    mouseover: function() {
      $(this).stop().animate({
        backgroundPosition: '-159px -260px'
      }, 200);
    },
    mouseout: function() {
      $(this).stop().animate({
        backgroundPosition: '-159px -234px'
      }, 200);
    }
  });

  $('#produto ul.buttons li a.share').live({
    mouseover: function() {
      $(this).stop().animate({
        backgroundPosition: '-394px -260px'
      }, 200);
    },
    mouseout: function() {
      $(this).stop().animate({
        backgroundPosition: '-394px -234px'
      }, 200);
    }
  });

/*$('#produto ul.buttons li a.list-add').live({
			mouseover : function(){
				$(this).stop().animate({ backgroundPosition : '-253px -260px' },200);
			},
			mouseout : function(){
				$(this).stop().animate({ backgroundPosition : '-253px -234px' },200);
			}
		});
		
		$('#produto ul.buttons li a.list-del').live({
			mouseover : function(){
				$(this).stop().animate({ backgroundPosition : '-253px -314px' },200);
			},
			mouseout : function(){
				$(this).stop().animate({ backgroundPosition : '-253px -288px' },200);
			}
		});*/

  $('#produto ul.buttons li a.list_add').live({
    click: function() {
      if ($('body').hasClass('logado')) {
        var id_produto = $(this).attr('href');
        id_produto = id_produto.split('/')
        $(this).removeClass('list_add').addClass('list_remove');

        var url_add = $(this).attr('href');
        var url_del = 'listas/remover/' + id_produto[2] + '';

        main.ajax(url_add, 'add-to-list');
        $(this).attr('href', url_del);
      } else {
        login_click();
      }
      return false;
    },
    mouseover: function() {
      $(this).stop().animate({
        backgroundPosition: '-253px -314px'
      }, 200);
    },
    mouseout: function() {
      $(this).stop().animate({
        backgroundPosition: '-253px -288px'
      }, 200);
    }
  });

  $('#produto ul.buttons li a.list_remove').live({
    click: function() {
      if ($('body').hasClass('logado')) {
        var id_produto = $(this).attr('href');
        id_produto = id_produto.split('/')
        $(this).removeClass('list_remove').addClass('list_add');

        var url_del = $(this).attr('href');
        var url_add = 'listas/adicionar/' + id_produto[2] + '';

        main.ajax(url_del, 'add-to-list');
        $(this).attr('href', url_add);
      } else {
        login_click();
      }
      return false;
    },
    mouseover: function() {
      $(this).stop().animate({
        backgroundPosition: '-253px -260px'
      }, 200);
    },
    mouseout: function() {
      $(this).stop().animate({
        backgroundPosition: '-253px -288px'
      }, 200);
    }
  });

  $('.button-tag').live('click', function() {
    if (!$(this).hasClass('active')) {
      $(this).css({
        backgroundPosition: '-159px -292px'
      }).addClass('active');
      pageCatalog.showAvatares();
    } else {
      $(this).css({
        backgroundPosition: '-159px -315px'
      }).removeClass('active');
      pageCatalog.hideAvatares();
    }
  });

  $('#container-ver-lista ul.buttons li a.other-list').live({
    click: function() {

    },
    mouseover: function() {
      $(this).stop().animate({
        backgroundPosition: '0 -533px'
      }, 200);
    },
    mouseout: function() {
      $(this).stop().animate({
        backgroundPosition: '0 -506px'
      }, 200);
    }
  });

  $('#container-ver-lista ul.buttons li a.my-list, #buscar_lista ul.buttons li a.my-list').live({
    mouseover: function() {
      $(this).stop().animate({
        backgroundPosition: '-148px -533px'
      }, 200);
    },
    mouseout: function() {
      $(this).stop().animate({
        backgroundPosition: '-148px -506px'
      }, 200);
    }
  });

  $('#container-ver-lista ul.buttons li a.share-list').live({
    click: function() {
      if (click_recom2 == false) {
        $('#frm_recomendar').show();
        click_recom2 = true;
      } else {
        $('#frm_recomendar').hide();
        click_recom2 = false;
      }
    },
    mouseover: function() {
      $(this).stop().animate({
        backgroundPosition: '-394px -314px'
      }, 200);
    },
    mouseout: function() {
      $(this).stop().animate({
        backgroundPosition: '-394px -288px'
      }, 200);
    }
  });

  $('#featured_lookbook .link_lookbook').mouseover(function() {
    $(this).stop().animate({
      backgroundPositionY: '-589px'
    }, 200);
  }).mouseout(function() {
    $(this).stop().animate({
      backgroundPositionY: '-569px'
    }, 200);
  });

  $('#featured_bottom .link_share').mouseover(function() {
    $(this).stop().animate({
      backgroundPositionY: '-634px'
    }, 200);
  }).mouseout(function() {
    $(this).stop().animate({
      backgroundPositionY: '-614px'
    }, 200);
  });


});





/* 4 - Pages
------------------------------------------------*/
var Page = new Object(); //Namespace to Pages
Page.pageHeight = 1239;
Page.currentPage = 'home';
Page.sidePage = '';
Page.oldPage = 'home';
Page.setOldPage = function(_page) {
  Page.oldPage = _page;
}
Page.setCurrentPage = function(page) {
  var menu = Array();
  menu['sobre'] = 0;
  menu['seja-uma-vik'] = 1;
  menu['campanha'] = 2;
  menu['catalogo'] = 3;
  menu['lojas'] = 4;
  menu['lista'] = 5;
  menu['contato'] = 7;
  menu['login'] = 8;
  if (Page.currentPage != page) {

    Page.currentPage = page;

    if (page != 'home' && page != 'login' && page != 'cadastro' && page != 'meucadastro') {
      if (page == 'catalogo' || page == 'lojas' || page == 'lista' || page == 'contato' || page == 'login') {
        //$('#top').css({ borderBottom : '1px solid #e8e8e8' });
      } else {
        //$('#top').css({ borderBottom : 'none' });
      }
      $('.set-markup').fadeIn().animate({
        width: $('#menu li').eq(menu[page]).width(),
        left: $('#menu li').eq(menu[page]).offset().left
      }, 500, 'easeInOutExpo');
    } else $('.set-markup').fadeOut().animate({
      width: $('.logo').width(),
      left: $('.logo').offset().left
    }, 500, 'easeInOutExpo');
  }
}






/* About
	------------------------------------------------*/
Page.About = function() {} //Namespace page sobre
var pageAbout = new Page.About(); //Instance to Page Vik






/* Seja uma VIK
	------------------------------------------------*/
Page.Vik = function() { //Namespace page VIK
  //this.offsetVik = $('#seja-uma-vik .look').offset().top;
}

Page.Vik.prototype.changePositionFeatured = function() {
  //if(state == 'fixed'){
  if (($(window).scrollTop() + $(window).height() >= $('#seja-uma-vik .look').offset().top + $('#seja-uma-vik .look').height()) || $(window).scrollTop() + $(window).height() <= (Page.pageHeight * 3) + 80) {
    $('#seja-uma-vik .look').removeClass('_absolute').addClass('_fixed');
  }
  if ($('#seja-uma-vik .look').offset().top <= pageVik.offsetVik) { //else if(state == 'absolute'){
    $('#seja-uma-vik .look').removeClass('_fixed').addClass('_absolute');
  } else if ($('#seja-uma-vik .look').offset().top + $('#seja-uma-vik .look').height() >= (Page.pageHeight * 3) + 80) { //if(state == 'absolute_zero'){
    $('#seja-uma-vik .look').removeClass('_fixed').addClass('_absolute_zero');
  }
}

var pageVik = new Page.Vik(); //Instance to Page Vik





/* Campaing
	------------------------------------------------*/
Page.Campaing = function() { //Namespace page Campaing
  //this.offsetVik = $('#seja-uma-vik .look').offset().top;
  this.sets = '';
  this.balls = '';
}

Page.Campaing.prototype.changePositionSets = function() {
  if ($(window).scrollTop() >= Page.pageHeight * 3 && $(window).scrollTop() < (Page.pageHeight * 3) + ($('#campanha').height() / 2) && this.sets == '') {
    $('#campanha .nav-left').animate({
      left: '10%'
    }, 600, 'easeInOutExpo');
    $('#campanha .nav-right').animate({
      right: '10%'
    }, 600, 'easeInOutExpo');
    this.sets = 'active';
  } else if ($(window).scrollTop() < Page.pageHeight * 3 && this.sets == 'active') {
    $('#campanha .nav-left').animate({
      left: '-10%'
    }, 600, 'easeInOutExpo');
    $('#campanha .nav-right').animate({
      right: '-10%'
    }, 600, 'easeInOutExpo');
    this.sets = '';
  } else if ($(window).scrollTop() > ((Page.pageHeight * 3) + $('#campanha').height()) && this.sets == 'active') {
    $('#campanha .nav-left').animate({
      left: '-10%'
    }, 600, 'easeInOutExpo');
    $('#campanha .nav-right').animate({
      right: '-10%'
    }, 600, 'easeInOutExpo');
    this.sets = '';
  }

  if ($(window).scrollTop() >= ((Page.pageHeight * 3) + $('#campanha').height()) - $(window).height()) {
    $('#campanha .nav-left, #campanha .nav-right').css({
      position: 'absolute',
      top: '47%'
    });
  } else if ($(window).scrollTop() < ((Page.pageHeight * 3) + $('#campanha').height()) - $(window).height()) {
    $('#campanha .nav-left, #campanha .nav-right').css({
      position: 'fixed',
      top: '45%'
    });
  }

  if ($(window).scrollTop() >= Page.pageHeight * 3 && $(window).scrollTop() < ((Page.pageHeight * 3) + $('#campanha').height()) - $(window).height()) {
    $('#campanha #ball-nav').css({
      position: 'fixed',
      bottom: '50px'
    }, 500);
  } else if ($(window).scrollTop() > ((Page.pageHeight * 3) + $('#campanha').height()) - $(window).height()) {
    $('#campanha #ball-nav').css({
      position: 'absolute',
      bottom: '135px'
    });
  } else if ($(window).scrollTop() < Page.pageHeight * 3) {
    $('#campanha #ball-nav').css({
      position: 'absolute',
      bottom: '320px'
    });
  }
}

var pageCampaing = new Page.Campaing(); //Instance to Page Campaing




/* Catalog
	------------------------------------------------*/
Page.Catalog = function() { //Namespace page Catalog		
  $('.products ul li').each(function() {
    //$(this).css({ opacity : 0 });
  });

  $('#produto .main-product').children().each(function() {
    $(this).css({
      marginLeft: main.widthWindow
    });
  });

  $('.avatar').each(function() {
    $(this).css({
      marginLeft: main.widthWindow
    });
  });

  $('#produto .main-product, #produto .main-product .wrap-image').css({
    height: ($(window).height() - 223)
  });



}

Page.Catalog.prototype.showProducts = function(rel) {
  var _delay = 0;
  $('.products ul li').each(function() {
    _delay += 100;
    $(this).delay(_delay).animate({
      opacity: 1
    }, 300);
  });

}

Page.Catalog.prototype.hideProducts = function(rel) {
  var _delay2 = 0;
  $('.products ul li').each(function() {
    _delay2 += 100;
    $(this).delay(_delay2).animate({
      opacity: 0
    }, 300);
  });
}

Page.Catalog.prototype.showDetailProduct = function() {
  $('#produto').css({
    top: 80
  }).animate({
    marginLeft: 0,
    top: 80
  }, 1000, 'easeInOutExpo', function() {
    $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
      display: 'none'
    });
    $('#produto .main-product .wrap-image').jScrollPane({}, 'produto');
  });
  $('#produto .main-product').children().each(function() {
    $(this).delay(300).animate({
      marginLeft: 0
    }, 1000, 'easeInOutExpo');
  });
}

Page.Catalog.prototype.hideDetailProduct = function() {
  if ($('.button-tag').hasClass('active')) $('.button-tag').click();
  $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
    display: 'block'
  });
  $('html, body').animate({
    scrollTop: $('#catalogo').offset().top - 80
  }, 1);
  $('#produto').animate({
    marginLeft: main.widthWindow
  }, 1000, 'easeInOutExpo', function() {
    $('#produto .main-product').children().each(function() {
      $(this).css({
        marginLeft: main.widthWindow
      });
    });
  });
}

Page.Catalog.prototype.showAvatares = function() {
  $('.avatar').each(function() {
    var _range = range(500, 1000);
    $(this).css({
      top: Math.floor(Math.random() * 801),
      left: Math.floor(Math.random() * 1001)
    }).animate({
      marginLeft: 0
    }, _range[Math.floor(Math.random() * _range.length)], 'easeInOutExpo');
  });
}

Page.Catalog.prototype.hideAvatares = function() {
  $('.avatar').each(function() {
    var _range = range(500, 1000);
    $(this).animate({
      marginLeft: main.widthWindow
    }, _range[Math.floor(Math.random() * _range.length)], 'easeInOutExpo');
  });
}



/* Lojas
	------------------------------------------------*/
Page.Lojas = function() { //Namespace page Contact		
  $('#lojas').css({
    marginLeft: main.widthWindow
  });
  $('#lojas.wrap-limits').css({
    height: $(window).height() - 80
  });
  $('#lojas .limits').css({
    height: $(window).height() - 120
  });
}

Page.Lojas.prototype.animateIn = function() {
  $('#lojas').css({
    top: 80
  }).animate({
    marginLeft: 0,
    top: 80
  }, 1000, 'easeInOutExpo', function() {
    $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
      display: 'none'
    });
  });
}

Page.Lojas.prototype.animateOut = function() {
  $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
    display: 'block'
  }); /*$('html, body').animate({ scrollTop : $('#' + Page.oldPage).offset().top },1);*/
  $('html, body').animate({
    scrollTop: $('#home').offset().top
  }, 1);
  $('#lojas').animate({
    marginLeft: main.widthWindow
  }, 1000, 'easeInOutExpo');
}

var pageLojas = new Page.Lojas(); //Instance to Page Contact



/* Lista de Presentes
	------------------------------------------------*/
Page.Presentes = function() { //Namespace page Contact		
  $('#buscar_lista').css({
    marginLeft: main.widthWindow
  });
  $('#ver-lista').css({
    display: 'none'
  });
  $('#buscar_lista.wrap-limits, #ver-lista.wrap-limits').css({
    height: $(window).height() - 80
  });
  $('#buscar_lista .limits, #ver-lista.limits').css({
    height: $(window).height() - 120
  });
}

Page.Presentes.prototype.animateIn = function(el) {

  if (el == '#buscar_lista') {
    $(el).css({
      top: 80
    }).animate({
      marginLeft: 0,
      top: 80
    }, 1000, 'easeInOutExpo', function() {
      $('body').css({
        height: $(window).height()
      });
      $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
        display: 'none'
      });
    });
  } else if ('#ver-lista') {
    $(el).css({
      top: 80
    }).fadeIn(500, function() {
      $('#id_search_lista').val('Digite o nome da pessoa');
      $('body').css({
        height: $(window).height()
      });
      $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
        display: 'none'
      });
    });
  }


}

Page.Presentes.prototype.animateOut = function(el, close) {

  if (el == '#buscar_lista') {
    $('.ui-autocomplete').fadeOut();
    if (close == 'busca_lista_close') {
      $('body').css({
        height: 'auto'
      });
      $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
        display: 'block'
      });
    }
    $(el).animate({
      marginLeft: main.widthWindow
    }, 1000, 'easeInOutExpo', function() {
      //$('#id_search_lista').val('');
    });
  }

  if (el == '#ver-lista') {
    $('body').css({
      height: 'auto'
    });
    $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
      display: 'block'
    });
    var redirect;
    if (Page.oldPage == '') {
      redirect = Page.currentPage;
    } else {
      redirect = Page.oldPage;
    } /*$('html, body').animate({ scrollTop : $('#' + redirect).offset().top },1);*/
    $('html, body').animate({
      scrollTop: $('#home').offset().top
    }, 1);

    $(el).animate({
      marginLeft: main.widthWindow
    }, 1000, 'easeInOutExpo', function() {
      $('.ui-autocomplete').fadeOut();
      //$('#id_search_lista').val('');
      $(this).css({
        display: 'none',
        marginLeft: 0
      });
    });
  }

}

var pagePresentes = new Page.Presentes(); //Instance to Page Contact




/* Login
	------------------------------------------------*/
Page.Login = function() { //Namespace page Login		
  $('#login').css({
    marginLeft: main.widthWindow,
    display: 'block'
  });
  $('#login.wrap-limits').css({
    height: $(window).height() - 80
  });
  $('#login .limits').css({
    height: $(window).height() - 120
  });
}

Page.Login.prototype.animateIn = function() {
  $('#login').css({
    top: 80
  }).animate({
    marginLeft: 0,
    top: 80
  }, 1000, 'easeInOutExpo', function() {
    $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({
      display: 'none'
    });
  });
}

Page.Login.prototype.animateOut = function() {
  var redirect;
  if (Page.oldPage == '') {
    redirect = 'catalogo';
  } else {
    redirect = Page.oldPage;
  }
  $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({
    display: 'block'
  }); /*$('html, body').animate({ scrollTop : $('#' + redirect).offset().top },1);*/
  $('html, body').animate({
    scrollTop: $('#home').offset().top
  }, 1);
  $('#login').animate({
    marginLeft: main.widthWindow
  }, 1000, 'easeInOutExpo');
}

var pageLogin = new Page.Login(); //Instance to Page Login



/* Cadastro
	------------------------------------------------*/
Page.Cadastro = function() { //Namespace page Login		
  $('#cadastro').css({
    marginLeft: main.widthWindow,
    display: 'block'
  });
  $('#cadastro.wrap-limits').css({
    height: $(window).height() - 80
  });
  $('#cadastro .limits').css({
    height: $(window).height() - 120
  });
  $('.select-cadastro > div').jScrollPane({}, 'estado');
  $('div.select-cadastro ul').css({
    top: 0,
    left: '-1px'
  });
  $('.jScrollPaneContainer').css({
    marginLeft: '-1px'
  });
}

Page.Cadastro.prototype.animateIn = function() {
  $('#cadastro').css({
    top: 80
  }).animate({
    marginLeft: 0,
    top: 80
  }, 1000, 'easeInOutExpo', function() {
    $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({
      display: 'none'
    });
  });
}

Page.Cadastro.prototype.animateOut = function() {
  $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({
    display: 'block'
  }); /*$('html, body').animate({ scrollTop : $('#' + Page.oldPage).offset().top },1);*/
  $('html, body').animate({
    scrollTop: $('#home').offset().top
  }, 1);
  $('#cadastro').animate({
    marginLeft: main.widthWindow
  }, 1000, 'easeInOutExpo');
}

var pageCadastro = new Page.Cadastro(); //Instance to Page Cadastro

/* Editar Cadastro
	------------------------------------------------*/
Page.MeuCadastro = function() { //Namespace page Login		
  $('#meucadastro').css({
    marginLeft: main.widthWindow,
    display: 'block'
  });
  $('#meucadastro.wrap-limits').css({
    height: $(window).height() - 80
  });
  $('#meucadastro .limits').css({
    height: $(window).height() - 120
  });
  $('.select-cadastro > div').jScrollPane({}, 'estado');
  $('div.select-cadastro ul').css({
    top: 0,
    left: '-1px'
  });
  $('.jScrollPaneContainer').css({
    marginLeft: '-1px'
  });
}

Page.MeuCadastro.prototype.animateIn = function() {
  $('#meucadastro').css({
    top: 80
  }).animate({
    marginLeft: 0,
    top: 80
  }, 1000, 'easeInOutExpo', function() {
    $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({
      display: 'none'
    });
  });
}

Page.MeuCadastro.prototype.animateOut = function() {
  $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({
    display: 'block'
  }); /*$('html, body').animate({ scrollTop : $('#' + Page.oldPage).offset().top },1);*/
  $('html, body').animate({
    scrollTop: $('#home').offset().top
  }, 1);
  $('#meucadastro').animate({
    marginLeft: main.widthWindow
  }, 1000, 'easeInOutExpo');
}

//var pageMeuCadastro_ = new Page.MeuCadastro(); //Instance to Page MeuCadastro



/* Contact
	------------------------------------------------*/
Page.Contact = function() { //Namespace page Contact		
  $('#contato').css({
    marginLeft: main.widthWindow
  });
  $('#contato.wrap-limits').css({
    height: $(window).height() - 80
  });
  $('#contato .limits').css({
    height: $(window).height() - 120
  });
}

Page.Contact.prototype.animateIn = function() {
  $('#contato').css({
    top: 80
  }).animate({
    marginLeft: 0,
    top: 80
  }, 1000, 'easeInOutExpo', function() {
    $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
      display: 'none'
    });
  });
}

Page.Contact.prototype.animateOut = function() {
  $('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({
    display: 'block'
  }); /*$('html, body').animate({ scrollTop : $('#' + Page.oldPage).offset().top },1);*/
  $('html, body').animate({
    scrollTop: $('#home').offset().top
  }, 1);
  $('#contato').animate({
    marginLeft: main.widthWindow
  }, 1000, 'easeInOutExpo');
}

var pageContact = new Page.Contact(); //Instance to Page Contact
/* 
Theme Name: Kipling
Author: Aurora Creative Business | Daniel Silvestre/Gustavo Carvalho - Front-End Engineer's
Author URI: http://www.aurora.ag

[ - INDICE - ]

	1 - Layout
	2 - Init
	3 - Events
	4 - Pages
	5 - 
	6 - 
	7 - 
	8 - 

*/

/* 1 - Layout
------------------------------------------------*/
$(function(){

	$('.wrap-logout').mouseenter(function(){
		$('.popup-login').show();
	}).mouseleave(function(){
		$('.popup-login').hide();
	});
	
	/* Menu
	------------------------------------------------*/
	$('#menu ul li:last').css({ margin: 0 });
	//Cufon.replace('#menu ul li a', { fontFamily: 'VAG Rounded Std', hover: true } );
	
	/*$('#menu ul li a.sobre').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '0 -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '0 0' }, 200);
	});
	
	$('#menu ul li a.seja-vik').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-83px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-83px 0' }, 200);
	});
	
	$('#menu ul li a.campanha').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-191px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-191px 0' }, 200);
	});
	
	$('#menu ul li a.catalogo').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-284px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-284px 0' }, 200);
	});
	
	$('#menu ul li a.lojas').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-374px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-374px 0' }, 200);
	});
	
	$('#menu ul li a.lista').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-431px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-431px 0' }, 200);
	});
	
	$('#menu ul li a.fanpage').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-575px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-575px 0' }, 200);
	});
	
	$('#menu ul li a.contato').mouseover(function(){
		$(this).stop().animate({ backgroundPosition : '-653px -14px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPosition : '-653px 0' }, 200);
	});*/
	
	
	/* Limits Height
	------------------------------------------------*/
	$('#home .limits').each(function(){
		$(this).css({ height :  $(this).parent().height() });
	});
	
	
	/* Twitter
	------------------------------------------------*/
	$('#twitter ul li:first').css({ paddingTop : 0 });
	$('#twitter ul li:last').css({ border : 'none' });
	
	
	/* Featured Bottom
	------------------------------------------------*/
	$('#featured_bottom .link_featured_bottom').css({ marginBottom : - $('#featured_bottom .link_featured_bottom').height() - 34 + 'px' });
	
	/*$('#featured_bottom').bind('mouseover', function(){
		//$(this).find('.alpha').animate({ opacity : .5 },200);
		$(this).find('img').animate({ width : '150%', height : '150%', left : '-25%', top : '-25%' },200, function(){
			 $('#featured_bottom').bind('mousemove', function(e){
				var movimento = 10;
				var _width = $('#featured_bottom').width();
				var _height = $('#featured_bottom').height();
				var _top = $('#featured_bottom').offset().top;
				var _left = $('#featured_bottom').offset().left;
				var pos_x = (e.pageX - _left) - (_width / 2);
				var pos_y = (e.pageY - _top) - (_height / 2);
				$(this).find('.photo_zoom').css({top: ( - (pos_y / movimento) ) +"%", left:  ( - (pos_x / movimento) )  +"%"});
			});
		});
	}).mouseleave(function(){
		$(this).find('img').animate({ width : '100%', height : '100%', left : 0, top : 0 },200);
		$(this).find('.photo_zoom').animate({ top : 0, left : 0 },200);
		//$(this).find('.alpha').stop().animate({ opacity : 0 },300);
	});*/
	
	
	/* Featured Catalog
	------------------------------------------------*/	
	/*$('#featured_catalog').bind('mouseover', function(){
		//$(this).find('.alpha').animate({ opacity : .5 },200);
		$(this).find('img').animate({ width : '150%', height : '150%', left : '-25%', top : '-25%' },200, function(){
			 $('#slider').bind('mousemove', function(e){
				var movimento = 10;
				var _width = $('#featured_catalog ul li').width();
				var _height = $('#featured_catalog ul li').height();
				var _top = $('#featured_catalog ul li').offset().top;
				var _left = $('#featured_catalog ul li').offset().left;
				var pos_x = (e.pageX - _width) - (_width / 2);
				var pos_y = (e.pageY - _height) - (_height / 2);
				$(this).find('.photo_zoom').css({top: ( - (pos_y / movimento) ) +"%", left:  ( - (pos_x / movimento) )  +"%"});
			});
		});
	}).mouseleave(function(){
		$(this).find('img').animate({ width : '100%', height : '100%', left : 0, top : 0 },200);
		$(this).find('.photo_zoom').animate({ top : 0, left : 0 },200);
		//$(this).find('.alpha').stop().animate({ opacity : 0 },300);
	});*/
	
	$("#featured_catalog #slider").easySlider({
		auto: true,
		continuous: true,
		hoverpause: true
	});
	
	$('.login').mouseover(function(){
		$(this).stop().animate({ backgroundPositionY : '-26px' }, 200);
	}).mouseout(function(){
		$(this).stop().animate({ backgroundPositionY : 0 }, 200);
	});
	
	
	/* Twitter
	------------------------------------------------*/	
	
	
});
	
	

	/* Home - Gallery featured campaign
	------------------------------------------------*/
	$(function(){
		$('#slideshow li:first').addClass('active');
	});
	
	function slideSwitch() {
		var $active = $('#slideshow li.active');
		if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
		var $next =  $active.next().length ? $active.next()
			: $('#slideshow li:first');
		$active.addClass('last-active');
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 2500, function() {
				$active.removeClass('active last-active');
			});
	}
	
	
	$(function(){
		main.timeoutCampaign = setInterval( function(){ slideSwitch() }, 6000 );
		
		/*$('#featured_campaign').bind('mouseover', function(){
			clearInterval(main.timeoutCampaign);
			//$(this).find('.alpha').animate({ opacity : .5 },200);
			$(this).find('img').animate({ width : '180%', height : '180%', left : '-35%', top : '-35%' },200, function(){
				 $('#featured_campaign').bind('mousemove', function(e){
					var movimento = 15;
					var _width = $('#featured_campaign').width();
					var _height = $('#featured_campaign').height();
					var _top = $('#featured_campaign').offset().top;
					var _left = $('#featured_campaign').offset().left;
					var pos_x = (e.pageX - _left) - (_width / 2);
					var pos_y = (e.pageY - _top) - (_height / 2);
					$(this).find('.photo_zoom').css({top: ( - (pos_y / movimento) ) +"%", left:  ( - (pos_x / movimento) )  +"%"});
				});
			});
		}).mouseleave(function(){
			main.timeoutCampaign = setInterval( function(){ slideSwitch() }, 3000 );
			$(this).find('img').animate({ width : '100%', height : '100%', left : 0, top : 0 },200);
			$(this).find('.photo_zoom').animate({ top : 0, left : 0 },200);
			//$(this).find('.alpha').stop().animate({ opacity : 0 },300);
		});*/
	});

	
	/* About Elements position
	-----------------------------------------------*/
	$(function(){
		//$('#sobre .bike, #seja-uma-vik .bike2').css({ right : main.marginHalfSide });
		//$('#sobre article').css({ right : ( main.marginHalfSide + 115 ) });
		if( $.browser.mozilla ){
			$('#sobre .texto-sobre').css({ height : '530px' });
			$('#container-busca-lista h2').css({ marginBottom : '34px' });
		}
		$('#sobre .texto-sobre').jScrollPane({},'sobre');
		
	});
	
	
	
	/* Catalog
	-----------------------------------------------*/
	$(function(){
		$('#catalogo .top-catalogo').css({ backgroundPosition : ( main.marginHalfSide - 250 ) + 'px 428px' });
		
		/* Menu */
		$('.top-nav a.categorias').css({ backgroundPosition : '-138px -446px' }).addClass('active');
		
		$('.top-nav a.colecoes').mouseover(function(){
			if( !$(this).hasClass('active') ) $(this).stop().animate({ backgroundPosition : '-18px -446px' },200);
		}).mouseout(function(){
			if( !$(this).hasClass('active') ) $(this).animate({ backgroundPosition : '-18px -476px' },200);
		}).click(function(){
			if( $(this).parent().parent().find('.active').hasClass('categorias') )
				var x = '-138px';
			if( $(this).parent().parent().find('.active').hasClass('colecoes') )
				var x = '-18px';
			if( $(this).parent().parent().find('.active').hasClass('cores') )
				var x = '-257px';
			
			$(this).parent().parent().find('.active').animate({ backgroundPosition : x + ' -476px' },200, function(){
				$(this).removeClass('active')
			});
			$(this).css({ backgroundPosition : '-18px -446px' }).addClass('active');
			$('#catalogo h2.title-category').slideDown(300);
			$('.list-categorias, .list-cores').fadeOut(300);
			$('#catalogo .top-catalogo').animate({ height : '427px', backgroundPosition: ( main.marginHalfSide - 250 ) + 'px 88px' },1000, 'easeInOutExpo', function(){
				$('.list-colecoes').fadeIn(300);
			});
			return false;
		});
		
		$('.top-nav a.categorias').mouseover(function(){
			if( !$(this).hasClass('active') ) $(this).stop().animate({ backgroundPosition : '-138px -446px' },200);
		}).mouseout(function(){
			if( !$(this).hasClass('active') ) $(this).animate({ backgroundPosition : '-138px -476px' },200);
		}).click(function(){
			if( $(this).parent().parent().find('.active').hasClass('categorias') )
				var x = '-138px';
			if( $(this).parent().parent().find('.active').hasClass('colecoes') )
				var x = '-18px';
			if( $(this).parent().parent().find('.active').hasClass('cores') )
				var x = '-257px';
		
			$(this).parent().parent().find('.active').animate({ backgroundPosition : x + ' -476px' },200, function(){
				$(this).removeClass('active');
			});
			$(this).css({ backgroundPosition : '-138px -446px' }).addClass('active');
			$('#catalogo h2.title-category').slideUp(300);
			$('.list-colecoes, .list-cores').fadeOut(300);
			$('#catalogo .top-catalogo').animate({ height : '271px', backgroundPosition: ( main.marginHalfSide - 250 ) + 'px 428px' },1000, 'easeInOutExpo', function(){
				$('.list-categorias').fadeIn(300);
			});
			return false;
		});
		
		$('.top-nav a.cores').mouseover(function(){
			if( !$(this).hasClass('active') ) $(this).stop().animate({ backgroundPosition : '-257px -446px' },200);
		}).mouseout(function(){
			if( !$(this).hasClass('active') ) $(this).animate({ backgroundPosition : '-257px -476px' },200);
		}).click(function(){
			if( $(this).parent().parent().find('.active').hasClass('categorias') )
				var x = '-138px';
			if( $(this).parent().parent().find('.active').hasClass('colecoes') )
				var x = '-18px';
			if( $(this).parent().parent().find('.active').hasClass('cores') )
				var x = '-257px';
		
			$(this).parent().parent().find('.active').animate({ backgroundPosition : x + ' -476px' },200, function(){
				$(this).removeClass('active')
			});
			$(this).css({ backgroundPosition : '-257px -446px' }).addClass('active');
			$('#catalogo h2.title-category').slideUp(300);
			$('.list-colecoes, .list-categorias').fadeOut(300);
			$('#catalogo .top-catalogo').animate({ height : '215px', backgroundPosition: ( main.marginHalfSide - 250 ) + 'px 428px' },1000, 'easeInOutExpo', function(){
				$('.list-cores').fadeIn(300);
			});
			return false;
		});
		/* End Menu */
		
		$('#produto').css({ marginLeft : main.widthWindow });
		
		//$('#resultados-lojas').css({ height : $(window).height() - 330 }).jScrollPane({}, 'lojas');
		
		$('#catalogo .top-catalogo .list-colecoes ul').each(function(){
			$(this).children('li:first').css({ margin : '0 0 2px 0' });
		});
		
		$('.list-categorias ul li:eq(0)').css({ width : '96px', marginRight : '49px' });
		$('.list-categorias ul li:eq(1)').css({ width : '88px', marginRight : '51px' });
		$('.list-categorias ul li:eq(2)').css({ width : '102px', marginRight : '61px' });
		$('.list-categorias ul li:eq(3)').css({ width : '71px', marginRight : '55px' });
		$('.list-categorias ul li:eq(4)').css({ width : '94px', marginRight : '39px' });
		$('.list-categorias ul li:eq(5)').css({ width : '115px', marginRight : 0 });
		
		$('.list-cores ul li:last').css({ marginRight : 0 });
		
		var li = 1;
		$('.products li').each(function(){
			//if( (li%2) != 0 ) $(this).children('a').css({ background : '#fff' });
			li++;
		});
		
		$('#catalogo h2.title-category').css({ marginLeft : main.marginHalfSide });
				
		$('.avatar').each(function(){
			$(this).css({ top : Math.floor(Math.random()*801), left : Math.floor(Math.random()*1001) });
		});
		
		$('.set-markup').css({ display : 'none', width : $('.logo').width(), left : $('.logo').offset().left });
		
		$('#produto.wrap-limits').css({ height : $(window).height() - 80 });
		$('#produto limits').css({ height : $(window).height() - 120 });
		
		//$('.select-cadastro > div').jScrollPane({}, 'estado');
		
	});
	
	
	/* Contato
	------------------------------------------------*/
	//Cufon.replace('#container-contato h2', { fontFamily: 'VAG Rounded Std'} );
	
	

/* 2 - Main
------------------------------------------------*/
	var main = new Object(); //Namespace to Main
	main.permission = true;
	main.timeoutCampaign;
	main.widthWindow = $(window).width();
	main.marginHalfSide = ( main.widthWindow - 1000 ) / 2;
	main.offsetTopWindow = $(window).scrollTop();
	main.statusCurrentPage = false;
	main.menuClicked = false;
	
	main.scrollTop = function(){
		main.offsetTopWindow = $(window).scrollTop();
	
		/* Setting page Vik */
		//pageVik.changePositionFeatured();
		pageCampaing.changePositionSets();
		
		if($(window).scrollTop() < Page.pageHeight && Page.sidePage != 'active') {
			if(Page.sidePage != 'active') Page.setCurrentPage( 'home' );	
		}
		
		/* Set Current Page */
		if( $(window).scrollTop() >= Page.pageHeight && $(window).scrollTop() < Page.pageHeight * 2 ){
			if( main.menuClicked == true ){
				if( $('#menu li').eq(0).hasClass('active') )
					Page.setCurrentPage( 'sobre' );
			} else {
				if(Page.sidePage != 'active') Page.setCurrentPage( 'sobre' );
			}			
		}
		
		if( $(window).scrollTop() >= Page.pageHeight * 2 && $(window).scrollTop() < Page.pageHeight * 3 ){
			if( main.menuClicked == true ){
				if( $('#menu li').eq(1).hasClass('active') ) 
					Page.setCurrentPage( 'seja-uma-vik' );	
			} else {
				if(Page.sidePage != 'active') Page.setCurrentPage( 'seja-uma-vik' );	
			}
		}

		if( $(window).scrollTop() >= Page.pageHeight * 3 && $(window).scrollTop() < ( ( Page.pageHeight * 3 ) + $('#campanha').height() ) ){
			if( main.menuClicked == true ){
				if( $('#menu li').eq(2).hasClass('active') )
					Page.setCurrentPage( 'campanha' );
			} else {
				if(Page.sidePage != 'active') Page.setCurrentPage( 'campanha' );
			}			
		}

		if( $(window).scrollTop() >= ( ( Page.pageHeight * 3 ) + $('#campanha').height() ) ){
			if( main.menuClicked == true ){
				if( $('#menu li').eq(3).hasClass('active') ) 
					Page.setCurrentPage( 'catalogo' );
			} else {  
				if(Page.sidePage != 'active') Page.setCurrentPage( 'catalogo' );
			}
		}
		/*
		if( $(window).scrollTop() > $('#produto').offset().top + ( $('#produto').height() / 2 ) ){
			//pageCatalog.hideDetailProduct();
		}
		/* End Current Page */
	}
	
	/* Parallax Effects */
	main.distanceParallax = function($element, settings){
        var fold = $(window).height() + $(window).scrollTop();
        return (fold + 100) - $element.offset().top ;
    };
	
	main.parallax = function(){
          var bpos = '50% ' + (-( main.distanceParallax($('#home'), 100 ) - 100 ) * .15) + 'px';
          $('#home').css({ backgroundPosition : bpos });
		  $('.link_catalog').css({ top : (+( main.distanceParallax($('.link_catalog'), -100 ) - 100 ) * .25) + 'px' });
		  $('.likes_campaign').css({ top : (+( main.distanceParallax($('.likes_campaign'), -100 ) - 300 ) * .1) + 'px' });
		  $('.link_share').css({ top : (+( main.distanceParallax($('.likes_campaign'), -100 ) - 100 ) * .07) + 'px' });
		  //$('#about .bike').css({ top : (+( main.distanceParallax($('#about .bike'), -100 ) - 100 ) * .25) + 'px' });
		 
	}
	/* End Parallax Effects */
	
	/* ScrollTo */
	main.scrollPage = function(el){
		el = el.replace('#','');
		scrollPos = $('#wrapper').find('div[id='+ el +']').offset().top - 80;
		$('html, body').animate({ scrollTop : scrollPos }, 1500, 'easeInOutExpo', function(){
			//location.hash = el;
			main.menuClicked = false;
		});
		return false;
	}

	var pageCatalog,
		pagePresentesVerLista,
		pageMeuCadastro;
	
	/* Ajax */	
	main.ajax = function(url, type){
		if( type == 'meu_cadastro' ){
			$('.logged').css({ background : 'url('+ base_url() +'/assets/public/images/ajax-loader.gif) no-repeat 0 0' });
		} else if( type == 'ver-lista '){
			$('body, #ver-lista').css({ background : 'url('+ base_url() +'/assets/public/images/ajax-loader.gif) no-repeat center center' });
		}
		$.ajax({
			url: base_url() + url + '?mode=ajax',
			dataType: "html",
			type: "GET",
			data: "&csrf_token=" + $.cookie("csrf_cookie"),
			success: function(data){
				if(type == 'product'){
					$('.products ul li ._load').fadeOut(); 
					$('#produto').html(data);
					pageCatalog = new Page.Catalog(); //Instance to Page Vik
					setTimeout(pageCatalog.showDetailProduct,1000);
				} else if(type == 'ver-lista'){
					//$('body').css({ background : '#fff' });
					$('#ver-lista').html(data).css({ background : '#fff' });
					pagePresentesVerLista = new Page.Presentes(); //Instance to Page Vik
					setTimeout(pagePresentesVerLista.animateIn( '#ver-lista' ),1000);
				} else if(type == 'add-to-list'){
					$('.products ul li ._load').fadeOut();
					if(data){
						if($("body").hasClass("logado")){
							main.ajax( 'listas/minhalista', 'contador-presentes' );
						}
						$('.aviso-top p').text('Produto adicionado com sucesso.');
						$('.aviso-top').animate({ top : '0' }, 500);
						setTimeout(function(){
							$('.aviso-top').animate({ top : '-20px' }, 500);
						},5000);
					}	
					else { 
						$('.aviso-top p').text('Não foi possível adicionar o produto.');
						$('.aviso-top').animate({ top : '0' }, 500);
						setTimeout(function(){
							$('.aviso-top').animate({ top : '-50px' }, 500);
						},5000);
					}
				} else if(type == 'del-to-list'){
					$('.products ul li ._load').fadeOut();
					if($("body").hasClass("logado")){
						main.ajax( 'listas/minhalista', 'contador-presentes' );
					}
					$('.aviso-top p').text('Produto removido com sucesso.');
					$('.aviso-top').animate({ top : '0' }, 500);
					setTimeout(function(){
						$('.aviso-top').animate({ top : '-20px' }, 500);
					},5000);
				} else if(type == 'meu_cadastro'){
					$('#meucadastro').html(data);
					pageMeuCadastro = new Page.MeuCadastro(); //Instance to Page Vik
					setTimeout(pageMeuCadastro.animateIn(),1000);
					$('#select-cadastro > div').css({ width : '490px', height : '300px' }).jScrollPane({}, 'estado');
					$('.logged').css({ background : 'none' });
				} else if(type == 'contador-presentes'){
					$('.my-list-home span').text(data);
				} else if(type == 'page-campanha'){
					$('#campanha').html(data);
				} else if(type == 'page-catalogo'){
					$('#catalogo').html(data);
				}
				$('.resetValue, .valueSelect').resetDefaultValue();
			}
		});
	}
	
	main.animaPermission = true;
	main.animaInside = function(el, type, time){
	
		var timer = setInterval(function(){ animaInside(type) }, time);
		var elements = el;
		var length = 14;
		var index = 0;
		
		function animaInside(type){
		
			if(type == 'fadeIn'){ 
				$(elements).eq(index).fadeIn(500);
			}
			else if(type == 'fadeOut'){ 
				$(elements).eq(index).fadeOut(500); 
			}
			else if(type == 'slideUp'){ 
				$(elements).eq(index).slideUp(1000);				
			}
			else if(type == 'slideDown'){
				$(elements).eq(index).slideDown(1000);	
			}
			
			index++;
			if (index >= length) {
				clearInterval(timer);
				main.animaPermission = true;
				$(el).css({ display : 'block' });
				//console.log(main.animaPermission);
			}
			
		}

	}
	
	
	/* Home - Set Position's from Column Left and Initialize Gallery Campain
	------------------------------------------------*/
	main.positionElHome = function(){
		var mgFeat = 9; 
		var offsetHome = 170;
		blogHeight = $('#featured_blog').outerHeight();
		videoHeight = $('#featured_video').height() + 9;
		catalogHeight = $('#featured_catalog').height() + 9;
		$('#featured_video').css({ top : blogHeight + offsetHome + mgFeat + 'px' });
		$('#featured_catalog').css({ top : blogHeight + videoHeight + offsetHome + mgFeat + 'px'});
		$('#featured_lookbook').css({ top : blogHeight + videoHeight + catalogHeight + offsetHome + mgFeat + 'px'});
		
		/* Campain
		-----------------------------------------------*/
		$('#slider-campain > ul img').css({ width : main.widthWindow });
		$('#slider-campain').simpleGallery();
		
		$('#campanha').css({ height : $('#slider-campain > ul img').height() });
		$('#catalogo .top-catalogo').css({ backgroundPosition : '0 ' + main.marginHalfSide });
		
	};
	
	$(function(){
		//$('#home').parallax("50%", 100, 0.075, true);
		if( !$('body').hasClass('ipad') ){
			$('#home').css({ backgroundPosition : '50% 80px' });
			$('#sobre').parallax("50%", 100, 0.075, true);
			$('#seja-uma-vik').parallax("50%", 100, 0.075, true);
		}
		
		if( $(window).width() >= 1024 ){
			var posx = '80%';
		} else {
			var posx = '99%';
		}
		
		$('#sobre .bike').css({ width : $(window).width() }).parallax(posx, 1000, 0.15, true);
		$('#seja-uma-vik .bike2').css({ width : $(window).width() }).parallax(posx, 1000, 0.15, true);
		//$('#catalogo').parallax("50%", -100, 0.075, true);
	});
	
	main.closeSidePages = function(){
		switch(Page.currentPage){
			case 'lojas' :
			pageLojas.animateOut();
			break;
			case 'lista' :
			pagePresentes.animateOut( '#ver-lista' );
			pagePresentes.animateOut( '#buscar_lista' );
			break;
			case 'contato' :
			pageContact.animateOut();
			break;
			case 'catalogo' :
			pageCatalog.hideDetailProduct();
			break;
			case 'login' :
			pageLogin.animateOut();
			break;
			case 'cadastro' :
			pageCadastro.animateOut();
			break;
			case 'meucadastro' :
			pageMeuCadastro.animateOut();
			break;
		}			
	}
	
	
	
	main.hash = function(){
		
		var hash_atual = location.hash;
		if( hash_atual.indexOf('#') != -1){
			var new_hash = hash_atual.split('#');
			hash_params = new_hash[1].split('/');
			if( hash_params[0] == 'listas' ){
				$('#ver-lista').css({ display : 'block' });
				$('body').css({ background : 'url('+ base_url() +'/assets/public/images/ajax-loader.gif) no-repeat center center' });
				$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'none' });
				
				Page.setOldPage( Page.currentPage );
				Page.sidePage = 'active';
				main.ajax( new_hash[1], 'ver-lista' );
				setTimeout(function(){
					Page.setCurrentPage( 'lista' );
				},800);
			} else if( hash_params[0] == 'produto' ){
				$('body').css({ height : $(window).height(), background : 'url('+ base_url() +'/assets/public/images/ajax-loader.gif) no-repeat center center' });
				$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'none' });
				
				Page.setOldPage( Page.currentPage );
				Page.sidePage = 'active';
				main.ajax( new_hash[1], 'product' );
				setTimeout(function(){
					Page.setCurrentPage( 'catalogo' );
				},800);
			}
		}
		
	}
	

	
/* 3 - Events
------------------------------------------------*/
	/* Scroll
	------------------------------------------------*/
	window.onscroll = function(){
		main.scrollTop();
		if( !$('body').hasClass('ipad') ){
			main.parallax();
		}
	};
	
	/* Loaded
	------------------------------------------------*/
	window.onload = function(){
		main.positionElHome();
		$('#video').attr('src', $('#video').attr('rel') );
		$('#fbframe').attr('src', $('#fbframe').attr('rel') );
		$('#twt').attr('src', $('#twt').attr('rel') );
		main.hash();
		main.ajax('listas/minhalista', 'contador-presentes');
		if(oldPageBeforeLogin){
			
			setTimeout(function(){
				Page.sidePage = 'active';
				pagePresentes.animateIn( '#buscar_lista' );
				Page.setCurrentPage('lista');
			},800);
			
		}
	}
	
	/* Resize
	------------------------------------------------*/
	window.onresize = function(){
		$('.wrap-limits').css({ width : $(window).width() });
	}
	
	
	/* Click
	------------------------------------------------*/
	
	
	$(function(){
		
		var over_photo_home = false,
			click_recom = false,
			click_recom2 = false;
	
		$('.hover_photo').mouseover(function(){
			over_photo_home = true;
		}).mouseout(function(){
			over_photo_home = false;
		});
	
		$('#featured_bottom img, .link_featured_bottom').mouseover(function(){
			over_photo_home = true;
			$('#featured_bottom img').stop().animate({ opacity : .5 },500);
			$('.hover_photo').stop().animate({ backgroundPositionY : 0 }, 200, 'easeInOutExpo');
		}).mouseout(function(){
			over_photo_home = false;
			setTimeout(function(){
				if(over_photo_home === false){
					$('.hover_photo').stop().animate({ backgroundPositionY : '116px' }, 200, 'easeInOutExpo');
					$('#featured_bottom img').stop().animate({ opacity : 1 },500);
				}
			},10);
		});
		
		var over_blog_home = false;
	
		$('.hover_blog').mouseover(function(){
			over_blog_home = true;
		}).mouseout(function(){
			over_blog_home = false;
		});
		
		$('#featured_blog').mouseover(function(){
			over_blog_home = true;
			$(this).children('.hover_blog').animate({ backgroundPositionY : 0 }, 200, 'easeInOutExpo');
		}).mouseout(function(){
			over_blog_home = false;
			setTimeout(function(){
				if(over_blog_home === false){
					$('#featured_blog .hover_blog').animate({ backgroundPositionY : '116px' }, 200, 'easeInOutExpo');
				}
			},10);
		}).click(function(){
			window.open('http://www.kiplingfanpage.com.br/','_blank');
		});
		
		
		$('#featured_catalog').mouseover(function(){
			$('#featured_catalog .link_catalog').stop().animate({ backgroundPositionY : '-116px' }, 400, 'easeInOutExpo');
		}).mouseout(function(){
			$('#featured_catalog .link_catalog').stop().animate({ backgroundPositionY : 0 }, 400, 'easeInOutExpo');
		}).click(function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				Page.sidePage = '';
			}
			main.menuClicked = true;
			$('#menu').find('.active').removeClass('active');
			$('#menu li').eq(3).children('a.mn').addClass('active');
			main.scrollPage( '#catalogo' );
			return false;
		});
		
		$('#featured_campaign').click(function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				Page.sidePage = '';
			}
			main.menuClicked = true;
			$('#menu').find('.active').removeClass('active');
			$('#menu li').eq(2).children('a.mn').addClass('active');
			main.scrollPage( '#campanha' );
			return false;
		});
		
	
		//$('#menu li a, .logo').not('#menu li:last a, #menu li:eq(4)').click(main.scrollPage);
		/* Menu Principal */
		$('#menu li a.mn, .logo').click(function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				Page.sidePage = '';
			}
			main.menuClicked = true;
			$(this).parent().parent().find('.active').removeClass('active');
			$(this).parent().addClass('active');
			var page = $(this).attr('href').split('/');
			main.scrollPage( page[1] );
			return false;
		});
		
		var login_click = function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				setTimeout(function(){
					Page.sidePage = 'active';
					pageLogin.animateIn();
				},800);
			} else {
				Page.setOldPage( Page.currentPage );
				Page.sidePage = 'active';
				pageLogin.animateIn();
			}
			setTimeout(function(){
				Page.setCurrentPage( 'login' );
			}, 800);
			return false;
		}
		
		$('.login').click(login_click);
		
		$('#login .close').click(function(){
			Page.sidePage = '';
			Page.setCurrentPage( Page.oldPage );
			pageLogin.animateOut();
		});
		
		$('.my-list-home').click(function(){
			$('#ver-lista').empty().fadeIn(200).css({ background : 'url('+ base_url() +'/assets/public/images/ajax-loader.gif) no-repeat center center' });
			$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').fadeOut(200);			
			Page.setOldPage( Page.currentPage );
			Page.sidePage = 'active';
			main.ajax( $(this).attr('href'), 'ver-lista' );
			setTimeout(function(){
				Page.setCurrentPage( 'lista' );
			},800);
			return false;
		});
		
		$('.cadastro').click(function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				setTimeout(function(){
					Page.sidePage = 'active';
					pageCadastro.animateIn();
				},800);
			} else {
				Page.setOldPage( Page.currentPage );
				Page.sidePage = 'active';
				pageCadastro.animateIn();
			}
			setTimeout(function(){
				Page.setCurrentPage( 'cadastro' );
			}, 800);
			return false;
		});
		
		$('#cadastro .close').click(function(){
			Page.sidePage = '';
			Page.setCurrentPage( Page.oldPage );
			pageCadastro.animateOut();
		});
		
		$(".meu_cadastro, .my-profile").click(function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				var $this = $(this);
				setTimeout(function(){
					Page.sidePage = 'active';
					main.ajax( $($this).attr('href'), 'meu_cadastro' );
				},800);
			} else {
				Page.setOldPage( Page.currentPage );
				Page.sidePage = 'active';
				main.ajax( $(this).attr('href'), 'meu_cadastro' );
			}
			setTimeout(function(){
				Page.setCurrentPage( 'meucadastro' );
			}, 800);
			return false;
		})
		
		$('#meucadastro .close').live('click', function(){
			Page.sidePage = '';
			Page.setCurrentPage( Page.oldPage );
			pageMeuCadastro.animateOut();
		});
		
		
		/* Contato */
		$('#menu li:last a').click(function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				setTimeout(function(){
					Page.sidePage = 'active';
					pageContact.animateIn();
				},800);
			} else {
				Page.setOldPage( Page.currentPage );
				Page.sidePage = 'active';
				pageContact.animateIn();
			}			
			setTimeout(function(){
				Page.setCurrentPage( 'contato' );
			}, 800);
			return false;
		});
		
		$('#contato .close').click(function(){
			Page.sidePage = '';
			Page.setCurrentPage( Page.oldPage );
			pageContact.animateOut();
		});
		
		/* Lojas */
		$('#menu li').eq(4).click(function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				setTimeout(function(){
					Page.sidePage = 'active';
					pageLojas.animateIn();
				},800);
			} else {
				Page.setOldPage( Page.currentPage );
				Page.sidePage = 'active';
				pageLojas.animateIn();
			}
			setTimeout(function(){
				Page.setCurrentPage( 'lojas' );
			}, 800);
			return false;
		});
		
		$('#lojas .close').live('click', function(){
			Page.sidePage = '';
			Page.setCurrentPage( Page.oldPage );
			pageLojas.animateOut();
		});
		
		/* Lista de Presentes */
		$('#menu li').eq(5).click(function(){
			if( Page.sidePage == 'active' ){
				main.closeSidePages();
				setTimeout(function(){
					Page.sidePage = 'active';
					pagePresentes.animateIn( '#buscar_lista' );
				},800);
			} else {
				Page.setOldPage( Page.currentPage );
				Page.sidePage = 'active';
				pagePresentes.animateIn( '#buscar_lista' );
			}
			setTimeout(function(){				
				Page.setCurrentPage( 'lista' );
			}, 800);
			return false;
		});
		
		$('#buscar_lista .close').click(function(){
			Page.sidePage = '';
			Page.setCurrentPage( Page.oldPage );
			pagePresentes.animateOut( '#buscar_lista', 'busca_lista_close' );			
		});
		
		
			$('.lista_profile_link').live('click', function(){
				pagePresentes.animateOut( '#buscar_lista' );
				$('#ver-lista').empty().fadeIn(200).css({ background : 'url('+ base_url() +'/assets/public/images/ajax-loader.gif) no-repeat center center' });
				var _url = $(this).attr('href');
				setTimeout(function(){
					main.ajax( _url , 'ver-lista' );
				},800);
				return false;
			});
			
			$('#ver-lista .close').live('click', function(){
				if( click_recom2 == true){
					$('#frm_recomendar').hide();
					click_recom2 = false;
				}
				Page.sidePage = '';
				Page.setCurrentPage( Page.oldPage );
				pagePresentes.animateOut( '#ver-lista' );
				return false;
			});
			
			$('.other-list').live('click', function(){
				pagePresentes.animateOut( '#ver-lista' );
				setTimeout(function(){
					pagePresentes.animateIn( '#buscar_lista' );
				},800);
				return false;
			});
			
			$('.my-list').live('click', function(){
				if( $('body').hasClass('logado') ){
					pagePresentes.animateOut( '#buscar_lista' );
					$('#ver-lista').empty().fadeIn(200).css({ background : 'url('+ base_url() +'/assets/public/images/ajax-loader.gif) no-repeat center center' });
					//$('body').css({ background : 'url('+ base_url() +'assets/public/images/ajax-loader.gif) no-repeat center center' });
					setTimeout(function(){
						main.ajax( 'listas/visualizar/', 'ver-lista' );
					},800);
					return false;
				} else {
					login_click();
				}	
			});
		
		
		$('.products .add-to-list').css({ backgroundPosition : '-110px -562px' });
		$('.products .del-to-list').css({ backgroundPosition : '-146px -562px' });
		
		main.b_over = false;
		/* Detalhe Produto */
		$('.products ul li a').live({ 
			mouseover : function(){
				$(this).parent().children('.add-to-list').stop().animate({ backgroundPosition : '-110px -598px' }, 200);
				$(this).parent().children('.del-to-list').stop().animate({ backgroundPosition : '-146px -598px' }, 200);
				$(this).removeClass('_hover').addClass('_hover_');
			}/*,
			mouseleave : function(){
				$(this).parent().children('.add-to-list').stop().animate({ backgroundPosition : '-110px -562px' }, 200);
				$(this).parent().children('.del-to-list').stop().animate({ backgroundPosition : '-146px -562px' }, 200);
				$(this).removeClass('_hover_').addClass('_hover');
			}*/,
			click : function(){
				$(this).parent().children('._load').fadeIn(); 
				Page.sidePage = 'active';
				main.ajax( $(this).attr('href'), 'product' );
				//pageCatalog.showDetailProduct();
				return false;
			}
		});
		
		
		$('.products ul li a._hover_').live('mouseout', function(){
			var $this = $(this);
			setTimeout(function(){
				if(main.b_over === false){ 
					$($this).parent().children('.add-to-list').stop().animate({ backgroundPosition : '-110px -562px' }, 200);
					$($this).parent().children('.del-to-list').stop().animate({ backgroundPosition : '-146px -562px' }, 200);
					$($this).removeClass('_hover_').addClass('_hover');	
				}
			},10);
		});
		
		
		$('#produto .close').live('click', function(){
			if( click_recom == true){
				$('#frm_recomendar_2').hide();
				click_recom = false;
			}
			$('body').css({ height : 'auto' });
			pageCatalog.hideDetailProduct();
		});
		
		
		//main.b_over = false;
		$('.products ul .add-to-list').live('click', function(){
			if( $('body').hasClass('logado') ){
				$(this).parent().find('._load').fadeIn();
				var id_produto = $(this).attr('rel');
				id_produto = id_produto.split('/')
				$(this).removeClass('add-to-list').addClass('del-to-list'); 
				$('.products .del-to-list').css({ backgroundPosition : '-146px -562px' });
				
				var url_add = $(this).attr('rel');
				var url_del = 'listas/remover/'+ id_produto[2]+'';
				
				main.ajax( url_add, 'add-to-list' );
				$(this).attr( 'rel', url_del );
				
			} else {
				login_click();
			}	
		}).live('mouseover', function(){
			main.b_over = true;
			$('.popup-lista').css({ background : 'url('+ base_url() +'assets/public/images/popup_lista_adicionar.png) no-repeat 0 57px' });
			//setTimeout(function(){
				$(this).stop().animate({ backgroundPosition : '-110px -634px' }, 200);
				$('.popup-lista').css({ top : ( $(this).parent().offset().top - 50 ), left : $(this).parent().offset().left + 104, display : 'block' })
				.stop().animate({ backgroundPosition : '0 0' }, 100);
			//},200);
		}).live('mouseout', function(){
			main.b_over = false;
			$(this).stop().animate({ backgroundPosition : '-110px -598px' }, 200);
			$('.popup-lista').animate({ backgroundPosition : '0 57px' }, 100, function(){
				$(this).css({ display : 'none', top : 0, left : 0 });
			});
		});
		
		$('.products ul .del-to-list').live('click', function(){
			if( $('body').hasClass('logado') ){
				$(this).parent().find('._load').fadeIn();
				if( $(this).parent().parent().parent().hasClass('_ver_lista') ){
					$(this).parent().fadeOut();
				}
			
				var id_produto = $(this).attr('rel');
				id_produto = id_produto.split('/');
				$(this).removeClass('del-to-list').addClass('add-to-list'); 
				$('.products .add-to-list').css({ backgroundPosition : '-110px -562px' });
				
				var url_del = $(this).attr('rel');
				var url_add = 'listas/adicionar/'+ id_produto[2] +'';
				
				main.ajax( url_del, 'del-to-list' );
				$(this).attr( 'rel', url_add );
				
				/*
				$(this).attr('rel','listas/adicionar/'+ id_produto[2]+''); 
				main.ajax( $(this).attr('rel'), 'del-to-list' );
				*/
				
			} else {
				login_click();
			}	
		}).live('mouseover', function(){
			main.b_over = true;
			
			$('.popup-lista').css({ background : 'url('+ base_url() +'assets/public/images/popup_lista_remover.png) no-repeat 0 57px' });
			
			//setTimeout(function(){
				$(this).stop().animate({ backgroundPosition : '-146px -634px' }, 200);
				$('.popup-lista').css({ top : ( $(this).parent().offset().top - 50 ), left : $(this).parent().offset().left + 104, display : 'block' })
				.stop().animate({ backgroundPosition : '0 0' }, 100);
			//},200);
		}).live('mouseout', function(){
			main.b_over = false;
			$(this).stop().animate({ backgroundPosition : '-146px -598px' }, 200);
			$('.popup-lista').animate({ backgroundPosition : '0 57px' }, 100, function(){
				$(this).css({ display : 'none', top : 0, left : 0 });
			});
		});
		
		
		
		
		$('.list-colecoes a, .list-categorias a, .list-cores a').click(function(){
			if( main.animaPermission === true ){
			
				var _rel = $(this).attr('rel').split(' ');
				$('.products li').fadeOut(300);
				
				if( $(this).parent().hasClass('title') || $(this).parent().hasClass('cor') || $(this).parent().hasClass('cat') )
					var rel = $(this).attr('rel');
				else
					var rel = _rel[1] + '.' + _rel[0];
				
			
				setTimeout(function(){
					if( $('.products li.' + rel).length > 0 ){
						$('.products .sem-produtos').fadeOut();
						
						//console.log(main.animaPermission);
						main.animaInside( $('.products li.' + rel), 'fadeIn', 100 );
						main.animaPermission = false;
						
						
						$('.pagi').html('');
						$('.products ul').eq(0).css({ marginTop : 0 });
						main.paginationProducts = 1;
						
						var qtdLI = $('.products li.' + rel).length;
						var pages = Math.ceil( qtdLI / 15 );
						$('.pagi').css({ width : 22 * pages, position : 'absolute', left : ( $(window).width() / 2 ), marginLeft :  - ( 22 * pages ) / 2 });
						if( pages > 1 ){
							for( i = 1; i <= pages; i++ ){
								$('.pagi').append('<a href="#" class="ir" rel="'+ i +'">'+ i +'</a>');
							}
						}
						$('.pagi').fadeIn();
						$('.pagi a:first').addClass('active');
						$('.pagi a:last').css({ margin : 0 });
						
					} else { 
						$('.products .sem-produtos').fadeIn();
						$('.pagi').fadeOut().html('');
					}
				},400);
				
				//$('.products li.' + _rel).delay(500).fadeIn(400);			
				$('.title-category').text( $(this).attr('param') );	
				
				if( $(this).parent().parent().parent().hasClass('list-cores') ){
					$('.marcar_cor').animate({ left : ( $(this).offset().left - main.marginHalfSide ) + 1 }, 800, 'easeInOutExpo');
				}
				
				if( $(this).parent().parent().parent().hasClass('list-categorias') ){
					$(this).parent().parent().parent().find('.active').removeClass('active');
					$(this).addClass('active');
				}
			
			}
			
			//pageCatalog.hideProducts( _rel );
			return false;
		});
		
		
		main.paginationProducts = 1;
		$('.pagi a').live('click', function(){
			
			if( !$(this).hasClass('active') ){
										
				$(this).parent().find('.active').removeClass('active');
				$(this).addClass('active');
				
				if( $(this).attr('rel') > main.paginationProducts ){	
					
					var rel = $(this).attr('rel') - main.paginationProducts;
					var pos_ = '-='+ ( 698 * rel ) +'px';

				} else if( $(this).attr('rel') < main.paginationProducts ){
					
					if( $(this).attr('rel') == 1 ){
						var pos_ = 0;
					} else {
						var rel = main.paginationProducts - $(this).attr('rel');
						var pos_ = '+='+ ( 698 * rel ) +'px';
					}
					
				}
				
				main.paginationProducts = $(this).attr('rel');
				
				$('.products ul').eq(0).animate({ marginTop : pos_ }, 1000, 'easeInOutExpo', function(){
					$('html, body').animate({ scrollTop : $('.products').offset().top - 100 },1500, 'easeInOutExpo');					
				});
			
			}
			
			return false;
			
		});
		
		
		$('#produto ul.buttons li a').live({
			click: function() {
				if( $(this).hasClass('share') && click_recom == false ){
					$('#frm_recomendar_2').show();
					click_recom = true;
				} else {
					$('#frm_recomendar_2').hide();
					click_recom = false;
				}
			}/*,
			mouseover: function() {
				$(this).stop().animate({ backgroundPositionY : '-260px' },200);
			},
			mouseout: function() {
				$(this).stop().animate({ backgroundPositionY : '-234px' },200);
			}*/
		});
		
		$('#produto ul.buttons li a.shop').live({
			mouseover : function(){
				$(this).stop().animate({ backgroundPosition : '-159px -260px' },200);
			},
			mouseout : function(){
				$(this).stop().animate({ backgroundPosition : '-159px -234px' },200);
			}
		});
		
		$('#produto ul.buttons li a.share').live({
			mouseover: function() {
				$(this).stop().animate({ backgroundPosition : '-394px -260px' },200);
			},
			mouseout: function() {
				$(this).stop().animate({ backgroundPosition : '-394px -234px' },200);
			}
		});
		
		/*$('#produto ul.buttons li a.list-add').live({
			mouseover : function(){
				$(this).stop().animate({ backgroundPosition : '-253px -260px' },200);
			},
			mouseout : function(){
				$(this).stop().animate({ backgroundPosition : '-253px -234px' },200);
			}
		});
		
		$('#produto ul.buttons li a.list-del').live({
			mouseover : function(){
				$(this).stop().animate({ backgroundPosition : '-253px -314px' },200);
			},
			mouseout : function(){
				$(this).stop().animate({ backgroundPosition : '-253px -288px' },200);
			}
		});*/
						
		$('#produto ul.buttons li a.list_add').live({
			click : function(){
				if( $('body').hasClass('logado') ){
					var id_produto = $(this).attr('href');
					id_produto = id_produto.split('/')
					$(this).removeClass('list_add').addClass('list_remove'); 
					
					var url_add = $(this).attr('href');
					var url_del = 'listas/remover/'+ id_produto[2]+'';
					
					main.ajax( url_add, 'add-to-list' );
					$(this).attr( 'href', url_del );
				} else {
					login_click();
				}	
				return false;
			},
			mouseover: function() {
				$(this).stop().animate({ backgroundPosition : '-253px -314px' },200);
			},
			mouseout: function() {
				$(this).stop().animate({ backgroundPosition : '-253px -288px' },200);
			}
		});
		
		$('#produto ul.buttons li a.list_remove').live({
			click : function(){
				if( $('body').hasClass('logado') ){
					var id_produto = $(this).attr('href');
					id_produto = id_produto.split('/')
					$(this).removeClass('list_remove').addClass('list_add'); 
					
					var url_del = $(this).attr('href');
					var url_add = 'listas/adicionar/'+ id_produto[2]+'';
					
					main.ajax( url_del, 'add-to-list' );
					$(this).attr( 'href', url_add );
				} else {
					login_click();
				}	
				return false;
			},
			mouseover: function() {
				$(this).stop().animate({ backgroundPosition : '-253px -260px' },200);
			},
			mouseout: function() {
				$(this).stop().animate({ backgroundPosition : '-253px -288px' },200);
			}
		});
		
		$('.button-tag').live('click', function(){			
			if( !$(this).hasClass('active') ){
				$(this).css({ backgroundPosition : '-159px -292px' }).addClass('active');
				pageCatalog.showAvatares();
			} else { 
				$(this).css({ backgroundPosition : '-159px -315px' }).removeClass('active');
				pageCatalog.hideAvatares();
			}			
		});
		
		$('#container-ver-lista ul.buttons li a.other-list').live({
			click: function() {
			
			},
			mouseover: function() {
				$(this).stop().animate({ backgroundPosition : '0 -533px' },200);
			},
			mouseout: function() {
				$(this).stop().animate({ backgroundPosition : '0 -506px' },200);
			}
		});
		
		$('#container-ver-lista ul.buttons li a.my-list, #buscar_lista ul.buttons li a.my-list').live({
			mouseover : function(){
				$(this).stop().animate({ backgroundPosition : '-148px -533px' },200);
			}, 
			mouseout : function(){
				$(this).stop().animate({ backgroundPosition : '-148px -506px' },200);
			}
		});
		
		$('#container-ver-lista ul.buttons li a.share-list').live({
			click: function() {
				if( click_recom2 == false ){
					$('#frm_recomendar').show();
					click_recom2 = true;
				} else {
					$('#frm_recomendar').hide();
					click_recom2 = false;
				}
			},
			mouseover: function() {
				$(this).stop().animate({ backgroundPosition : '-394px -314px' },200);
			},
			mouseout: function() {
				$(this).stop().animate({ backgroundPosition : '-394px -288px' },200);
			}
		});
		
		$('#featured_lookbook .link_lookbook').mouseover(function(){
			$(this).stop().animate({ backgroundPositionY : '-589px' },200);
		}).mouseout(function(){
			$(this).stop().animate({ backgroundPositionY : '-569px' },200);
		});
		
		$('#featured_bottom .link_share').mouseover(function(){
			$(this).stop().animate({ backgroundPositionY : '-634px' },200);
		}).mouseout(function(){
			$(this).stop().animate({ backgroundPositionY : '-614px' },200);
		});
		
		
	});
	
	
	
	

/* 4 - Pages
------------------------------------------------*/
	var Page = new Object(); //Namespace to Pages
	Page.pageHeight = 1239;
	Page.currentPage = 'home';
	Page.sidePage = '';
	Page.oldPage = 'home';
	Page.setOldPage = function( _page ){
		Page.oldPage = _page; 
	}
	Page.setCurrentPage = function( page ){	
		var menu = Array();
		menu['sobre'] = 0;
		menu['seja-uma-vik'] = 1;		
		menu['campanha'] = 2;		
		menu['catalogo'] = 3;	
		menu['lojas'] = 4;	
		menu['lista'] = 5;		
		menu['contato'] = 7;
		menu['login'] = 8;		
		if( Page.currentPage != page ){
			
			Page.currentPage = page; 
		
			if( page != 'home' && page != 'login' && page != 'cadastro' && page != 'meucadastro' ){
				if( page == 'catalogo' || page == 'lojas' || page == 'lista' || page == 'contato' || page == 'login' ){
					//$('#top').css({ borderBottom : '1px solid #e8e8e8' });
				} else {
					//$('#top').css({ borderBottom : 'none' });
				}
				$('.set-markup').fadeIn().animate({ width : $('#menu li').eq(menu[page]).width(), left : $('#menu li').eq(menu[page]).offset().left },500, 'easeInOutExpo');
			}
			else 
				$('.set-markup').fadeOut().animate({ width : $('.logo').width(), left : $('.logo').offset().left },500, 'easeInOutExpo');
		}
	}
	
	
	
	
	
	
	/* About
	------------------------------------------------*/
	Page.About = function(){} //Namespace page sobre
	var pageAbout = new Page.About(); //Instance to Page Vik
	
	
	
	
	
	
	/* Seja uma VIK
	------------------------------------------------*/
	Page.Vik = function(){ //Namespace page VIK
		//this.offsetVik = $('#seja-uma-vik .look').offset().top;
	}
	
	Page.Vik.prototype.changePositionFeatured = function(){
		//if(state == 'fixed'){
		if( ( $(window).scrollTop() + $(window).height() >= $('#seja-uma-vik .look').offset().top + $('#seja-uma-vik .look').height() ) || $(window).scrollTop()  + $(window).height() <= ( Page.pageHeight * 3 ) + 80 ){	
			$('#seja-uma-vik .look').removeClass('_absolute').addClass('_fixed');
		} if( $('#seja-uma-vik .look').offset().top <= pageVik.offsetVik ){ //else if(state == 'absolute'){
			$('#seja-uma-vik .look').removeClass('_fixed').addClass('_absolute');
		}
		else if( $('#seja-uma-vik .look').offset().top + $('#seja-uma-vik .look').height() >= ( Page.pageHeight * 3 ) + 80 ){ //if(state == 'absolute_zero'){
			$('#seja-uma-vik .look').removeClass('_fixed').addClass('_absolute_zero');
		}
	}
	
	var pageVik = new Page.Vik(); //Instance to Page Vik
	
	
	
	
	
	/* Campaing
	------------------------------------------------*/
	Page.Campaing = function(){ //Namespace page Campaing
		//this.offsetVik = $('#seja-uma-vik .look').offset().top;
		this.sets = '';
		this.balls = '';
	}
	
	Page.Campaing.prototype.changePositionSets = function(){
		if( $(window).scrollTop() >= Page.pageHeight * 3 && $(window).scrollTop() < ( Page.pageHeight * 3 ) + ( $('#campanha').height() / 2 ) && this.sets == ''){
			$('#campanha .nav-left').animate({ left : '10%' }, 600, 'easeInOutExpo');
			$('#campanha .nav-right').animate({ right : '10%' }, 600, 'easeInOutExpo');
			this.sets = 'active';
		} else if( $(window).scrollTop() < Page.pageHeight * 3 && this.sets == 'active' ){			
			$('#campanha .nav-left').animate({ left : '-10%' }, 600, 'easeInOutExpo');
			$('#campanha .nav-right').animate({ right : '-10%' }, 600, 'easeInOutExpo');
			this.sets = '';
		} else if( $(window).scrollTop() > ( ( Page.pageHeight * 3 ) + $('#campanha').height() ) && this.sets == 'active' ){
			$('#campanha .nav-left').animate({ left : '-10%' }, 600, 'easeInOutExpo');
			$('#campanha .nav-right').animate({ right : '-10%' }, 600, 'easeInOutExpo');
			this.sets = '';
		}		
		
		if( $(window).scrollTop() >= ( ( Page.pageHeight * 3 ) + $('#campanha').height() ) - $(window).height() ){
			$('#campanha .nav-left, #campanha .nav-right').css({ position : 'absolute', top : '47%' });	
		} else if( $(window).scrollTop() < ( ( Page.pageHeight * 3 ) + $('#campanha').height() ) - $(window).height() ){
			$('#campanha .nav-left, #campanha .nav-right').css({ position : 'fixed', top : '45%' });			
		} 		
		
		if( $(window).scrollTop() >= Page.pageHeight * 3 && $(window).scrollTop() < ( ( Page.pageHeight * 3 ) + $('#campanha').height() ) - $(window).height()){
			$('#campanha #ball-nav').css({ position : 'fixed', bottom : '50px' }, 500);
		} else if( $(window).scrollTop() > ( ( Page.pageHeight * 3 ) + $('#campanha').height() ) - $(window).height() ){
			$('#campanha #ball-nav').css({ position : 'absolute', bottom : '135px' });
		} else if( $(window).scrollTop() < Page.pageHeight * 3 ){
			$('#campanha #ball-nav').css({ position : 'absolute', bottom : '320px' });
		}
	}
	
	var pageCampaing = new Page.Campaing(); //Instance to Page Campaing
	
	
	
	
	/* Catalog
	------------------------------------------------*/
	Page.Catalog = function(){ //Namespace page Catalog		
		$('.products ul li').each(function(){
			//$(this).css({ opacity : 0 });
		});	
		
		$('#produto .main-product').children().each(function(){
			$(this).css({ marginLeft : main.widthWindow });
		});
		
		$('.avatar').each(function(){
			$(this).css({ marginLeft : main.widthWindow });
		});
		
		$('#produto .main-product, #produto .main-product .wrap-image').css({ height : ( $(window).height() - 223 ) });
		
		
				
	} 
	
	Page.Catalog.prototype.showProducts = function( rel ){
		var _delay = 0;
		$('.products ul li').each(function(){
			_delay += 100;
			$(this).delay(_delay).animate({ opacity : 1 },300);
		});
		
	}
	
	Page.Catalog.prototype.hideProducts = function( rel ){
		var _delay2 = 0;
		$('.products ul li').each(function(){
			_delay2 += 100;
			$(this).delay(_delay2).animate({ opacity : 0 },300);
		});
	}
	
	Page.Catalog.prototype.showDetailProduct = function(){
		$('#produto').css({ top : 80 }).animate({ marginLeft : 0, top : 80 }, 1000, 'easeInOutExpo', function(){
			$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'none' });
			$('#produto .main-product .wrap-image').jScrollPane({}, 'produto');
		});
		$('#produto .main-product').children().each(function(){
			$(this).delay(300).animate({ marginLeft : 0 }, 1000, 'easeInOutExpo');
		});
	}
	
	Page.Catalog.prototype.hideDetailProduct = function(){
		if( $('.button-tag').hasClass('active') ) $('.button-tag').click();
		$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'block' });
		$('html, body').animate({ scrollTop : $('#catalogo').offset().top - 80 },1);
		$('#produto').animate({ marginLeft : main.widthWindow }, 1000, 'easeInOutExpo', function(){
			$('#produto .main-product').children().each(function(){
				$(this).css({ marginLeft : main.widthWindow });
			});
		});
	}
	
	Page.Catalog.prototype.showAvatares = function(){
		$('.avatar').each(function(){
			var _range = range(500, 1000);
			$(this).css({ top : Math.floor(Math.random()*801), left : Math.floor(Math.random()*1001) }).animate({ marginLeft : 0 }, _range[Math.floor(Math.random()*_range.length)], 'easeInOutExpo');
		});
	}
	
	Page.Catalog.prototype.hideAvatares = function(){
		$('.avatar').each(function(){
			var _range = range(500, 1000);
			$(this).animate({ marginLeft : main.widthWindow }, _range[Math.floor(Math.random()*_range.length)], 'easeInOutExpo');
		});
	}
	
	
	
	/* Lojas
	------------------------------------------------*/
	Page.Lojas = function(){ //Namespace page Contact		
		$('#lojas').css({ marginLeft : main.widthWindow });
		$('#lojas.wrap-limits').css({ height : $(window).height() - 80 });
		$('#lojas .limits').css({ height : $(window).height() - 120 });
	} 
	
	Page.Lojas.prototype.animateIn = function(){
		$('#lojas').css({ top : 80 }).animate({ marginLeft : 0, top : 80 }, 1000, 'easeInOutExpo', function(){
			$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'none' });
		});
	}
	
	Page.Lojas.prototype.animateOut = function(){
		$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'block' });
		/*$('html, body').animate({ scrollTop : $('#' + Page.oldPage).offset().top },1);*/
		$('html, body').animate({ scrollTop : $('#home').offset().top },1);
		$('#lojas').animate({ marginLeft : main.widthWindow }, 1000, 'easeInOutExpo');
	}
	
	var pageLojas = new Page.Lojas(); //Instance to Page Contact
	
	
	
	/* Lista de Presentes
	------------------------------------------------*/
	Page.Presentes = function(){ //Namespace page Contact		
		$('#buscar_lista').css({ marginLeft : main.widthWindow });
		$('#ver-lista').css({ display : 'none' });
		$('#buscar_lista.wrap-limits, #ver-lista.wrap-limits').css({ height : $(window).height() - 80 });
		$('#buscar_lista .limits, #ver-lista.limits').css({ height : $(window).height() - 120 });
	} 
	
	Page.Presentes.prototype.animateIn = function( el ){
		
		if( el == '#buscar_lista' ){
			$( el ).css({ top : 80 }).animate({ marginLeft : 0, top : 80 }, 1000, 'easeInOutExpo', function(){
				$('body').css({ height : $(window).height() });
				$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'none' });
			});
		} else if( '#ver-lista' ){
			$( el ).css({ top : 80 }).fadeIn(500, function(){
				$('#id_search_lista').val('Digite o nome da pessoa');
				$('body').css({ height : $(window).height() });
				$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'none' });
			});
		}
		
		
	}
	
	Page.Presentes.prototype.animateOut = function( el, close ){
		
		if( el == '#buscar_lista' ){
			$('.ui-autocomplete').fadeOut();
			if( close == 'busca_lista_close' ){
				$('body').css({ height : 'auto' });
				$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'block' });
			}
			$( el ).animate({ marginLeft : main.widthWindow }, 1000, 'easeInOutExpo', function(){
				//$('#id_search_lista').val('');
			});
		} 
		
		if( el == '#ver-lista' ){
			$('body').css({ height : 'auto' });
			$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'block' });
			var redirect;
			if(Page.oldPage == ''){
				redirect = Page.currentPage;
			} else {
				redirect = Page.oldPage;
			}
			/*$('html, body').animate({ scrollTop : $('#' + redirect).offset().top },1);*/
			$('html, body').animate({ scrollTop : $('#home').offset().top },1);
						
			$( el ).animate({ marginLeft : main.widthWindow }, 1000, 'easeInOutExpo', function(){
				$('.ui-autocomplete').fadeOut();
				//$('#id_search_lista').val('');
				$(this).css({ display : 'none', marginLeft : 0 });
			});
		}
		
	}
	
	var pagePresentes = new Page.Presentes(); //Instance to Page Contact
	
	
	
	
	/* Login
	------------------------------------------------*/
	Page.Login = function(){ //Namespace page Login		
		$('#login').css({ marginLeft : main.widthWindow, display : 'block' });
		$('#login.wrap-limits').css({ height : $(window).height() - 80 });
		$('#login .limits').css({ height : $(window).height() - 120 });
	} 
	
	Page.Login.prototype.animateIn = function(){
		$('#login').css({ top : 80 }).animate({ marginLeft : 0, top : 80 }, 1000, 'easeInOutExpo', function(){
			$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({ display : 'none' });
		});
	}
	
	Page.Login.prototype.animateOut = function(){
		var redirect;
		if( Page.oldPage == '' ){
			redirect = 'catalogo';
		} else {
			redirect = Page.oldPage;
		}
		$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({ display : 'block' });
		/*$('html, body').animate({ scrollTop : $('#' + redirect).offset().top },1);*/
		$('html, body').animate({ scrollTop : $('#home').offset().top },1);
		$('#login').animate({ marginLeft : main.widthWindow }, 1000, 'easeInOutExpo');
	}
	
	var pageLogin = new Page.Login(); //Instance to Page Login
	
	
	
	/* Cadastro
	------------------------------------------------*/
	Page.Cadastro = function(){ //Namespace page Login		
		$('#cadastro').css({ marginLeft : main.widthWindow, display : 'block' });
		$('#cadastro.wrap-limits').css({ height : $(window).height() - 80 });
		$('#cadastro .limits').css({ height : $(window).height() - 120 });
		$('.select-cadastro > div').jScrollPane({}, 'estado');
		$('div.select-cadastro ul').css({ top : 0, left : '-1px' });
		$('.jScrollPaneContainer').css({ marginLeft : '-1px' });
	} 
	
	Page.Cadastro.prototype.animateIn = function(){
		$('#cadastro').css({ top : 80 }).animate({ marginLeft : 0, top : 80 }, 1000, 'easeInOutExpo', function(){
			$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({ display : 'none' });
		});
	}
	
	Page.Cadastro.prototype.animateOut = function(){
		$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({ display : 'block' });
		/*$('html, body').animate({ scrollTop : $('#' + Page.oldPage).offset().top },1);*/
		$('html, body').animate({ scrollTop : $('#home').offset().top },1);
		$('#cadastro').animate({ marginLeft : main.widthWindow }, 1000, 'easeInOutExpo');
	}
	
	var pageCadastro = new Page.Cadastro(); //Instance to Page Cadastro
	
	/* Editar Cadastro
	------------------------------------------------*/
	Page.MeuCadastro = function(){ //Namespace page Login		
		$('#meucadastro').css({ marginLeft : main.widthWindow, display : 'block' });
		$('#meucadastro.wrap-limits').css({ height : $(window).height() - 80 });
		$('#meucadastro .limits').css({ height : $(window).height() - 120 });
		$('.select-cadastro > div').jScrollPane({}, 'estado');
		$('div.select-cadastro ul').css({ top : 0, left : '-1px' });
		$('.jScrollPaneContainer').css({ marginLeft : '-1px' });
	} 
	
	Page.MeuCadastro.prototype.animateIn = function(){
		$('#meucadastro').css({ top : 80 }).animate({ marginLeft : 0, top : 80 }, 1000, 'easeInOutExpo', function(){
			$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({ display : 'none' });
		});
	}
	
	Page.MeuCadastro.prototype.animateOut = function(){
		$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo').css({ display : 'block' });
		/*$('html, body').animate({ scrollTop : $('#' + Page.oldPage).offset().top },1);*/
		$('html, body').animate({ scrollTop : $('#home').offset().top },1);
		$('#meucadastro').animate({ marginLeft : main.widthWindow }, 1000, 'easeInOutExpo');
	}
	
	//var pageMeuCadastro_ = new Page.MeuCadastro(); //Instance to Page MeuCadastro
	
	
	
	/* Contact
	------------------------------------------------*/
	Page.Contact = function(){ //Namespace page Contact		
		$('#contato').css({ marginLeft : main.widthWindow });
		$('#contato.wrap-limits').css({ height : $(window).height() - 80 });
		$('#contato .limits').css({ height : $(window).height() - 120 });
	} 
	
	Page.Contact.prototype.animateIn = function(){
		$('#contato').css({ top : 80 }).animate({ marginLeft : 0, top : 80 }, 1000, 'easeInOutExpo', function(){
			$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'none' });
		});
	}
	
	Page.Contact.prototype.animateOut = function(){
		$('#home, #sobre, #seja-uma-vik, #campanha, #catalogo, #login').css({ display : 'block' });
		/*$('html, body').animate({ scrollTop : $('#' + Page.oldPage).offset().top },1);*/
		$('html, body').animate({ scrollTop : $('#home').offset().top },1);
		$('#contato').animate({ marginLeft : main.widthWindow }, 1000, 'easeInOutExpo');
	}
	
	var pageContact = new Page.Contact(); //Instance to Page Contact