
/*
 * AppleMenu
 * Author: Lucas Forchino
 * WebSite: http://www.jqueryload.com
 *
 */
 function PopUp(url_pop,name,etc) {

var lef = (window.screen.width-150)/2;
var to = (window.screen.height-100)/2;

Yaldex=window.open(url_pop,'YaldexWindow','toolbar=yes,status=yes,menubar=yes,location=yes,resizable=yes,width=150,height=100,left='+lef+',top='+to);
Yaldex.focus();
}

$(document).ready(function(){

    // this is just to center the options,
    // I fix the size according the options number
    $('.shab-inner').find('ul').each(function(){
        var liCount=$(this).find('li').size();
        var ulsize=liCount*220;
        $(this).css('width',ulsize);
    })

    // All animations are here, this include the arrow
    // and the options move.

    $('.shab-menu').find('a').bind('click',function(){
        var position=$('.shab-menu').find('a').index(this);
        var pos=position*1100;
        var iconsMove='left';
        if (pos>position)
            {
                iconsMove='right';
            }

        $('.shab-window').animate({'scrollLeft' : pos},1000,'easeInExpo',function(){
                var effect=80;
                if (iconsMove=='left'){
                    effect=effect*(-1);
                }
                $('.shab-submenu').find('a').animate({'margin-left':effect},100,'easeInOutCirc').animate({'margin-left':0},200,'easeOutBounce');
        });
        var linkPos=$(this).position();
        var left=linkPos.left;
        var siz= $(this).width();
        left=left + (siz/2) -4;
        $('.shab-active').animate({'left' : left});
        //$('.shab-menu').find('a').removeClass('shab-menu-active');
        $(this).addClass('shab-menu-active');
    })

})

