var currentSelector = 0;

function loadPage(html, selector, image) {

	if(currentSelector !== selector) {
	
		//$('#currentPage').html("<div class = 'copy'><img src = '../img/loader-grey.gif' /></div>");
		$('#sel' + currentSelector).removeClass('currentSelector');
		$('#sel' + selector).addClass('currentSelector').fadeIn(250);
		$('#currentPage').html(html);
		currentSelector = selector;
		
		//alert(image);
		
		//load image
		$('#img' + selector).load(image, function() {
			//$(this).css('display', 'none');
			$(this).text('');
			//$('#img' + selector).fadeIn(250).css('background', 'url(' + image + ') no-repeat');
			$(this).css({
				background: 'url(' + image + ') no-repeat',
				opacity: '0'
			}).animate({ 'opacity': '1' }, 1000, function () {
			});
		});
		
		/*var img = new Image();
		$(img).load(function () {
			$(this).css('display','none');
			$(this).fadeIn();
		}).attr('src', image);*/
	}
}




