﻿$(document).ready(function($) {

    
    
    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
    fmaRotator();

    $(".playreel,.hlApply").fancybox({
        'titlePosition': 'inside',
        'transitionIn': 'none',
        'transitionOut': 'none'
    });

    loadMovies();





});
    
//Handle the pageLoaded event. The below function will execute on every   
//UpdatePanel' update.   
function pageLoaded(sender, args)   
{
    loadWaterMarks();
    $('.customDD').selectbox(); 
    //Write the code which needs to execute everytime the page is updated    
    //by the updatepanel.
}

function loadWaterMarks() {
    emailCopy = 'Email Address';
    nameCopy = 'Full Name';

    if ($(".contactName").val() != nameCopy) {
        $(".contactName").css({ color: "black" });
    }
    if ($(".email").val() != emailCopy) {
        $(".email").css({ color: "black" });
    }

     $(".contactName").focus(function() {
     if ($(this).val() == nameCopy) {
             $(this).attr('value', '');
             $(this).css({ color: "black" });
         }
     });

     $(".contactName").blur(function() {
        if ($(this).val() == "") {
            $(this).attr('value', nameCopy);
             $(this).css({ color: "#999999" });
         }
     });

     $(".email").focus(function() {
     if ($(this).val() == emailCopy) {
             $(this).attr('value', '');
             $(this).css({ color: "black" });
         }
     });

     $(".email").blur(function() {
         if ($(this).val() == "") {
             $(this).attr('value', emailCopy);
                 $(this).css({ color: "#999999" });
             }
         });

 }

function fmaRotator() {
    $('#fmaRotator').cycle({
        fx: 'fade',
        //speed: 600,
        timeout: 8000,
        pager: '.control',
        pagerEvent: 'mouseover',
        pauseOnPagerHover: true,
        fastOnEvent: 300,
        requeueTimeout: 1000
    });
};


function loadMovies() {
    $(".rareVid").focus(function() {
        embedSWF('rm-2010-reel-v2-med-web.flv', 'player1', '490', '300');

    });
    $(".rareVid").click(function() {
        embedSWF('rm-2010-reel-v2-med-web.flv', 'player1', '490', '300');

    });
    $(".moxVid1").focus(function() {
        embedSWF('JW-Moxies-30.mp4', 'player1', '347', '254');
    });
    $(".moxVid1").click(function() {
        embedSWF('JW-Moxies-30.mp4', 'player1', '347', '254');
    });

    $(".utahFair").focus(function() {
        embedSWF('Utah-State-Fair-Napoleon-Dynamite-BoxOrig_30.flv', 'player1', '347', '254');
    });
    $(".utahFair").click(function() {
        embedSWF('Utah-State-Fair-Napoleon-Dynamite-BoxOrig_30.flv', 'player1', '347', '254');
    });

    $(".utahFair2").focus(function() {
        embedSWF('Utah State Fair food - handshake.flv', 'player1', '347', '254');
    });
    $(".utahFair2").click(function() {
        embedSWF('Utah State Fair food - handshake.flv', 'player1', '347', '254');
    });

    $(".utahFair3").focus(function() {
        embedSWF('Utah State Fair food - healthy.flv', 'player1', '347', '254');
    });
    $(".utahFair3").click(function() {
        embedSWF('Utah State Fair food - healthy.flv', 'player1', '347', '254');
    });
}

/*---SWF OBJECT---*/
function embedSWF(file, player, width, height) {
    var flashvars = {
        'file': file,
        'autostart': 'true'
    };
    var attributes = {
        'id': player,
        'name': player
    };

    var params = {
        'allowfullscreen': 'true',
        'allowscriptaccess': 'always',
        'bgcolor': '#000000'

    };

    swfobject.embedSWF('Flash/player.swf', player, width, height, '9', 'false', flashvars, params, attributes);

}










