 $(document).ready(function() {
	 $('a.ajc').each(function() {
		 var href = $(this).attr('href');
		 var base = href.split('/')[1];
		 var category = href.split('/')[2];
		 var product = href.split('/')[3];
		 
		 $(this).attr('href',"/"+base+'/#'+category+'/'+product); 
	 });
//	 $('a.ajc').live('click',function() {
//		 var dahref1 = $(this).attr('href').split('#')[0].split('/')[1];
//		 var dahref = $(this).attr('href').split('#')[1];
//		 var dahref2 = dahref.split('/')[0];
//		 var dahref3 = dahref.split('/')[1];
//		 var go = "/"+dahref1+"/"+dahref2+"/"+dahref3+"/"+"?ajc";
//		 
//		 
//		 $.get(go, function(data){
//			 $('div#wholelottastuff').html(data);
//		 });
//	 });
	 $('a.acc').each(function() {
		 var href = $(this).attr('href');
		 var base = href.split('/')[1];
		 var category = href.split('/')[2];
		 
		 $(this).attr('href',"/"+base+'/#'+category+'/'); 
	 });
	 $('a.hoverchange').each(function() {
		 var href = $(this).attr('href');
		 $(this).attr('href',"#"); 
	 });
	 
	 setInterval("checkSize()", 300); 
	 
	 $('a.hoverchange').live('click',function() {
		 return false;
	 });
	 $('a.1_hoverchange').live('click',function() {
		 return false;
	 });
	 $('a.hoverchange').live('mouseover',function() {
		 $('a.1_hoverchange').addClass('hoverchange');
		 
		 $('a.1_hoverchange').removeClass('1_hoverchange');
		 $(this).removeClass('hoverchange');
		 $(this).addClass('1_hoverchange');
		 
		 
		 var img_small = $(this).children('img').attr('src');
		 var img_big = img_small.replace('_small.','_big.')
		 $('div.product_img_big').children('img').fadeOut('200',function(){
			 $('div.product_img_big').html('<img src="'+img_big+'">');
			 $('div.product_img_big').children('img').fadeIn('200');
			 
			 
			 return false;
		 });
		 
	 });
//	 $('a.acc').live('click',function() {
//		 
//		 var dahref1 = $(this).attr('href').split('#')[0].split('/')[1];
//		 var dahref = $(this).attr('href').split('#')[1];
//		 var dahref2 = dahref.split('/')[0];
//		 
//	 });
	 setInterval("checkAnchor()", 300); 
	 
 });
var currentAnchor = null;  
function checkSize () {
	
	var bodywidth = $('body').width();
	 if (bodywidth < 1000) {$('body').addClass('shrinking');}
	 if (bodywidth > 1000) {$('body').removeClass('shrinking');}
};

function checkAnchor () {
	
	if(currentAnchor != document.location.hash){  
	currentAnchor = document.location.hash;  
	//if there is not anchor, the loads the default section  
	if(!currentAnchor)  
	query = "";  
	else  
	{  
	//Creates the  string callback. This converts the url URL/#main&id=2 in URL/?section=main&id=2  
	
	anchor = currentAnchor.replace('#','');
	
	var base = document.location.toString();
	base = base.split('/')[3];
	var category = anchor.split('/')[0];
	var product = anchor.split('/')[1];
			
	var go = "/"+base+"/"+category+"/";
	
	if (product != '') {
		go = go+product+"/";
		
	} else {
		$('div.sub_nav').hide('100');
	};
	go = go+"?ajc";
	
	$('div#wholelottastuff').addClass('fill');
	$('div.content_right').hide();
	$('div.content_right').fadeOut('50', function () {
		
		$.get(go, function(data){
			$('div#wholelottastuff').removeClass('fill');
			$('div#wholelottastuff').html(data);
			$('div.content_right').fadeIn('200');
			if (product == '') {
				$('div.sub_nav').show('200');
			} else {
				$('div.sub_nav').show();
			};
			
		 });
		
		
		
	});
	}
	
	}
};  
	 

