/*
    VIDEO OPTIONS
*/

// URL to vsm dir
var url_to_vsm_dir = 'http://www.socialmediasummit09.com/';

// Video name
// NOTE: If you want to point exact URL to your video edit vsm_url_flv
//       variable at the bottom of this section
var video_name = 'main_page_2009.flv';

// Auto close VSM after N seconds. If this parameter is 0 your
// model will not be auto cloced.
var vsm_autoclose_after = 0;

// 1 - Always on screen
// 2 - Static position
// 3 - Renders model where js code was called
var vsm_renderType = 2;

// Model positioning:
// 1 - left upper corner,
// 2 - right upper corner,
// 3 - left lower corner,
// 4 - right lower corner,
// 5 - screen center,
// 6 - center left,
// 7 - center right,
// 8 - bottom middle,
// 9 - top middle
var vsm_position = 9;

// Variables to additional control of model position.
// Model will be shifted by values of these variables.
var vsm_container_Shift_Left = 15;
var vsm_container_Shift_Top  = 0;

// Use the next 2 variables in static rendering only
// to set position reletive to left and top border of browser.
var vsm_leftPosition = 0;
var vsm_topPosition  = 4;

// Enables or disables VSM logo. Can be 1 or 0.
var vsm_showlogo = 0;

// If 1 the model will start talking as automaticly.
// Otherwise VSM logo with PLAY will be shown.
var vsm_autoplay = 1;

// Show player controls option. 1 or 0.
var vsm_show_gui = 1;

// If 1 the model will be shown only once during browser session.
var vsm_showOnce = 1;

// Enables or disables auto refreshing when model finishes her speach.
var vsm_refresh = 0;

// 1 click stop.
var vsm_click_stop = 1;

// Link to follow.
var vsm_refresh_url = '';

// Default width and height of VSM player. Helps to change VSM logo size.
var vsm_playerWidth  = 100;
var vsm_playerHeight = 294;

// URL to follow when user clicks on model.
var vsm_url_click = '';

// URL to model's video. Removed ""
var vsm_url_flv = url_to_vsm_dir + video_name;

// URL to models right-click menu.
var vsm_menu_items = url_to_vsm_dir + 'menu_items.txt';

// URL to player controls.
var vsm_gui = url_to_vsm_dir + 'vsm-gui.swf';

// URL to player.
var vsm_player = url_to_vsm_dir + 'vsm-player.swf';

// Streamming server URL.
var vsm_nc_server = '';





// ------------------------------------------------
//           DON'T EDIT BELOW
// ------------------------------------------------

var vsm_containerID = 'vsm_player';
var vsm_containerContents = '';
var vsm_containerStyle = '';

/* First find the type of the browser */

var vsm_userAgent = navigator.userAgent;
var b_name = navigator.appName;
var is_moz = (b_name.indexOf('Microsoft')!=-1);

var kitName = "applewebkit/";
var tempStr = navigator.userAgent.toLowerCase();
var pos = tempStr.indexOf(kitName);
var isAppleWebkit = (pos != -1);

if (is_moz)
{
vsm_userAgent = 'ie';
}
else if (isAppleWebkit)
{
vsm_userAgent = 'safari';
}
else if (document.getElementById)
{
vsm_userAgent = 'ns';
} else {
vsm_userAgent = 'other';
}

// set-up for browser
function init()
{
    switch (vsm_userAgent)
    {
        case "ie":
            expl("<script id=__ie_onload defer src=javascript:void(0)><\/script>","__ie_onload");
            break;

        case "ns":
            if (document.addEventListener)
            {
               document.addEventListener("DOMContentLoaded", showVSM, false);
            }
            break;

        // OK lets go
        default:
            window.onload = showVSM();
            break;
          	// end main   --------------------------------
    }

}

function expl(src, arg)
   {
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

          document.write(src);
          var obj = document.getElementById(arg);
          obj.onreadystatechange = function() {
          if (obj.readyState == "complete")
          {
           showVSM();
            }
           }
    	// end function expl(src, arg) --------------------------------
}


