function loadProductList(category_id) {
	$(".productListDiv").hide();
	$("#productList").show();
	w = $("#productMenu1").parent().width() - $("#productMenu1").width() - 45;

	$("#category_"+category_id).show();

	// Set first height
	if($("#category_"+category_id).height() < $("#categoryList").height()) {
		$("#productMenu1").height($("#categoryList").height());
		// Set second height
		$("#category_"+category_id).height($("#productMenu1").height());
	} else {
		$("#productMenu1").height($("#category_"+category_id).height());
	}

	addMouseOverEvent();
}

function loadProductDetails(product_id) {
	$("#productDetails").show();
	w = $("#productMenu1").parent().width() - $("#productMenu1").width() - $("#productMenu2").width() - 45;
	$("#productDetails").html("<div style='width:"+w+"px;text-align:center'><img src='"+SITE_ROOT+"images/ajax-loader.gif'></div>");
	$.post("index.php?name=cms&func=include&noFrame=1", { 
			dir: 'includes/php/menu/',
			file: 'menuProductsDetailsAjax',
			product_id: product_id
		},
		function(data){
			if(data.substr(0,6)=="ERROR:") alert(data);
			setTimeout(function() {
				$("#productDetails").html(data);

/*				h = $("#productDetails").height();
				if($("#productMenu1").height() < h) {
					$("#productMenu1").height(h);
				}
				if($("#productMenu2").height() < h) {
					$("#productMenu2").height(h);
				}*/
				
				addMouseOverEvent();
				$(".inlineVideo").fancybox({
					'width'				: '50%',
					'height'			: '50%',
					'overlayOpacity'	: 0.7,
					'overlayColor'		: '#303030',
					'type'				: 'iframe'
				});
			}, 100);
		}
	);	
}

function loadAthleteDetails(athlete_id) {
	$("#athleteDetails").html("<div style='width:300px;text-align:center'><br/><br/><img src='"+SITE_ROOT+"images/ajax-loader.gif'></div>");
	$.post("index.php?name=cms&func=include&noFrame=1", { 
			dir: 'includes/php/menu/',
			file: 'menuAthleteDetailsAjax',
			athlete_id: athlete_id
		},
		function(data){
			if(data.substr(0,6)=="ERROR:") alert(data);
			setTimeout(function() {
				$("#athleteDetails").html(data);

				// Set first height
				if($("#athleteList").height() < $("#athleteDetails").height()) {
					$("#athleteList").height($("#athleteDetails").height());
				} else {
					$("#athleteDetails").height($("#athleteList").height());
				}

				addMouseOverEvent();
				$(".inlineVideo").fancybox({
					'width'				: '50%',
					'height'			: '50%',
			//		'autoScale'			: false,
			//		'showCloseButton'	: false,
					'overlayOpacity'	: 0.9,
					'overlayColor'		: '#452733',
					'type'				: 'iframe'
				});
			}, 100);
		}
	);	
}

function loadProgramDetails(program_id) {
	$("#programDetails").html("<div style='width:210px;text-align:center'><br/><br/><img src='"+SITE_ROOT+"images/ajax-loader.gif'></div>");
	$.post("index.php?name=cms&func=include&noFrame=1", { 
			dir: 'includes/php/menu/',
			file: 'menuProgramsDetailsAjax',
			program_id: program_id
		},
		function(data){
			if(data.substr(0,6)=="ERROR:") alert(data);
			setTimeout(function() {
				$("#programDetails").html(data);

				// Set first height
				if($("#programMenu1").height() < $("#programDetails").height()) {
					$("#programMenu1").height($("#programDetails").height());
				} else {
					$("#programMenu1").height($("#programDetails").height());
				}

				addMouseOverEvent();
			}, 100);
		}
	);	
}
