// change the content in content frame
$('.small_image_gallery').live('click', 
	function () {	
		if (($(this).text() == 'Produktinfos' || $(this).text() == 'Product infos') && $('#removable_content_'+$(this).attr("alt")+':first').html().search('<object') == -1) {
			$('#blur_field').trigger('focus');	// delete the cursor of the content_navi element for sven
			$('#content').css('display', 'none');
			$('#flashcontent').css('display', 'block');
		} else {	
			$('#flashcontent').css('display', 'none');	
			$('#content').css('display', 'block');
			$('#blur_field').trigger('focus');	// delete the cursor of the content_navi element for sven
			var n = $("#removable_content_0 > *").size(); //check if placeholder for the first page is empty
			if (n<=0) {
				$('#content').children().clone(true).prependTo('#removable_content_0');
			}	
			/*
				$("#content").children().remove();
				$('#removable_content_'+$(this).attr("alt")).children().clone(true).prependTo("#content");	
			*/
			$("#content").children().replaceWith($('#removable_content_'+$(this).attr("alt")).html());	

		}
		/*
		*	manipulate the content_navi
		*/
		$(".small_image_gallery.content_navi").css("color", '#FFFFFF');		// set alle content_navi element to default color

		// show if the mouse is over the content_navi or the "click" was fired by another element
		if ($('#content_navi_'+$(this).attr("alt")).css("background-color") == 'rgb(255, 0, 0)' 
			|| $('#content_navi_'+$(this).attr("alt")).css("background-color") == 'red'
			|| $('#content_navi_'+$(this).attr("alt")).css("background-color") == '#ff0000') {
			$('#content_navi_'+$(this).attr("alt")).css("color", '#FFFFFF');		// set color of the active content_navi element
		} else {
			$('#content_navi_'+$(this).attr("alt")).css("color", 'red');		// set color of the active content_navi element		
		}
		$("div").data("aktive", $(this).attr("id"));	// save the active menupoint for the hover event from ".small_image_gallery.content_navi" class
	}
);

// manipulate smart links in product description
$('.small_image_gallery.smart_links').hover(
	function() {
		$(this).css("color", "red");
		$(this).css("border-bottom", "0.075em solid red");
	},
	function() {
		$(this).css("color", "#000000");
		$(this).css("border-bottom", "0.075em solid black");
	}
);

$(".small_image_gallery.content_navi").hover(
	function() {
		$(this).css("color", "#FFFFFF");
		$(this).css("background-color", "red");
	},
	function() {
		if ($(this).attr("id") == $("div").data("aktive") || $("div").data("aktive") == null && $(this).attr("id") == "content_navi_0") {	// set the font-color of the active menupoint
			$(this).css("color", "red");
		}
		$(this).css("background-color", "#333333");
	}
);


/* for new categories navigation */ 
$(document).ready(function(){		 
	 /*************** fading effects	****************/
	 $fade_slow = 'slow';
	 $fade_normal = 'normal';	 
	 $fade_fast = 'fast';

	// close all categories navigation effects on mouseover out of the navigation fields
	 $(".closer,.navi_row,#main1,#trans_overlay,.content_left,.gsc-results,#MainMenu_u,#MainMenu,.navi_table,#spacer_gif").live("mouseover", function(){
			var n = $("#trans_overlay").queue("fx");
			if (n.length > 3) {
				$(".footer").stop(true, true);
				$("#trans_overlay").stop(true, true);
			}			
			$("#trans_overlay").fadeOut($fade_normal);
			$(".footer").fadeOut($fade_normal);
			
			$(".high_link").removeClass("high_link_active");
			$(".high_link_normal").removeClass("high_link_normal_active");
			
			active_element = "";	// set value back because of "open category windows only when it's not open before" problem for function "$(".high_link_normal").hover" in ..._nav.php files
	 });
	 // make the navigation on categories navigation elements visible
	 $('div.categories').hover(
		function () {
			$(this).fadeTo($fade_fast, 0.60);
			$(this).fadeTo($fade_normal, 1.00);
			$(this).css("border", "1px dashed #C5C5C5");
			//$(this).css("border", "1px dashed red");
		},
		function () {
			$(this).css("border", "1px solid #FFFFFF");
		}
	 );	
	 // make navigation on categories main field visible
	 $('.categories_pic').hover(
		function () {
			$(this).fadeTo($fade_fast, 0.60);
		},
		function () {
			$(this).fadeTo($fade_fast, 1.00);
		}
	 );	
	 // set the categories navigation on right position depend on the rest of content
	 var pos = $("#page_margins").position();
	 $(".footer").css("left", pos.left); 
	 $(".footer").css("width", $("#page_margins").width());
	 var pos = $(".main_menu").position();
	 $(".footer").css("top", pos.top + $(".main_menu").outerHeight()); 
});
