// JavaScript Document

var initVal = "";
var initIndex = "";
var resultsArray = window.location.search.split("=");
if (resultsArray.length > 1) {
  initVal = resultsArray[1].split("?")[0];
  initIndex = Number(resultsArray[2]);
}

function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

function updateBeingPlayedArea(initVal) {
  var name = "";
  var description = "";
  initVal = initVal.split("&")[0];
  if (videoHash[initVal]) {
    name = videoHash[initVal]['name'];
    description = videoHash[initVal]['description']
  } 
	document.getElementById("videoNameBeingPlayed").innerHTML = name;
	document.getElementById("videoDescriptionBeingPlayed").innerHTML = description;  
}

function loadswf(initVal,theVideoPlayer,width,height,color){
  if (initVal) {
    updateBeingPlayedArea(initVal);
  }

  var SWFO=new SWFObject(theVideoPlayer,"videoclips",width,height,"9",color);
  SWFO.addVariable("id",initVal);
  SWFO.write("videoPlayer");
}

function callToActionscript(videoclips, initVal) {
    updateBeingPlayedArea(initVal);
    getFlashMovie(videoclips).sendToActionscript(initVal);
}

/*
	Video tab code, cloned by Shah Khatri from the HeadlineBistro "left_sidebar_tabs"
*/
$(document).ready(function(){
  $('.video_tabs_nav').addClass('video_tabs_nav_js');
  $('.video_tab_content > div').hide();
  if(initIndex == 0)
  {
  	$('.video_tab_content > div:eq(0)').show();
  	$('.video_tabs_nav > li:eq(0) a').addClass('active');
  } else if(initIndex == 1)
  {
  	$('.video_tab_content > div:eq(1)').show();
  	$('.video_tabs_nav > li:eq(1) a').addClass('active');
  } else if(initIndex == 2)
  {
  	$('.video_tab_content > div:eq(2)').show();
  	$('.video_tabs_nav > li:eq(2) a').addClass('active');
  }
  $('.video_tabs_nav > li a').click(function(){
    $('.video_tabs_nav > li a.active').removeClass('active');
    $(this).addClass('active');
    $('.video_tab_content > div:visible').slideUp(300, showVideoTabContent);
    return false;
  });
});

function showVideoTabContent() {
  $($('.video_tabs_nav > li a.active').attr('href')).slideDown(300);
}

function termsAndConditionsPopup(popup) {
  if (popup) {
    var disclaimer = "Video Download Request"+"\n"+"\n"+"Disclaimer:"+"\n"+"\n"+"By downloading a film from Knights of Columbus, I hereby agree that permission is granted for a limited, nonexclusive license for use, and not for republication, distribution, assignment, sublicense, sale, preparation of derivative works or other use. Allowable use includes showing the film at a public event, church, youth group, or otherwise private association. Nothing in this agreement implies permission or rights to broadcast the Knights of Columbus film on television or other broadcast media without prior written consent from the Knights of Columbus."+"\n"+"\n"+"The content, organization, graphics, design, compilation, magnetic translation, digital conversion and other matters related to any Knights of Columbus film are protected under applicable copyrights, trademarks and other proprietary (including but not limited to intellectual property) rights. Copying or redistribution of Knights of Columbus films is strictly prohibited. Downloading a film does not allow the user to acquire ownership rights to any logo, content, graphics, video, or any elements contained within a Knights of Columbus film.";
    return confirm(disclaimer);
  }
  else {
    return true;
  }
}



<!--Below is an external interface call from the videos.swf file that calls the following function and passes the name of the div layer. Depending on the current class name, the class name switches back and forth between two classes (hide, show), As of 12/15 this function is disabled but will be kept until it is warrented for a later date-->

function changecss(objDivID){
  var myID = objDivID;
	if(document.getElementById(myID).className=='hide')
	{
		document.getElementById(myID).className = 'show';
	} else {
		if(document.getElementById(myID).className=='show'){
			document.getElementById(myID).className = 'hide';
		}
	}
}


function disablerc()
{
// (C) 2003 CodeLifter.com
// Source: CodeLifter.com
// Do not remove this header

// Set the message for the alert box

// do not edit below this line
// ===========================
	var bV  = parseInt(navigator.appVersion)
	var bNS = navigator.appName=="Netscape"
	var bIE = navigator.appName=="Microsoft Internet Explorer"

	function nrc(e) {
   		if (bNS && e.which > 1){
			termsAndConditionsPopup(1)
      			return false
   		} else if (bIE && (event.button >1)) {
			termsAndConditionsPopup(1)
     			return false;
   		}
	}

	document.onmousedown = nrc;
	if (document.layers) window.captureEvents(Event.MOUSEDOWN);
	if (bNS && bV<5) window.onmousedown = nrc;
}