$(document).ready(function() {
	
	buildNavMenu();	
	$('.nav_hover').hover( 
		function()
		{			
			$(this).attr( 'src',  $(this).attr('src').replace('-off', '-on') );
		},
		function()
		{							
		 $(this).attr( 'src',  $(this).attr('src').replace('-on', '-off') );
		});
		
	jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
		jQuery("<img>").attr("src", arguments[i]);
	  }
	}	

	$.preloadImages(
		"/images/buttons/de/contact-on.gif",
		"/images/buttons/de/news-on.gif",
		"/images/buttons/de/work-on.gif",
		"/images/buttons/de/profile-on.gif",
		"/images/buttons/pl/contact-on.gif",
		"/images/buttons/pl/news-on.gif",
		"/images/buttons/pl/work-on.gif",
		"/images/buttons/pl/profile-on.gif"	,	
		"/images/buttons/ru/contact-on.gif",
		"/images/buttons/ru/news-on.gif",
		"/images/buttons/ru/work-on.gif",
		"/images/buttons/ru/profile-on.gif"	,
		"/images/buttons/en/contact-on.gif",
		"/images/buttons/en/news-on.gif",
		"/images/buttons/en/work-on.gif",
		"/images/buttons/en/profile-on.gif"			
);		
		
	$("a.thumb").thumbs(); // the wrapping function
	$("a.thumb img").thumbsImg();

    $("a.thumb img").fadeTo( 0, 0.3 );  
    $("a.thumb img").hover(function(){
        $(this).fadeTo("slow", 1.0);  
        },function(){  
        $(this).fadeTo("slow", 0.3);
    });
	
	
});

function buildNavMenu()
{
	
	// adjust menuwidh and height 
	// for the major browser
	
	if(jQuery.browser.safari) {
		adjustTopValue = -4;
		menuWidth = 124;		
		
		$(".gfxwindow").css("margin-left","0px");
	} else if (jQuery.browser.msie && jQuery.browser.version.substr(0,1) < 8 ) {
		adjustTopValue = 0;
		menuWidth = 117;		
	} else if (jQuery.browser.msie ) {
		adjustTopValue = -4;
		menuWidth = 119;		
	} else {
		adjustTopValue = -6;
		menuWidth = 119;		
	}
	

	
	$(".navMenu").buildMenu(
		{	
			menuWidth: menuWidth,
			additionalData:"",
			openOnRight:false,
			menuSelector: ".menuContainer",
			//iconPath:"ico/"",
			hasImages:false,
			fadeInTime:200,
			fadeOutTime:100,
			adjustLeft:0,
			adjustTop:0,
			menuTop: adjustTopValue,
			opacity:.5,
			shadow:true,
			closeOnMouseOut:false,
			closeAfter:500,
			minZindex:200,
			hoverIntent:0		
			});
			
}


