$(document).ready(function() {
	/*this is for dinamical centering of .slide div depending of his  parent ul width*/					   
	$('#menu_container #nav .top .slide').each( function(){ 
									var topPaddingLeft = parseInt($(this).parent().css('padding-left').replace('px',''));
			                        var topHlafWidth = $(this).parent().width()/2;
									var slideLeft = topPaddingLeft + topHlafWidth - 64;
									var slideLeftFormated = slideLeft.toString() + 'px';
									$(this).css('left', slideLeftFormated);});					   
	
   /*this is instead of  last-child for internet explorer 6 an 7, and first-child for 6*/
   if ($.browser.msie != null)
   {
	   if($.browser.version == '6.0')
	   
	   {
		   //$(this).css('zIndex', zIndexNumber);
		   $('#menu_container #nav .top .slide').each(function(){ $(this).css('z-index', '100'); } );
		   $('#menu_container #nav .top .slide ul').each( function(){
						   $(this).children('li').children('a').first().css('line-height', '43px');
						   $(this).children('li').first().height(43);
		        /* url for pics must be updated to point img directory, path needs to look like the ones listed here*/
		                   $(this).children('li').first().css('background-image', 'url(images/slideTopEdgeBack.gif)');//update path to img folder here!!!
		                                                            });
		   $('#slider').css('left','0px');
	   }
	   if($.browser.version == '7.0')
	   {
		   $('#slider').css('left','0px');
	   }
	$('#menu_container #nav .top .slide ul').each( function(){
         $(this).children('li').last().height(39);
		 /* url for pics must be updated to point img directory, path needs to look like the ones listed here*/
		 $(this).children('li').last().css('background-image', 'url(images/slideBottomEdgeBack.png)');//update path to img folder here!!!
		  $(this).children('li').last().css('behavior', 'url(iepngfix.htc)');
		 });   
   
	}


$(function()
    {
        var zIndexNumber = 1000;
        $('div').each(function()
        {
            $(this).css('z-index', zIndexNumber);
            zIndexNumber -= 10;
        });
    });
$('#control').css('z-index', '30000');
$('#slider').css('z-index', '10000');
$('.photo_container').css('z-index', '20000');

/*sets z-index of contact_form to high so date picker component would show above else*/
$('.contact_form').css('z-index', '40000');


	$(function(){
	    $("ul#nav li ").each(function(){
		$(this).hover(function(mouseIn){
			mouseIn.stopPropagation();
			var slideHeight = 0;
			
			
			$(this).children('.slide').children('ul').children('li').each(function(){slideHeight += $(this).height();});
			formatedSlideHeight = slideHeight.toString() + "px";
			$(this).children('.slide').animate({height: formatedSlideHeight}, {queue:false, duration:300});
	      },function() {
			  $(this).children('.slide').animate({height: "0px"}, {queue:false, duration:300});
		  });
	    });
	    
	});

});


