/* Include external files */
 var scriptfiles = [

	 '/js/jquery.easing.js',

	 '/js/jquery.hoveranim.min.js',
	 '/js/jquery.hoverintent.js',
	 '/js/jquery.center.js',
	 '/js/jquery.innerfade.js',
	 '/js/jquery.fitimage.js',
	 '/js/colorbox/jquery.colorbox.js'
 ];
 var includes_loaded = false;

 
$.include(scriptfiles,function(){

/* create a timeOut function in jQuery */
	jQuery.fn.idle = function(time){
		return this.each(function(){
			var i = $(this);
			i.queue(function(){
				setTimeout(function(){
					i.dequeue();
				}, time);
			});
		});
	};

		//execute code after all scripts are completed

		includes_loaded=true;	
		
		$(document).ready(function(){
			//$("#container").center();
			$('body').prepend('<div id="mask" style="position:absolute;height:100%;width:100%;background-color:#fff;z-index:1000;"> </div>');
			var wh = $(window).height();
			var ch = 570 //container height;

			var tm = parseInt((wh - ch) / 2);
			if(tm>0){
				$("#container").css("top",tm + "px");

			}

			$("#mask").fadeOut();
			
			$("area").bind("focus", function(){
				 this.blur();
				return true;
			});
			$("a").bind("focus", function(){
				 this.blur();
				return true;
			});
			
			var hfact = 3, hspeed = 1250;
			$('#btn-home a img').hoverAnim({width: 147+hfact, height: 63+hfact},{easing: 'easeOutElastic', speed: hspeed, sensivity: 3,interval: 500});
			$('#btn-back a img').hoverAnim({width: 118+hfact, height: 73+hfact},{easing: 'easeOutElastic', speed: hspeed, sensivity: 3,interval: 500});

			/* Slideshow hover code to indicate purpose */
			$('.slideshow-hint').prepend('<span class="slideshow-hint-hover" style="z-index:5000; display: block; height:100%; opacity: 1; position: absolute; text-align: center; width:100%; top: 30%;"><img src="/uploads/images/image-gallery.gif" /></span>').each(function () {
			  var $span = $('> span.slideshow-hint-hover', this);//.css('opacity', 0);
			  $(this).hover(function () {
				$span.stop().fadeTo(500, 1).idle(3000).fadeTo(1000,0); 
			  }, function () {
				$span.stop().fadeTo(500, 0);
			  });
			});
			$('span.slideshow-hint-hover').css({cursor:'pointer'}).fadeTo(500,0);
			$('span.slideshow-hint-hover').bind('click',function(){ $('#colorbox-slide-show a:first').click();});

			/*now call page specific document-ready function*/
			if( window.document_ready ){
				window.document_ready();
			} 
			
		});//document ready
 });





