// JavaScript Document

//get the string of framework areas from flash
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 28;
// -----------------------------------------------------------------------------
// -->


// Handle all the FSCommand messages in a Flash movie.
function framework_DoFSCommand(command, args) {
		var frameworkObj = isInternetExplorer ? document.all.framework : document.framework;
	  if (command == "getTextFromFlash") { 
	  document.getElementById("receivedField").value = args;
  }
}

// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub framework_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call framework_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

$(document).ready(function () {
	$('.expandDescription').hide();

	$('.field').focus(function(){

		if($(this).hasClass('showhelp'))
		{
			toggleHelp($(this).parents());
		}

	});

	// tab setup as per http://docs.jquery.com/UI/Tabs
	$tabs = $("#container-1 > ul").tabs();

	/*var $tabs = $('#container-1 > ul').tabs({
		show: function(ui) {
	       return true;
	    },

	});*/

	
	// section2_link should go to the second tab
	$('#section2_link').click( function() 
		{
			$tabs.tabs('select', 1);
		}
	);
	
	
	// section3_link should go to the third tab
	$('#section3_link').click( function() 
		{
			$tabs.tabs('select', 2);
			return '#top';
		}
	);
			
	
	
	// section4_link should go to the fourth tab
	$('#section4_link').click( function() 
		{
			$tabs.tabs('select', 3);
			return '#top';
		}
	);


	$('.field').blur(function(){
		
		if($(this).hasClass('showhelp'))
		{
			toggleHelp($(this).parents());
		}

	});

	$('.helpIcon').click(function(){
		toggleHelp($(this).parents());
	});

	function toggleHelp(parents)
	{
		parents.each(function (i) {
			var currentParent = $(parents[i]);

			if (currentParent.hasClass('helpContainer')) {

				var currentChildren = currentParent.children();
				$(currentChildren).each( function (j) {

					var currentChild = $(currentChildren[j]);
					if(currentChild.hasClass('expandDescription'))
					{
						currentChild.toggle('fast');
					}

				});

			}

		});

	}

});


function setSelected(arrClassifications)
{
	var theList =  '';
	var theElement = '';

	//alert('here!');

	for(i=0; i < arrClassifications.length; i++)
	{

		theElement = arrClassifications[i].classificationid;

		if(arrClassifications[i].skillid != -1)
		{
			theElement = theElement + '|' + arrClassifications[i].skillid;
		}else{
			
			theElement = theElement + '|0';
		}

		if(arrClassifications[i].conditionid != -1)
		{
			theElement = theElement + '|' + arrClassifications[i].conditionid;
		}else{
			theElement = theElement + '|0';
		}

		if(theList.length != 0)
		{
			theList = theList + ',' + theElement;
		}else{
			theList = theElement;			
		}

	}

	document.forms[0].acfjdList.value = theList;

}

