/**
*   This script is necessary for ~/database/literature.php and ~/database/structures.php
*   it invokes a hovering effect on Atlas-Related articles and monographies
*   
*/

$(document).ready(function() {
// enable tooltip for "download" element. use the "slide" effect
$(".atlas").tooltip({ delay: 1500, tip: '.tooltip', effect:'slide', offset: [20, -1]}); 
});



/**
*   Checking wether the Flash-Plugin is activated or installed
*
*
**/

$(document).ready(function() {

    if(!FlashDetect.installed){
    //alert("Flash is required to enjoy this site.");
    
    }else{

    //alert("Flash is insalled on your Web browser.");
    $('div#flashbox').hide()

    }
});


 
/**
*   Filtering the Captcha-appearance and filtering the iframe for a correct
*   rendering in Mozilla-Browsers
*   
*/  

$(document).ready(function() {

    var sPath = window.location.pathname;
    //var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    //alert(sPage);

if ( sPage == "feedback.php" ) {

    $("iframe").hide();

} else {

}

});



/**
*   Drag functionality for ~/brain/sections/microslices.php
*   
*
*/

$(document).ready(function() {

	// Set header viewport to follow viewport scroll on x axis
	$('#microslices_gallery').
		scrollsync({targetSelector: '#viewport', axis : 'x'});


	$('#microslices_gallery, #viewport, li ').
	dragscrollable({dragSelector: '.dragger', acceptPropagatedEvent: false});

});



/**
*   Checking the width of the Browserwindow
*   The Navigation box for the Slices-View is presented when the width 
*   allows the placement on the right hand side
*/

$(document).ready(function() {
 
    var pWidth = $(window).width();
 
//    $(window).width();   // returns width of browser viewport

    if (pWidth >= '1700' ) {
        
        $('#slice_nagigation_box').addClass('expanded');
        
        /*
        alert (("The pagewidth is") + pWidth );
        */
    }


});



/*
$(document).ready(function() {

	$("#microslices_gallery, .active").animate({
	   'scrollLeft':  '50%'
	}, 3000);

});


        $(document).ready(function (){
            $('#sc_menu').draggable();
	            var halfScreen = $('#sc_menu').parent().width()/2;
    	        var left = ($('#sc_menu').width()/2)-halfScreen;
            $('#sc_menu').css("left", (-left)+"px");
        });

*/
/*

$(document).ready(function() {
    //Get our elements for faster access and set overlay width
    var div = $('div.sc_menu'),
                 ul = $('ul.sc_menu'),
                 // unordered list's left margin
                 ulPadding = 20;

    //Get menu width
    var divWidth = div.width();

    //Remove scrollbars
    div.css({overflow: 'hidden'});

    //Find last image container
    var lastLi = ul.find('li:last-child');

    //When user move mouse over menu
    div.mousemove(function(e){

      //As images are loaded ul width increases,
      //so we recalculate it each time
      var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

      var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
      div.scrollLeft(left);
    });
});
*/

// $(document).ready(function() {
//     //Get our elements for faster access and set overlay width
//     var div =$('div#microslices_gallery'), ul = $('ul.sc_menu'),
//                  // unordered list's left margin
//                  ulPadding = 200;
// 
//     //Get menu width
//     var divWidth = div.width();
// 
//     //Remove scrollbars
//     div.css({overflow: 'hidden'});
// 
//     //Find last image container
//     var lastLi = ul.find('li:last-child');
// 
//     //When user move mouse over menu
//     div.mousemove(function(e){
// 
//       //As images are loaded ul width increases,
//       //so we recalculate it each time
//       var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
// 
//       var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
//       div.scrollLeft(left);
//     });
// });
//  
 
/*
$(document).ready(function() {
    $('#s1').before('<div id="navx" class="navx" style="width: 648px;">').cycle({ 
        fx:     'fade',
        timeout:  8000,
        speed: 3000,
        pager: '#navx',
        pagerAnchorBuilder: function() {
        // return selector string for existing anchor 
        return "<a href='#'><\/a>";
        }
    });
});
 **/



    