function showVSM()
{
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

       if (vsm_showOnce == 1) {
          if (vsm_getCookie(escape(vsm_url_flv))) {
              return false;
          }
          vsm_setCoockie(escape(vsm_url_flv), '1');
      }

       if (!document.getElementById(vsm_containerID))
      {
        var vsm_container = document.createElement("div");
        vsm_container.id = vsm_containerID;
        vsm_container.innerHTML = vsm_containerContents;
        document.getElementsByTagName('body')[0].appendChild(vsm_container);
       }
         contparams();

        if (vsm_renderType == 1){
         setInterval('vsm_On_Screen_Handler()', 20);
         vsm_On_Screen_Handler();
        }
        else if(vsm_renderType == 3)
        {

         vsm_container = document.getElementById(vsm_containerID);
          if (!vsm_container) return false;
           if (vsm_container)
          {
          vsm_container.innerHTML = getHtml();
          window.obj_vsm_player = document.getElementById("obj_" + vsm_containerID);
          }
    }
      	// end function showVSM  --------------------------------
}

   function contparams()
     {
     // Video Spokes Model Jscript
     // Lenape Associates, Inc. Dec 2007
     // Boris Spivak & Jim Spaulding

    var vsm_container = document.getElementById(vsm_containerID);
    if (!vsm_container) return false;
     if (vsm_renderType == 1 || vsm_renderType == 2)
       {
	  with (vsm_container.style){
        height = getContainerHeight();
        position = getContainerPosition();
        width = getContainerWidth();
        zIndex = getContainer_zIndex();
        left = getContainer_Style_Left();
        top = getContainer_Style_Top();
        }
        vsm_container.innerHTML = getHtml();
      }
      if (vsm_renderType == 1)
      {
        window.onresize = vsm_On_Screen_Handler;
        window.onscroll = vsm_On_Screen_Handler;
      }
    }
  	// end function contparams --------------------------------

   function getContainerHeight()
   {
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding
	// for both render type 1 & 2
	if (vsm_renderType == 1 || vsm_renderType == 2)
    {
    v_Height = vsm_playerHeight;
    }
    return v_Height;
}   // end function getContainerHeight-----------------------------

    function getContainerPosition()
   {
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding
	// for both render type 1 & 2
	if (vsm_renderType == 1 || vsm_renderType == 2)
    {
    v_Pos = "absolute";
    }
    return v_Pos;
}   // end function getContainerPosition-----------------------------

function getContainerWidth()
   {
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding
	// for both render type 1 & 2
	if (vsm_renderType == 1 || vsm_renderType == 2)
    {
    v_Width = vsm_playerWidth;
    }
    return v_Width;
}   // end function getContainerWidth-----------------------------

function getContainer_zIndex()
   {
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding
	// for both render type 1 & 2
	if (vsm_renderType == 1 || vsm_renderType == 2)
    {
    v_zIndex = vsm_playerWidth;
    }
    return v_zIndex;
}   // end function getContainer_zIndex-----------------------------

function getContainer_Style_Left()
   {
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding
	// for both render type 1 & 2
	if (vsm_renderType == 1)
    {
      v_left = 0;
    }
    else if (vsm_renderType == 2)
    {
      v_left = vsm_leftPosition;
    }
    return v_left;
  }   // end function getContainer__Style_Left-----------------------------

  function getContainer_Style_Top()
   {
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding
	// for both render type 1 & 2
	if (vsm_renderType == 1)
    {
      v_top = 0;
    }
    else if (vsm_renderType == 2)
    {
      v_top = vsm_topPosition;
    }
    return v_top;
  }   // end function getContainer__Style_Top-----------------------------


   function getHtml()
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding
 {
  var objdef = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="obj_' + vsm_containerID + '" name="obj_' + vsm_containerID + '" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + vsm_playerWidth + '" height="' + vsm_playerHeight + '" align="middle">';

  params = '?min_buff=3' +
  (vsm_nc_server != '' ? '&nc_server=' + escape(vsm_nc_server) : '') +
  '&divid=' + vsm_containerID +
  '&url_flv=' + escape(vsm_url_flv) +
  '&url_click=' + escape(vsm_url_click) +
  '&url_menu_items=' + escape(vsm_menu_items) +
  '&autoplay=' + vsm_autoplay +
  '&trb=' + vsm_showlogo +
  (vsm_show_gui ? '&url_gui=' + escape(vsm_gui) : '');

    var playdef = '<embed src="' + vsm_player + params + '" width="' + vsm_playerWidth + '" height="' + vsm_playerHeight + '" loop="false" align="middle" allowScriptAccess="always" wmode="transparent" id="obj_' + vsm_containerID + '_embed" name="obj_' + vsm_containerID + '" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer">';

var html = objdef;
    html += '<param name="movie" value="' + vsm_player + params + '">';
    html += '<param name="wmode" value="transparent">';
    html += '<param name="LOOP" value="false">';
    html += '<param name="allowScriptAccess" value="always">';
    html += playdef;
    html += '</object>';
    return html;
// end function getHtml -----------------------------
}


