jQuery(function(){

     var item_count = 0;
     var current_item = 0;
     var carusel_index = 0;

    var browser = navigator.appName;
    if (browser != "Microsoft Internet Explorer"){
        star();
    }


 jQuery('#header .items .line a').each(function(index){
     carusel_index = -1 + index;
     jQuery(this).animate({left: carusel_index*160},0).attr('rel','lightbox[2]')
     item_count = index;
 })



 jQuery('.message .box').css('margin-top',(jQuery('.message').height()-jQuery('.message .box').height())/2)

    jQuery('#header #menu .topl').mouseenter(function(){
        if (browser == "Microsoft Internet Explorer"){
            jQuery(this).children('ul').stop(true,true).fadeIn(0);
        } else {
            jQuery(this).children('ul').stop(true,true).fadeIn(200);
        }
        jQuery(this).children('.toplevel').addClass('hover');
    })
    
    jQuery('#header #menu .topl').mouseleave(function(){
        if (browser == "Microsoft Internet Explorer"){
            jQuery(this).children('ul').stop(true,true).fadeOut(0);
        } else {
            jQuery(this).children('ul').stop(true,true).fadeOut(200);
        }
       jQuery(this).children('.toplevel').removeClass('hover');
    })


    jQuery('#header .items .line img').mouseenter(function(){
        jQuery(this).stop(true,true).animate({
            width: '169px',
            height: '128px',
            'margin-top': '0',
            'margin-right': '-8px',
            'margin-bottom': '0',
            'margin-left': '-8px'
        },50);

        var left=jQuery(this).parents('a').position().left;

        if (browser == "Microsoft Internet Explorer"){
            jQuery('#header .carusel .shadow').animate({left: 8+left},0).fadeIn(0);
        } else {
            jQuery('#header .carusel .shadow').stop(true,true).animate({left: 8+left},0).fadeIn(100);
        }
    });

    jQuery('#header .items .line img').mouseleave(function(){


        jQuery(this).stop(true,true).animate({
            width: '139px',
            height: '104px',
            'margin-top': '13px',
            'margin-right': '7px',
            'margin-bottom': '13px',
            'margin-left': '7px'
        },100);
        if (browser == "Microsoft Internet Explorer"){
            jQuery('#header .carusel .shadow').fadeOut(0);
        } else {
            jQuery('#header .carusel .shadow').stop(true,true).fadeOut(100);
        }

    })

    jQuery('#header .calculator').mouseenter(function(){
        jQuery('#header .calculator img').animate({
            width: '146px',
            right: '19px',
            height: '120px',
            top: '262px'
        },150)
    })

    jQuery('#header .calculator').mouseleave(function(){
        jQuery('#header .calculator img').animate({
            width: '130px',
            height: '108px',
            right: '25px',
            top: '270px'
        },0)
    })


    jQuery('#header .next').live('click',function(){

        if (current_item == item_count){
            current_item = 1;
        }
            jQuery('#header .items a:eq(0)').insertAfter(jQuery('#header .items a:last')).stop(true,true).animate({left: (item_count-1)*160},0);

            jQuery('#header .items .line a').stop(true,true).animate({
                left: '-=160'
            })

    })
    jQuery('#header .prev').live('click',function(){


            jQuery('#header .items a:last').insertBefore(jQuery('#header .items a:eq(0)')).stop(true,true).animate({left: -320},0);
  

        jQuery('#header .items .line a').stop(true,true).animate({
            left: '+=160'
        })

    })


    function star(){
        jQuery('.litlestar').delay(100).fadeOut(500).delay(100).fadeIn(700);
        jQuery('.middlestar').delay(200).fadeOut(800).delay(250).fadeIn(600);
        jQuery('.bigstar').delay(100).fadeOut(700).delay(300).fadeIn(1000, star);
    }
    



    jQuery('#footer .development,#footer .design').click(function() {
        window.open(jQuery(this).attr('href'));
        return false;
    });

         jQuery('#menu .topl .toplevel[href=no]').removeAttr('href');


});
