

$(document).ready(function(){

    var myFile = document.location.toString();
    if (myFile.match('#')) { // the URL contains an anchor
    var myAnchor = '#' + myFile.split('#')[1];
    //$.scrollTo(myAnchor,1700);
    } else {
    $.scrollTo('#home',1700);
    }

    $('#coda-slider-1').codaSlider({
        dynamicArrows: false,
        dynamicTabs: false
    });


    $('#message_box').submit(function() {
        $('.result').html('Sending...');
        $.post("/media/php/email.php", $("#message_box").serialize(), function(data) {
            $('.result').html(data);
        });
        $('#message_box textarea').val('');
        return false;
    });

    $('#email_box').click(function() {
        $('#message_box').slideToggle('slow', function() {
            });
        return false;
    });

       

$('#sign_2').click(function(){

		var flashvars = {};
            var params = {wmode:"transparent"};
            var attributes = {};
        swfobject.embedSWF("/media/swf/retronoid/smash.swf", "game_1", "750", "580", "9.0.0.", "#fff", flashvars, params, attributes);

    $("#game").modal({
            onClose: function (dialog) {
                dialog.data.fadeOut(1000, function () {
                    dialog.container.slideUp(200, function () {
                        dialog.overlay.fadeOut(150, function () {
				
                            $.modal.close(); // must call this!
				$("#game_1").addClass("hide");
                        });
                    });
                });

            },
            overlayClose: true
        }
        );

        return false;
    });

    $('#sign_3').click(function(){
    $("#test").show();
    $("#gallery").modal({
            onClose: function (dialog) {
                dialog.data.fadeOut(1000, function () {
                    dialog.container.slideUp(200, function () {
                        dialog.overlay.fadeOut(150, function () {
                            $.modal.close(); // must call this!
                        });
                    });
                });

            },
            overlayClose: true
        }
        );
        
        $('#gallery').load("/media/php/gallery.html", function() {
        $("#test").hide();
              var Highslide_2 = new ImageFlow();
        Highslide_2.init({
            ImageFlowID: 'gallery',
            reflections: false,
            reflectionP: 0.0,
            startID: 4,
            onClick: function() {

                return hs.expand(this,

                {
                        src: this.getAttribute('longdesc'),
                        outlineType: 'rounded-white',
                        fadeInOut: true
                    } );
            }
        });

        

        });

        

        return false;
    })

    $('.under_construction').click(function (){
        $("#sample").modal({
            onClose: function (dialog) {
                dialog.data.fadeOut(1000, function () {
                    dialog.container.slideUp(200, function () {
                        dialog.overlay.fadeOut(150, function () {
                            $.modal.close(); // must call this!
                        });
                    });
                });
            },
            overlayClose: true
        }

        );
        
        return false;
    });


    $('#twitter').click(function (){
        $("#bird").modal({
            onClose: function (dialog) {
                dialog.data.fadeOut(1000, function () {
                    dialog.container.slideUp(200, function () {
                        dialog.overlay.fadeOut(150, function () {
                            $.modal.close(); // must call this!
                        });
                    });
                });
            },
            overlayClose: true
        }

        );

        return false;
    });


    $(window)._scrollable();
    $('.go').click(function(){
        $.scrollTo($(this).attr('href'),1700);
        return false;
    });

    $(window).bind('resize', function() {
        if($(window).width()<1150) {
            $(".text").css('right',(-1*($(window).width()-1150)/2)+90);
            $(".news").css('right',(-1*($(window).width()-1150)/2)+320);
            $(".news2").css('right',(-1*($(window).width()-1150)/2)+330);

        } else {
            $(".text").css('right',90);
            $(".news").css('right',320);
            $(".news2").css('right',330);

        }
    }).trigger('resize');


});


