var actualPhoto = 0;
var nextPhoto = 1;
function showSubMenuText(prefix, id, size) {
	for (var i = 0; i < size; i++) {
		$j_p("#"+prefix+i).hide();
		//$j_p("#subMenuLink_"+i).css({'color':'#fafafa'});
		$j_p("#subMenuLink_"+i).removeClass('forcePinkMenu').addClass('notPinkMenu');
	}
	$j_p("#subMenuLink_"+id).removeClass('notPinkMenu').addClass('forcePinkMenu');
	//$j_p("#subMenuLink_"+id).css({'color':'#F4B5A5'});
	$j_p("#"+prefix+id).fadeIn();
}

function showGalleryImage(id) {
	nextPhoto = id;
	if (actualPhoto > 0) {
		$j_p("#image_"+actualPhoto).css({"border-color":"transparent"});
		$j_p("#galleryImage_"+actualPhoto).fadeOut(1500, showGalleryNextImage);
		$j_p("#gallerynavleft").fadeOut(200);
		$j_p("#gallerynavright").fadeOut(200);
	} else {
		showGalleryNextImage();
	}
}

function showGalleryNextImage() {
	$j_p("#image_"+nextPhoto).css({"border-color":"#f4b5a5"});
	$j_p("#galleryImage_"+nextPhoto).fadeIn(1000);
	$j_p("#gallerynavleft").fadeIn(2000);
	$j_p("#gallerynavright").fadeIn(2000);
	actualPhoto = nextPhoto;
	var MT = ($j_p("#galleryImage").height()-$j_p("#galleryImage_"+nextPhoto).height())/2;
	var ML = ($j_p("#galleryImage").width()-$j_p("#galleryImage_"+nextPhoto).width())/2;
	if ($j_p("#galleryImage_"+nextPhoto).height() == 0 || $j_p("#galleryImage_"+nextPhoto).width() == 0) {
		MT = 0;
		ML = 90;
	}
	$j_p("#galleryImage_"+nextPhoto).css({'margin-top':MT});
	$j_p("#galleryImage_"+nextPhoto).css({'margin-left':ML});
	/*alert(
		"actualPhoto:"+actualPhoto + "\n" + 
		"nextPhoto:"+nextPhoto + "\n" + 
		$j_p("#galleryImage").height() + "\n" +
		$j_p("#galleryImage").width() + "\n" +
		$j_p("#galleryImage_"+nextPhoto).height() + "\n" +
		$j_p("#galleryImage_"+nextPhoto).width() + "\n" +
		MT + " " + ML
	);/**/
}

function nextGalleryImage() {
	if (actualPhoto == 16) showGalleryImage(1);
	else showGalleryImage(++nextPhoto);
}

function prevGalleryImage() {
	if (actualPhoto == 1) showGalleryImage(16);
	else showGalleryImage(--nextPhoto);
}
