

function showAtributes(){
	$("#flower_advices").hide();
	$("#flower_images").hide();
	$("#related_products").hide();
	$("#flower_attributes").show();
	$(".active_tab").removeAttr("class");
	$("#show_atrib").attr("class","active_tab");
}

function showAdvices(){
	$("#flower_attributes").hide();
	$("#flower_images").hide();
	$("#related_products").hide();
	$("#flower_advices").show();
	$(".active_tab").removeAttr("class");
	$("#show_advices").attr("class","active_tab");
}

function showImages(){
	$("#flower_attributes").hide();
	$("#flower_advices").hide();
	$("#related_products").hide();
	$("#flower_images").show();
	$(".active_tab").removeAttr("class");
	$("#show_images").attr("class","active_tab");
}

function showRelated(){
	$("#flower_attributes").hide();
	$("#flower_advices").hide();
	$("#flower_images").hide();
	$("#related_products").show();
	$(".active_tab").removeAttr("class");
	$("#show_related").attr("class","active_tab");
}

function swapImages(id)
{
		var href = $("#"+id).attr("href");
		//set big image
		var new_img_src = href.replace("big","medium");
		$("#big_image a img").attr("src",new_img_src);
		var new_big_title = $("#"+id).attr("title");
		$("#big_image a img").attr("alt",new_big_title);
		$("#big_image a").attr("title",new_big_title);
}


$(document).ready(function(){
	$("#show_atrib").click(function(event){
		event.preventDefault();
		showAtributes();
	});
	$("#show_advices").click(function(event){
		event.preventDefault();
		showAdvices();
	});
	$("#show_images").click(function(event){
		event.preventDefault();
		showImages();
	});
	$("#show_related").click(function(event){
		event.preventDefault();
		showRelated();
	});
	
	$(".small_image").mouseenter(function(){
		var id = this.id;
		swapImages(id);
	});
	
	$("#active_image").click(function(){
		var img1 = {'caption': $("#main_small").attr("title"), 'url': $("#main_small").attr("href")};
		var img2 = {'caption': $("#detail_1").attr("title"), 'url': $("#detail_1").attr("href")};
		var img3 = {'caption': $("#detail_2").attr("title"), 'url': $("#detail_2").attr("href")};
		var img4 = {'caption': $("#detail_3").attr("title"), 'url': $("#detail_3").attr("href")};
		
		var image_set = new Array();
		var i = 0;
		if(img1.url)
		{
			image_set[i] = img1;
			i = i+1;
		}
		if(img2.url)
		{
			image_set[i] = img2;
			i = i+1;
		}
		if(img3.url)
		{
			image_set[i] = img3;
			i = i+1;
		}
		if(img4.url)
		{
			image_set[i] = img4;
			i = i+1;
		}
			
		return GB_showImageSet(image_set, 1);
	});
	
	$(".pict_icon_button").click(function(event){
		event.preventDefault();
		$(".detail_pict_help").hide();
		var help_id = $(this).attr("id");
		$("#"+help_id+"_help").show();
	});
	$(".close_help a").click(function(event){
		event.preventDefault();
		$(".detail_pict_help").hide();
	});
	$('head').append('<link rel="stylesheet" href="./pr_detail.css" type="text/css" />');
	if(jQuery.url.attr("anchor") == "flower_advices" )
	{
		showAdvices();
		$("#flower_advices#").css("display","block");
	}
	else
	{
		showAtributes();
	}
	$("#related_products").hide();
	
 });