function changeImg(src) {
	$('#soul_pic').attr('src',src);
}

function cart_del(i) {
	ff = document.forms['soul_cart'];
	ff.elements['qty['+i+']'].value='0';
	ff.submit();
}

function show_cart(s,i) {
	s = '<strong>'+s+'</strong>';
	if (i) {
		s += '<br />'+i+' reference';
		if (i>1) {
			s+= 's';
		}
	}
	el = $('#cart');
	if (el[0]) {
		el.html(s);
	} else {
		$('<a href="'+shopurl+'" id="cart" class="bg5">'+s+'</a>').prependTo('#header');
	}
}

$(document).ready(function() {
	$('#loglnk').click(function() {
	  $('#login').slideToggle('fast', function() {
	    $(this).find('input:text').focus();
	  });
	  return false;
	});
	$('#links').hover(function() {
		// $(this).addClass('show');
		$('#tmnet').slideDown('fast', function() {});
	}, function() {
		//	$(this).removeClass('show');
		$('#tmnet').slideUp('fast', function() {});
	});
	var cb = $('a.cbox');
	if (cb[0]) {
		cb.colorbox({
			'width':'460px',
			'onComplete': function() {
				$('ul.rsize li a').click(function(e){
					console.log('clicked : '+$(this).attr('href'));
					e.preventDefault();
					$('#cboxLoadedContent').load($(this).attr('href'));
				});
			}
		});
	}
	if (!fix_footer()) {
		$('#handle').mouseenter(function() {
			clearTimeout(anim);
			$('#footer').addClass('bg7').animate({'height':'85px'},100);
		});
		$('#footer').hover(function() {
			clearTimeout(anim);
		}, function() {
			e = $(this);
			if (e.is('.bg7')) {
				anim = setTimeout('hide_menu()',600);
			}
		});
	}
});

var anim;
function hide_menu() {
	$('#footer').animate({'height':'30px'},100,function() {$(this).removeClass('bg7');})
}
function fix_footer() {
	if (navigator.userAgent.search(/iPad|iPod|iPhone/i) < 0) {
		return false;
	}
	ef = $('#footer');
	if (!ef.hasClass('ifix')) {
		return false;
	}
	$('#content').css('padding-bottom','80px');
	ef.addClass('bg7').css({
		'height':'85px',
		'overflow':'visible'
	});
	ex = $('.ifix');
	ex.css({
		'position':'relative',
		'margin-top':'-85px'
	});
	$('#links').appendTo('#footer').css({
		'position':'absolute'
	});
	
	return true;
}

