/* copyrigths 2011 picios */
/* revolweb */
$(document).ready(function(){

	/*
	 * site menu behaviour
	 */

	$('.lewa ul li:first>a').attr('id', 'menu1');	
		
	$size_of_top_li = $('.lewa > ul > li > a').size();
	for ($i=4; $i<=$size_of_top_li; $i++) {
		$('.lewa > ul > li > a').eq($i).attr('id', 'menu4');	
	}

	$('.lewa ul li').hover(
		function () {
			//show its submenu
			$('ul', this).show();
			$('ul ul', this).hide();
		},
		function () {
			//hide its submenu
			$('ul', this).hide();
		}); 




	/*
	 * youtube movie size adjusting to max box size
	 */
	$("div.content_youtube iframe").each(function() {
		// ie_dump contains real width of the section consistance
		$container_width = $(this).parent().siblings(".ie_dump").width();
		$youtube_height = $(this).height();
		$youtube_width = $(this).width();
		$new_height = ($youtube_height / $youtube_width) * $container_width;

		$(this).width($container_width);
		$(this).height($new_height + 22);
	});




	/*
	 * admin panel behaviour
	 */

	$('tr.highlight_static').animate({
		backgroundColor: '#f5f5f5'
	}, 4000);

	$('tr.highlight_static_white').animate({
		backgroundColor: '#fff'
	}, 4000);

	/*$('div.text_validate_error').fadeOut(5000);*/

	$('.block_message').fadeOut(4000);

	$("div.wrapper_slider").click( function() {
		$("#wrapper").slideToggle("slow");
		$(".wrapper_slider").toggle();
	});




	/*
	 * gallery div height adjusting for all the same
	 */

	$max_description_height = 0;
	$(".gallery_image_container").each(function() {
		if ($(this).height() > $max_description_height) {
			$max_description_height = $(this).height();
		//$(".gallery_image_container").
		}
	}).height( $max_description_height  );

	

});