function resizeFlash(x, y, divid)
{
      // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

    if(vsm_userAgent == 'ns')
       {
        objVSM = document.getElementById("obj_" + divid + "_embed");
       }
    else
       {
        objVSM = document.getElementById("obj_" + divid);
       }
    objVSM.width = x;
    objVSM.height = y;
    vsm_playerWidth = x;
    vsm_playerHeight = y;
    vsm_container = document.getElementById(divid);
    vsm_container.style.height = vsm_playerHeight;
    vsm_container.style.width = vsm_playerWidth;
	// end function resizeFlash(x, y, divid) --------------------------------
}

function hideVSM(divid)
{
 	// Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

   if(document.getElementById && document.getElementById(divid))
        {
        document.getElementById(divid).innerHTML = '';
        }

    if(document.all && document.all[divid])
       {
        return document.all[divid].innerHTML = '';
       }
	// end function hideVSM(divid) --------------------------------
}

function timeToClose(divid)
{
 // Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

    if (vsm_refresh == 1 && vsm_refresh_url != '') {
        location.href = vsm_refresh_url;
    } else if (vsm_autoclose_after>0) {
        timer = setTimeout ("hideVSM(\"" + divid + "\");", vsm_autoclose_after*1000);
    }

	// end function timeToClose(divid) --------------------------------
}

 function vsm_On_Screen_Handler()
{
	// Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

    var left = 0;
    var top = 0;
    var windowWidth = 0;
    var windowHeight = 0;
    var pageXOffset = 0;
    var pageYOffset = 0;


	// find container
    vsm_container = document.getElementById(vsm_containerID);
    if (!vsm_container) return false;

	// find size width & heighth of window
    windowWidth = calc_Window_width();
    windowHeight = calc_Window_Height();


	// find size X-axis & Y-axis offset of window
    pageXOffset = calc_Screen_XOffset();
    pageYOffset = calc_Screen_yOffset();


	// set working area values based on position selection
    left = vsm_Left_Position_Selector();
    top = vsm_Top_Position_Selector();


    left += pageXOffset;
    top += pageYOffset;

    left += vsm_container_Shift_Left;
    top += vsm_container_Shift_Top;


	// format as style command setting
    vsm_container.style.left = left + 'px';
    vsm_container.style.top = top + 'px';

	// end function vsm_On_Screen_Handler --------------------------------
}


function calc_Window_width()
{
	// Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

	// find width  of window
    if(document.body.clientWidth)
      {
      winWidth = document.body.clientWidth;
      }
      else if(document.getElementsByTagName('body')[0]){
        winWidth=document.getElementsByTagName('body')[0].clientWidth;
    }
    else
      {
      winWidth = window.innerWidth;
      }
   return winWidth;
	// end function calc_Window_width --------------------------------
}

function calc_Window_Height()
{
	// Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

	// find heighth  of window
    if(document.body.clientWidth)
      {
      winHeight = document.body.clientHeight;
      }
      else if(document.getElementsByTagName('body')[0]){
        winHeight=document.getElementsByTagName('body')[0].clientHeight;
    }
    else
      {
      winHeight = window.innerHeight;
      }
    return winHeight;
	// end function calc_Window_Height --------------------------------
}

function calc_Screen_XOffset()
{
	// Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

      // find window X-axis offset ... find left

     vsm_container = document.getElementById(vsm_containerID);
    if (!vsm_container) return false;
    if (window.pageXOffset)
        {
        XOffset = window.pageXOffset;
        }
    else if(document.documentElement && document.documentElement.scrollLeft){
        XOffset = document.documentElement.scrollLeft;
    } else if(document.getElementsByTagName('body')[0]){
        XOffset = document.getElementsByTagName('body')[0].scrollLeft;
    }
   return XOffset;
	// end function calc_Screen_XOffset --------------------------------
}

