// JavaScript Document

/********** getElementById - IE fix ***********/
if (/msie/i.test (navigator.userAgent)) //only override IE
{
	document.nativeGetElementById = document.getElementById;
	document.getElementById = function(id)
	{
		var elem = document.nativeGetElementById(id);
		if(elem)
		{
			//make sure that it is a valid match on id
			if(elem.id == id)
			{
				return elem;
			}
			else
			{
				//otherwise find the correct element
				for(var i=1;i<document.all[id].length;i++)
				{
					if(document.all[id][i].id == id)
					{
						return document.all[id][i];
					}
				}
			}
		}
		return null;
	};
}
/********************************************/

function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
  }
}

// custom easing called "custom"
$.easing.custom = function (x, t, b, c, d) {
	var s = 1.70158; 
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}



function onloadInit(){
 /* if(jQuery('#navigation').length>0 && !isScrolledIntoView('#navigation') && jQuery('#'+document.actDiv).css('display')=='none'){
    dockHandle('#'+document.actDiv);                        
  }*/  
  if(document.hiddenNavi){
    jQuery('.leftNaviButton a#hideNavi').click;
  }
  jQuery('#navigation ul li a').each(function(){
    jQuery(this).click(function(){            
      document.lock = true;
      jQuery.scrollTo(jQuery(this).attr('href'),500,{onAfter:function(){document.lock = false;jQuery('#dockMenu').trigger('dockwake');}});
      return false;
    });
  }); 
  if(jQuery('#navigation').length>0){                
    scrollHandler();
  }
     
  externalLinks();   
  //Shadowbox.init();
}

jQuery.noConflict();

/********** moving background ***************/
/**
 * @author Alexander Farkas
 * v. 1.02
 */
(function(jQuery) {
 jQuery.extend(jQuery.fx.step,{
   backgroundPosition: function(fx) {
     if (fx.state === 0 && typeof fx.end == 'string') {
       var start = jQuery.curCSS(fx.elem,'backgroundPosition');
       start = toArray(start);
       fx.start = [start[0],start[2]];
       var end = toArray(fx.end);
       fx.end = [end[0],end[2]];
       fx.unit = [end[1],end[3]];
     }
     var nowPosX = [];
     nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
     nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
     fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
    
     function toArray(strg){
       strg = strg.replace(/left|top/g,'0px');
       strg = strg.replace(/right|bottom/g,'100%');
       strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
       var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
       return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
     }
   }
 });
})(jQuery);

