$(document).ready(function() {
	/*Testing code main data inside the current initialization data */
	//width = $(window).width();
	//height = $(window).height();
	//$('#debug').html(width  + ' ' + height + ' ' + mask_width);
	
	$('#navacasa').attr('src','media/images/navacasa_hit.jpg');
	$('#navacasa_en').attr('src','media/images/navacasa_hit_en.jpg');
	$('#navdesprenoiistoric').addClass('section-menu-selected');
	$('a.panel').click(function () {
		$('a.panel').removeClass('selected');
		$(this).addClass('selected');
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);			
		
		var currentSelectedItem = $('img',this).attr('id')
		$('img',this).attr('src','media/images/' + currentSelectedItem + '_hit.jpg')
		$('#nav a').each(function(){
			if($('img',this).attr('id')!=currentSelectedItem){
				$('img',this).attr('src','media/images/'+ $('img',this).attr('id')+ '.jpg');
			}
		})
		return false;
	});
	$('a.panel_en').click(function () {
		$('a.panel_en').removeClass('selected');
		$(this).addClass('selected');
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);			
		
		var currentSelectedItem = $('img',this).attr('id')
		$('img',this).attr('src','media/images/' + currentSelectedItem + '_hit.jpg')
		$('#nav a').each(function(){
			if($('img',this).attr('id')!=currentSelectedItem){
				$('img',this).attr('src','media/images/'+ $('img',this).attr('id')+ '.jpg');
			}
		})
		return false;
	}); 
	 
	$('a.section-menu-selected').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
	
	});
	
	$('a.section-menu-deselected').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
	
	});
	$('a.section-menu-en-selected').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
	
	});
	
	$('a.section-menu-en-deselected').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
	
	});
	
	$('a.section-s-menu-selected').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
	
	});
	
	$('a.section-s-menu-deselected').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
	
	});
	
	$('a.section-s-menu-en-selected').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
	
	});
	
	$('a.section-s-menu-en-deselected').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);	
	
	});
	
	$('a.section-picture-menu').click(function () {
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'), 800);
	});
	
	$(window).resize(function () {
		resizePanel();
	});
	
	
	$('#accordionProducts').msAccordion({vertical:true});
});
function resizePanel() {
	//height = $(window).height();
	//width = $(window).width();
	//mask_width = width * $('.item').length;
	//$('#debug').html(width  + ' ' + height + ' ' + mask_width);
	$('#wrapper').scrollTo($('a.selected').attr('href'), 0);		
}