		$(document).ready(function() {
			$.localScroll.defaults.axis = 'y';
			$.localScroll({
				queue:true,
				duration:1000,
				target:'#pages'
			});
			$('.flags img').animate({opacity:0.6});
			$('.flags img').hover(function () {
				$(this).stop().animate({opacity:1});
			}, function () {
				$(this).stop().animate({opacity:0.6});
			});
			
			$('.jspPane').css({"top":0});
			
			
			
			$('.fancybox').fancybox();
			
			var myWidth = 0;
			if( typeof( window.innerWidth ) == 'number' ) {
				myWidth = window.innerWidth;
			} else if( document.documentElement && document.documentElement.clientWidth  ) {
				myWidth = document.documentElement.clientWidth;
			} else if( document.body && document.body.clientWidth  ) {
				myWidth = document.body.clientWidth;
			}
			
			var myHeight = 0;
			if( typeof( window.innerHeight ) == 'number' ) {
				myHeight = window.innerHeight;
			} else if( document.documentElement && document.documentElement.clientHeight  ) {
				myHeight = document.documentElement.clientHeight;
			} else if( document.body && document.body.clientHeight  ) {
				myHeight = document.body.clientHeight;
			}
			$('#wrapper').css({"width":"1000px","marginLeft":"10%","marginRight":"10%"});
			$('#top, #pages, #page1, #page2, #page3, #page4, #footer').width($('#wrapper').width());
			$('.pages-wrapper').width($('#wrapper').width()*4+myWidth*0.2);
			$('#page1, #page2, #page3').css({"marginRight":myWidth*0.05});
			$('.page1-span').width($('#page1').width()-600);
			$('.page2-span, .page3-span, .page4-span').width($('#wrapper').width());
			$('.page2-content, .page3-content').css({"width":$('#page1').width()*0.7});
			if(myHeight>700) { $('.page2-content, .page3-content').css({"height":myHeight-230}); $('#footer').css({"position":"absolute","bottom":30}); } else $('.page2-content, .page3-content').css({"height":myHeight-230});
			if(myHeight>700) { $('.scroll-pane').css({"height":myHeight-260}); } else { $('.scroll-pane').css({"height":$('.page2-content').height()}); }
			$('.page2-content img.scale').css({"width":$('.page2-content').width()-20});
			
			
			
			$(window).resize(function() {
					var myWidth = 0;
					if( typeof( window.innerWidth ) == 'number' ) {
						myWidth = window.innerWidth;
					} else if( document.documentElement && document.documentElement.clientWidth  ) {
						myWidth = document.documentElement.clientWidth;
					} else if( document.body && document.body.clientWidth  ) {
						myWidth = document.body.clientWidth;
					}
					var myHeight = 0;
			if( typeof( window.innerHeight ) == 'number' ) {
				myHeight = window.innerHeight;
			} else if( document.documentElement && document.documentElement.clientHeight  ) {
				myHeight = document.documentElement.clientHeight;
			} else if( document.body && document.body.clientHeight  ) {
				myHeight = document.body.clientHeight;
			}
			
			$('#wrapper').css({"width":"1000px","marginLeft":"10%","marginRight":"10%"});
			$('#top, #pages, #page1, #page2, #page3, #page4, #footer').width($('#wrapper').width());
			$('.pages-wrapper').width($('#wrapper').width()*4+myWidth*0.2);
			$('#page1, #page2, #page3').css({"marginRight":myWidth*0.05});
			$('.page1-span').width($('#page1').width()-1600);
			$('.page2-span, .page3-span, .page4-span').width($('#wrapper').width());
			$('.page2-content, .page3-content').css({"width":$('#page1').width()*0.7});
			$('.page2-content, .page3-content').css({"height":myHeight-170,"overflow":"auto"});
			$('.scroll-pane').css({"height":myHeight-260,"width":$('.page2-content').width()});
			
			//$('.jspContainer').css({"width":$('.page2-content').width()});
			
			$('.page2-content img.scale').css({"width":$('.page2-content').width()-20});
					
					if(myHeight<700) { $('#footer').css({"width":$('#pages').width(),"position":"static","bottom":0,"paddingBottom":30}); } else { $('#footer').css({"width":$('#pages').width(),"position":"absolute","bottom":30,"paddingBottom":0}); }
					//if($('.page1-span').height()>300) alert ('a');
					
				});
    });
		
		
		
$(function() {
    $('#page2-slideshow').before('<div class="page2-menu">').cycle({
        fx:     'fade',
        speed:  'fast',
				cleartypeNoBg:true,
        timeout: 0,
				height:	'fit',
        pager:  '.page2-menu',activePagerClass: 'page2-menu-activeSlide',
        pagerAnchorBuilder: function(idx, slide) {
            return '<h3><a href="#">' + slide.title + '</a></h3>';
        }
    });
		
		$('#page3-slideshow').before('<div class="page3-menu">').cycle({
        fx:     'fade',
        speed:  'fast',
				cleartypeNoBg:true,
        timeout: 0,
				height:	'fit',
        pager:  '.page3-menu',activePagerClass: 'page3-menu-activeSlide',
        pagerAnchorBuilder: function(idx, slide) {
            return '<h3><a href="#">' + slide.title + '</a></h3>';
        }
    });
		
});
