function doSomething(to) {
    saddr = document.getElementById('saddr').value;
        $.fancybox([
            { 'href'    : 'http://maps.google.nl/?f=d&source=s_d&saddr=' + saddr + '&daddr=' + to }
        ],{
            'width'             : '90%',
            'height'            : '90%',
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'type'              : 'iframe'
        });

        return false;
}

$(function(){
    //NAVIGATION DROPDOWN
    /*
    $('#nav li').hover(
        function () { $('ul', this).fadeIn(500);	},
        function () { $('ul', this).fadeOut(200); }
    );
    */

    //LOGO LINK
    $('#logo').click(function(){
        window.location = 'index.php';
    });

    //ODDEVEN
    $('.oddeven:even').css("background-color", "#EEE");

    //SOCIAL MEDIA HOVER
    if (navigator.appName != "Microsoft Internet Explorer") {
        $('.socialIcon').fadeTo(0, 0.7);
        $('.socialIcon').hover( function() {
            $(this).stop(true, true).fadeTo(300, 1);
        }, function() {
            $(this).stop(true, true).fadeTo(300, 0.7);
        });
    }

    //CUFON
    Cufon.replace('h1')('h2')('h5');

    $('#CargoOffice').click(function(){
        window.open("http://vanduijn.nl6.cargooffice.com");
    });

    //CYCLE ARTIKEL HOME
    $('#header_cycle').cycle({
        fx: 'fade',
        timeout: 4500
    });

    //CYCLE NEWS ARCHIVE
    $('#newsArchive').cycle({
        fx: "scrollVert",
        timeout: 0,
        startingSlide:   0,
        pager:  '.pager',
        pagerAnchorBuilder: function(idx, slide) {
            return '<a href="#"> &bull; </a>';
        },

        before: function(slide,next){
                $("#newsArchive").animate({
                'height' :  $(next).height()
                }, 1000);
        }
    }, 500);

    //CYCLE SEARCH
    $('#pageSlide').cycle({
        fx: "scrollVert",
        timeout: 0,
        startingSlide:   0,
        pager:  '.pager',
        pagerAnchorBuilder: function(idx, slide) {
            return '<a href="#"> &bull; </a>';
        },

        before: function(slide,next){
                $("#pageSlide").animate({
                'height' :  $(next).height()
                }, 1000);
        }
    }, 500);

    //FANCYBOX
        $(".fancybox").fancybox();

    //FANCYBOX FLOORPLANNER
        $("a.fancyboxIframe").fancybox({
            'width'				: '85%',
            'height'			: '85%',
            'autoScale'     	: false,
            'transitionIn'		: 'none',
            'transitionOut'		: 'none',
            'type'				: 'iframe'
        });

    //FANCYBOX PROJECTEN
    $("a.gallery").fancybox({
            titlePosition : 'inside',
            titleFormat   : function(title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-inside"><span class="floatRight" style="font-size: 10px; color: #333333;">' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span><span class="flaotLeft">'+title+'</span></span>';
            }
    });

    //DROPDOWN
    var max = 0;
    $('#nav ul li ul').each(function(){
        var height = $(this).children().length;
        if (height > max) {
            max = height;
        }
    });

    var topHeight = $('#top').height();
    var liHeight = $('#nav ul li ul li').height();
    $('#top').hover( function() {
        $('#top').stop().animate({
            height: topHeight + (liHeight * max) + liHeight
        }, 250);
        $('#shadow').stop().animate({
            top: topHeight + (liHeight * max) + liHeight,
            height: 15 + (8 * max)
        }, 250);
    }, function() {
        $('#top').stop().animate({
            height: topHeight
        }, 500);
        $('#shadow').stop().animate({
            top: topHeight,
            height: 15
        }, 500);
    });

    $('#nav>ul>li').equalHeights();

    $('#loginTab .container #tab').toggle(function(){
        $('#loginTab').animate({
            top: 95
        });
    },function(){
        $('#loginTab').animate({
            top: 42
        });
    });

    $('#searchTab .container #tab').toggle(function(){
        $('#searchTab').animate({
            top: 95
        });
    },function(){
        $('#searchTab').animate({
            top: 42
        });
    });

    $('h1').append('<div class="line"><div class="block">&nbsp;</div></div>');
    $('.borderBottom').append('<div class="line"><div class="block">&nbsp;</div></div>');

    //WATERMARK
    $('.watermark').watermark();

    //LAVALAMP MENU
    //$('#nav ul#lavaLampBasicImage').lavaLamp({
        //fx: "backout",
        //autoResize:true,
        //speed: 700
    //});

});



