// JavaScript Document
MoveEffect_selfref=new Array();
function RemoteEffects(){
//this.axis;
this.x_distance;
this.y_distance;
this.total_distance;
this.time;
this.interval;
this.MoveEffect = MoveEffectFunc;
this.MoveEffectI = MoveEffectInterval;
this.Cancel=CancelFunc;
this.timePassed=0;
this.inter=10;
this.vinit=3;
this.vfinal=0;
this.acc=0;
this.x_startpos=0;
this.x_sign=1;
this.y_sign=1;
this.angle=0;
this.lastTimestamp;
function MoveEffectInterval(cpos){
sr = MoveEffect_selfref[cpos];
td = new Date();
var ctime = td.getTime();
sr.timePassed+=(ctime-sr.lastTimestamp);
sr.lastTimestamp = ctime;
finished=false;
displacement = (sr.vinit * (sr.timePassed/1000))+(.5*(sr.acc)*((sr.timePassed/1000) * (sr.timePassed/1000)))
x_displacement = Math.cos(sr.angle) * displacement;
y_displacement = Math.sin(sr.angle) * displacement;
cvel = Number(sr.vinit)+(Number(sr.acc)*Number(Number(sr.timePassed)/1000))
xval=Number(sr.x_startpos)+(Number(x_displacement)*sr.x_sign);
yval=Number(sr.y_startpos)+(Number(y_displacement)*sr.y_sign);
if(Math.abs(Number(displacement))>=Math.abs(Number(sr.total_distance)) || cvel<=0){
xval=Number(sr.x_startpos)+(Number(sr.x_distance)*sr.x_sign);
yval=Number(sr.y_startpos)+(Number(sr.y_distance)*sr.y_sign);
finished=true;
}
sr.domObj.style.left=Math.round(xval)+'px';
sr.domObj.style.top =Math.round(yval)+'px';
if(finished==true){
window.clearInterval(sr.interval);
if(typeof(sr.finish) == "function") sr.finish();
}
}
function CancelFunc(){
window.clearInterval(sr.interval);
}
function MoveEffectFunc( x_distance, y_distance, time, domObj, finishFunc){
if(x_distance<0) this.x_sign=-1; else this.x_sign=1;
if(y_distance<0) this.y_sign=-1; else this.y_sign=1;
this.angle = (Math.atan(Math.abs(y_distance/x_distance)));
x_distance=Math.abs(x_distance);
y_distance=Math.abs(y_distance);
this.x_distance = x_distance;
this.y_distance = y_distance;
this.total_distance = Math.sqrt((x_distance*x_distance)+(y_distance*y_distance));
this.d = new Date();
this.lastTimestamp = this.d.getTime();
this.time = time;
this.domObj = document.getElementById(domObj);
this.finish = finishFunc;
this.timePassed=0;
if(this.domObj.style.left) this.x_startpos = MoveEffectRemovePX(this.domObj.style.left); else this.x_startpos=0;
if(this.domObj.style.top) this.y_startpos = MoveEffectRemovePX(this.domObj.style.top);else this.y_startpos=0;
cpos = MoveEffect_selfref.length;
MoveEffect_selfref[cpos]=this;
this.vinit = ((this.total_distance*2)/this.time);
this.acc = (this.vfinal - this.vinit)/this.time;
this.interval = window.setInterval("MoveEffect_selfref["+cpos+"].MoveEffectI("+cpos+")", this.inter);
}
function MoveEffectRemovePX(strName){
return strName.substring(0, strName.length-2);
}
}
/*# AVOID COLLISIONS #*/
;if(window.jQuery)(function($){
/*# AVOID COLLISIONS #*/
var smart_tag_counter = 0; //holds the number of the smartobject tags
var waitingForImageCounter=0;
var l_image = new Array(); //Array of icon images for each SmartObject tool
var smart_v_included=false; //flag to set whether to include smart_z_manager script
var img_idx; //index of the image in l_image array
var finished_adding_images=false;
var smartsite_is_IE6 = false;
smart_oid = "y9xBpy74";
var flash_support = 0;
var evid = getQueryStringParams('evid') ,
autoplay=getQueryStringParams('playvideoembed'),
autoplay_popup=getQueryStringParams('playvideo');
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.iOS() || isMobile.Android() || isMobile.BlackBerry() || isMobile.Opera() || isMobile.Windows());
}
};
$.fn.smartobject = function(){
return this.each(function(){
var e = $(this);
var smartconnect_tdiv;
switch(e.attr('type'))
{
//--------------------------------------------------------------------------------------------------
case "video":
//replace the current smartobject tag with a numbered div
//--------------------------------------------------------------------------------
smartconnect_tdiv = document.createElement("div");
$(smartconnect_tdiv).attr('id','smartsite_embedded_player'+smart_tag_counter)
.attr('class','smartsite_embedded_player');
//replace the smartobject tag with the newly created div tag
e.replaceWith($(smartconnect_tdiv));
if(e.attr('styles')){
$.parseStyles($(smartconnect_tdiv), e.attr('styles'));
}
//Load the actual content using load function in remote_video.php
//--------------------------------------------------------------------------------
$(this).video({target_div: $(smartconnect_tdiv).attr('id'), image: e.attr('image'), pos: smart_tag_counter, bizname: e.attr('business_name_to_display'), mcode: e.attr('movie_code'), au: autoplay, evid:evid, show_tabs: e.attr('show_tabs'), mode: e.attr('mode'), autop: e.attr('autoplay'), buffertime: e.attr('buffertime')});
break;
//--------------------------------------------------------------------------------------------------
case "smartvideo":
//Create a div to contain the tool
//--------------------------------------------------------------------------------
smartconnect_tdiv = document.createElement("div");
$(smartconnect_tdiv).attr('id','smartsite_smartvideo'+smart_tag_counter)
.attr('class','smartsite_smartvideo');
//replace the smartobject tag with the newly created div tag
e.replaceWith($(smartconnect_tdiv));
//Create a new image to hold the icon image, then increment the image counter. The image counter requires that all icons are loaded before any of
//the smartobject tools can be used.
//--------------------------------------------------------------------------------
ci = l_image.length;
l_image[ci] = new Image();
l_image[ci].pos = smart_tag_counter;
$.incrementWaitingForImageCounter();
//Create a function to be called when the icon image is loaded
//--------------------------------------------------------------------------------
l_image[ci].onload = function(){
$(this).smartvideo({target_div:$(smartconnect_tdiv).attr('id'),
icon_url:e.attr('icon_url'),
icon_over_url:e.attr('icon_over_url'),
icon_close_url:e.attr('icon_close_url'),
w:this.width,
h:this.height,
mcode: e.attr('movie_code'),
open_x:e.attr('open_x'),
open_y:e.attr('open_y'),
open_direction:e.attr('open_direction'),
auto_center:e.attr('auto_center'),
pos:this.pos,
auto_open:e.attr('auto_open'),
allow_tabs:e.attr('allow_tabs'),
netReceiptID: evid,
vmode: e.attr('mode')
});
$.decrementWaitingForImageCounter();
}
l_image[ci].src = e.attr('icon_url');
//Set flag to include smart_z_managerV2.js, which manages auto-opening
//--------------------------------------------------------------------------------
smart_v_included=true;
break;
case "clicktotext":
//Click to text may be an image or text link. If it's a text link, create a hyperlink
//--------------------------------------------------------------------------------
if(e.attr('image') == null)
{
smartconnect_tdiv = document.createElement("span");
$(smartconnect_tdiv).attr('id','smartsite_clicktotext'+smart_tag_counter);
//replace the smartobject tag with the newly created div tag
e.replaceWith($(smartconnect_tdiv));
if (e.attr('display_type'))
$("#smartsite_clicktotext"+smart_tag_counter).css('display',e.attr('display_type'));
$.load_ctt($(smartconnect_tdiv).attr('id'), e.attr('image'), e.attr('text') ,e.attr('width'), e.attr('height'), smart_tag_counter);
}
//If this 'click to text' uses an image icon, create it
//--------------------------------------------------------------------------------
else
{
//Create a div to contain the tool
smartconnect_tdiv = document.createElement("div");
$(smartconnect_tdiv).attr('id','smartsite_clicktotext'+smart_tag_counter);
//replace the smartobject tag with the newly created div tag
e.replaceWith($(smartconnect_tdiv));
//Create a new image to hold the icon image, then increment the image counter. The image counter requires that all icons are loaded before any of
//the smartobject tools can be used.
ci = l_image.length;
l_image[ci] = new Image();
l_image[ci].pos = smart_tag_counter;
$.incrementWaitingForImageCounter();
l_image[ci].onload = function(){
$.load_ctt($(smartconnect_tdiv).attr('id'), e.attr('image'), e.attr('text') ,e.attr('width'), e.attr('height'), this.pos);
$.decrementWaitingForImageCounter();
}
//Set the image's src, beginning the loading process
l_image[ci].src=e.attr('image');
if (e.attr('display_type'))
$("#smartsite_clicktotext"+smart_tag_counter).css('display', e.attr('display_type'));
}
break;
case "smartlibrary":
//Create a div to contain the tool
//--------------------------------------------------------------------------------
smartconnect_tdiv = document.createElement("div");
$(smartconnect_tdiv).attr('id','smartsite_smartlibrary'+smart_tag_counter)
.attr('class','smartsite_smartlibrary').css('position','relative');
e.replaceWith($(smartconnect_tdiv));
//If a styles attribute has been set, pass through those style settings to the created div
//--------------------------------------------------------------------------------
if(e.attr('styles')){
$.parseStyles($(smartconnect_tdiv), e.attr('styles'));
}
//Create a function to be called when the icon image is loaded
//--------------------------------------------------------------------------------
ci= l_image.length;
l_image[ci] = new Image();
l_image[ci].pos = smart_tag_counter;
$.incrementWaitingForImageCounter();
//Create a function to be called when the icon image is loaded
//--------------------------------------------------------------------------------
l_image[ci].onload = function(){
smartlibrary.init(document.getElementById($(smartconnect_tdiv).attr('id')), e.attr('icon_url'),e.attr('icon_over_url'),e.attr('icon_close_url'), this.width, this.height,e.attr('library_code'),e.attr('open_x'),e.attr('open_y'),e.attr('open_direction'),e.attr('auto_center'), this.pos, e.attr('auto_open'), evid);
/*load_smartlibrary(document.getElementById($(smartconnect_tdiv).attr('id')), e.attr('icon_url'),e.attr('icon_over_url'),e.attr('icon_close_url'), this.width, this.height,e.attr('library_code'),e.attr('open_x'),e.attr('open_y'),e.attr('open_direction'),e.attr('auto_center'), this.pos, e.attr('auto_open'), evid);*/
$.decrementWaitingForImageCounter();
};
//Set the image's src, beginning the loading process
//--------------------------------------------------------------------------------
l_image[ci].src=e.attr('icon_url');
//Set flag to include smart_z_manager.js, which manages auto-opening
//--------------------------------------------------------------------------------
smart_v_included=true;
break;
default:
break;
}
smart_tag_counter++;
finished_adding_images = true;
});
};//end of $.fn.smartobject
//Dynamically add an image to a div
//--------------------------------------------------------------------------------
$.writeImage = function(imagesrc, divid, width, height, style_extras, extras, imgid){
if(smartsite_is_IE6 && imagesrc.indexOf(".png")!=-1)
{
$("#"+divid).append('');
}
else
{
$("#"+divid).append('');
}
}
//Dynamically add an image to the beginning of a div, using browser detection to correct for IE6's lack of support for PNGs
//--------------------------------------------------------------------------------
$.writeImageToBeginning = function(imagesrc, divid, width, height, style_extras, extras, imgid){
if(smartsite_is_IE6 && imagesrc.indexOf(".png")!=-1)
$("#"+divid).prepend('');
else
$("#"+divid).prepend('');
}
$.overwriteImage = function(imagesrc, divid, width, height, style_extras, extras, id){
if(smartsite_is_IE6 && imagesrc.indexOf(".png")!=-1)
$("#"+divid).html('');
else
$("#"+divid).html('');
}
$.smartsite_createCookie = function(name,value,days)
{
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
$.smartsite_readCookie = function(name){
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
//incrementWaitingForImageCounter tracks the number of icon images still to be loaded. Icon images must all be loaded before any tools can be used.
//This is because some tools may be set to auto open, and if they try to open before their icons have been loaded, certain values may not be set.
//--------------------------------------------------------------------------------
$.incrementWaitingForImageCounter = function(){
waitingForImageCounter++;
}
//Decrement the count for the number of icon images still loading. Icon images must all be loaded before any tools can be used.
//This is because some tools may be set to auto open, and if they try to open before their icons have been loaded, certain values may not be set.
//--------------------------------------------------------------------------------
$.decrementWaitingForImageCounter = function(){
waitingForImageCounter--;
//If all the images have loaded andthe tools included on the page require smart_z_manager.js, which manages auto-opening, dynamically add smart_z_manager.js
//--------------------------------------------------------------------------------
if(waitingForImageCounter==0 && smart_v_included==true && finished_adding_images) {
$.addScript("http://www.smartsite.tv/remote/smart_z_managerV2.js", 0);
}
}
//Add a script to the HEAD section of the page dynamically, causing it to run immediately
//--------------------------------------------------------------------------------
$.addScript = function(sc_src, clr){
if(clr) $.clearOldScripts();
var oScript= document.createElement("script");
oScript.type = "text/javascript";
oScript.src = sc_src;
document.getElementsByTagName('HEAD').item(0).appendChild( oScript );
}
//Each time certain SmartConnect tools are used, the smartsite_responder.php script (which outputs javascript) is added to the HEAD section of the page.
//This function clears existing script tags referencing the responder scripts, which are no longer needed once they are run once
//--------------------------------------------------------------------------------
$.clearOldScripts = function(){
scrs=document.getElementsByTagName("script");
for(var z=0;z0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.majorfv.major){return true;}
if(this.minorfv.minor){return true;}
if(this.rev');
smartvideo_iswide[pos]=false;
smartvideo_isauto[pos]=false;
if(options.mode=="wide"){
iwidth="534";
smartvideo_iswide[pos]=true;
}
$.writeImage(options.image, "smartsite_embedded_player"+pos, iwidth, 345, '', 'class="video_img" onclick="javascript:jQuery(this).video(\'load\','+pos+', \''+mc+'\')"', "player_button"+pos);
if(options.buffertime!=null){
smartvideo_buffertime[pos]=buffertime;
}
else{
smartvideo_buffertime[pos]=null;
}
$("#smartsite_embedded_player"+pos).append("
");
$.writeImage("http://www.smartsite.tv/modules/player/popup.png", "smartsite_pngdiv1"+pos, 164, 36, "", "class='video_popup_img'", "");
$.writeImage("http://www.smartsite.tv/modules/player/popup.png", "smartsite_pngdiv2"+pos, 164, 36, "", "class='video_popup_img'", "");
if(options.au!=""){
$.addScript("http://www.smartsite.tv/full_modules/smartsite_responderV2.php?auto_mc="+options.au+"&this_mc="+mc+"&action_request=autoplay_video&pos="+pos+"&pid="+smart_oid, 1);
}
else{
if(options.autop=="true"){
smartvideo_isauto[pos]=true;
if($.smartsite_readCookie("smst_v_"+mc)==null){ $(this).video('load',pos,mc);}
}
}
if(ev!=""){
$("#play_module_post"+pos).attr('src','http://www.smartsite.tv/client_sites/shared/remote_netrec_check.php?evid='+ev);
}
setTimeout(function(){
smartvideo_effectobj1 = new RemoteEffects();
smartvideo_effectobj1.MoveEffect(0, -40, 1, "sharediv"+pos, null);
}, 3000);
/*setTimeout(function(){
smartvideo_effectobj2 = new RemoteEffects();
smartvideo_effectobj2.MoveEffect(0, -40, 1, "calldiv"+pos, null);
}, 5000);*/
},
load:function(idx, mc){
$.clearOldScripts();
$.addScript("http://www.smartsite.tv/full_modules/smartsite_responderV2.php?id="+mc+"&action_request=video&pos="+idx+"&pid="+smart_oid, 1);
},
play:function(r){
//write_log(r);
var bufferString="";
var wideString = 0;
if($.smartsite_readCookie("smst_v_"+r.mc)==null){
$.smartsite_createCookie("smst_v_"+r.mc,1,"");
}
$("#player_frame"+r.pos).css("display","block");
$("#player_button"+r.pos).css("display","none");
if(smartvideo_buffertime[r.pos]!=null) bufferString="buffertime="+smartvideo_buffertime[r.pos]+"&";
if(smartvideo_iswide[r.pos] == true) wideString=1;
$("#player_frame"+r.pos).attr("src","http://www.elocallink.tv/sandbox2/large_viewer_no_mid_buffer.php?"+bufferString+"def_vhost="+r.def_vhost+"&dir_path="+r.dir_path+"&movie="+r.movie+"&allow_wider="+wideString);
$("#play_module_post"+r.pos).attr("src","http://www.smartsite.tv/tracking/universal_tracking.php?pid="+r.eid+"&insert_type=webvideo&etx="+r.ename);
}
}
/*$.click_to_call = function(e, pos){
if (!e) return;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
window.open('http://www.smartsite.tv/full_modules/click_to_call/remote_ctc.php?pid='+smart_oid,'click_to_call_window','width=400,height=200,toolbar=no,location=no,status=no,menubar=no');
}*/
$.click_to_share = function(e, pos, businessname, mc){
if (!e) return;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
fulluri = encodeURI(document.location.href);
window.open('http://www.smartsite.tv/full_modules/share_popup/remote_share.php?url='+fulluri+'&mc='+mc+'&pos='+pos+'&pid='+smart_oid+'&name='+businessname,'click_to_call_window','width=400,height=300,toolbar=no,location=no,status=no,menubar=no');
}
$.fn.video = function( method ) {
if ( video_methods[method] ) {
//write_log('execute a method of video :'+method);
return video_methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
//write_log('initialize video');
return video_methods.init.apply( this, arguments );
} else {
$.error( 'Method ' + method + ' does not exist on jQuery.video' );
}
};//This script creates a slide-out video
//-----------------------------------------------------------------
smartvideo_params = {
smartvideo_db_response: [],
smartvideo_opening: false,
smartvideo_closing: false,
smartvideo_opened: false,
smartvideo_swapping: false,
smartvideo_now_opened: -1,
smartvideo_originalZ: 0,
smartvideo_initialX: 0,
smartvideo_initialY: 0,
smartvideo_muted: false,
smartvideo_phoneSelected: false,
smartvideo_mcodes: [],
smartvideo_activation_begun: [],
smartvideo_custom_pos: [],
smartvideo_pos_values: [],
smartvideo_cookie_based_open_allowed: [],
smartvideo_show_tabs: [],
smartvideo_callpanel_timeouts: [],
smartvideo_sharepanel_timeouts: [],
smartvideo_autocenter_vars: [],
smartvideo_opening_effectobj: new RemoteEffects(),
smartvideo_closing_effectobj: new RemoteEffects(),
smartvideo_trackingClientIDs: [],
smartvideo_CCEmail: [],
smartvideo_NetReceipts: [],
smartvideo_widescreen: [],
smartvideo_width: [],
smartvideo_playerwidth: []
}
var smartvideo_methods = {
init: function(options){
var iwidth=400;
var pos = options.pos;
var w = options.w;
var h = options.h;
smartvideo_params.smartvideo_widescreen[pos]=false;
if(options.vmode=="wide"){
iwidth = 534;
smartvideo_params.smartvideo_widescreen[pos]=true;
}
smartvideo_params.smartvideo_width[pos] = iwidth;
smartvideo_params.smartvideo_playerwidth[pos] = iwidth+18;
//Store the net receipt id and position of this smartvideo
//-----------------------------------------------------------------
smartvideo_params.smartvideo_NetReceipts[pos] = options.netReceiptID;
smartvideo_params.smartvideo_pos_values.push(pos);
//If auto-opening is turned off in atributes, do not allow the smart_z_manager script to auto-open this smartvideo
//-----------------------------------------------------------------
if(options.auto_open=="false" || typeof(options.auto_open) == 'undefined')
{
smartvideo_params.smartvideo_cookie_based_open_allowed.push(false);
}
else
{
smartvideo_params.smartvideo_cookie_based_open_allowed.push(true);
}
smartvideo_params.smartvideo_show_tabs[pos] = true;
if(options.allow_tabs=="false"){
smartvideo_params.smartvideo_show_tabs[pos] = false;
}
//Create divs for buttons and the slide-out player
//-----------------------------------------------------------------
var smartvideo_standard_div = document.createElement('div');
$(smartvideo_standard_div).attr('id','smartvideo_icon_standard'+pos)
.attr('class','smartvideo_icon_standard')
.css('width',w+'px')
.css('height',h+'px');
var smartvideo_over_div = document.createElement('div');
$(smartvideo_over_div).attr('id','smartvideo_icon_over'+pos)
.attr('class','smartvideo_icon_over')
.css('width',w+'px')
.css('height',h+'px');
var smartvideo_close_div = document.createElement('div');
$(smartvideo_close_div).attr('id','smartvideo_icon_close'+pos)
.attr('class','smartvideo_icon_close')
.css('width',w+'px')
.css('height',h+'px');
$("#"+options.target_div).css('width',w+'px')
.css('height',h+'px')
.append($(smartvideo_standard_div))
.append($(smartvideo_over_div))
.append($(smartvideo_close_div));
//Store the movie code for this tool
//-----------------------------------------------------------------
smartvideo_params.smartvideo_mcodes[pos]=options.mcode;
//Set the activation status for this tool
//-----------------------------------------------------------------
smartvideo_params.smartvideo_activation_begun[pos]=false;
//Set the opening position and direction if this was set in attributes
//-----------------------------------------------------------------
if(options.open_x!=null && options.open_y!=null && options.open_direction!=null){
smartvideo_params.smartvideo_custom_pos[pos]={x:options.open_x, y:options.open_y, dir:options.open_direction};;
}
else{
smartvideo_params.smartvideo_custom_pos[pos]=null;
}
//Set auto-center variable
//-----------------------------------------------------------------
if(options.auto_center!=null)
smartvideo_params.smartvideo_autocenter_vars[pos]=options.auto_center;
else
smartvideo_params.smartvideo_autocenter_vars[pos]=null;
//Write icon images
//-----------------------------------------------------------------
$(smartvideo_standard_div).html("");
$(smartvideo_over_div).html("");
$(smartvideo_close_div).html("");
if(isMobile.any())
{
$('#smartvideo_image_standard'+pos).bind('touchstart',function(e){
$(this).parent().css('display','none');
$(this).parent().siblings('.smartvideo_icon_over').css('display','block');
$(this).parent().siblings('.smartvideo_icon_close').css('display','none');
}).bind('touchend',function(e){
$(this).smartvideo('activate', pos);
});
}
else
{
$('#smartvideo_image_standard'+pos).bind('mouseover',function(e){
$(this).parent().css('display','none');
$(this).parent().siblings('.smartvideo_icon_over').css('display','block');
$(this).parent().siblings('.smartvideo_icon_close').css('display','none');
});
$('#smartvideo_image_over'+pos).bind('mouseout',function(e){
if(!smartvideo_params.smartvideo_opening)
{
$(this).parent().siblings('.smartvideo_icon_standard').css('display','block');
$(this).parent().css('display','none');
$(this).parent().siblings('.smartvideo_icon_close').css('display','none');
}
}).bind('click',function(e){
$(this).smartvideo('activate', pos);
});
}
$('#smartvideo_image_close'+pos).bind('click',function(e){
$(this).smartvideo('close', pos);
});
return this;
},
activate: function(idx){
//If there is no div for this video, do nothing (in case of incorrect variable put into query string)
//-----------------------------------------------------------------
if($("#smartsite_smartvideo"+idx).length == 0) return;
//If the activation has not yet begun, begin it by calling smartsite_responder
//Begin playing the actual video by dynamically adding a script reference to smartsite_responder.php to the HEAD section of the document
//This enables cross-domain communication that would be impossible with standard AJAX. The smartsite_responder script calls playvideo_r, passing
//data about the client and video to play as an argument
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_activation_begun[idx]==false){
smartvideo_params.smartvideo_activation_begun[idx]=true;
$.addScript("http://www.smartsite.tv/full_modules/smartsite_responderV2.php?action_request=load_smartvideo&pos="+idx+"&mcode="+smartvideo_params.smartvideo_mcodes[idx]+"&pid="+smart_oid, 1);
}
else if(smartvideo_params.smartvideo_db_response[idx]!=null){
//If a response from the responder script already exists, the data has already been loaded, so the user is replaying the video and there is no need to load it again
//-----------------------------------------------------------------
$(this).smartvideo('open', idx);
}
},
load: function(r,idx){
//Retrieve the tracking id and email address for the client
//--------------------------------------------------------------------------------
smartvideo_params.smartvideo_trackingClientIDs[idx] = r.enc_tcid;
smartvideo_params.smartvideo_CCEmail[idx] = r.cc_email;
//If there is no div for this video, do nothing (in case of incorrect variable put into query string)
//-----------------------------------------------------------------
if($('#smartsite_smartvideo'+idx).length == 0) return;
//If no position was specified in attributes, use the position stored in the database
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_custom_pos[idx]!=null){
r.left = smartvideo_params.smartvideo_custom_pos[idx].x;
r.top = smartvideo_params.smartvideo_custom_pos[idx].y;
r.direction = smartvideo_params.smartvideo_custom_pos[idx].dir;
}
//If client has a click to call number and show_tabs attribute is not set to false, show the click to call tab
//-----------------------------------------------------------------
if(r.clicktocall != null){
//Check for valid phone number in database
//-----------------------------------------------------------------
re = /^\d{10,11}$/;
regexp = new RegExp(re);
if(regexp.test(r.clicktocall) && smartvideo_params.smartvideo_show_tabs[idx]!=false){
smartvideo_params.smartvideo_show_tabs[idx] = true;
}
else {
smartvideo_params.smartvideo_show_tabs[idx] = false;
}
}
else{
smartvideo_params.smartvideo_show_tabs[idx] = false;
}
//Determine if this video is to be auto centered
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_autocenter_vars[idx]!=null){
if(smartvideo_params.smartvideo_autocenter_vars[idx]=="false")
smartvideo_params.smartvideo_autocenter_vars[idx]=0;
else if(smartvideo_params.smartvideo_autocenter_vars[idx]=="true")
smartvideo_params.smartvideo_autocenter_vars[idx]=1;
r.autocenter=smartvideo_params.smartvideo_autocenter_vars[idx];
}
//Save the response from the server
//-----------------------------------------------------------------
smartvideo_params.smartvideo_db_response[idx]=r;
//Create the HTML for the slide-out video player
//-----------------------------------------------------------------
smartvideo_params.smartvideo_originalZ=$('#smartsite_smartvideo'+idx).css('zIndex');
$("#smartsite_smartvideo"+idx).append("");
if(!smartvideo_params.smartvideo_widescreen[idx])
{
$('#smartvideo_avatar'+idx).append('');
}
else
{
$('#smartvideo_avatar'+idx).append('');
}
$('#smartvideo_avatar'+idx).append('
Send via e-mail Send via SmartPhone CC email to this video's owner Request net receipt
";
$('#smartvideo_avatar'+idx).append("
"+shareAndCallPanel+"
"+shareform+"
");
$('#smartvideo_avatar'+idx).append("");
$('#smartsite_smartvideo'+idx).append('');
if(!smartvideo_params.smartvideo_widescreen[idx])
{
$.writeImage("http://www.elocallink.tv/zyte/zyte_images/tourlowerbar.png", "smartvideo_lowerbarcontainer"+idx, 418, 46, '', 'class="smartvideo_img"', 'smartvideo_lowerbar'+idx);
$.writeImageToBeginning("http://www.elocallink.tv/zyte/zyte_images/tourupper_smart_wCtrl.png","smartvideo_textImage"+idx, 418,364, '','class="smartvideo_img"', '');
}
else
{
$.writeImage("http://www.elocallink.tv/zyte/zyte_images/tourlowerbar_wide.png", "smartvideo_lowerbarcontainer"+idx, 552, 46, '', 'class="smartvideo_img"', 'smartvideo_lowerbar'+idx);
$.writeImageToBeginning("http://www.elocallink.tv/zyte/zyte_images/tourupper_smart_wide_wCtrl.png","smartvideo_textImage"+idx, 552,364, '','class="smartvideo_img"', '');
}
//If a net receipt has been requested for this page view through a query string variable, meaning it was sent to a friend
//post the remote_netrec_check.php to an iframe to handle the net receipt
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_NetReceipts[idx]!=""){
$("#smartvideo_postframe"+idx).attr('src','http://www.smartsite.tv/client_sites/shared/remote_netrec_check.php?evid='+smartvideo_params.smartvideo_NetReceipts[idx]);
}
//Slide out the video pane
//-----------------------------------------------------------------
$(this).smartvideo('open',idx);
},
//Begin opening the SmartVideo tool
//-----------------------------------------------------------------
open: function(idx){
//Calculate the auto center position and refresh HTML element position
//-----------------------------------------------------------------
$.smartvideo_checkAutoCenter(idx);
$.smartvideo_refreshDependentPositions(idx);
//If another video is opening or closing, cancel the current opening, as the opening/closing animation must finish before any action is taken
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_opening || smartvideo_params.smartvideo_closing) return;
//If another smartvideo is open, close it and open the new one
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_opened){
smartvideo_params.smartvideo_swapping=true;
smart_z_lock();
$(this).smartvideo('close',smartvideo_params.smartvideo_now_opened);
smartvideo_params.smartvideo_opened=false;
}
//Check to see if opening is allowed
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_swapping==false){
if(smartsite_requestPermission()==false) return;
}
//Show click to call and click to share panels after a set amount of time, if allowed by the attributes
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_show_tabs[idx]){
//hide call panel
if($("#smartvideo_callpanel_"+idx).length !=0){
$("#smartvideo_callpanel_"+idx).css('display','none');
}
//clearTimeout(smartvideo_callpanel_timeouts[idx]);
setTimeout(function(){
if($("#smartvideo_callpanel_"+idx).length != 0){
$("#smartvideo_callpanel_"+idx).css('opacity',0).show().animate({opacity: 1},2000);
}
}, 8000);
}
else
{
//write_log('no call panel');
}
//Hide the click to share panel
if($("#smartvideo_sharepanel_"+idx).length != 0){
$("#smartvideo_sharepanel_"+idx).css('display','none');
}
//clearTimeout(smartvideo_sharepanel_timeouts[num]);
setTimeout(function(){
if($("#smartvideo_sharepanel_"+idx).length != 0){
$("#smartvideo_sharepanel_"+idx).css('opacity',0).show().animate({opacity: 1},2000);
}
}, 6000);
//Set the z-index to allow this tool to open over other content
//-----------------------------------------------------------------
$('#smartsite_smartvideo'+idx).css('zIndex',9999);
smartvideo_params.smartvideo_muted=false;
//Calculate the point to which the video panel should slide out to in the first step of its animation, based on the slide direction
//-----------------------------------------------------------------
var startpoint=$("#smartsite_smartvideo"+idx).height()/2 - 23;
var move_distance = smartvideo_params.smartvideo_playerwidth[idx]+19;
//If sliding out to the left, calculate and begin left slide animation
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_db_response[idx].direction=="left"){
$('#smartvideo_lowerbarcontainer'+idx).css('top',startpoint+'px');
$('#smartvideo_lowerbarcontainer'+idx).css('left',-1*smartvideo_params.smartvideo_playerwidth[idx]+'px');
$('#smartvideo_lowerbar'+idx).css('left',move_distance+"px");
smartvideo_params.smartvideo_opening_effectobj.MoveEffect(-1*move_distance, 0, 1, "smartvideo_lowerbar"+idx, function(){$(this).smartvideo('moveBarDown',idx);});
//$("#smartvideo_lowerbar"+idx).animate({left: '-='+move_distance},1000,'linear',function(){$(this).smartvideo('moveBarDown',idx);});
}
else
{
//If sliding to the right, calculate and begin right slide animation
//-----------------------------------------------------------------
$('#smartvideo_lowerbarcontainer'+idx).css('top',startpoint+'px');
$('#smartvideo_lowerbarcontainer'+idx).css('left',$("#smartsite_smartvideo"+idx).width()+'px');
$('#smartvideo_lowerbar'+idx).css('left',-1*move_distance+"px");
smartvideo_params.smartvideo_opening_effectobj.MoveEffect(move_distance, 0, 1, "smartvideo_lowerbar"+idx, function(){$(this).smartvideo('moveBarDown',idx);});
//$("#smartvideo_lowerbar"+idx).animate({left: '+='+move_distance},1000,'linear',function(){$(this).smartvideo('moveBarDown',idx);});
}
//Lock SmartConnect tools so no other tools can open while the animtion is occurring
//-----------------------------------------------------------------
smartvideo_params.smartvideo_opening=true;
smart_z_lock();
$('#smartvideo_icon_standard'+idx).css('display','none');
$('#smartvideo_icon_over'+idx).css('display','none');
$('#smartvideo_icon_close'+idx).css('display','block');
$('#smartvideo_avatar'+idx).css('display','block');
},
//Perform the second stage of the animation, moving the sliding bar into the position that the video will appear in
//-----------------------------------------------------------------
moveBarDown: function(idx){
//write_log('move bar down......');
//Store the position of the bar at this stage of the animation so it may be returned to when closing
//-----------------------------------------------------------------
smartvideo_params.smartvideo_initialX=$('#smartvideo_lowerbarcontainer'+idx).position().left;
smartvideo_params.smartvideo_initialY=$('#smartvideo_lowerbarcontainer'+idx).position().top;
//Animate the bar sliding into position
//-----------------------------------------------------------------
smartvideo_params.smartvideo_opening_effectobj.MoveEffect(smartvideo_params.smartvideo_db_response[idx].left-smartvideo_params.smartvideo_initialX, smartvideo_params.smartvideo_db_response[idx].top-smartvideo_params.smartvideo_initialY+26, 1, "smartvideo_lowerbarcontainer"+idx, function(){$(this).smartvideo('showVideoPanel',idx);});
},
//Perform the third stage of the animation, sliding the video panel out of the bar
//-----------------------------------------------------------------
showVideoPanel: function(idx){
//Show the video panel by sliding it from the bar
$('#smartvideo_desctext'+idx).css('display','block');
$('#smartvideo_flashavatar'+idx).css('left', $('#smartvideo_lowerbarcontainer'+idx).position().left + 9+'px');
$('#smartvideo_flashavatar'+idx).css('top', $('#smartvideo_lowerbarcontainer'+idx).position().top -292 - 26 +'px');
//Put panel div in correct position
$('#smartvideo_textAreaContainer'+idx).css('top', $('#smartvideo_lowerbarcontainer'+idx).position().top- 330 - 26 +'px');
$('#smartvideo_textAreaContainer'+idx).css('left', $('#smartvideo_lowerbarcontainer'+idx).position().left+'px');
smartvideo_params.smartvideo_opening_effectobj.MoveEffect(0, -400, 1, "smartvideo_textArea"+idx, function(){$(this).smartvideo('fullyopened', idx);});
},
fullyopened: function(idx){
//Track this view in the database by posting universal_tracking to an iframe
$("#smartvideo_postframe2-"+idx).attr('src','http://www.smartsite.tv/tracking/universal_tracking.php?pid='+smart_oid+'&insert_type=webvideo&etx='+smartvideo_params.smartvideo_db_response[idx].enc_tag);
//Display the video div
$('#smartvideo_flashavatar'+idx).css('display','block');
//Change the bar image
if(!smartvideo_params.smartvideo_widescreen[idx])
{
$("#smartvideo_lowerbar"+idx).attr('src','http://www.elocallink.tv/zyte/zyte_images/tourlowerbarpartial.png');
}
else
{
$("#smartvideo_lowerbar"+idx).attr('src','http://www.elocallink.tv/zyte/zyte_images/tourlowerbarpartial_wide.png');
}
//Now that the video is finished opening, unlock to allow closing or other SmartConnect tools opening
smartvideo_params.smartvideo_opening=false;
//smartvideo_params.smartvideo_opened=true;
setSwapFunc(function(idx){
$(this).smartvideo('close',idx);
}, idx);
smartvideo_params.smartvideo_now_opened = idx;
smartvideo_params.smartvideo_swapping = false;
smartvideo_params.smartvideo_opened = true;
smart_z_unlock();
//Set the iframe to player page to play the video
$("#smartvideo_flashavatar"+idx).attr('src','http://www.elocallink.tv/sandbox2/large_viewer_no_mid_debug.php?def_vhost='+smartvideo_params.smartvideo_db_response[idx].def_vhost+'&dir_path='+smartvideo_params.smartvideo_db_response[idx].dir_path+'&movie='+smartvideo_params.smartvideo_db_response[idx].movie+'&allow_wider='+smartvideo_params.smartvideo_widescreen[idx]);
},
//first stage of closing animation, hide the video
close: function(idx){
if(smartvideo_params.smartvideo_closing==true || smartvideo_params.smartvideo_opening==true) return;
if(smartvideo_params.smartvideo_swapping==false){
smartvideo_params.smartvideo_closing = true;
smartvideo_params.smartvideo_opened = false;
clearSwapFunc();
smart_z_lock();
}
//Replace the bar image
if(!smartvideo_params.smartvideo_widescreen[idx])
{
$("#smartvideo_lowerbar"+idx).attr('src','http://www.elocallink.tv/zyte/zyte_images/tourlowerbar.png');
}
else
{
$("#smartvideo_lowerbar"+idx).attr('src','http://www.elocallink.tv/zyte/zyte_images/tourlowerbar_wide.png');
}
//Hide elements of the video tool for closing
$('#smartvideo_flashavatar'+idx).css('display','none');
$('#smartvideo_flashavatar'+idx).attr('src','about:blank');
$('#smartvideo_icon_standard'+idx).css('display','block');
$('#smartvideo_icon_over'+idx).css('display','none');
$('#smartvideo_icon_close'+idx).css('display','none');
//Slide the video panel into the lower bar
smartvideo_params.smartvideo_closing_effectobj.MoveEffect(0, 400, 1, "smartvideo_textArea"+idx, function(){$(this).smartvideo('movebarup',idx);});
},
//Second stage of closing animation, animate the bar returning to its original slid-out position
movebarup: function(idx){
//Hide elements
$('#smartvideo_sendtofrienddiv'+idx).css('display','none');
$('#smartvideo_desctext'+idx).css('display','none');
//Get the current bar position
var cx=$('#smartvideo_lowerbarcontainer'+idx).position().left;
var cy=$('#smartvideo_lowerbarcontainer'+idx).position().top;
//Slide the bar back to its original, slid-out position
//-----------------------------------------------------------------
smartvideo_params.smartvideo_closing_effectobj.MoveEffect(smartvideo_params.smartvideo_initialX-cx, smartvideo_params.smartvideo_initialY-cy, 1, "smartvideo_lowerbarcontainer"+idx, function(){$(this).smartvideo('retractbar',idx);});
},
//Third stage of closing animation, retract the bar back into the icon
retractbar: function(idx){
var move_distance = smartvideo_params.smartvideo_playerwidth[idx]+19;
//Depending on the direction the bar originally slid out from, animate it sliding back into the icon
if(smartvideo_params.smartvideo_db_response[idx].direction=="left"){
smartvideo_params.smartvideo_closing_effectobj.MoveEffect(move_distance, 0, 1, "smartvideo_lowerbar"+idx, function(){$(this).smartvideo('closeEnded',idx);});
}
else{
smartvideo_params.smartvideo_closing_effectobj.MoveEffect(-1*move_distance, 0, 1, "smartvideo_lowerbar"+idx, function(){$(this).smartvideo('closeEnded',idx);});
}
},
//Finalize avatar closing animation
closeEnded: function(idx){
$('#smartvideo_avatar'+idx).css('display','none');
$('#smartvideo_flashavatar'+idx).attr('src','about:blank');
$('#smartsite_smartvideo'+idx).css('zIndex',smartvideo_params.smartvideo_originalZ);
if(smartvideo_params.smartvideo_swapping==false){
smartvideo_params.smartvideo_closing=false;
smartvideo_params.smartvideo_now_opened=-1;
smart_z_unlock();
}
}
}
//Check if the video should be auto-centered, if so, calculate the center
//-----------------------------------------------------------------
$.smartvideo_checkAutoCenter = function(num){
//If the video should be auto-centered, calculate the center
//-----------------------------------------------------------------
var smartvideo_offset = $('#smartsite_smartvideo'+num).offset();
var smartvideo_leftDistance= smartvideo_offset.left;
var smartvideo_topDistance = smartvideo_offset.top;
var scrolldist = $(document).scrollTop();
if(smartvideo_params.smartvideo_db_response[num].autocenter==true){
smartvideo_params.smartvideo_db_response[num].left= ($(window).width()-smartvideo_params.smartvideo_playerwidth[num])/2 - smartvideo_leftDistance;
smartvideo_params.smartvideo_db_response[num].top=$(window).height()/2-smartvideo_topDistance+141+scrolldist;
}
//Set the direction the avatar panel should slide out
//-----------------------------------------------------------------
if(smartvideo_params.smartvideo_db_response[num].left>-120)
{
smartvideo_params.smartvideo_db_response[num].dir='right';
}
else
{
smartvideo_params.smartvideo_db_response[num].dir='left';
}
}
//Update the position of elements within the smartvideo panel HTML
//-----------------------------------------------------------------
$.smartvideo_refreshDependentPositions = function(num){
if($("#smartvideo_desctext"+num).length != 0){
$("#smartvideo_desctext"+num).css('left', (Number(smartvideo_params.smartvideo_db_response[num].left)+23)+"px");
$("#smartvideo_desctext"+num).css('top', (Number(smartvideo_params.smartvideo_db_response[num].top)+17+26)+"px");
}
}
//Show the 'send to friend' div with no auto-close timeout
//-----------------------------------------------------------------
$.smartvideo_showFriendDivNoTimeout = function(num){
$('#smartvideo_flashavatar'+num).css('display','none').attr('src','about:blank');
$('#smartvideo_sendtofrienddiv'+num).css('display','block');
}
//Replay the movie
//-----------------------------------------------------------------
$.smartvideo_playMovReset = function(num){
//Set iframe source to player page to show video
$("#smartvideo_flashavatar"+num).attr('src','http://www.elocallink.tv/sandbox2/large_viewer_no_mid_debug.php?def_vhost='+smartvideo_params.smartvideo_db_response[num].def_vhost+'&dir_path='+smartvideo_params.smartvideo_db_response[num].dir_path+'&movie='+smartvideo_params.smartvideo_db_response[num].movie+'&allow_wider='+smartvideo_params.smartvideo_widescreen[num]).css('display','block');
$('#smartvideo_sendtofrienddiv'+num).css('display','none');
}
//Show/hide smartphone carrier dropdown
//-----------------------------------------------------------------
$.smartvideo_toggleSmartphone = function(num){
if($("#smartvideo_sendTypeGroupSmartphone"+num).attr('checked')){
$("#smartvideo_carrier"+num).css('display','block');
}
else{
$("#smartvideo_carrier"+num).css('display','none');
}
}
//Process the 'send to friend' form
//-----------------------------------------------------------------
$.smartvideo_sendTheForm = function(num){
//Check that e-mail address was entered
if($("#smartvideo_sendaddress"+num).val()=="") alert("Please enter an e-mail address.");
else{
//Check if copy should be sent to SmartConnect owner
if($("#smartvideo_sendCC"+num).attr('checked')) sendCC = "true";
else sendCC = "false";
//Set e-mailing variables
senderEmail = $("#smartvideo_fromaddress"+num).val();
recipientEmail = $("#smartvideo_sendaddress"+num).val();
if($("#smartvideo_sendTypeGroupEmail"+num).attr('checked')) sendType = "email";
else if($("#smartvideo_sendTypeGroupSmartphone"+num).attr('checked')) sendType = "smartphone";
if($("#smartvideo_sendNetReceipt"+num).attr('checked')) requestNetReceipt = "1";
else requestNetReceipt = "0";
//Check for valid e-mail address with regular expression
var emailRE = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var cellRE = /^(\d{10})$/;
var carrier =$("#smartvideo_carrier"+num).val();
if(sendType == 'email')
{
if(!recipientEmail.match(emailRE) || !senderEmail.match(emailRE)){
alert("Please enter sender and receipient e-mail addresses in the format recipient@domain.com");
return;
}
}
else
{
//send via cellphone
if(!recipientEmail.match(cellRE))
{
alert("Please enter sender cell number in the format xxxxxxxxxx");
return;
}
else if(carrier == 'carrier')
{
alert("Please choose a carrier");
return;
}
}
var pageURL = getPageURL();
var queryString = escape(getQueryString());
//Track this share by posting universal_tracking script page to an iframe
$("#smartvideo_postframe2-"+num).attr('src','http://www.smartsite.tv/tracking/universal_tracking.php?pid='+smart_oid+'&insert_type=sharewebvideo&etx='+smartvideo_params.smartvideo_db_response[num].enc_tag+'&cc='+sendCC+'&from_email='+senderEmail+'&to_email='+recipientEmail);
//Post the e-mailing script to an iframe in order to send the e-mail
$('#smartvideo_postframe'+num).attr('src','http://www.smartsite.tv/scripts/share_video_with_mid_v2.php?to='+recipientEmail+'&from='+senderEmail+'&sendtype='+sendType+'&netrec='+requestNetReceipt+'&cc_biz='+sendCC+'&addt_qstring='+queryString+'&enctcid='+smartvideo_params.smartvideo_trackingClientIDs[num]+'&encpid='+smart_oid+'&typeofplayer=smartVideoPopUp&carrier='+carrier+'&cc_email='+smartvideo_params.smartvideo_CCEmail[num]+'&page_url='+pageURL+'&unique_id='+num);
//Cleaer the send to friend form
$("#smartvideo_fromaddress"+num).val('');
$("#smartvideo_sendaddress"+num).val('');
$('#smartvideo_response'+num).text('Message Sent');
setTimeout(function(){
$(this).smartvideo('close',num);
$('#smartvideo_response'+num).html('');
}, 2000);
}
}
//Open the pop-up click to call window
//-----------------------------------------------------------------
$.smartvideo_click_to_call = function(e, pos){
if (!e) return;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
window.open('http://www.smartsite.tv/full_modules/click_to_call/remote_ctc.php?pid='+smart_oid,'click_to_call_window','width=400,height=200,toolbar=no,location=no,status=no,menubar=no');
}
$.fn.smartvideo = function( method ) {
if ( smartvideo_methods[method] ) {
//write_log('execute a method of smartvideo :'+method);
return smartvideo_methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
//write_log('initialize smartvideo');
return smartvideo_methods.init.apply( this, arguments );
} else {
$.error( 'Method ' + method + ' does not exist on jQuery.smartvideo' );
}
};
$.load_ctt = function(target_div, imagesrc, text, w, h, pos){
if(imagesrc!=null){
$.writeImage(imagesrc, target_div, w, h, 'cursor:pointer;', 'onclick="window.open(\'http://www.smartsite.tv/full_modules/click_to_text/remote_ctt.php?pid='+smart_oid+'\',\'click_to_text_window\',\'width=400,height=300,toolbar=no,location=no,status=no,menubar=no\'); return false;"', 'ctt'+pos);
}
else{
$("#"+target_div).html(""+text+" ");
}
}
var smartlibrary = function(){
var smart_oid = "y9xBpy74";
var SMARTLIBRARY_WIDTH = 552; //this width includes shadow on the left/right edge
var DESCTEXT_TOP_OFFSET = 16; //the top offset of the text on the lower bar relative to the top edge of the bar
var DESCTEXT_LEFT_OFFSET = 23;//the left offset of the text on the lower bar relative to the left edge of the lower bar
var PLAYER_LEFT_OFFSET = 9; //the left offset of the video player(flashavatar div) relative to the left edge of the lower bar
var PLAYER_RIGHT_OFFSET = 8; //the width of shadow of the player on the right side
var PLAYER_TOP_OFFSET = 38; //the top offset of the video player(falshavatar div) relative to the upper edge of the smartlibrary_videoArea div
var PLAYER_HEIGHT = 330; //the height of the smartlibrary_flashavatar div
var LOWERBAR_UPPER_SHADOW_HEIGHT = 8;
var VIDEO_CONTAINER_HEIGHT = 368; //the height of the smartlibrary_videoContainer div
var LOWERBAR_HEIGHT = 47;
var TESTIMONIAL_PANEL_WIDTH = 170;
var TESTIMONIAL_PANEL_TOP_SHADOW = 6;
var p = {
opening: false,
closing: false,
opened: false,
swapping: false,
now_opened:-1,
originalZ: 0,
initialX: [],
initialY: [],
currentPos: -1,
nowPlaying: -1,
db_response: [],
lcodes: [],
activation_begun: [],
custom_pos: [],
autocenter_vars: [],
numFaces_original: [],
testimonialsContent: [],
trackingClientIDs: [],
ccEmail: [],
netReceipts: [],
opening_effectobj:new RemoteEffects(),
closing_effectobj:new RemoteEffects(),
click_effectobj:new RemoteEffects(),
mtoplay:[], //global
pos_values: [], //global
cookie_based_open_allowed: [] //global
};
function custom_pos(x,y,dir) {
this.x=x;
this.y=y;
this.dir=dir;
}
function init_smartlibrary(target_div, image, image2, image3, w, h, lcode, open_x, open_y, open_direction, autoc, pos, autoopen, netReceiptID)
{
var $target = $(target_div);
var $icon_standard_div = $('');
var $icon_over_div = $('');
var $icon_close_div = $('');
p.netReceipts[pos] = netReceiptID;
p.pos_values.push(pos);
p.lcodes[pos] = lcode;
p.activation_begun[pos] = false;
p.mtoplay[pos] = 0;
p.originalZ = $target.css('zIndex');
p.autocenter_vars[pos] = autoc != null ? autoc: null;
if(autoopen=="true")
p.cookie_based_open_allowed.push(true);
else
p.cookie_based_open_allowed.push(false);
if(open_x != null && open_y != null && open_direction != null)
{
p.custom_pos[pos]=new custom_pos(open_x,open_y,open_direction);
}
else
p.custom_pos[pos]=null;
//Create divs for buttons
//*******************************************************************************************************************************************************************
$target.width(w).height(h);
$icon_standard_div.css({'position':'absolute','width':w+'px', 'height': h+'px'});
$icon_over_div.css({'position':'absolute','width':w+'px', 'height': h+'px', 'display':'none'});
$icon_close_div.css({'position':'absolute','width':w+'px', 'height': h+'px', 'display':'none'});
//append the icon divs to the target div
$target.append($icon_standard_div, $icon_over_div, $icon_close_div);
//Write button images
//*******************************************************************************************************************************************************************
$.writeImage(image, "smartlibrary_icon_standard"+pos, w, h, '', 'class="smartlibrary_icon"', 'smartlibrary_image'+pos);
$.writeImage(image2, "smartlibrary_icon_over"+pos, w, h, '', 'class="smartlibrary_icon"', 'smartlibrary_image_over'+pos);
$.writeImage(image3, "smartlibrary_icon_close"+pos, w, h, '', 'class="smartlibrary_icon"', 'smartlibrary_image_close'+pos);
if(isMobile.any())
{
$("#smartlibrary_image"+pos).bind('touchstart',function(){smartlibrary_showRollover(pos)}).bind('touchend',function(){
activate_smartlibrary(pos);
});
}
else
{
$("#smartlibrary_image"+pos).bind('mouseover',function(){smartlibrary_showRollover(pos)});
$("#smartlibrary_image_over"+pos).bind('mouseout',function(){smartlibrary_hideRollover(pos)}).bind('click',function(){activate_smartlibrary(pos)});
}
$("#smartlibrary_image_close"+pos).bind('click',function(){close_smartlibrary(pos)});
}
function smartlibrary_checkAutoCenter(num){
var smartlibrary_offset = $('#smartsite_smartlibrary'+num).offset();
var smartlibrary_leftDistance= smartlibrary_offset.left;
var smartlibrary_topDistance = smartlibrary_offset.top;
var scrolldist = $(document).scrollTop();
var y_offset = (VIDEO_CONTAINER_HEIGHT + LOWERBAR_HEIGHT - LOWERBAR_UPPER_SHADOW_HEIGHT)/2 - LOWERBAR_HEIGHT;
//If the smartlibrary should be auto-centered, calculate the center
//-----------------------------------------------------------------
if(p.autocenter_vars[num]){
p.db_response[num].left = ($(window).width() - SMARTLIBRARY_WIDTH)/2 - smartlibrary_leftDistance;
p.db_response[num].top = $(window).height()/2 - smartlibrary_topDistance + y_offset + scrolldist;
if(p.db_response[num].left>-120)
p.db_response[num].direction='right';
else
p.db_response[num].direction='left';
}
}
function smartlibrary_refreshDependentPositions(num){
if($("#smartlibrary_desctext"+num).length > 0){
$("#smartlibrary_desctext"+num).css({'left': (Number(p.db_response[num].left) + DESCTEXT_LEFT_OFFSET)+"px", 'top': (Number(p.db_response[num].top) + DESCTEXT_TOP_OFFSET)+"px"});
}
}
//*******************************************************************************************************************************************************************
//Show button rollover
//*******************************************************************************************************************************************************************
function smartlibrary_showRollover(num)
{
$('#smartlibrary_icon_standard'+num).css('display','none');
$('#smartlibrary_icon_over'+num).css('display','block');
$('#smartlibrary_icon_close'+num).css('display','none');
}
//*******************************************************************************************************************************************************************
//Hide button rollover
//*******************************************************************************************************************************************************************
function smartlibrary_hideRollover(num)
{
if(!p.opening){
$('#smartlibrary_icon_standard'+num).css('display','block');
$('#smartlibrary_icon_over'+num).css('display','none');
$('#smartlibrary_icon_close'+num).css('display','none');
}
}
function activate_smartlibrary(num)
{
if($('#smartsite_smartlibrary'+num).length == 0) return;
if(p.activation_begun[num]==false){
p.activation_begun[num]=true;
$.addScript("http://www.smartsite.tv/full_modules/smartsite_responderV2.php?action_request=load_smartlibrary&pos="+num+"&lcode="+p.lcodes[num]+"&pid="+smart_oid, 1);
}
else if(p.db_response[num]!=null)
open_smartlibrary(num);
}
//Begin opening the SmartLibrary tool
//-----------------------------------------------------------------
function open_smartlibrary(num)
{
smartlibrary_checkAutoCenter(num);
smartlibrary_refreshDependentPositions(num);
if(p.opening || p.closing) return;
//Check to see if opening is allowed
//-----------------------------------------------------------------
if(smartsite_requestPermission()==false) return;
//set the current video to be the first one on the list
p.nowPlaying=0;
p.currentPos=num;
$('#smartsite_smartlibrary'+num).css('zIndex','1000');
$('#smartlibrary_icon_standard'+num).css('display','none');
$('#smartlibrary_icon_over'+num).css('display','none');
$('#smartlibrary_icon_close'+num).css('display','block');
var lowerbar_topDist=$("#smartsite_smartlibrary"+num).height()/2 - LOWERBAR_HEIGHT/2;
if(p.db_response[num].direction == "left")
{
$('#smartlibrary_lowerbarcontainer'+num).css({'top': lowerbar_topDist +'px', 'left':-1*SMARTLIBRARY_WIDTH+'px'});
$('#smartlibrary_lowerbar'+num).css('left',SMARTLIBRARY_WIDTH + 'px');
p.opening_effectobj.MoveEffect(-1*SMARTLIBRARY_WIDTH , 0, 1, "smartlibrary_lowerbar"+num, function(){
smartlibrary_moveBarDown(num);
});
}
else
{
$('#smartlibrary_lowerbarcontainer'+num).css({'top': lowerbar_topDist +'px', 'left':$('#smartsite_smartlibrary'+num).width()+'px'});
$('#smartlibrary_lowerbar'+num).css('left',-1 * SMARTLIBRARY_WIDTH + 'px');
p.opening_effectobj.MoveEffect(SMARTLIBRARY_WIDTH , 0, 1, "smartlibrary_lowerbar"+num, function(){
smartlibrary_moveBarDown(num);
});
}
p.opening = true;
//lock opening/closing activity
smart_z_lock();
$('#smartlibrary_avatar'+num).css('display','block');
}
//Perform the second stage of the animation, moving the sliding bar into the position that the video will appear in
//-----------------------------------------------------------------
function smartlibrary_moveBarDown(num)
{
p.initialX[num] = $('#smartlibrary_lowerbarcontainer'+num).position().left;
p.initialY[num] = $('#smartlibrary_lowerbarcontainer'+num).position().top;
p.opening_effectobj.MoveEffect(p.db_response[num].left - p.initialX[num], p.db_response[num].top - p.initialY[num], 1, "smartlibrary_lowerbarcontainer"+num, function(){smartlibrary_showVideoPanel(num);});
}
//Perform the third stage of the animation, sliding the video panel out of the bar
//-----------------------------------------------------------------
function smartlibrary_showVideoPanel(num)
{
var left_offset = $('#smartlibrary_lowerbarcontainer'+num).position().left;
var top_offset = $('#smartlibrary_lowerbarcontainer'+num).position().top;
//Put panel div in correct position-----------------------------------------------
$('#smartlibrary_videoContainer'+num).css({'left': left_offset + 'px' , 'top': top_offset - VIDEO_CONTAINER_HEIGHT + LOWERBAR_UPPER_SHADOW_HEIGHT + 'px'});
$('#smartlibrary_videoArea'+num).css('top',VIDEO_CONTAINER_HEIGHT + 'px');
$('#smartlibrary_flashavatar'+num).css({'left': PLAYER_LEFT_OFFSET +'px', 'top': PLAYER_TOP_OFFSET + 'px' });
//p.opening_effectobj.MoveEffect(0, -1 * VIDEO_CONTAINER_HEIGHT, 1.5, "smartlibrary_videoArea"+num, function(){smartlibrary_fullyOpened(num);});
p.opening_effectobj.MoveEffect(0, -1 * VIDEO_CONTAINER_HEIGHT, 1.5, "smartlibrary_videoArea"+num, function(){smartlibrary_showTestimonial(num);});
}
//Perform the fourth stage of the animation, sliding the testimonial panel out of the video container
//-----------------------------------------------------------------
function smartlibrary_showTestimonial(num)
{
var left_offset = $('#smartlibrary_videoContainer'+num).position().left;
var top_offset = $('#smartlibrary_videoContainer'+num).position().top;
//put testimonial panel in correct position
$('#smartlibrary_testimonial_panel'+num).css({'left': left_offset + SMARTLIBRARY_WIDTH - PLAYER_RIGHT_OFFSET + 'px', 'top': top_offset + PLAYER_TOP_OFFSET - TESTIMONIAL_PANEL_TOP_SHADOW + 'px', 'display':'block'});
$('#smartlibrary_testimonial_container'+num).css('left',-1 * TESTIMONIAL_PANEL_WIDTH + 'px').css('top','0px');
//always set the scrollTop to 0 for the testimonial content when refreshing the page
$('#smartlibrary_testimonialContent'+num).scrollTop(0);
open_testimonial_panel(num,smartlibrary_fullyOpened);
}
function playVideo(num,idx)
{
if(!$('#smartlibrary_sendtofrienddiv'+num).is(':visible') && !p.closing)
{
//only play the video when the share div is not visible
$('#smartlibrary_flashavatar'+num).attr('src','http://www.elocallink.tv/sandbox2/large_viewer.php?value='+p.db_response[num].videos[idx].mid).fadeIn();
}
}
function smartlibrary_fullyOpened(num)
{
smartlibrary_highlight(p.mtoplay[num], num);
playVideo(num,p.mtoplay[num]);
var ctitle = p.db_response[num].videos[p.mtoplay[num]].short_moviename;
$('#smartlibrary_desctext'+num).text(ctitle).css('display','block');
$("#smartlibrary_postframe2nd"+num).attr('src', 'http://www.smartsite.tv/tracking/universal_tracking.php?pid=' + smart_oid + '&insert_type=webvideo&etx=' + p.db_response[num].videos[p.mtoplay[num]].enc_moviename);
$.overwriteImage("http://www.elocallink.tv/zyte/zyte_images/talklowerbarpartialV2.png","smartlibrary_lowerbarcontainer"+num, 552,47, '','class="smartlibrary_img"', 'smartlibrary_lowerbar'+num);
p.opening=false;
smart_z_unlock();
p.opened=true;
setSwapFunc(close_smartlibrary, num);
}
function close_testimonial_panel(num, callback)
{
$('#smartlibrary_testimonial_closebtn'+num).css('display','none');
$('#smartlibrary_testimonial_container'+num).animate({left:-1*TESTIMONIAL_PANEL_WIDTH}, 1000, function(){
if(!p.closing)
$('#smartlibrary_testimonial_openbtn'+num).fadeIn('fast');
if(callback)
{
callback(num);
}
});
}
function open_testimonial_panel(num, callback)
{
$('#smartlibrary_testimonial_openbtn'+num).css('display','none');
$('#smartlibrary_testimonial_container'+num).animate({left: 0}, 1000, function(){
$('#smartlibrary_testimonial_closebtn'+num).fadeIn('fast');
if(callback)
{
callback(num);
}
});
}
function smartlibrary_highlight(video_idx, num)
{
if(!$('#smartlibrary_link'+video_idx+'-'+num).hasClass('smartlibrary_highlighted'))
{
$('.smartlibrary_aTestimonialDiv .smartlibrary_highlighted').removeClass('smartlibrary_highlighted');
$('#smartlibrary_link'+video_idx+'-'+num).addClass('smartlibrary_highlighted');
}
}
function load_smartlibrary_func(r, pos)
{
p.trackingClientIDs[pos] = r.enc_tcid;
p.ccEmail[pos] = r.remote_cc_email;
p.numFaces_original[pos]=r.videos.length;
if(p.custom_pos[pos]!=null){
r.left = p.custom_pos[pos].x;
r.top = p.custom_pos[pos].y;
r.direction = p.custom_pos[pos].dir;
}
if(p.autocenter_vars[pos]!=null){
if(p.autocenter_vars[pos]=="false")
p.autocenter_vars[pos]=0;
else if(p.autocenter_vars[pos]=="true")
p.autocenter_vars[pos]=1;
r.autocenter=p.autocenter_vars[pos];
}
p.db_response[pos]= r;
//create children nodes for smartsite_smartlibrary div
var $postframe = $('');
var $postframe2 = $('');
var $smartlibrary_avatar = $('');//video player container
$('#smartsite_smartlibrary'+pos).append($postframe, $postframe2, $smartlibrary_avatar);
//create children nodes for $smartlibrary_avatar
var $lowerbar_container = $('');
var $desctext = $('');//the text on the lower bar
var $video_container = $('');
var $testimonial_panel = $('');
$desctext.css({'left': (Number(p.db_response[pos].left)+23) + 'px', 'top': (Number(p.db_response[pos].top)+16) + 'px' });
$smartlibrary_avatar.append($lowerbar_container, $desctext, $video_container, $testimonial_panel);
//create child node for $video_container
var $video_area = $('');
$video_container.append($video_area);
//create children nodes for $video_area
var $video_bg_imageholder = $('');
var $flashavatar = $('');
var $sharediv = $('');
var $smartlibrary_closebtn = $('');
var $sendtofriend_btn = $('');
//bind event listeners to the close button
$smartlibrary_closebtn.bind('mouseover',function(){
$(this).attr('src', 'http://www.elocallink.tv/zyte/zyte_images/closebuttonbright.jpg');
}).bind('mouseout', function(){
$(this).attr('src', 'http://www.elocallink.tv/zyte/zyte_images/closebutton.jpg');
}).bind('click', function(){close_smartlibrary(pos);});
//bind event listeners to the sendtofriend button
$sendtofriend_btn.bind('mouseover',function(){
$(this).attr('src', 'http://www.elocallink.tv/zyte/zyte_images/emailbright.jpg');
}).bind('mouseout', function(){
$(this).attr('src', 'http://www.elocallink.tv/zyte/zyte_images/email.jpg');
}).bind('click', function(){showShareDiv(pos);});
//$video_area.append($video_bg_imageholder,$flashavatar, $sharediv, $testimonial_panel, $smartlibrary_closebtn, $sendtofriend_btn);
$video_area.append($video_bg_imageholder,$flashavatar, $sharediv, $smartlibrary_closebtn, $sendtofriend_btn);
//create children nodes for $sharediv
var $sharediv_subject = $('
Would you like to share this with a friend?
');
var $sharediv_fields_container = $('');
var $sharediv_response = $('');
$sharediv.append($sharediv_subject, $sharediv_fields_container, $sharediv_response);
//create children nodes for $testimonial_panel
var $testimonial_container = $('');
var $testimonialContent = $('');
var $testimonialList = $('');
var $testimonial_closebtn = $('');
var $testimonial_openbtn = $('');
//if the index isn't valid, reset the index of the video to be played
if(p.mtoplay[pos]>=r.videos.length || p.mtoplay[pos] < 0)
{
p.mtoplay[pos] = 0;
}
$.each(r.videos, function(key, obj){
$testimonialList.append('
'+obj.moviename+'
');
});
$testimonialList.find('.smartlibrary_aTestimonialDiv').bind('click',function(){
var current_link_idx = $(this).index();
smartlibrary_changeMov(current_link_idx,pos);
});
$testimonial_closebtn.bind('click',function(){close_testimonial_panel(pos);});
$testimonial_openbtn.bind('click',function(){open_testimonial_panel(pos);});
$testimonialContent.append($testimonialList);
$testimonial_container.append($testimonialContent);
$testimonial_panel.append($testimonial_container,$testimonial_openbtn, $testimonial_closebtn);
//create children nodes for $sharediv_fields_container
var recipient_address_field = '';
var sender_address_field = '';
var sendType_byEmail_radio = '';
var sendType_byPhone_radio = '';
var sendCC_chk = '';
var sendNetReceipt_chk = '';
var send_button = '';
var carrier = '';
$sharediv_fields_container.html('Recipient Address (e.g. jane@site.com) ' + recipient_address_field + ' Sender Address (e.g. jane@site.com) ' + sender_address_field + ' ' + sendType_byEmail_radio + 'Send via e-mail ' + sendType_byPhone_radio + 'Send via SmartPhone '+carrier+' ' + sendCC_chk + 'CC email to this video\'s owner ' + sendNetReceipt_chk + 'Request net receipt
'+send_button);
$('input[name="smartlibrary_sendTypeGroup'+pos+'"]').bind('change',function(){
smartlibrary_toggleSendType(pos);
});
$('#shareform_send_btn'+pos).bind('click',function(e){
e.preventDefault();
smartlibrary_sendTheForm(pos);
});
$.writeImage("http://www.elocallink.tv/zyte/zyte_images/talklowerbarV2.png","smartlibrary_lowerbarcontainer"+pos, 552, 47, '','class="smartlibrary_img"', "smartlibrary_lowerbar"+pos);
$.writeImage("http://www.elocallink.tv/zyte/zyte_images/talkupper_smartV2.png", "smartlibrary_player_imgholder"+pos, 552,368, "","","");
if(p.netReceipts[pos]!=""){
$postframe.attr('src', 'http://www.smartsite.tv/client_sites/shared/remote_netrec_check.php?evid='+p.netReceipts[pos]);
}
open_smartlibrary(pos);
}
//first stage of closing animation, hide the testimonial panel if it is open
function close_smartlibrary(num)
{
if(p.closing==true || p.opening==true) return;
p.closing = true;
smart_z_lock();
p.opened = false;
clearSwapFunc();
if($('#smartlibrary_testimonial_closebtn'+num).is(':visible'))
{
close_testimonial_panel(num, smartlibrary_hideVideoPanel);
}
else
{
$('#smartlibrary_testimonial_openbtn'+num).hide();
smartlibrary_hideVideoPanel(num);
}
}
//second stage of closing animation, hide the video
function smartlibrary_hideVideoPanel(num)
{
//write_log('from callback hide video panel');
$.overwriteImage("http://www.elocallink.tv/zyte/zyte_images/talklowerbarV2.png", "smartlibrary_lowerbarcontainer"+num, 552,47, '','', "smartlibrary_lowerbar"+num);
$('#smartlibrary_flashavatar'+num).css('display','none').attr('src','about:blank');
$('#smartlibrary_icon_standard'+num).css('display','block');
$('#smartlibrary_icon_over'+num).css('display','none');
$('#smartlibrary_icon_close'+num).css('display','none');
p.closing_effectobj.MoveEffect(0, VIDEO_CONTAINER_HEIGHT, 1.5, "smartlibrary_videoArea"+num, function(){
smartlibrary_movebarup(num);
});
}
//Third stage of closing animation, animate the bar returning to its original slid-out position
function smartlibrary_movebarup(num)
{
$('#smartlibrary_sendtofrienddiv'+num).css('display','none');
$('#smartlibrary_desctext'+num).css('display','none');
var cx=$('#smartlibrary_lowerbarcontainer'+num).position().left;
var cy=$('#smartlibrary_lowerbarcontainer'+num).position().top;
p.closing_effectobj.MoveEffect(p.initialX[num]-cx, p.initialY[num]-cy, 1, "smartlibrary_lowerbarcontainer"+num, function(){
smartlibrary_retractBar(num);
});
}
//Fourth stage of closing animation, retract the bar back into the icon
function smartlibrary_retractBar(num)
{
if(p.db_response[num].direction=="left"){
p.closing_effectobj.MoveEffect(SMARTLIBRARY_WIDTH, 0, 1, "smartlibrary_lowerbar"+num, function(){smartlibrary_closeEnded(num);});
}
else{
p.closing_effectobj.MoveEffect(-1 * SMARTLIBRARY_WIDTH, 0, 1, "smartlibrary_lowerbar"+num, function(){smartlibrary_closeEnded(num);});
}
}
//Finalize smartlibrary closing animation
function smartlibrary_closeEnded(num){
$('#smartlibrary_testimonial_openbtn'+num).css('display','none');
$('#smartlibrary_testimonial_closebtn'+num).css('display','block');
$('#smartlibrary_testimonial_container'+num).css('left',0);
$('#smartlibrary_avatar'+num).css('display','none');
$('#smartlibrary_testimonial_panel'+num).css('display','none');
$('#smartsite_smartlibrary'+num).css('zIndex',p.originalZ);
smartlibrary_highlight(p.mtoplay[num],num);
p.closing = false;
smart_z_unlock();
}
//show the share form
function showShareDiv(num)
{
$('#smartlibrary_flashavatar'+num).css('display','none').attr('src','about:blank');
$('#smartlibrary_sendtofrienddiv'+num).fadeIn();
}
function smartlibrary_toggleSendType(num)
{
if($('#smartlibrary_sendTypeGroupSmartphone'+num).attr('checked')){
$("#smartlibrary_carrier"+num).css('display','block');
}
else{
$("#smartlibrary_carrier"+num).css('display','none');
}
}
function smartlibrary_sendTheForm(num)
{
var sendType = "email";
var recipientEmail = $("#smartlibrary_recipientAddress"+num).val();
var senderEmail = $("#smartlibrary_senderAddress"+num).val();
var sendCC = "false";
var requestNetReceipt = "0";
if($("#smartlibrary_sendTypeGroupSmartphone"+num).attr('checked'))
sendType = "smartphone";
if(recipientEmail =="" && sendType=="email")
alert("Please enter a recipient e-mail address.");
else if(recipientEmail =="" && sendType=="smartphone")
alert("Please enter a phone number.");
else{
if($("#smartlibrary_sendCC"+num).attr('checked'))
sendCC = "true";
if($("#smartlibrary_sendNetReceipt"+num).attr('checked'))
requestNetReceipt = "1";
var emailRE = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var cellRE = /^(\d{10})$/;
var carrier = document.getElementById("smartlibrary_carrier"+num).value;
if(sendType == 'email')
{
if(!recipientEmail.match(emailRE) || !senderEmail.match(emailRE)){
alert("Please enter sender and receipient e-mail addresses in the format recipient@domain.com");
return;
}
}
else
{
//send via cellphone
if(!recipientEmail.match(cellRE))
{
alert("Please enter recipient cell number in the format xxxxxxxxxx");
return;
}
else if(carrier == 'carrier')
{
alert("Please choose a carrier");
return;
}
}
var pageURL = getPageURL();
var queryString = escape(getQueryString());
$('#smartlibrary_postframe'+num).attr('src','http://www.smartsite.tv/scripts/share_video_with_mid_v2.php?to='+recipientEmail+'&from='+senderEmail+'&sendtype='+sendType+'&netrec='+requestNetReceipt+'&cc_biz='+sendCC+'&addt_qstring='+queryString+'&enctcid='+p.trackingClientIDs[num]+'&encpid='+smart_oid+'&typeofplayer=smartLibraryPopUp&carrier='+carrier+'&cc_email='+p.ccEmail[num]+'&page_url='+pageURL+'&unique_id='+num+'¤tPlaying='+p.nowPlaying);
$('#smartlibrary_postframe2nd'+num).attr('src','http://www.smartsite.tv/tracking/universal_tracking.php?pid='+smart_oid+'&insert_type=sharewebvideo&etx='+p.db_response[num].videos[p.nowPlaying].enc_moviename+"&cc="+sendCC+"&from_email="+senderEmail+"&to_email="+recipientEmail);
$("#smartlibrary_recipientAddress"+num).val('');
$("#smartlibrary_senderAddress"+num).val('');
$('#smartlibrary_response'+num).text('Message Sent');
setTimeout(function(){
close_smartlibrary(num);
$('#smartlibrary_response'+num).empty();
}, 2000);
}
}
function smartlibrary_changeMov(video_idx, num)
{
if($('#smartlibrary_sendtofrienddiv'+num).is(':visible'))
{
$('#smartlibrary_sendtofrienddiv'+num).fadeOut();
}
smartlibrary_highlight(video_idx, num);
//p.mtoplay[num] = video_idx;
$('#smartlibrary_flashavatar'+num).attr('src','').css('display','none');
close_testimonial_panel(num,function(num){playVideo(num,video_idx)});
p.nowPlaying = video_idx;
$('#smartlibrary_desctext'+num).text(p.db_response[num].videos[video_idx].short_moviename);
$("#smartlibrary_postframe2nd"+num).attr('src','http://www.smartsite.tv/tracking/universal_tracking.php?pid='+smart_oid+'&insert_type=webvideo&etx='+p.db_response[num].videos[video_idx].enc_moviename);
$('#smartlibrary_sendtofrienddiv'+num).css('display','none');
}
return {
mtoplay:p.mtoplay,
pos_values: p.pos_values,
open_allowed: p.cookie_based_open_allowed,
init: init_smartlibrary,
load: load_smartlibrary_func,
activate: activate_smartlibrary
}
}();
//Global function returns private vars within smartlibrary object
get_smartlibrary_vars = function()
{
return{
mtoplay: smartlibrary.mtoplay,
pos_values : smartlibrary.pos_values,
cookie_based_open_allowed: smartlibrary.open_allowed
}
}();
//Global function returns private functions within smartlibrary object
get_smartlibrary_funcs = function()
{
return{
load: function(r,pos){smartlibrary.load(r,pos)},
activate: function(pos){smartlibrary.activate(pos);}
}
}(); /*
###Default implementation
smartobject initiation
*/
$(function(){
if(!+"\v1"){smartsite_is_IE6 = ((parseFloat(navigator.userAgent.substring((navigator.userAgent.indexOf("MSIE"))+5))==6)?1:0); }
$('smartobject').smartobject();
//If the tools included on the page require smart_z_manager.js, which manages auto-opening, and there are no image icons to load, dynamically add smart_z_manager.js
//--------------------------------------------------------------------------------
if(smart_v_included==true && waitingForImageCounter==0){
$.addScript("http://www.smartsite.tv/remote/smart_z_managerV2.js", 0);
}
});
/* #AVOID COLLISIONS #*/
})(jQuery);
/* #AVOID COLLISIONS #*/
//This function not renamed 'smartavatar' because it is called from the swf file
//Change the title to the default, "Thank you. You already told us how you found us."
//-----------------------------------------------------------------
function ZyteAvatar_resetStatusDesc(){
if(jQuery){
jQuery.avatar_resetStatusDesc();
}
}