var bellHD_videoExists=0;
if (bellHD_videoExists==0) {
if ((bellHD_butImg==undefined) || (bellHD_butImg.length<=3)) { var bellHD_butImg='http://www.bellhd.com/images/blank.gif'; }
if ((bellHD_butLeft==undefined) || (bellHD_butLeft.length=0)) { var bellHD_butLeft='0px'; }
if ((bellHD_butTop==undefined) || (bellHD_butTop.length=0)) { var bellHD_butTop='0px'; }
function bellHD_addOnloadEvent(fnc){
  if ( typeof window.addEventListener != "undefined" )
    window.addEventListener( "load", fnc, false );
  else if ( typeof window.attachEvent != "undefined" ) {
    window.attachEvent( "onload", fnc );
  }
  else {
    if ( window.onload != null ) {
      var oldOnload = window.onload;
      window.onload = function ( e ) {
        oldOnload( e );
        window[fnc]();
      };
    }
    else
      window.onload = fnc;
  }
}

function cBellHdDiv() {
   var divTag = document.createElement("div");
   divTag.id = "bhdUnDivId";
   divTag.setAttribute("align", "center");
   divTag.style.margin = "0px auto";
   divTag.className = "bhdUnDivCl";
   divTag.innerHTML = '<div id="bellHD_acontainerDiv" style="z-index:1000000"><div id="bellHD_avideoDiv"></div><div id="bellHD_aplayDiv"></div><img src="'+bellHD_butImg+'" id="bellHD_butImg" style="display:none; position:absolute; left:0px; top:0px;"></div>';
   document.body.appendChild(divTag);
   
bellHD_initiatePlayer();

//Call Update Position, Generic
bellHD_updatePosition();

//Update IE Class
bellHD_updateClass();

}

bellHD_addOnloadEvent(cBellHdDiv);

//COOKIE FUNCTIONS
function bellHD_createCookie(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=/";
}

function bellHD_readCookie(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;
}

function bellHD_eraseCookie(name) {
bellHD_createCookie(name,"",-1);
}

if (bellHD_readCookie('bellHD_view_'+bellHD_videoFile)==null) { bellHD_createCookie('bellHD_view_'+bellHD_videoFile,'1',30); }
else { var bellHD_cookieVar=bellHD_readCookie('bellHD_view_'+bellHD_videoFile); }




//Div Containers
var bellHD_vSWFvar='bellHD_videoSWF';
var bellHD_vDIVvar='bellHD_avideoDiv';
var bellHD_pSWFvar='bellHD_playSWF';
var bellHD_pDIVvar='bellHD_aplayDiv';
var bellHD_cDIVvar='bellHD_acontainerDiv';


//Dimensions (video will auto-resize based on .flv dimensions ;) )
var bellHD_videoWidth=0; //not needed
var bellHD_videoHeight=0; //not needed
var bellHD_playerWidth=114;
var bellHD_playerHeight=38;

function bellHD_initiatePlayer() {
//Throw in a little padding, and offset video to correct position
document.getElementById(bellHD_vDIVvar).style.marginBottom='0px';
document.getElementById(bellHD_pDIVvar).style.marginBottom='5px';
document.getElementById(bellHD_pDIVvar).style.marginLeft='5px';

//Set Button Style
document.getElementById('bellHD_butImg').style.top=bellHD_butTop;
document.getElementById('bellHD_butImg').style.left=bellHD_butLeft;

//Create play button object
var bellHD_playButtonSWF = new SWFObject("http://files.bellmedia.com/bellhd/player/flash/bellHD_play.swf", bellHD_pSWFvar, bellHD_playerWidth, bellHD_playerHeight, "9", "#F8f8f8");
bellHD_playButtonSWF.addParam("wmode", "transparent");
bellHD_playButtonSWF.addParam("swliveconnect", "true");
bellHD_playButtonSWF.addParam("allowscriptaccess","always");
bellHD_playButtonSWF.addParam("menu","false");
bellHD_playButtonSWF.write(bellHD_pDIVvar);

//Auto play movie
if ((bellHD_autoPlay.toLowerCase()=='yes') || (bellHD_autoPlay.toLowerCase()=='playonce')) {
if (((bellHD_autoPlay.toLowerCase()=='playonce') && bellHD_cookieVar!='1') || (bellHD_autoPlay.toLowerCase()=='yes')) {
	bellHD_playMovie();
   }
}

}

//Update position based on bellHD_videoPosition variable
function bellHD_updatePosition() {
if (bellHD_videoPosition=='bottomleft') {
	document.getElementById(bellHD_cDIVvar).style.position='fixed';
	document.getElementById(bellHD_cDIVvar).style.bottom='0px';
	document.getElementById(bellHD_cDIVvar).style.left='0px';
}
else if (bellHD_videoPosition=='bottomright') {
	document.getElementById(bellHD_cDIVvar).style.position='fixed';
	document.getElementById(bellHD_cDIVvar).style.bottom='0px';
	document.getElementById(bellHD_cDIVvar).style.right='0px';
}
else if (bellHD_videoPosition=='topleft') {
	document.getElementById(bellHD_cDIVvar).style.position='fixed';
	document.getElementById(bellHD_cDIVvar).style.top='0px';
	document.getElementById(bellHD_cDIVvar).style.left='0px';
}
else if (bellHD_videoPosition=='topright') {
	document.getElementById(bellHD_cDIVvar).style.position='fixed';
	document.getElementById(bellHD_cDIVvar).style.top='0px';
	document.getElementById(bellHD_cDIVvar).style.right='0px';
}
else if (bellHD_videoPosition=='inline') {
	document.getElementById(bellHD_cDIVvar).style.position='absolute';
	document.getElementById(bellHD_cDIVvar).style.top='0px';
	document.getElementById(bellHD_cDIVvar).style.right='0px';
}
else if (bellHD_videoPosition=='inlineA') {
	document.getElementById(bellHD_cDIVvar).style.position='fixed';
	document.getElementById(bellHD_cDIVvar).style.display='inline';
	document.getElementById(bellHD_cDIVvar).style.bottom='0px';
	document.getElementById(bellHD_cDIVvar).style.left='35%';
}
else if (bellHD_videoPosition=='cusTafe') {
	document.getElementById(bellHD_cDIVvar).style.position='fixed';
	document.getElementById(bellHD_cDIVvar).style.bottom='0px';
	document.getElementById(bellHD_cDIVvar).style.left='100px';
}
else if (bellHD_videoPosition=='leftIn') {
	document.getElementById(bellHD_cDIVvar).style.position='fixed';
	document.getElementById(bellHD_cDIVvar).style.bottom='0px';
	document.getElementById(bellHD_cDIVvar).style.left='220px';
}
}



//Trace SWF action for play button, when clicked do something
function bellHD_playSWF_DoFSCommand(command, args) {
if (command == "playMovie") {
	bellHD_playMovie();
}
}

//Trace SWF actions for video
function bellHD_videoSWF_DoFSCommand(command, args) {
if (command == "stopMovie") {
	bellHD_stopMovie();
}
if (command == "sendWidth") {
	bellHD_videoWidth=args;
}
if (command == "sendHeight") {
	bellHD_videoHeight=args;
	bellHD_updateVidDimensions();
}
if (command == "sendTime") {
	bellHD_sendTime(args);
}

}

//resize video dimensions based on set variables (ie, when .flv loads and returns size)
function bellHD_updateVidDimensions() {
document.getElementById(bellHD_vSWFvar).width=bellHD_videoWidth;
document.getElementById(bellHD_vSWFvar).height=bellHD_videoHeight;
}

//Initiate video playback
function bellHD_playMovie() {
document.getElementById(bellHD_vDIVvar).innerHTML=''; //Clear existing movies if exist.
var bellHD_videoSWF = new SWFObject("http://files.bellmedia.com/bellhd/player/flash/bellHD_video_new.swf", bellHD_vSWFvar, bellHD_videoWidth, bellHD_videoHeight, "9", "#F8f8f8");
bellHD_videoSWF.addParam("wmode", "transparent");
bellHD_videoSWF.addParam("swliveconnect", "true");
bellHD_videoSWF.addParam("allowscriptaccess","always");
bellHD_videoSWF.addParam("menu","false");

//Send custom variables to flash video file
bellHD_videoSWF.addVariable('_vidName',bellHD_videoFile);
bellHD_videoSWF.addVariable('videoWidth',bellHD_videoWidth);
bellHD_videoSWF.addVariable('videoHeight',bellHD_videoHeight);

bellHD_videoSWF.write(bellHD_vDIVvar);
//Hide play button, show Video
document.getElementById(bellHD_pDIVvar).style.display='none';
document.getElementById(bellHD_vDIVvar).style.display='';

}

//Stop movie, bring back play button
function bellHD_stopMovie() {
document.getElementById(bellHD_pDIVvar).style.display='';
document.getElementById(bellHD_vDIVvar).style.display='none';
}

function flipButton(to) {
if (to=='hide') {
document.getElementById('bellHD_butImg').style.display='none';
} else {
document.getElementById('bellHD_butImg').style.display='';
}
}

if (bellHD_butStart==undefined) { var bellHD_butStart=0; }
if (bellHD_butLast==undefined) { var bellHD_butLast=0; }
function bellHD_sendTime(args) {
if ((args>=bellHD_butStart) && (args<=(bellHD_butStart+bellHD_butLast))) {
flipButton('show');
} else {
flipButton('hide');
}
}

bellHD_videoExists='1';
	}
	function bellHD_updateClass() { document.getElementById(bellHD_cDIVvar).className='bellHD_ieClass'; }