﻿//Use These Options To Customize Your Video
//When you are done go to the very bottom of this script and place the tag in your page where you want the video to appear

//Set Your Options
var MyWidth = "320"; //Width Of Video in pixels
var MyHeight = "240"; //Height of Video in pixels
var IDToReplace = "myVideo"; //ID of the tag to be replaced with video, 'See very bottom of script'.
var UseMayITalk = "false";  //Do You Wish To Have A 'May I Talk'
var MayITalkStillImage = ""; //If using May I Talk, you may have a still image show, use full path to your image "http://yourdomain.com/image.jpg"
var MayITalkImageX = "0";
var MayITalkImageY = "0";
var MayITalkButtonX = "0";  //Where is 'May I Talk Button' left to right
var MayITalkButtonY = "0";  //Where is 'May I Talk Button' top to bottom
var MyPlayerSkin = "http://swfhd.com/dynamic-flv/swf/TMZ-PlayerSkin-Anchor-small.swf"; //Choose A Player skin Default is 'http://swfhd.com/dynamic-flv/swf/TMZ-PlayerSkin-Anchor-wVol.swf', Small Player Option is 'http://swfhd.com/dynamic-flv/swf/TMZ-PlayerSkin-Anchor-small.swf'
var StartingVolume = "60"; //Choose A Starting Volume 0-100
var RewindVideoAtEnd = "true"; //Should Your Video Rewind To The Beginning when over. It will not loop.
var ShowCloseButton = "false"; //Would you like to have a close button
var CloseButtonX = "205"; //Where is the Close Button left to right
var CloseButtonY = "290"; //Where is the Close Button top to bottom
var BufferTime = "2.5"; //This is the percent of the video that must load before starting to play. The larger the number the less likely the video is to skip. Default Value is "2.5"
//var MySpokespersonWidth = "320"; //Width of spokesperson video, usually same as MyWidth.
//var MySpokespersonHeight = "240"; //Height of spokesperson video, usualy same as MyHeight.
var MySpokespersonX = "0"; //Usually 0, Where is the spokesperson from left to right. Default is "0", or all the way to the left.
var MySpokespersonY = "0"; //Usually 0, Where is the spokesperson from top to bottom. Default is "0", or all the way at the top.


//Use A Play Again Cookie?
//The Play Again Cookie will play the video when a visitor first visits your website.
//If the visitor returns to your website within a given time, then it will show the 'May I Talk'.
var UsePlayAgain = "false";  //Enable this feature. If "false", 'May I Talk' option is set above.
var PlayAgainDays = "0"; //How many days after first visit until video plays again automatically.



//Your Spokesperson
var MySpokespersonVideo = "http://c0404562.cdn.cloudfiles.rackspacecloud.com/BreedenIns-Quote.flv"; //This is the url to your spokesperson video given to you from The Media Zoo


//Would you like a background video?
var MyBackgroundVideo = "";  //Choose a background from our list
var MyBackgroundVideoX = "0";  // If not using entire banner size then you may find a section you like, Usually this is 0.
var MyBackgroundVideoY = "0";  // If not using entire banner size then you may find a section you like, Usually this is 0.

//Choose A Background Color or Transparent, if not using a background video.
var params =
    {
        wmode: "transparent",  //or bgcolor: "#000000"
        width: MyWidth, //Leave Alone, this is set above
        height: MyHeight //Leave Alone, this is set above
    };




// ------------- Do Not Edit These Options ----------------
if (UsePlayAgain == "true") {
    //Set Cookie Function
    function setCookie(c_name, value, expiredays) {
        var exdate = new Date();
        exdate.setDate(exdate.getDate() + expiredays);
        document.cookie = c_name + "=" + escape(value) +
            ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
    }

    //Check if Cookie Exists
    function getCookie(c_name) {
        if (document.cookie.length > 0) {
            c_start = document.cookie.indexOf(c_name + "=");
            if (c_start != -1) {
                c_start = c_start + c_name.length + 1;
                c_end = document.cookie.indexOf(";", c_start);
                if (c_end == -1) c_end = document.cookie.length;
                return unescape(document.cookie.substring(c_start, c_end));
            }
        }
        return "";
    }
    function checkCookie() {
        videoName = getCookie(IDToReplace);
        if (videoName != null && videoName != "") {
            UseMayITalk = "true";
        }
        else {
            setCookie(IDToReplace, "1", PlayAgainDays);
            UseMayITalk = "false";
        }
    }
    checkCookie();
}



// --------- Do Not Edit These Options -------------------
// -------------------------------------------------------
//Set Personalized Options from above
var flashvars =
    {
        mySpokesperson: MySpokespersonVideo,  //Your Spokesperson Video
        StartAutomatically: "true", //Start Video Automatically, this should ALWAYS be true
        RewindAtEnd: RewindVideoAtEnd, //Rewind at end of video
        MyPlayer: MyPlayerSkin, //Choose your player
        MyVolume: StartingVolume, //Set Volume 0-100
        width: MyWidth, //Leave Alone
        height: MyHeight, //Leave Alone
        MayITalk: UseMayITalk, //Leave Alone
        MayITalkImage: MayITalkStillImage, //Leave Alone
        MayITalkImageX: MayITalkImageX, //Leave Alone
        MayITalkImageY: MayITalkImageY, //Leave Alone
        MayITalkX: MayITalkButtonX, //Leave Alone
        MayITalkY: MayITalkButtonY, //Leave Alone
        SpokespersonDiv: IDToReplace, //Leave Alone
        CloseButtonVisible: ShowCloseButton, //Leave Alone
        CloseX: CloseButtonX, //Leave Alone
        CloseY: CloseButtonY, //Leave Alone
        VideoBuffer: BufferTime, //Leave Alone
        //spokespersonHeight: MySpokespersonHeight, //Leave Alone
        //spokespersonWidth: MySpokespersonWidth, //Leave Alone
        spokespersonX: MySpokespersonX, //Leave Alone
        spokespersonY: MySpokespersonY, //Leave Alone
        backgroundVideo: MyBackgroundVideo, //Leave Alone
        backgroundVideoX: MyBackgroundVideoX, //Leave Alone
        backgroundVideoY: MyBackgroundVideoY //Leave Alone
    };

//--------- Do Not Edit This Line Of Code -----------------------
swfobject.embedSWF("http://swfhd.com/dynamic-flv/swf/dynamicflv4-1.swf", IDToReplace, MyWidth, MyHeight, "8.0", "", flashvars, params);

//---------- Do Not Edit This Block of Code ----------------------
function closeVideo(IDToReplace) {
    replaceSwfWithEmptyDiv(IDToReplace)
}