
$(document).ready(function(){
		
		
		$('.page-item-4').hover(
			function(){
				$('.productCategories').show();
			},
			function(){
				$('.productCategories').delay(100).hide();
			}
		);
				
		$('.productCategories').hover(
			function(){
				$('.productCategories').show();
			},
			function(){
				$('.productCategories').delay(100).hide();
			}
		);				
		
		
		$('.productCategories a').hover(
		
			function(){
				$(this).children('img').animate({width:'150px',height:'150px',opacity:1,marginTop:'-20px'},100);
				$(this).children('h3').animate({fontSize:'14px',color:'#333333'},100);
			},
			function(){
				$(this).children('img').animate({width:'120px',height:'120px',opacity:.5,marginTop:'0px'},100);
				$(this).children('h3').animate({fontSize:'11px',color:'#999999'},100);
			}
		
		);
		
		$('.productCategories a').click(function(){
		
			$('.productCategories').hide();
		
		});
		
        // Address handler

        $('a.ajaxlink').address(function() {            
            var url = $(this).attr('href').replace(/^#!/, '')
            return url;
        });

        $.address.init(function(event) {
        	
        }).change(function(event) {

					$('.loader, .loaderimage').show();
					$('html,body').animate({scrollTop: 0}, 500);
        	
        	if(event.value != "") {
//						if(event.value.substring(0,15) == "/products-page/") {
	
		        	$.get('http://eternaleds.com' + event.value, {}, function(data) {
								$('.ajaxContent').html(data);
								$.address.title(document.title);
								$('.loader, .loaderimage').hide();
							});
				
					} else {
		        	$.get('http://eternaleds.com/main/', {}, function(data) {
								$('.ajaxContent').html(data);
								$('.loader, .loaderimage').hide();
							});
					
					
					}
        }).externalChange(function(event) {
        	if(event.value != "") {
        		
			}
     
     }).history(true);



	
})
