//
// Copyright Your Website Spokesperson, LLC
//
///////////////////////////////////////////////////////////////////////////
//                                                                       //
//  This file allows you to change how your website spokesperson         //
//  will display on your webpage without the need for any programming.   //
//  Just follow the directions below to change the parameters, and       //
//  then copy this file to the correct webserver folder.                 // 
//                                                                       //
///////////////////////////////////////////////////////////////////////////
//
//***********************************************
//                POSITIONING
//***********************************************

//Position type ( 0 - Static, 2 - Dynamic )
//Static means you specify where the video will play using x & y coordinates.
//The upper left corner of the screen is (0,0). 
//Dynamic means the position will be automatically calculated for you, based 
//on the position you select with the "preset position" option.
//
var position_type = 2;


//x offset (used for 0-Static).  Increase the x value to move the video to the right.  
//
offsetx = 740;


//y offset (used for 0-Static).  Increase the y value to move the video down.
//
offsety = 290;


//Preset position - used if Position Type=2 Dynamic(above).  Options are:
//  0 - Top Left,    1 - Top Middle     2 - Top Right
//  3 - Middle Left  4 - Middle         5 - Middle Right
//  6 - Bottom Left  7 - Bottom Middle  8 - Bottom Right
//
var preset_position = 6;


//Fixed on Page (0) or Fixed on Screen (1).  A value of 0 means the video will stay fixed on the web page (will scroll off the screen if the user scrolls down).  A value of 1 means the video will remain on the screen even if the person scrolls through the webpage.
//
var iScrolls = 1;


//***********************************************
//                TIMING OPTIONS
//***********************************************

//Time to delay showing video on page (0..n seconds)
//
var delay_time = 0;


//Time for video to remain on page after video is done (0..n seconds).
//A value of 0 means keep the video on the page forever.
//
var remain_time = 0;


//Seconds to fade-in video (0..n seconds).  A value of 0 means no fade-in.
//
var fadein_seconds = 0;


//Seconds to fade video out for (0..n seconds).  A value of 0 means no fade-out.
//
var fadeout_seconds = 0;


//***********************************************
//                FREQUENCY OPTIONS
//***********************************************

//Frequency that video shows (0-every time, 1-once per session, 2-every x number of days)
//
var frequency = 1;


//Show video every (0..n) days.  Used if Frequency=2 (above).
//
var frequency_days = 1;


//Options for when video does not automatically play on subsequent viewings
//Values are 0-hide it
//           1-show stopped with play button
//           2-show playing muted with play button
//           3-show stopped with player controls
//
var frequency_hide_option = 1;


//Do you want to show different, sequential videos for subsequent visits?
//Values are 0-none
//           1-use sequential list
//
var frequency_video_list_sequential = 0;


//Do you want to show different, random videos for subsequent visits?
//Values are 0-none
//           1 - use random list
//
var frequency_video_list_random = 0;


//If different sequential or random videos will be shown on subsequent visits,
//list the videos here separated by a semicolon (;)
//
var frequency_video_list = "";


//***********************************************
//                FLASH MOVIE OPTIONS
//***********************************************

//URL for flash movie.  If the .flv file is in the same directory as this file,
//you only need to identify the filename.
//
video_url = 'http://www.yourwebsitespokesperson.com/hosted/yws-10173/yws-10173.flv';


//Height of video (in pixels).  Be careful about changing this value.
//
video_height = 330;


//Width of video (in pixels).  Be careful about changing this value.
//
video_width = 200;


//Percent to buffer video before playing (0-100).  This lets you determine
//how much of the video will be downloaded before it starts playing.  Higher
//numbers mean less chance for video stuttering, but may delay the start of 
//the video.
//
var video_buffer = 15;


//Determines whether to start playing the video with sound or muted.
//Values are 0-start with sound
//           1-start muted
//
var start_muted = 0;


//If starting muted, determine how video will display.
//Values are 1-start muted 
//           2-start muted with large play button
//           3-start muted with large play button on mouseover
//
var start_muted_options = 2;


//Determines whether the user must press a large play button to start the video.
//Values are 0-don't show before video
//           1-show before video
//
var play_button_timing_before = 0;


//Determines whether a large play button appears after the video ends, in order to
//replay the video.  
//Values are 0-don't show after video
//           1-show after video
//
var play_button_timing_after = 1;


//Determines whether the video should automatically play if a large play button is
//not used.  
//Values are 0-don't autoplay
//           1-autoplay
//
var auto_play = 1;


//Determines whether the video will loop back to the beginning and begin playing
//again once it's done.  
//Values are 0-don't loop
//           1-loop
//
var loop = 0;