jQuery(document).ready(function(){
  jQuery('.mainMenu ul li').each(function(){
    if(jQuery(this).next('li').hasClass('active')){
      jQuery(this).css('background','none');
    }
  });
  jQuery('.mainMenu ul li a:not(.mainMenu ul li.active a)')
    .mouseenter(function(){      
      jQuery(this).next('span').stop().animate({
        opacity: '1'
      },500);
    })
    .mouseleave(function(){
      jQuery(this).next('span').stop().animate({
        opacity: '0'
      },500);
      
    });
  jQuery('#slider').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
		slices:20,
		animSpeed:1500, //Slide transition speed
		pauseTime:10000,
		startSlide:'random', //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
      controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:false, //Stop animation while hovering
		manualAdvance:true, //Force manual transitions
		captionOpacity:1, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	if(jQuery('#slider').length>0)
	 jQuery('#slider').data('nivo:vars').stop = true;
  
  jQuery('.footerLinksCenter span')
    .mouseover(function(){
      jQuery(this).children('strong').each(function(){
        jQuery(this).css('color','#757474');
      });
    })
    .mouseout(function(){
      jQuery(this).children('strong').each(function(){
        jQuery(this).css('color','#484848');
      });
    });  
  /*jQuery('#slider')
    .mouseenter(function(){      
      jQuery('.nivo-caption h1').css('background-position','0 -378px');
    })
    .mouseleave(function(){
      jQuery('.nivo-caption h1').css('background-position','0 -318px');
    });*/
  jQuery('h1 a')
    .mouseover(function(){
      jQuery(this).parent().css('background-position','0 -378px');
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','0 -318px');
    });
  jQuery('h2 a')
    .mouseover(function(){
      jQuery(this).parent().css('background-position','0 -610px');
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','0 -555px');
    });
  jQuery('h3 a')
    .mouseover(function(){
      jQuery(this).parent().css('background-position','0 -79px');
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','0 -39px');
    });
  jQuery('h4 a')
    .mouseover(function(){
      jQuery(this).parent().css('background-position','0 -76px');
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','0 -36px');
    });
  jQuery('.thickList li a')
    .mouseover(function(){
      jQuery(this).parent().css('background-position','0 -468px');
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','0 -435px');
    });
  jQuery('.hiddenMenuTop')
    .live('mouseover',function(){
      jQuery(this).css('background-position','0 -20px');      
      jQuery(this).stop().animate({opacity:1},300);
    })
    .live('mouseout',function(){
      jQuery(this).css('background-position','0 0px');
      jQuery(this).stop().animate({opacity:0.5},300);
    });
  jQuery('.hiddenMenuRight')
    .live('mouseover',function(){
      jQuery(this).css('background-position','-20px -160px');
      jQuery(this).stop().animate({opacity:1},300);
    })
    .live('mouseout',function(){
      jQuery(this).css('background-position','0 -160px');
      jQuery(this).stop().animate({opacity:0.5},300);
    });
    
  jQuery('.hiddenMenuBottom')
    .live('mouseover',function(){
      jQuery(this).css('background-position','-160px -20px');
      jQuery(this).stop().animate({opacity:1},300);
    })
    .live('mouseout',function(){
      jQuery(this).css('background-position','-160px 0px');
      jQuery(this).stop().animate({opacity:0.5},300);
    });
  jQuery('.hiddenMenuLeft')
    .live('mouseover',function(){
      jQuery(this).css('background-position','-20px 0px');
      jQuery(this).stop().animate({opacity:1},300);
    })
    .live('mouseout',function(){
      jQuery(this).css('background-position','0 0px');
      jQuery(this).stop().animate({opacity:0.5},300);
    });
  jQuery('.referenceNavigation li a:not(.referenceNavigation li a.active)')
    .mouseover(function(){
      jQuery(this).parent().css('background-position','0 -468px');
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','0 -435px');
    });  
  /*jQuery('.navList li a')
    .mouseover(function(){
      jQuery(this).children().css('background-position','0 -522px');
    })
    .mouseout(function(){
      jQuery(this).children().css('background-position','0 -502px');
    });*/
  jQuery('.buttonWrappLeft')
    .mouseover(function(){
      jQuery(this).parent().css('background-position','right 0');
      jQuery(this).css('background-position','0 -417px');
      /*jQuery(this).children().css('color','#555555');*/
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','right -36px');
      jQuery(this).css('background-position','0 -453px');
      /*jQuery(this).children().css('color','#FFFFFF');*/
    }); 
  jQuery('.imageWide a')
    .mouseover(function(){
      jQuery(this).parent().css('background-position','0 -142px');
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','0 0');
    });       
/*reference handler begin*/
  bindReferenceEventHandler();
/*reference handler end*/

/*jQDock begin*/  
  if(jQuery('#navigation').length>0){            
    document.actDiv = actDiv;    
    document.hiddenNavi = hiddenNavi;        
    var dock = null;     
    document.dock = dock;   
    var lock = false;
    document.lock = lock;    
    jQuery(window).scroll(function(){
      scrollHandler();
    });
    
    jQuery('#dockMenu a').each(function(){
      jQuery(this).click(function(){
        jQuery.scrollTo(jQuery(this).attr('href'),500);
        return false;
      });
    });
    jQuery('#floatedDivLeft').css('margin','0 0 -'+(60*(jQuery('#dockMenu').children().length+4)/2)+'px 0');
    jQuery('#floatedDivTop').css('margin','0 0 0 -'+(60*(jQuery('#dockMenu').children().length+4)/2)+'px');
    jQuery('#floatedDivRight').css('margin','0 0 -'+(60*(jQuery('#dockMenu').children().length+4)/2)+'px 0');
    jQuery('#floatedDivBottom').css('margin','0 0 0 -'+(60*(jQuery('#dockMenu').children().length+4)/2)+'px');
    
    bindDockNavi();
    jQuery('.arrowNavi').trigger('mouseenter');
    jQuery('.arrowNavi').trigger('mouseleave');
    
  	setDragable();
  	
  	setDroppable();  	
  }
/*jQDock end*/

/*detailGallery begin*/
  jQuery("ul.thumb li").hover(function() {
  	jQuery(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
  	jQuery(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
  		.animate({
  			marginTop: '-10px', /* The next 4 lines will vertically align this image */ 
  			marginLeft: '-10px',
  			top: '50%',
  			left: '50%',
  			width: '120px', /* Set new width */
  			height: '90px' /* Set new height */  			  			
  		}, 100); /* this value of "200" is the speed of how fast/slow this hover animates */
  
  	} , function() {
  	jQuery(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
  	jQuery(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
  		.animate({
  			marginTop: '0', /* Set alignment back to default */
  			marginLeft: '0',
  			top: '0',
  			left: '0',
  			width: '101px', /* Set width back to default */
  			height: '76px' /* Set height back to default */  			  			
  		}, 20);
  });
   jQuery("ul.thumb li a").click(function() {  
     var mainImage = jQuery(this).attr("href"); //Find Image Name
     jQuery("#detailMainImg img").attr({ src: mainImage });
     var temp = jQuery(".viewport #canvas").html();
     jQuery(".viewport #canvas").remove();
     jQuery('#detailMainImg').append(temp);
     jQuery(".viewport a img").load(function(){
      if(jQuery('.viewport').find('#canvas').length<=0)     
        jQuery(this).reflect({
          startOpacity: 0.2,     // Value between 0 and 1
                                 //     the starting opacity of the gradient 
                                 //     for the reflection
          reflectionScale: 0.099   // Size of the reflection relative to the 
                                 //     size of the image
        });
     });
      
     return false;
   }); 
  jQuery(".column p a img").hover(function() {
  	jQuery(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
  	jQuery(this).addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
  		.animate({
  			marginTop: '0', /* The next 4 lines will vertically align this image */ 
  			marginLeft: '-5px',
  			top: '50%',
  			left: '50%',
  			width: '309px', /* Set new width */
  			height: '130px' /* Set new height */  			  			
  		}, 400); /* this value of "200" is the speed of how fast/slow this hover animates */
  
  	} , function() {
  	jQuery(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
  	jQuery(this).removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
  		.animate({
  			marginTop: '0', /* Set alignment back to default */
  			marginLeft: '0',
  			top: '0',
  			left: '0',
  			width: '300px', /* Set width back to default */
  			height: '120px' /* Set height back to default */  			  			
  		}, 300);
  });
/*detailGallery end*/

/*detail image animation begin */
  jQuery('.viewport').live
    ('mouseenter',function(e) {        
        jQuery('.viewport canvas').animate({ height: '509', left: '-20', top: '-20', width: '640'}, 300);
        jQuery(this).children('a').children('span.dark-background').fadeIn(300);
    }).live
    ('mouseleave',function(e) {
        jQuery('.viewport canvas').animate({ height: '489', left: '0', top: '0', width: '594'}, 300);
        jQuery(this).children('a').children('span.dark-background').fadeOut(300);
    });
  jQuery(".viewport a img").load(function(){
    jQuery(this).reflect({
      startOpacity: 0.2,     // Value between 0 and 1
                             //     the starting opacity of the gradient 
                             //     for the reflection
      reflectionScale: 0.099   // Size of the reflection relative to the 
                             //     size of the image
    });
   });
/*detail image animation end */

  onloadInit();
});
function scrollHandler(){
  if(!document.hiddenNavi){         
    if(!isScrolledIntoView('#navigation') && jQuery('#'+document.actDiv).css('display')=='none' && !document.lock){
      if(document.dock == null){               
        dockHandle('#'+document.actDiv);          
      }else{                          
        jQuery('#dockMenu').trigger('dockwake');
      }               
    }
    if(jQuery('#'+document.actDiv).css('display')=='block' && isScrolledIntoView('#navigation')){        
      jQuery('#dockMenu').trigger('docksleep');         
    }
  }else{      
    toShowHideId();        
    if(!isScrolledIntoView('#navigation') && jQuery('.'+document.toShowHideId).css('display')=='none'){          
      jQuery('.'+document.toShowHideId).css('display','block');
    }
    if(isScrolledIntoView('#navigation') && jQuery('.'+document.toShowHideId).css('display')=='block'){          
      jQuery('.'+document.toShowHideId).css('display','none');
    }        
  }
}
function setDroppable(){
  jQuery(".floatedDiv").each(function(){
    if(jQuery(this).attr('id')!=document.actDiv){
      jQuery(this).droppable({		
    		drop: function( event, ui ) {
    			jQuery( this )
    				.addClass( "floatedDropped" )				
    				.css({display:'block', opacity:1});
    				
    			jQuery('.arrowNavi, .leftNaviButton, .leftNaviButton a, .hiddenMenu, .leftNaviButton a#hideNavi').unbind();
          jQuery(".floatedDiv").each(function(){
            if(jQuery(this).attr('id')!=document.actDiv){
              jQuery(this).droppable("destroy");
            }
          });
                                				          
          jQuery('#dockMenu').hide(300);
          jQuery('#'+document.actDiv).html('');//remove old dock
          document.dock=null;
          
          jQuery(this).html(document.dockBackup);//add act html
          document.actDiv = jQuery(this).attr('id');
                                                      
          jQuery('#dockMenu a').each(function(){
            jQuery(this).click(function(){
              jQuery.scrollTo(jQuery(this).attr('href'),500);
              return false;
            });
          });
          
          dockHandle('#'+document.actDiv);          
          
          bindDockNavi();
    
        	setDragable();
  	
  	      setDroppable();
  	      
          ajaxCacheCall();		    			

    		},
    		activate: function(event, ui){    		  
          jQuery('#floatedOverlay').css('display','block');
          jQuery('.arrowNavi').unbind('mouseenter');
          jQuery('.arrowNavi').unbind('mouseleave');
        },
        deactivate: function(event, ui){
          jQuery('#floatedOverlay').css('display','none');
          bindDockNavi();          
        },
    		over: function(event, ui) { 
          jQuery( this ).stop().css({opacity:0.6});
        },
        out: function(event, ui) { 
          jQuery( this ).stop().css({opacity:0.3});
        }
    	});
    }
  });
}

function setDragable(){
  jQuery( ".arrowNavi" ).draggable({ revert: "invalid", opacity: 0.7, scroll: false });
}
function bindDockNavi(){
  jQuery('.arrowNavi')
    .mouseenter(function(){                
      jQuery(this).stop().animate({opacity:1},300);
      jQuery("#dockMenu").stop().animate({opacity:0.5},300);
      jQuery(".floatedDiv").each(function(){
        if(jQuery(this).attr('id')!=document.actDiv){
          jQuery(this).css('display','block');
          jQuery(this).stop().animate({opacity:0.3},300);
        }  
      });
                  
    })
    .mouseleave(function(){      
      jQuery(this).animate({opacity:0.3},300);
      jQuery("#dockMenu").animate({opacity:1},300);
      jQuery(".floatedDiv").each(function(){
        if(jQuery(this).attr('id')!=document.actDiv){
          jQuery(this).animate({opacity:0},300,function(){jQuery(this).css('display','none');});
        }
      });
      			                  
    });
  jQuery('.leftNaviButton a')
    .mouseover(function(){
      if(jQuery(this).attr('id') == 'hideNavi'){
        jQuery(this).parent().css('background-position','0 -30px'); 
      }else{
        jQuery(this).parent().css('background-position','0 -60px');
      }      
    })
    .mouseout(function(){
      jQuery(this).parent().css('background-position','0 0');
    });
  jQuery('.leftNaviButton a:not(.leftNaviButton a#hideNavi)')
    .click(function(){      
      jQuery.scrollTo('.rootTable',500);
      return false;       
    });
  jQuery('.leftNaviButton')
    .mouseenter(function(){
      jQuery(this).stop().animate({opacity:1},300);      
    })
    .mouseleave(function(){
      jQuery(this).stop().animate({opacity:0.3},300);
    }); 
  jQuery('.leftNaviButton a#hideNavi')
    .click(function(){                                                
      jQuery('#dockMenu').trigger('docksleep');
      document.hiddenNavi = true;
      jQuery('.'+toShowHideId()).css('display','block'); 
      ajaxCacheCall();                   
      return false;
    });
  jQuery('.hiddenMenu')
    .click(function(){                                          
      jQuery('.'+toShowHideId()).css('display','none');
      if(document.dock == null){               
        dockHandle('#'+document.actDiv);          
      }else{                          
        jQuery('#dockMenu').trigger('dockwake');
      }                               
      document.hiddenNavi = false;
      ajaxCacheCall();                
    });  
    
}
function dockHandle(id){
  
  if(document.dock == null){
    var dockBackup = jQuery(id).html();
    document.dockBackup = dockBackup;//making backup of menu                  
    
    jQuery('.floatedDiv').each(function(){      
      if(jQuery(this).attr('id')=='floatedDivLeft'){                
        //jQuery(this).makeFloat({x:0,y:((jQuery(window).height()-60*(jQuery('#dockMenu').children().length+3))/2), speed:'fast'});//making float dockMenu 
        if(jQuery(this).attr('id')==document.actDiv){                
          document.dock = jQuery('#dockMenu').jqDock({align:'left', size:60, distance:80, labels:false });//creating dockMenu
          jQuery('.arrowNavi, #dockMenu').addClass('cLeft');
          jQuery(this).css({border:'0',backgroundImage:'none',backgroundColor:'transparent',opacity:1,height:60*(jQuery('#dockMenu').children().length+4)+'px',width:'125px'});          
        }else{        
          jQuery(this).css({height:60*(jQuery('#dockMenu').children().length+4)+'px',width:'60px',border:'1px #000000 solid',backgroundColor:'#555555',backgroundImage:'url("/site/img/dragV.png")',opacity:0,display:'none'});          
        }
        return true;
      }
      if(jQuery(this).attr('id')=='floatedDivTop'){                
        //jQuery(this).makeFloat({x:((jQuery(window).width()-60*(jQuery('#dockMenu').children().length+3))/2),y:0, speed:'fast'});//making float dockMenu 
        if(jQuery(this).attr('id')==document.actDiv){
          document.dock = jQuery('#dockMenu').jqDock({align:'top', size:60, distance:80, labels:false });//creating dockMenu
          jQuery('.arrowNavi, #dockMenu').removeClass('cLeft');
          jQuery(this).css({border:'0',backgroundImage:'none',backgroundColor:'transparent',opacity:1,height:'125px',width:60*(jQuery('#dockMenu').children().length+4)+'px'});
        }else
          jQuery(this).css({height:'60px',width:60*(jQuery('#dockMenu').children().length+4)+'px',border:'1px #000000 solid',backgroundColor:'#555555',backgroundImage:'url("/site/img/dragH.png")',opacity:0,display:'none'});
        return true;
      }
      if(jQuery(this).attr('id')=='floatedDivRight'){                
        //jQuery(this).makeFloat({x:jQuery(window).width()-62,y:((jQuery(window).height()-60*(jQuery('#dockMenu').children().length+3))/2), speed:'fast'});//making float dockMenu
        if(jQuery(this).attr('id')==document.actDiv){
          document.dock = jQuery('#dockMenu').jqDock({align:'right', size:60, distance:80, labels:false });//creating dockMenu
          jQuery('.arrowNavi, #dockMenu').addClass('cLeft');
          jQuery(this).css({border:'0',backgroundImage:'none',backgroundColor:'transparent',opacity:1,height:60*(jQuery('#dockMenu').children().length+4)+'px',width:'125px'});
        }else
          jQuery(this).css({height:60*(jQuery('#dockMenu').children().length+4)+'px',width:'60px',border:'1px #000000 solid',backgroundColor:'#555555',backgroundImage:'url("/site/img/dragV.png")',opacity:0,display:'none'});  
        return true;
      }
      if(jQuery(this).attr('id')=='floatedDivBottom'){        
        //jQuery(this).makeFloat({x:((jQuery(window).width()-60*(jQuery('#dockMenu').children().length+3))/2),y:jQuery(window).height()-62, speed:'fast'});//making float dockMenu        
        if(jQuery(this).attr('id')==document.actDiv){
          document.dock = jQuery('#dockMenu').jqDock({align:'bottom', size:60, distance:80, labels:false });//creating dockMenu
          jQuery('.arrowNavi, #dockMenu').removeClass('cLeft');
          jQuery(this).css({border:'0',backgroundImage:'none',backgroundColor:'transparent',opacity:1,height:'125px',width:60*(jQuery('#dockMenu').children().length+4)+'px'});
        }else
          jQuery(this).css({height:'60px',width:60*(jQuery('#dockMenu').children().length+4)+'px',border:'1px #000000 solid',backgroundColor:'#555555',backgroundImage:'url("/site/img/dragH.png")',opacity:0,display:'none'}); 
        return true;
      }
    });    
                                                                              
    jQuery(id).css({border:0,backgroundImage:'none',backgroundColor:'transparent',opacity:1});     
    jQuery(id).show(300);
    jQuery('#dockMenu').bind('docksleep', function(){ jQuery(id).hide(300); });
    jQuery('#dockMenu').bind('dockwake', function(){ jQuery(id).show(300); });
    
  }else{
    jQuery('#dockMenu').trigger('docknudge');
  }  
}
function isScrolledIntoView(elem){
    var docViewTop = jQuery(window).scrollTop();
    var docViewBottom = docViewTop + jQuery(window).height();

    var elemTop = jQuery(elem).offset().top;
    var elemBottom = elemTop + jQuery(elem).height();
      
    return (((elemBottom-30) >= docViewTop) && (elemTop <= docViewBottom));
}

function toShowHideId(){
  var toShowHideId = '';
  document.toShowHideId = toShowHideId;  
  jQuery('.floatedDiv').each(function(){
    if(jQuery(this).attr('id')==document.actDiv){                
      if(jQuery(this).attr('id')=='floatedDivLeft'){
        document.toShowHideId = 'hiddenMenuLeft';
        return true;
      }
      if(jQuery(this).attr('id')=='floatedDivRight'){
        document.toShowHideId = 'hiddenMenuRight';
        return true;
      }
      if(jQuery(this).attr('id')=='floatedDivTop'){
        document.toShowHideId = 'hiddenMenuTop';
        return true;      
      }
      if(jQuery(this).attr('id')=='floatedDivBottom'){ 
        document.toShowHideId = 'hiddenMenuBottom';
        return true;        
      }                  
    }
  });           
  return document.toShowHideId;                             
        
}
function bindReferenceEventHandler(){
  jQuery('#thumbnails .items div img').tooltip({
    effect:'slide',
    offset:[20,0]     
  }).dynamic({ bottom: { direction: 'down', className: 'bottom' } });
  jQuery("#thumbnails").scrollable({ easing: 'custom', speed: 1200, mousewheel:false, size:5 }).find("img").each(function(index) {

		// thumbnail images trigger the overlay
	/*	jQuery(this).overlay({
      effect: 'apple',    	
			target: '#box',
			mask: {
    		color: '#ffffff',
    		loadSpeed: 400,
    		fadeOutSpeed: 800,
    		opacity: 0.6,
    		maskId: 'mask'
    	},
      
    	closeOnClick: true,

			// when box is opened, scroll to correct position (in 0 seconds)
			onLoad: function() {
				jQuery("#images").data("scrollable").seekTo(index, 0);
			}
		});*/
	});
	
	jQuery("#images").scrollable({ easing: 'custom', speed: 1800 });
	
	// enable tooltips for the images
	jQuery("#images img").tooltip({
		position: "bottom center",
		offset: [-137, 0],
		opacity: 0.8,
		effect: 'fade',
		tipClass:'referenceTip',
    relative: true
	});
	
  jQuery('#slider2, #box')
    .mouseenter(function(){      
      jQuery(this).find('.navi').css('display','block');
    })
    .mouseleave(function(){
      jQuery(this).find('.navi').css('display','none');
    });  
  /*jQuery('#box')
    .mouseenter(function(){      
      jQuery('#box .navi').css('display','block');
    })
    .mouseleave(function(){      
      jQuery('#box .navi').css('display','none');            
    });*/
}
function ajaxCacheCall(){
  var type = '?position='+document.actDiv+'&hidden='+(document.hiddenNavi?1:0);          
    jQuery.ajax({
       async: false,
       type: "POST",
       url: '/ajax/dock/'+type,
       success: function(){                            
       }
    });
}
