var x = 0;
var pos=-1;
var page = location.search.substr(1).split("?");

for (x=0;x<=page.length;x++) 
{
  eval(page);
}

page = escape(page);
page = page.slice(7);

pos = page.substr(page.length-2,page.length);
_page = page.substr(0,page.length-2)

//alert("pos=" + pos + "page = " + page);
//alert(isNaN(pos));
if(isNaN(pos))
{
	pos = page.substr(page.length-1,page.length);
	_page = page.substr(0,page.length-1)
}
page = _page;
//alert("pos=" + pos + "page = " + page);

function NYKMenu()
{
  this.header = null;
  this.flashFile = "nyk_FLASH_menu.swf";
  this.useHeader = true;
  this.background ="img/graphic_navBkgrd.gif";
  this.useBackground = true;
  this.category = new Array(); 
}

function _flashContent()
{
	paramStr="";
	if(page!="")
	{
		paramStr = "?x=menu_options.xml&page=" + page +"&pos="+ pos;
	}
	
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="156" HEIGHT="450" id="nyk_FLASH_menu" ALIGN="">');
	document.write('	<PARAM NAME=movie VALUE="'+ this.flashFile + paramStr + '">');
	document.write('	<PARAM NAME=quality VALUE=high>');
	document.write('	<PARAM NAME=wmode VALUE=transparent>');
	document.write('	<PARAM NAME=bgcolor VALUE=#FFFFFF>');
	document.write('	<EMBED src="' + this.flashFile + paramStr + '" quality=high bgcolor=#FFFFFF  WIDTH="156" HEIGHT="450" NAME="stripDown_menu_FINAL_noSroll" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
	document.write('</OBJECT>');
}

function _jsContent()
{
		for(i=0;i<this.category.length;i++)
	  {
	    if(page == this.category[i].id || this.category[i].visible == false)
	    {
	      this.opened(this.category[i])
	    }
	    else
	    {
	      this.closed(this.category[i]);
	    }
  	}
}

function _build()
{
 this.begin();
 
  if ( MM_FlashCanPlay)
	{
 		this.flashContent();
	}
	else
	{
		this.jsContent();
	}
  this.end();
}

function _begin()
{
	document.write('<TABLE width="156" border=0 cellPadding=0 cellSpacing=0>');
	document.write('<TR>');
	document.write('<TD><img src="'+ this.header +'" width="156" height="33"></TD>');
	document.write('</TR>');
	document.write('<TR>');
	document.write('<TD height="3" bgcolor="#000000"></TD>');
	document.write('</TR>');
	document.write('<TR>');
	
	if(this.useHeader)
	{
		document.write('<TD background="'+ this.background + '">');
	}
}

function _end()
{
	document.write('</TD>');
	document.write('</TR>');
	document.write('<TR>');
	if(this.useBackground)
  {
		document.write('<TD align="center" valign="top" background="' + this.background + '"><br><img src="img/graphic_endPoint.gif" width="24" height="6"></TD></TR>');
	}
	document.write('</TABLE>');
}

function _closed(cat)
{
  document.write('<table width="99%" cellpadding="0" cellspacing="0" border="0"><tr>');
  
	if (cat.useImage)
  {
    document.write('<td width="24"><img align="absmiddle" src="' + cat.closeName +'" width="' + cat.width + '" height="' + cat.height + '"border="0">');
  }
  
  document.write('</td><td background="'+ cat.buttonName  +'"><a class="foldType" href = "' +cat.url+ '?page='+ cat.id +'0" target="_self">');
  document.write(formatName(cat.name,true) + '</a></td></tr></table>');
}

function _opened(cat) 
{
  if(cat.visible == true)
  {
  	document.write('<table width="99%" cellpadding="0" cellspacing="0" border="0"><tr>');
  	document.write('<td width="24"><img align="absmiddle" src="' + cat.openName +'" width="' + cat.width + '" height="' + cat.height + '"border="0"></td>');
  }
 		
 	document.write('<td background="'+ cat.buttonName  +'"><a class="foldType" href = "'+ cat.url  + '?page='+ cat.id +'0" target="_self">'); 
  document.write(formatName(cat.name, true) + '</a></td></tr></table>');

  
  if(cat.subCategory.length > 0)
  {
  	document.write('<table id="leftNavSubNav" cellpadding="0" cellspacing="0" border="0" width="99%" ><tr><td colspan="2" height="5"></td></tr>');
		for (x=0;x<cat.subCategory.length;x++)
		{
			if (cat.subCategory[x].useImage  == true)
			{
				document.write('<tr '  + cat.subCategory[x].highlight  +'><td height="'+ cat.subCategory[x].height +'">&nbsp;&nbsp;<img align="absbottom" src="' + cat.subCategory[x].imageName +'" width="' + cat.subCategory[x].width + '" height="' + cat.subCategory[x].height + '">&nbsp;</td>');
			}
			document.write('<td><a href="' + cat.subCategory[x].link +'?page='+ cat.id +(x+1)+'">' + formatName(cat.subCategory[x].name,false) + '</a></td></tr><tr><td height="3"></td></tr>');
		}
		document.write('</table>');
	}
}

function Category(name, id,url,visible)
{
  this.useImage=true;
  this.name=name;
  this.id=id;
  this.visible = true;
  this.url= "";
  
  if(url !=null)
  {
  	this.url = url;
  }
  
  if(visible != null)
  {
  	this.visible = visible;
  }	
  
  midButton = "button";
  rightButton = "button_right";
	openButton = "open";
	closeButton = "fold";
  
  this.height=29;
  
  if(name.length>18)
  {
  	midButton = midButton + "_double";
  	rightButton = rightButton + "_double";
		openButton = openButton + "_double";
		closeButton = closeButton + "_double";
		this.height=40 ;
  }
  
  if(pos==0 && this.id==page)
  {
  	midButton = midButton + "_h";
  	rightButton = rightButton + "_h";
		openButton = openButton + "_h";
		closeButton = closeButton + "_h";
  }

  this.buttonName="img/"  + midButton +".gif";
  this.buttonRightName="img/" + rightButton + ".gif";
  this.openName="img/" + openButton + ".gif";
  this.closeName="img/"+ closeButton + ".gif";
  this.width=24;
  this.subCategory = new Array();
}

function _setCategory(categoryName, id,url,visible)
{
  this.category[this.category.length] = new Category(categoryName, id,url, visible);
}

function _getCategory(id)
{
 for(i=0;i<this.category.length;i++)
  {
    if(this.category[i].id == id)
    {
      return this.category[i];
    }
  }
}

function SubCategory(name, link, _pos)
{
  this.name=name;
  this.link = link;
  this._pos = _pos

	this.useImage=true;
	this.imageName="img/list.gif";
	this.height="9";
	
	this.width="8";
	
	this.highlight="";

	if(this._pos==pos)
	{
		this.highlight="bgcolor=#FFEBBE";
	}
}

function _setSubCategory(name, link)
{
  this.subCategory[this.subCategory.length] = new SubCategory(name, link,this.subCategory.length+1 );
}

Category.prototype.setSubCategory = _setSubCategory;

NYKMenu.prototype.begin = _begin;
NYKMenu.prototype.end = _end;
NYKMenu.prototype.build = _build;
NYKMenu.prototype.closed = _closed;
NYKMenu.prototype.opened = _opened;
NYKMenu.prototype.setCategory = _setCategory;
NYKMenu.prototype.getCategory = _getCategory;
NYKMenu.prototype.flashContent = _flashContent;
NYKMenu.prototype.jsContent = _jsContent;



function gotoPage(url)
{
	location.href=url;
}

function formatName(name, isHeader)
{
	_name = name;

	if(name.length > 18)
	{
		breakAtSpace = false;
		z=18;
		for(y=18;y>0;y--)
		{
			val = _name.substr(y,1);
			if(val == " ")
			{
				breakAtSpace = true;
			  z = y;
			  break;
			}
		}

		if(breakAtSpace)
		{
			_name = name.substr(0,z) + "<br>" + name.substr(z+1,name.length-1); 
		}
		else
		{
			_name = name.substr(0,z) + "<br>" + name.substr(z,name.length-1); 
		}
	}
	
	if(isHeader)
	{
		return "&nbsp;&nbsp;&nbsp;"+_name;
	}	
	else
	{
		return _name;
	}
}