﻿//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 = "282"; //Width Of Video in pixels
var MyHeight = "304"; //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 'M i T'
var MayITalkStillImage = ""; //If using M i T, 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 'M i T Button' left to right
var MayITalkButtonY = "0";  //Where is 'M i T Button' top to bottom
var MyPlayerSkin = ""; //Choose A Player skin
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 G57Width = "320"; //Width of g57 video, usually same as MyWidth.
//var G57Height = "240"; //Height of g57 video, usualy same as MyHeight.
var G57X = "0"; //Usually 0, Where is the g57 from left to right. Default is "0", or all the way to the left.
var G57Y = "0"; //Usually 0, Where is the g57 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 'M i T'.
var UsePlayAgain = "false";  //Enable this feature. If "false", 'M i T' option is set above.
var PlayAgainDays = "0"; //How many days after first visit until video plays again automatically.



//Your Spokesperson
var G57Video = "gs_ads_frz.flv"; //This is the url to your g57 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: G57Video,  //Your G57 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
        //g57Height: G57Height, //Leave Alone
        //g57Width: G57Width, //Leave Alone
        g57X: G57X, //Leave Alone
        g57Y: G57Y, //Leave Alone
        backgroundVideo: MyBackgroundVideo, //Leave Alone
        backgroundVideoX: MyBackgroundVideoX, //Leave Alone
        backgroundVideoY: MyBackgroundVideoY //Leave Alone
    };

//--------- Do Not Edit This Line Of Code -----------------------
swfobject.embedSWF("videodemo.swf", IDToReplace, MyWidth, MyHeight, "8.0", "", flashvars, params);

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