// JavaScript Document

var initVal = "";
var resultsArray = window.location.search.split("=");
if (resultsArray.length > 1) {
  initVal = resultsArray[1];
}

function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
	alert(movieName);
}

function updateBeingPlayedArea(initVal) {
  var name = "";
  var description = "";
  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+initVal,"videoclips",width,height,"9",color);
  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();
  $('.video_tab_content > div:first').show();
  $('.video_tabs_nav > li:first 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 = "The content, organization, graphics, design, compilation, magnetic translation, digital conversion and other matters related to the Knights of Columbus productions are protected under applicable copyrights, trademarks and other proprietary (including but not limited to intellectual property) rights. Copying or redistribution of the Knights of Columbus film is strictly prohibited.";
    return confirm(disclaimer);
  }
  else {
    return true;
  }
}

function changecss(objDivID){
  var myID = "videoRightMenu";
	if(document.getElementById(myID).className=='semi_transparent')
	{
		document.getElementById(myID).className = 'opaque';
	} else {
		if(document.getElementById(myID).className=='opaque'){
			document.getElementById(myID).className = 'semi_transparent';
		}
	}
}
