function changecss(id,value,x,y) {
	if (value == "left") {		
		$("#nav li ul").css({position:"absolute",display:"none"}).queue(function() {;
			$("#"+id+" ul").css({position:"absolute",left: x,top: y,display:"block"});
			$("#"+id+" ul").bind("mouseleave", function() {
				$("#nav li ul").css({position:"absolute",display:"none"});
			});
			$(this).dequeue();
		});
		
		//$("#sub_page_flash").bind("mouseleave", function() {
			//$("#"+id+" ul").css({position:"absolute",display:"none"});
		//});
		
		/*$(document).mousemove(function(e){
		var xloc = $("#"+id+" ul").offset().left;
		var yloc = $("#"+id+" ul").offset().top;
			$("#debug").html(
"UL Starting X: "+xloc+"<br/>"+
"UL Starting Y: "+yloc+"<br/><br/>"+
"Mouse X: "+e.pageX+"<br/>"+
"Mouse Y: "+e.pageY+"<br/><br/>"+
"UL Ending X: "+(xloc+parseInt($("#"+id+" ul").width()))+"<br/>"+
"UL Ending Y: "+(yloc+parseInt($("#"+id+" ul").height())));
		});*/
	}
	
	if (value == "click") {
		var linkloc = $("#"+id+" a:first").attr("href");
		window.location = linkloc;
	}
	
	if (value == "null") {
		
	}
}


/*function changecss(id,value) {
	//alert(id);
	try{
	var target = document.getElementById(id).getElementsByTagName("ul");
	var atarget = document.getElementById(id).getElementsByTagName("a");
	//target[0].style[element] = value;
	if(value == "" || value == "null"){
		window.status="";
		target[0].className = "";
	}else if(value == "click"){
		window.location = atarget[0].href;
	}else{
		window.status = atarget[0].href;
		target[0].className = "amhover";
	}
	}catch(e){
		//do nothing	
		//console.log(e);
	}
}
*/
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function get_var( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function setDim(id, w, h){
	var myel = document.getElementById(id);
	myel.style.width = w+"px";
	if(h > 60){
		myel.style.height = h+"px";
	}else{
		myel.style.height = 60+"px";	
	}
}

var processed = 0;
var processString = "";

function setStyles(str){
	processString = "";
	var style = document.createElement("style");
    style.setAttribute("type", "text/css");
	var array = str.split("|");
	var innertext = "";
	for(var n = 0; n < array.length; n++){
		var sarray = array[n].split(",");
		
		//innertext += "#nav li#"+sarray[0]+" ul{ \n\t";
		//innertext += "width: "+ (parseInt(sarray[2]))+"px; \n}\n";
		
		innertext += "#nav li#"+sarray[0]+" ul:hover, \n";
		innertext += "#nav li#"+sarray[0]+".sfhover ul, \n ";
		innertext += "#nav li#"+sarray[0]+" ul.amhover  { \n\t";
		innertext += "left: "+ (parseInt(sarray[1]) -  parseInt(sarray[2]) - 5)+"px; \n}\n";
		
		innertext += "#nav li#"+sarray[0]+" ul ul:hover, \n";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover li.sfhover ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover li.sfhover li.sfhover ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover li.sfhover li.sfhover li.sfhover ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover li.sfhover li.sfhover li.sfhover li.sfhover ul, \n ";
		innertext += "#nav li#"+sarray[0]+" ul ul.amhover {\n\t";
		innertext += "left: auto; \n}\n"
		
		innertext += "#nav li#"+sarray[0]+".sfhover ul ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover li.sfhover ul ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover li.sfhover li.sfhover ul ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover li.sfhover li.sfhover li.sfhover ul ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover li.sfhover li.sfhover li.sfhover li.sfhover ul ul, \n ";
		innertext += "#nav li#"+sarray[0]+".sfhover li.sfhover ul ul{ \n";
		innertext += "left: -999em; \n}\n"
		

		}
	if (style.styleSheet) {   // IE
	   style.styleSheet.cssText = innertext;
			
		
	}else{ //the world
		var textNode = document.createTextNode(innertext);
  		style.appendChild(textNode);
	}
	
	var headElement = document.getElementsByTagName('head')[0];
	headElement.appendChild(style);
}

function includeCSS(filepath){
	var css  = document.createElement('link');
	css.rel = 'stylesheet';
	css.id = 'access_styles';
	css.type = 'text/css';
	css.href = filepath;
	document.getElementsByTagName('head')[0].appendChild(css);
}

<!--
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommand messages in a Flash movie.
function FlashNav_DoFSCommand(command, args) {
	var FlashNavObj = isInternetExplorer ? document.all.FlashNav : document.FlashNav;
	//
	// Place your code here.
	//
	//alert(args);
	if(args == "load"){
		setStyles(command);
	}else{
		changecss(command,'left',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 FlashNav_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call FlashNav_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}
//-->


/*--------------------------------------------------*/
/*	set the Y (top) position of the Flash navigation
/*--------------------------------------------------*/
function setDropDownY(yval){
	yval -= 3; // minor adjustment to line up with flash hit area
	$('#nav').css('top', yval+'px');	
}

/*--------------------------------------------------*/
/*	resize sidebar Flash navigation
/*--------------------------------------------------*/
function resizeSideNav(height){
	$('#sidelinks').css('height', height+'px');
}

/*--------------------------------------------------*/
/*	"hide" Flash rollover state on rollout
/*--------------------------------------------------*/
function initNavRollout(swfID){
	$('#nav li ul').hover(
		function(){},
		function(){
			thisMovie(swfID).hideOver();
		}
	);
}
