// JavaScript Document
var overImage;
var currentImagePath;

var movieArray = new Array("1","2","3","4","5");

function changeFrame(index){
	indexNumber = index.id;
	videoFrame = document.getElementById('videoThumbnail');
	videoLinkPath = document.getElementById('videoLink');
	
	switch (indexNumber)
	{
		case "1":
		videoFrame.src = '/Portals/0/Skins/Poseidon/images/video1.jpg';
		videoLinkPath.href = '/Portals/0/Videos/videoPlayer.swf?width=720&height=480&flashvars=pathToVideo=/Portals/0/Videos/WhyYouNeedPoseidon.flv&skinSelection=/Portals/0/Videos/ClearOverPlaySeekMute.swf';
		videoLinkPath.title = 'Part1: The Need';
		hightlightFrame("1");
		break;
		
		case "2":
		videoFrame.src = '/Portals/0/Skins/Poseidon/images/video2.jpg';
		videoLinkPath.href = '/Portals/0/Videos/videoPlayer.swf?width=720&height=480&flashvars=pathToVideo=/Portals/0/Videos/HowPoseidonDoesIt.flv&skinSelection=/Portals/0/Videos/ClearOverPlaySeekMute.swf';
		videoLinkPath.title = 'Part2: What It Does';
		hightlightFrame("2");
		break;
		
		case "3":
		videoFrame.src = '/Portals/0/Skins/Poseidon/images/video3.jpg';
		videoLinkPath.href = '/Portals/0/Videos/videoPlayer.swf?width=720&height=480&flashvars=pathToVideo=/Portals/0/Videos/WhatAPoseidonSystemIs.flv&skinSelection=/Portals/0/Videos/ClearOverPlaySeekMute.swf';
		videoLinkPath.title = 'Part3: How It Works';
		hightlightFrame("3");
		break;
		
		case "4":
		videoFrame.src = '/Portals/0/Skins/Poseidon/images/video4.jpg';
		videoLinkPath.href = '/Portals/0/Videos/videoPlayer.swf?width=720&height=480&flashvars=pathToVideo=/Portals/0/Videos/WhatPoseidonDoes.flv&skinSelection=/Portals/0/Videos/ClearOverPlaySeekMute.swf';
		videoLinkPath.title = 'Part4: What It Is';
		hightlightFrame("4");
		break;
		
		case "5":
		videoFrame.src = '/Portals/0/Skins/Poseidon/images/video5.jpg';
		videoLinkPath.href = '/Portals/0/Videos/videoPlayer.swf?width=720&height=480&flashvars=pathToVideo=/Portals/0/Videos/UserTestimonials.flv&skinSelection=/Portals/0/Videos/ClearOverPlaySeekMute.swf';
		videoLinkPath.title = 'Part5: Testimonials';
		hightlightFrame("5");
		break;
	}
}

function hightlightFrame(frame){
		for(i=0;i<movieArray.length;i++){
			if(movieArray[i] == frame){
				document.getElementById(movieArray[i]).className = "selectedMovie";
			} else {
				document.getElementById(movieArray[i]).className = "notSelected";
			}
		}
}

function overFrame(thumbImg){
	overImage = document.getElementById(thumbImg.id);
	currentImagePath = overImage.src;
	pathExtension = currentImagePath.substring(currentImagePath.lastIndexOf('.'),currentImagePath.length);
	sansExtension = currentImagePath.substring(0,currentImagePath.lastIndexOf('.'));
	rolloverPath = sansExtension + "_hot.jpg";
	if(currentImagePath.indexOf('_') == -1){
		overImage.src = rolloverPath;
	}
}

function outFrame(thumbImg){
	overImage = document.getElementById(thumbImg.id);
	currentImagePath = overImage.src;
	pathEnd = currentImagePath.substring(currentImagePath.lastIndexOf('_'),currentImagePath.length);
	sansPathEnd = currentImagePath.substring(0,currentImagePath.lastIndexOf('_'));
	rolloutPath = sansPathEnd + ".jpg";
	if(currentImagePath.indexOf('_') != -1){
		overImage.src = rolloutPath;
	}
}