function calc_Screen_yOffset()
{
	// Video Spokes Model Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

	// find window Y-axis offset ... find top
	var YOffset = 0;
	vsm_container = document.getElementById(vsm_containerID);
    if (!vsm_container) return false;
    if (window.pageYOffset)
        {
        YOffset = window.pageYOffset;
        }
    else if(document.documentElement && document.documentElement.scrollTop){
        YOffset = document.documentElement.scrollTop;
    } else if(document.getElementsByTagName('body')[0]){
        YOffset = document.getElementsByTagName('body')[0].scrollTop;
    }
   return YOffset ;
	// end function calc_Screen_yOffset  --------------------------------
}



function vsm_Left_Position_Selector()
{
	// VideoSpokesModel Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

	// set working area values based on
	// position selection within page and container
  var lpos = 0;
  vsm_container = document.getElementById(vsm_containerID);
    if (!vsm_container) return false;

 switch (vsm_position)
   {
    case 2:
	// top of working area
        lpos += winWidth - vsm_playerWidth;
        break;
    case 3:
	// left of working area
        break;
    case 4:
	// lower - right of working area
        lpos += winWidth - vsm_playerWidth;
        break;
    case 5:
	// center of working area
        lpos += winWidth/2 - vsm_playerWidth/2;
        break;
    case 6:
	// Left center of working area
         break;
    case 7:
	// right center of working area
        lpos += winWidth - vsm_playerWidth;
        break;
    case 8:
	// bottom center of working area
        lpos += winWidth/2 - vsm_playerWidth/2;
        break;
    case 9:
	// top center of working area
        lpos += winWidth/2 - vsm_playerWidth/2;
        break;
    }
	return lpos;
	// end function vsm_Left_Position_Selector --------------------------------
}

function vsm_Top_Position_Selector()
{
	// VideoSpokesModel Jscript
	// Lenape Associates, Inc. Dec 2007
	// Boris Spivak & Jim Spaulding

	// set working area values based on
	// position selection within page and container
  var tpos = 0;

  vsm_container = document.getElementById(vsm_containerID);
    if (!vsm_container) return false;
 switch (vsm_position)
    {
    case 2:
	// top of working area
        break;
    case 3:
	// left of working area
        tpos += winHeight - vsm_playerHeight;
        break;
    case 4:
	// lower - right of working area
        tpos += winHeight - vsm_playerHeight;
        break;
    case 5:
	// center of working area
        tpos += winHeight/2 - vsm_playerHeight/2;
        break;
    case 6:
	// Left center of working area
        tpos += winHeight/2 - vsm_playerHeight/2;
        break;
    case 7:
	// right center of working area
        tpos += winHeight/2 - vsm_playerHeight/2;
        break;
    case 8:
	// bottom center of working area
        tpos += winHeight - vsm_playerHeight;
        break;
    case 9:
	// top center of working area
        break;
    }
	return tpos;
	// end function vsm_Position_Selector --------------------------------
}

function vsm_setCoockie(name, value)
{
    var exdate = new Date();
    exdate.setTime(exdate.getTime());
    document.cookie = name + "=" + escape(value) + "; expires=" ;


}

function vsm_getCookie(name)
{
    if (document.cookie.length>0) {
        c_start=document.cookie.indexOf(name + "=")
        if (c_start!=-1)
        {
            c_start=c_start + 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 null;
}

function getReferer(vsm_containerID)
{
    var me;
    if (vsm_userAgent == 'ie') {
        me = document.getElementById('obj_' + vsm_containerID);
    } else {
        me = document.getElementById('obj_' + vsm_containerID + '_embed');
    }
    me.SetVariable('referer', escape(location.href));
}

function isset(varname)
{
    return(typeof(window[varname])!='undefined');
}

if (vsm_renderType == 3 ) {
   if (!document.getElementById(vsm_containerID))
 {
    document.write('<div id="' + vsm_containerID + '" style="' + vsm_containerStyle + '">' + vsm_containerContents + '</div>');
}
}

init();