// Utility method for cross-browser compatibility
function getSWF(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

// Play Random Video
function randomVideo() {
	getSWF("video_player").playRandomVideo();
}

// Play Video by Index (base 0)
function playVideoByIndex(index) {
	getSWF("video_player").playVideoByIndex(index);	
}

// Called by SWF when a video has completed playing
function videoComplete(index) {
/*	// Display video index in textfield
	document.getElementById('boxIndex').value = index;	*/
	
	if (index == 0) {
			playing = 1;
			javascript:playVideoByIndex(33);
	}
	else if (index == 1) {
		playing = 1;
		// end of second video	
	}
	else if (index == 2) {
		playing = 1;
		// end of third video	
	}
	else if (index == 3) {
		playing = 1;
		
		// end of fourth video	
	}
	else if (index == 4) {
		playing = 1;
		// end of fourth video	
		
		
		
	}else if (index == 32) {
		playing = 1;
		var rand_no = Math.random();
		rand_no = rand_no * 23;
		rand_no += 7;
		rand_no = Math.ceil(rand_no);
		javascript:playVideoByIndex(rand_no);
		// end of fourth video	
		
		
		
	}else if (index > 7 && index < 31) {
		playing = 1;
		
		
		javascript:playVideoByIndex(31);
		$('#click_here').delay(1500).fadeIn(200).delay(200).fadeOut(200);
		$('#click_here').delay(200).fadeIn(200).delay(200).fadeOut(200);
		$('#click_here').delay(200).fadeIn(200).delay(200).fadeOut(200);
		$('#click_here').delay(200).fadeIn(200);
		
		// end of fourth video	
		
		
		
	}else if (index == 31) {
	//code to be executed when lastvideo played
		$('.symptom_dropdown').fadeOut('slow' );
		$("#shadow_2").delay(800).fadeOut(200);
		$("#symptoms").delay(1000).animate({"bottom": "2080px"}, "slow");
		
		
		reset_box();
	}else{
	playing = 1;
	}
}
