function subMenuSlideDown(nr)
{
	$('.submenuclass').slideUp(500); 
	if (!$('#submainmenu'+nr).is(':visible'))
		$('#submainmenu'+nr).slideDown(500); 
}

function docWrite(msg, pointer) { document.write('<br />'+msg); }

$(document).ready(function() {

	$(".submenuclass li a").click(function(){

		href = $(this).attr('href') ;
		$(this).parent().parent().parent().parent().slideUp(500, function() {
			setTimeout(function() { location.href=href;  } , 50); 
		  });
		
		return false;
	});


//	alert($.browser.msie);
//	alert($.browser.version.slice(0,1));
//	alert(version.slice(0,3) == "1.9" )
	if ($.browser.msie && $.browser.version.slice(0,1)=="7")
	{}
	else
		$("ul.mainmenu li a:hover").css('opacity', '1' );

	$("ul.mainmenu li a").hover(function(){
		$(this).css({ opacity: 1.0 });
	},function(){
		$(this).css({ opacity: 1.0 });
	});

	$('#flagi a').tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false, 
		showBody: " - ", 
		fade: 250 
	});


	$("a.fancylightbox").fancybox({
		'titleShow'     : true,
		'titlePosition'	: 'over',
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade',
		'overlayOpacity': '0.5',
		'overlayColor'  :  '#333'
	});
	$("a.buttonfancylightbox").fancybox({
		'titleShow'     : true,
		'titlePosition'	: 'over',
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade',
		'overlayOpacity': '0.5',
		'overlayColor'  :  '#333'
	});
	$("a.fancylightboxnorollover").fancybox({
		'titleShow'     : true,
		'titlePosition'	: 'over',
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade',
		'overlayOpacity': '0.5',
		'overlayColor'  :  '#333'
	});
	$("a[rel=portfolio]").fancybox({
		'titleShow'     : true,
		'titlePosition'	: 'over',
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'overlayOpacity': '0.5',
		'overlayColor'  :  '#333'
	});
	$(".videolightbox").fancybox({
		'titleShow'     : false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe',
		'overlayOpacity': '0.5',
		'overlayColor'  :  '#333'
	});
	$(".buttonvideolightbox").fancybox({
		'titleShow'     : false,
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe',
		'overlayOpacity': '0.5',
		'overlayColor'  :  '#333'
	});

	$('.transparent').each(function() {
		$(this).hover(
			function() {
				$(this).stop().animate({ opacity: 0.5 }, 400);
			},
		   function() {
			   $(this).stop().animate({ opacity: 1.0 }, 400);
		   })
		});

});


//Start of Overlay Icons
$(document).ready(function(){   
    $("a.fancylightbox").append("<span></span>"); 
    $("a.fancylightbox").hover(function(){ 
        $(this).children("span").stop(true, true).fadeIn(0); 
    },function(){ 
        $(this).children("span").stop(true, true).fadeOut(0); 
    }); 
});
$(document).ready(function(){ 
    $("a.videolightbox").append("<span></span>"); 
    $("a.videolightbox").hover(function(){ 
        $(this).children("span").stop(true, true).fadeIn(0); 
    },function(){ 
        $(this).children("span").stop(true, true).fadeOut(0); 
    }); 
});

function showContactDetails(id, section)
{
	if ($(section+' #smallContact'+id).is(':hidden'))
	{
		$(section+' .smallContactInfo').slideUp();
		$(section+' #smallContact'+id).slideDown();
	}
}



$(document).ready(function() {
 
    //move the image in pixel
    var move = -15;
     
    //zoom percentage, 1.2 =120%
    var zoom = 1.2;
 
    //On mouse over those thumbnail
    $('.zitem').hover(function() {
         
        //Set the width and height according to the zoom percentage
        width = $('.zitem').width() * zoom;
        height = $('.zitem').height() * zoom;
         
        //Move and zoom the image
        $(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
         
        //Display the caption
        $(this).find('div.caption').stop(false,true).fadeIn(200);
    },
    function() {
        //Reset the image
        $(this).find('img').stop(false,true).animate({'width':$('.zitem').width(), 'height':$('.zitem').height(), 'top':'0', 'left':'0'}, {duration:100}); 
 
        //Hide the caption
        $(this).find('div.caption').stop(false,true).fadeOut(200);
    });
 
});

