﻿

$(document).ready(function() {
    // bind the movie click

    var profiles =
{


    windowCenter:
	{
	    height: 550,
	    width: 810,
	    center: 1
	}


};

    $(".pasta101").popupwindow(profiles);




    $('#opentv').bind('click', function() {

    pageTracker._trackEvent('Documentary', 'Play', 'Sub Page');
        $('#tvmodal').modal({
            opacity: 90,

            containerCss: {
                height: '640px',
                width: '720px',
                backgroundColor: 'Transparent',
                border: '0px solid #fff',
                color: 'Black',
                lineHeight: 'normal',
                padding: '0',
                overflow: 'hidden'

            },

            onOpen: function(dialog) {

                $('#simplemodal-overlay').bind('click', function() {
                    $.modal.close();
                });

                dialog.overlay.fadeIn('slow', function() {
                    $('#thetv').show();
                    dialog.container.slideDown('slow', function() {
                        // do flash

                        var flashvars;
                        var params = {
                            quality: "high",
                            align: "middle",
                            play: "true",
                            loop: "true",
                            scale: "showall",
                            wmode: "transparent"
                        };
                        var attributes = {
                            id: "myDynamicContent",
                            name: "myDynamicContent"
                        };

                        swfobject.embedSWF("res/flash/documentary/carinos_autoStart_large.swf", "tvmodal", "720", "640", "9.0.0", "res/flash/expressInstall.swf", flashvars, params, attributes);




                    });
                });


            },


            onClose: function(dialog) {


                dialog.container.fadeOut(400, function() {
                    dialog.overlay.fadeOut(400, function() {
                        $.modal.close();

                    });

                });


            },
            onShow: function(dialog) {


            }
        });
    });



    // if has form let's load the the javascript and do bindings
    if (jQuery().validate) { //form validation plugin exists
        // this means that we have to make our modal
        ContestWindow();
    }

});