//Frame to show for Fade In/Fade Out/Mouseovers (0..n where n is last frame of video)
//If this is set to 0, the first frame is shown.
//
var frame_show_number = 0;


//Webpage to display if the user clicks the video.  If this is blank, clicking on 
//the video will not have any effect.
//
var clickable_url = '';


//Determines whether the webpage that is displayed if the user clicks on the video
//will open in a new browser window, or open in the current browser window.
//Values are 0-open in new browser window
//           1-open in same browser window.
//Note, this option is ignored if the "clickable_url" option is blank (above).
//
var clickable_window_option = 0;


//Determines when the player controls (play, pause, mute) should be shown
//Values are 0-show always
//           1-never
//           2-show only on mouseover
//
var show_player_controls = 2;


//
//////////////////////////////////////////////////////////////////////////
//                                                                      //
//        DO NOT CHANGE OR MODIFY ANYTHING BELOW THIS LINE              //
//                                                                      //
//////////////////////////////////////////////////////////////////////////
//

var client_key = '';
var removeVideoStr = 'removeVideo';
var scale_to_resolution=0;var player_controls_alpha=1;delay_time=delay_time*1000;remain_time=remain_time*1000;if(scale_to_resolution){video_width=(video_width/1920)*screen.width;video_height=(video_height/1080)*screen.height;}
function buildURLString(){var sURL="?a="+video_url;sURL+="&b2="+player_controls_alpha;if(delay_time>0)
sURL+="&b="+delay_time;if(remain_time>0)
sURL+="&c="+remain_time;sURL+="&d="+frequency;if(frequency_days>0)
sURL+="&e="+frequency_days;if(fadein_seconds>0)
sURL+="&f="+fadein_seconds;if(fadeout_seconds>0)
sURL+="&g="+fadeout_seconds;if(video_buffer>0)
sURL+="&h="+video_buffer;if(play_button_timing_before)
sURL+="&j="+play_button_timing_before;if(play_button_timing_after)
sURL+="&k="+play_button_timing_after;if(frame_show_number)
sURL+="&l="+frame_show_number;if(clickable_url.length>0){sURL+="&m="+clickable_url;sURL+="&n="+clickable_window_option;}
if(removeVideoStr){sURL+="&q="+removeVideoStr;}
if(auto_play!=0)
sURL+="&s=1";if(loop!=0)
sURL+="&t=1";sURL+="&u="+show_player_controls;if(start_muted){sURL+="&v=1";if(start_muted_options=="2")
sURL+="&i=1";if(start_muted_options=="3"){sURL+="&i=1";sURL+="&w=1";}}
sURL+="&r=1";return sURL;}
function f_clientWidth(){return f_filterResults(window.innerWidth?window.innerWidth:0,document.documentElement?document.documentElement.clientWidth:0,document.body?document.body.clientWidth:0);}
function f_clientHeight(){return f_filterResults(window.innerHeight?window.innerHeight:0,document.documentElement?document.documentElement.clientHeight:0,document.body?document.body.clientHeight:0);}
function f_scrollLeft(){return f_filterResults(window.pageXOffset?window.pageXOffset:0,document.documentElement?document.documentElement.scrollLeft:0,document.body?document.body.scrollLeft:0);}
function f_scrollTop(){return f_filterResults(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0);}
function f_filterResults(n_win,n_docel,n_body){var n_result=n_win?n_win:0;if(n_docel&&(!n_result||(n_result>n_docel)))
n_result=n_docel;return n_body&&(!n_result||(n_result>n_body))?n_body:n_result;}
function buildStyleString(){var bUseJSScroll=false;var browser=navigator.appName;

if(browser=="Microsoft Internet Explorer")
bUseJSScroll=true;

var sPosition="absolute";if(iScrolls==1&&!bUseJSScroll){sPosition="fixed";}
var style_string="style='width: "+video_width+"px; height: "+video_height+"px; position: "+sPosition+"; z-index: 1000; ";if(position_type==0)
style_string=style_string+"left: "+offsetx+"px; top: "+offsety+"px; display: none'";if(position_type==1)
style_string=style_string+"margin-left: "+offsetx+"px; margin-top: "+offsety+"px; display: none '";if(position_type==2){var ml=video_width/2*-1;var mt=video_height/2*-1;sW=f_clientWidth();sH=f_clientHeight();horizMiddle=sW/2;vertMiddle=sH/2;if(iScrolls==1&&bUseJSScroll){switch(preset_position){case 0:style_string=style_string+"top: 0px; left: 0px; display: none'";break;case 1:style_string=style_string+"top: 0px; left: "+(horizMiddle+ml)+"px; display: none'";break;case 2:style_string=style_string+"top: 0px; left: "+(sW-video_width)+"px; display: none;'";break;case 3:style_string=style_string+"top: "+(vertMiddle+mt)+"px; left: 0px; display: none'";break;case 4:style_string=style_string+"top: "+(vertMiddle+mt)+"px; left: "+(horizMiddle+ml)+"px; display: none'";break;case 5:style_string=style_string+"top: "+(vertMiddle+mt)+"px; left: "+(sW-video_width)+"px; display: none'";break;case 6:style_string=style_string+"top: "+(sH-video_height)+"px; left: 0px; display: none'";break;case 7:style_string=style_string+"top: "+(sH-video_height)+"px; left: "+(horizMiddle+ml)+"px; display: none'";break;case 9:style_string=style_string+"top: 0px; display: none'";break;case 10:style_string=style_string+"left: "+(sW-video_width)+"px; display: none'";break;case 11:style_string=style_string+"top: "+(sH-video_height)+"px; display: none'";break;case 12:style_string=style_string+"left: 0px; display: none'";break;case 8:default:style_string=style_string+"top: "+(sH-video_height)+"px; left: "+(sW-video_width)+"px; display: none'";break;}}else{switch(preset_position){case 0:style_string=style_string+"top: 0; left: 0; display: none'";break;case 1:style_string=style_string+"top: 0; left: 50%; margin-left: "+ml+"; display: none'";break;case 2:style_string=style_string+"top: 0; right: 0; display: none;'";break;case 3:style_string=style_string+"top: 50%; margin-top: "+mt+"; left: 0; display: none'";break;case 4:style_string=style_string+"top: 50%; left: 50%; margin-top: "+mt+"; margin-left: "+ml+"; display: none'";break;case 5:style_string=style_string+"top: 50%; margin-top: "+mt+"; right: 0; display: none'";break;case 6:style_string=style_string+"bottom: 0; left: 0; display: none'";break;case 7:style_string=style_string+"bottom: 0; left: 50%; margin-left: "+ml+"; display: none'";break;case 9:style_string=style_string+"top: 0; display: none'";break;case 10:style_string=style_string+"right: 0; display: none;'";break;case 11:style_string=style_string+"bottom: 0; display: none'";break;case 12:style_string=style_string+"left: 0; display: none'";break;case 8:default:style_string=style_string+"bottom: 0; right: 0; display: none'";break;}}}
return style_string;}
function updatePosition(){var ml=video_width/2*-1;var mt=video_height/2*-1;sW=f_clientWidth();sH=f_clientHeight();scrollTop=f_scrollTop();scrollLeft=f_scrollLeft();horizMiddle=sW/2;vertMiddle=sH/2;var element=document.getElementById('playerDiv');if(position_type==2){switch(preset_position){case 0:element.style.top=scrollTop+'px';element.style.left=scrollLeft+'px';break;case 1:element.style.top=scrollTop+'px';element.style.left=(scrollLeft+horizMiddle+ml)+'px';break;case 2:element.style.top=scrollTop+'px';element.style.left=(scrollLeft+sw-video_width)+'px';break;case 3:element.style.top=(scrollTop+vertMiddle+mt)+'px';element.style.left=scrollLeft+'px';break;case 4:element.style.top=(scrollTop+vertMiddle+mt)+'px';element.style.left=(scrollLeft+horizMiddle+ml)+'px';break;case 5:element.style.top=(scrollTop+vertMiddle+mt)+'px';element.style.left=(scrollLeft+sW-video_width)+'px';break;case 6:element.style.top=(scrollTop+sH-video_height)+'px';element.style.left=scrollLeft+'px';break;case 7:element.style.top=(scrollTop+sH-video_height)+'px';element.style.left=(scrollLeft+horizMiddle+ml)+'px';break;case 9:element.style.top=scrollTop+'px';break;case 10:element.style.left=(scrollLeft+horizMiddle+ml)+'px';break;case 11:element.style.top=(scrollTop+sH-video_height)+'px';break;case 12:element.style.left=scrollLeft+'px';break;case 8:default:element.style.top=(scrollTop+sH-video_height)+'px';element.style.left=(scrollLeft+sW-video_width)+'px';break;}}else{element.style.top=(scrollTop+offsety)+'px';element.style.left=(scrollLeft+offsetx)+'px';}}
function setCookie(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires){expires=expires*1000*60*60*24;}
var expires_date='';if(expires){expires_date=new Date(today.getTime()+(expires));expires_date=expires_date.toGMTString();}
document.cookie=name+"="+escape(value)+
((expires)?";expires="+expires_date:"")+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+
((secure)?";secure":"");}
function getCookie(check_name){var a_all_cookies=document.cookie.split(';');var a_temp_cookie='';var cookie_name='';var cookie_value='';var b_cookie_found=false;for(i=0;i<a_all_cookies.length;i++){a_temp_cookie=a_all_cookies[i].split('=');cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,'');if(cookie_name==check_name){b_cookie_found=true;if(a_temp_cookie.length>1){cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,''));}
return cookie_value;break;}
a_temp_cookie=null;cookie_name='';}
if(!b_cookie_found){return null;}}
var videos=frequency_video_list.split(";");var last_shown_index=getCookie('lastshown_'+video_url);if(last_shown_index==null){last_shown_index=-1;}
var video_first_shown=getCookie('frequency_'+video_url)==null;var show_video=false;switch(frequency){case 2:if(video_first_shown){show_video=true;setTimeout("document.getElementById('playerDiv').style.display='block';",delay_time);setCookie('lastshown_'+video_url,0,30,'/','','');setCookie('frequency_'+video_url,frequency,frequency_days,'/','','');}
break;case 1:if(video_first_shown){show_video=true;setTimeout("document.getElementById('playerDiv').style.display='block';",delay_time);setCookie('lastshown_'+video_url,0,30,'/','','');setCookie('frequency_'+video_url,frequency,'','/','','');}
break;case 0:default:show_video=true;setTimeout("document.getElementById('playerDiv').style.display='block';",delay_time);break;}
if(frequency>0&&!video_first_shown){switch(frequency_hide_option){case 3:auto_play=false;show_video=true;if(show_player_controls==2)
show_player_controls=3;setTimeout("document.getElementById('playerDiv').style.display='block';",delay_time);break;case 2:auto_play=true;start_muted=1;start_muted_options=2;show_video=true;setTimeout("document.getElementById('playerDiv').style.display='block';",delay_time);break;case 1:auto_play=false;play_button_timing_before=1;show_video=true;setTimeout("document.getElementById('playerDiv').style.display='block';",delay_time);break;case 0:default:}}
if(show_video){if(frequency_video_list_sequential&&frequency_video_list_sequential==1){if(last_shown_index!=-1){if(last_shown_index==videos.length){last_shown_index=1;}else{last_shown_index++;}
setCookie('lastshown_'+video_url,last_shown_index,30,'/','','');video_url=videos[last_shown_index-1];}else{setCookie('lastshown_'+video_url,0,30,'/','','');}}
if(frequency_video_list_random&&frequency_video_list_random==1){var randomnumber=Math.floor(Math.random()*videos.length);video_url=videos[randomnumber];}}
function setScrolling(){

if(iScrolls==1&&navigator.appName=="Microsoft Internet Explorer"){
window.setInterval('updatePosition',20);
window.onscroll=updatePosition;
window.onresize=updatePosition;}

}setScrolling();if(show_video){setTimeout("document.getElementById('playerDiv').style.display='block';",delay_time);}
function startRemainingTimer(){setTimeout("document.getElementById('playerDiv').style.display='none';",remain_time);}
var session_id=getCookie('reporting');if(session_id==null){var session_id=Math.floor(Math.random()*100001);setCookie('reporting',session_id,'','/','','');}
function removeVideo(){setTimeout("removeVideoInternal()",1000);}
function removeVideoInternal(){var node=document.getElementById('playerDiv');node.parentNode.removeChild(node);}
var url_string=buildURLString();var style_string=buildStyleString();var flashobj='<div id="playerDiv" '+style_string+'><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+video_width+'" height="'+video_height+'" id="player" align="middle">';flashobj+='<param name="allowScriptAccess" value="always" />';flashobj+='<param name="allowFullScreen" value="false" />';flashobj+='<param name="movie" value="http://www.yourwebsitespokesperson.com/hosted/yws-10173/player.swf'+url_string+'" />';flashobj+='<param name="wmode" value="transparent" />';flashobj+='<param name="quality" value="high" />';flashobj+='<param name="bgcolor" value="#000000" />';flashobj+='<embed src="http://www.yourwebsitespokesperson.com/hosted/yws-10173/player.swf'+url_string+'" wmode="transparent" scale="exactFit" quality="high" bgcolor="#000000" width="100%" height="100%" name="player" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed>';flashobj+='</object></div>';document.write(flashobj);

