function Primary_Name() {
  var urlString = location.href.toLowerCase();
  site1 = urlString.lastIndexOf("zooyork/index");
  site2 = urlString.lastIndexOf("news");
  site3 = urlString.lastIndexOf("team");
  site4 = urlString.lastIndexOf("products/");
  site5 = urlString.lastIndexOf("company");
  site6 = urlString.lastIndexOf("admin");
  site7 = urlString.lastIndexOf("show_allxxx");
  site8 = urlString.lastIndexOf("survey");
  site9 = urlString.lastIndexOf("index-news");
  site10 = urlString.lastIndexOf("productsdev");
  
  siteName="zooyork/index";
  maxNum=site1;
  
  if (site2 > maxNum) {siteName="news"; maxNum=site2;}
  if (site3 > maxNum) {siteName="team"; maxNum=site3;}
  if (site4 > maxNum) {siteName="products/"; maxNum=site4;}
  if (site5 > maxNum) {siteName="company"; maxNum=site5;}
  if (site6 > maxNum) {siteName="admin"; maxNum=site6;}
  if (site7 > maxNum) {siteName="show_allxxx"; maxNum=site7;}
  if (site8 > maxNum) {siteName="survey"; maxNum=site8;}
  if (site9 > maxNum) {siteName="index-news"; maxNum=site9;}
  if (site10 > maxNum) {siteName="productsdev"; maxNum=site10;}
  return siteName;
}



function Sub_name() {
  var urlString = location.href.toLowerCase();
  subsite1 = urlString.lastIndexOf("index");
  subsite2 = urlString.lastIndexOf("news-reports");
  subsite3 = urlString.lastIndexOf("news-tour-dates");
  subsite4 = urlString.lastIndexOf("news-galleries");
  subsite5 = urlString.lastIndexOf("skate");
  subsite6 = urlString.lastIndexOf("moto");
  subsite7 = urlString.lastIndexOf("bmx");
  subsite8 = urlString.lastIndexOf("snow");
  subsite9 = urlString.lastIndexOf("family");
  subsite10 = urlString.lastIndexOf("category=skate");
  subsite11 = urlString.lastIndexOf("category=mens");
  subsite12 = urlString.lastIndexOf("category=womens");
  subsite13 = urlString.lastIndexOf("category=media");
  subsite14 = urlString.lastIndexOf("company-history");
  subsite15 = urlString.lastIndexOf("company-contact");
  subsite16 = urlString.lastIndexOf("company-register");
  subsite17 = urlString.lastIndexOf("company-store-locator");
  subsite18 = urlString.lastIndexOf("subscribe");
  subsite19 = urlString.lastIndexOf("-delete");
  subsite20 = urlString.lastIndexOf("surf");
  subsite21 = urlString.lastIndexOf("zytimes");
  subsite22 = urlString.lastIndexOf("media");
  subsite23 = urlString.lastIndexOf("salesreps");

  subsiteName="index";
  maxNum=subsite1;
  
  if (subsite2 > maxNum) {subsiteName="news-reports"; maxNum=subsite2;}
  if (subsite3 > maxNum) {subsiteName="news-tour-dates"; maxNum=subsite3;}
  if (subsite4 > maxNum) {subsiteName="news-galleries"; maxNum=subsite4;}
  if (subsite5 > maxNum) {subsiteName="skate"; maxNum=subsite5;}
  if (subsite6 > maxNum) {subsiteName="moto"; maxNum=subsite6;}
  if (subsite7 > maxNum) {subsiteName="bmx"; maxNum=subsite7;}
  if (subsite8 > maxNum) {subsiteName="snow"; maxNum=subsite8;}
  if (subsite9 > maxNum) {subsiteName="family"; maxNum=subsite9;}
  if (subsite10 > maxNum) {subsiteName="category=skate"; maxNum=subsite10;}
  if (subsite11 > maxNum) {subsiteName="category=mens"; maxNum=subsite11;}
  if (subsite12 > maxNum) {subsiteName="category=womens"; maxNum=subsite12;}
  if (subsite13 > maxNum) {subsiteName="category=media"; maxNum=subsite13;}
  if (subsite14 > maxNum) {subsiteName="company-history"; maxNum=subsite14;}
  if (subsite15 > maxNum) {subsiteName="company-contact"; maxNum=subsite15;}
  if (subsite16 > maxNum) {subsiteName="company-register"; maxNum=subsite16;}
  if (subsite17 > maxNum) {subsiteName="company-store-locator"; maxNum=subsite17;}
  if (subsite18 > maxNum) {subsiteName="subscribe"; maxNum=subsite18;}
  if (subsite19 > maxNum) {subsiteName="-delete"; maxNum=subsite19;}
  if (subsite20 > maxNum) {subsiteName="surf"; maxNum=subsite20;}
  if (subsite21 > maxNum) {subsiteName="zytimes"; maxNum=subsite21;}
  if (subsite22 > maxNum) {subsiteName="media"; maxNum=subsite22;}
  if (subsite23 > maxNum) {subsiteName="salesreps"; maxNum=subsite23;}
  
  return subsiteName;
}



function Product_type() {
  var urlString = location.href.toLowerCase();
  productsite1 = urlString.lastIndexOf("zooyork/index");
  productsite2 = urlString.lastIndexOf("womens");
  productsite3 = urlString.lastIndexOf("products/admin");
  productsite4 = urlString.lastIndexOf("productsdev/admin");
  
  productsiteName="zooyork/index";
  maxNum=productsite1;
  
  if (productsite2 > maxNum) {productsiteName="womens"; maxNum=productsite2;}
  if (productsite3 > maxNum) {productsiteName="products/admin"; maxNum=productsite3;}
  if (productsite4 > maxNum) {productsiteName="productsdev/admin"; maxNum=productsite4;}
  return productsiteName;
}


function PrimaryNav() { 
  siteName=Primary_Name();

  productsiteName=Product_type();
  productsrc1="";
  if (productsiteName == "womens") { productsrc1="womens/"; }

  src1="";
  src2=""; edge2="";
  src3=""; edge3="";
  src4=""; edge4="";
  src5=""; edge5="";
  src6=""; edge6="";

  if (siteName == "zooyork/index") 	{src1="";}
  if (siteName == "index-news") 			{src2="_r"; edge2="_news";}
  if (siteName == "news") 			{src2="_r"; edge2="_news";}
  if (siteName == "team") 			{src3="_r"; edge3="_team";}
  if (siteName == "products/") 		{src4="_r"; edge4="_product";}
  if (siteName == "company") 		{src5="_r"; edge5="_company";}
  if (siteName == "productsdev") 		{src6="_r"; edge6="_product";}

  document.write("<a href='/cgi-bin/index-news/show_all.cgi' onMouseOver=MM_swapImage('news','','/images/" + productsrc1 + "nav/news_r.gif','newsteam','','/images/" + productsrc1 + "nav/news_team_news.gif','team','','/images/" + productsrc1 + "nav/team.gif','teamproduct','','/images/" + productsrc1 + "nav/team_product.gif','products/','','/images/" + productsrc1 + "nav/product.gif','productcompany','','/images/" + productsrc1 + "nav/product_company.gif','company','','/images/" + productsrc1 + "nav/company.gif',1) onMouseOut=MM_swapImgRestore()> <img src='/images/" + productsrc1 + "nav/news"+src2+".gif' name='news' width='47' height='94' border='0'></a>");
  document.write("<img src='/images/" + productsrc1 + "nav/news_team" + edge2 + "" + edge3 + ".gif' name='newsteam' width='11' height='94'>");
  document.write("<a href='/cgi-bin/team/show.cgi?type=skate' onMouseOver=MM_swapImage('news','','/images/" + productsrc1 + "nav/news.gif','newsteam','','/images/" + productsrc1 + "nav/news_team_team.gif','team','','/images/" + productsrc1 + "nav/team_r.gif','teamproduct','','/images/" + productsrc1 + "nav/team_product_team.gif','products/','','/images/" + productsrc1 + "nav/product.gif','productcompany','','/images/" + productsrc1 + "nav/product_company.gif','company','','/images/" + productsrc1 + "nav/company.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + productsrc1 + "nav/team"+src3+".gif' name='team' width='40' height='94' border='0'></a>");
  document.write("<img src='/images/" + productsrc1 + "nav/team_product" + edge3 + "" + edge4 + ".gif' name='teamproduct' width='11' height='94'>");
  document.write("<a href='/product/' onMouseOver=MM_swapImage('news','','/images/" + productsrc1 + "nav/news.gif','newsteam','','/images/" + productsrc1 + "nav/news_team.gif','team','','/images/" + productsrc1 + "nav/team.gif','teamproduct','','/images/" + productsrc1 + "nav/team_product_product.gif','products/','','/images/" + productsrc1 + "nav/product_r.gif','productcompany','','/images/" + productsrc1 + "nav/product_company_product.gif','company','','/images/" + productsrc1 + "nav/company.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + productsrc1 + "nav/product"+src4+".gif' name='products/' width='54' height='94' border='0'></a>");
  document.write("<img src='/images/" + productsrc1 + "nav/product_company" + edge4 + "" + edge5 + ".gif' name='productcompany' width='18' height='94'>");
  document.write("<a href='/cgi-bin/company-history/show.cgi' onMouseOver=MM_swapImage('news','','/images/" + productsrc1 + "nav/news.gif','newsteam','','/images/" + productsrc1 + "nav/news_team.gif','team','','/images/" + productsrc1 + "nav/team.gif','teamproduct','','/images/" + productsrc1 + "nav/team_product.gif','product','','/images/" + productsrc1 + "nav/product.gif','productcompany','','/images/" + productsrc1 + "nav/product_company_company.gif','company','','/images/" + productsrc1 + "nav/company_r.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + productsrc1 + "nav/company"+src5+".gif' name='company' width='67' height='94' border='0'></a>");

}



function SubNav() { 
  siteName=Primary_Name();
  subsiteName=Sub_name();
  productsiteName=Product_type();

  theclass="";
  thedirectory="";
  if (productsiteName == "womens") { theclass="_women"; thedirectory="womens/"; }
  
  src2="_off";
  src3="_off";
  src4="_off";
  src5="_off";
  src6="_off";
  src7="_off";
  src8="_off";
  src9="_off";
  src10="_off";
  src11="_off";
  src12="_off";
  src13="_off";
  src14="_off";
  src15="_off";
  src16="_off";
  src17="_off";
  src20="_off";
  src21="_off";
  src22="_off";
  src23="_off";
	 
  if (subsiteName == "news-reports") 			{src2="_on";}
  if (subsiteName == "news-galleries") 			{src3="_on";}
  if (subsiteName == "news-tour-dates") 		{src4="_on";}
  if (subsiteName == "skate") 					{src5="_on";}
  if (subsiteName == "moto") 					{src6="_on";}
  if (subsiteName == "bmx") 					{src7="_on";}
  if (subsiteName == "snow") 					{src8="_on";}
  if (subsiteName == "family") 					{src9="_on";}
  if (subsiteName == "category=skate") 			{src10="_on";}
  if (subsiteName == "category=mens") 			{src11="_on";}
  if (subsiteName == "category=womens") 		{src12="_on";}
  if (subsiteName == "category=media") 			{src13="_on";}
  if (subsiteName == "company-history") 		{src14="_on";}
  if (subsiteName == "company-contact") 		{src15="_on";}
  if (subsiteName == "company-register")		{src16="_on";}
  if (subsiteName == "company-store-locator") 	{src17="_on";}
  if (subsiteName == "surf") 					{src20="_on";}
  if (subsiteName == "zytimes") 				{src21="_on";}
  if (subsiteName == "media") 					{src22="_on";}
  if (subsiteName == "salesreps") 				{src23="_on";}  

  document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>");

  if (siteName == "zooyork/index") {
	  document.write("");
  }
  else if (siteName == "news") {
	  document.write("<td class=home_news>");
	  document.write("<img src='/images/pixel.gif' width='13' height='1'>");
	  document.write("<a href='/cgi-bin/news-reports/show.cgi' onMouseOver=MM_swapImage('news_reports','','/images/subnav/reports_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/reports" + src2 + ".gif' name='news_reports' width='57' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/news-tour-dates.shtml' onMouseOver=MM_swapImage('news_tour','','/images/subnav/tourdates_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/tourdates" + src4 + ".gif' name='news_tour' width='71' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/cgi-bin/news-galleries/show.cgi' onMouseOver=MM_swapImage('news_galleries','','/images/subnav/galleries_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/galleries" + src3 + ".gif' name='news_galleries' width='64' height='10' border='0' vspace='12'></a>");
	  document.write("</td>");
  }
  else if (siteName == "team") {
	  document.write("<td class=home_news>");
	  document.write("<img src='/images/pixel.gif' width='13' height='1'>");
	  document.write("<a href='/cgi-bin/team/show.cgi?type=skate' onMouseOver=MM_swapImage('team_skate','','/images/subnav/skate_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/skate" + src5 + ".gif' name='team_skate' width='42' height='10' border='0' vspace='12'></a>");
	 // document.write("<a href='/cgi-bin/team/show.cgi?type=moto' onMouseOver=MM_swapImage('team_moto','','/images/subnav/moto_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/moto" + src6 + ".gif' name='team_moto' width='40' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/cgi-bin/team/show.cgi?type=bmx' onMouseOver=MM_swapImage('team_bmx','','/images/subnav/bmx_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/bmx" + src7 + ".gif' name='team_bmx' width='35' height='10' border='0' vspace='12'></a>");
	  //document.write("<a href='/cgi-bin/team/show.cgi?type=snow' onMouseOver=MM_swapImage('team_snow','','/images/subnav/snow_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/snow" + src8 + ".gif' name='team_snow' width='42' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/cgi-bin/team/show.cgi?type=surf' onMouseOver=MM_swapImage('team_surf','','/images/subnav/surf_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/surf" + src20 + ".gif' name='team_surf' width='39' height='10' border='0' vspace='12'></a>");
	  document.write("</td>");
  }
  else if (siteName == "products/") {
	  document.write("<td class=home_news" + theclass + ">");
	  document.write("<img src='/images/pixel.gif' width='13' height='1'>");
	  document.write("<a href='/product' onMouseOver=MM_swapImage('product_mens','','/images/" + thedirectory + "subnav/pr_mens_apparel_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + thedirectory + "subnav/pr_mens_apparel" + src11 + ".gif' name='product_mens' width='87' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/cgi-bin/products/show.cgi?category=skate' onMouseOver=MM_swapImage('product_skate','','/images/" + thedirectory + "subnav/pr_skate_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + thedirectory + "subnav/pr_skate" + src5 + ".gif' name='product_skate' width='43' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/cgi-bin/products/show.cgi?category=womens' onMouseOver=MM_swapImage('product_womens','','/images/" + thedirectory + "subnav/pr_womens_apparel_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + thedirectory + "subnav/pr_womens_apparel" + src12 + ".gif' name='product_womens' width='104' height='10' border='0' vspace='12'></a>");
//	  document.write("<a href='/cgi-bin/products/show.cgi?category=media' onMouseOver=MM_swapImage('product_media','','/images/" + thedirectory + "subnav/pr_media_on.gif',1)' onMouseOut=MM_swapImgRestore()><img src='/images/" + thedirectory + "subnav/pr_media" + src13 + ".gif' name='product_media' width='45' height='10' border='0' vspace='12'></a>");
	  document.write("</td>");
  }
    else if (siteName == "productsdev") {
	  document.write("<td class=home_news" + theclass + ">");
	  document.write("<img src='/images/pixel.gif' width='13' height='1'>");
	  document.write("<a href='/cgi-bin/productsDEV/show.cgi?category=mens' onMouseOver=MM_swapImage('product_mens','','/images/" + thedirectory + "subnav/pr_mens_apparel_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + thedirectory + "subnav/pr_mens_apparel" + src11 + ".gif' name='product_mens' width='87' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/cgi-bin/productsDEV/show.cgi?category=skate' onMouseOver=MM_swapImage('product_skate','','/images/" + thedirectory + "subnav/pr_skate_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + thedirectory + "subnav/pr_skate" + src5 + ".gif' name='product_skate' width='43' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/cgi-bin/productsDEV/show.cgi?category=womens' onMouseOver=MM_swapImage('product_womens','','/images/" + thedirectory + "subnav/pr_womens_apparel_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/" + thedirectory + "subnav/pr_womens_apparel" + src12 + ".gif' name='product_womens' width='104' height='10' border='0' vspace='12'></a>");
//	  document.write("<a href='/cgi-bin/products/show.cgi?category=media' onMouseOver=MM_swapImage('product_media','','/images/" + thedirectory + "subnav/pr_media_on.gif',1)' onMouseOut=MM_swapImgRestore()><img src='/images/" + thedirectory + "subnav/pr_media" + src13 + ".gif' name='product_media' width='45' height='10' border='0' vspace='12'></a>");
	  document.write("</td>");
  }
  else if (siteName == "company") {
	  document.write("<td class=home_news>");
	  document.write("<img src='/images/pixel.gif' width='13' height='1'>");
	  document.write("<a href='/cgi-bin/company-history/show.cgi' onMouseOver=MM_swapImage('company_history','','/images/subnav/history_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/history" + src14 + ".gif' name='company_history' width='54' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/company-contact.shtml' onMouseOver=MM_swapImage('company_contact','','/images/subnav/contact_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/contact" + src15 + ".gif' name='company_contact' width='56' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/company-register.shtml' onMouseOver=MM_swapImage('company_register','','/images/subnav/register_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/register" + src16 + ".gif' name='company_register' width='60' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/company-store-locator.shtml' onMouseOver=MM_swapImage('company_storelocator','','/images/subnav/store_locator_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/store_locator" + src17 + ".gif' name='company_storelocator' width='88' height='10' border='0' vspace='12'></a>");
	  document.write("<a href='/product/zootimes/' onMouseOver=MM_swapImage('zytimes','','/images/subnav/zytimes_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/zytimes" + src21 + ".gif' name='zytimes' width='45' height='10' border='0' vspace='12'></a>");
	  document.write("<img src='/images/pixel.gif' width='13' height='1'>");
      document.write("<a href='http://zooyorkpr.blogspot.com/' target='_blank' onMouseOver=MM_swapImage('media','','/images/subnav/media_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/media" + src22 + ".gif' name='media' width='81' height='10' border='0' vspace='12'></a>");
      document.write("<img src='/images/pixel.gif' width='13' height='1'>");
      document.write("<a href='/creativebrief/calendar/form.html' target='_blank' onMouseOver=MM_swapImage('salesreps','','/images/subnav/salesreps_on.gif',1) onMouseOut=MM_swapImgRestore()><img src='/images/subnav/salesreps" + src23 + ".gif' name='salesreps' width='81' height='10' border='0' vspace='12'></a>");

      document.write("</td>");
  }
  else if (siteName == "admin") {
	  document.write("<td class=home_news>");
	  document.write("<img src='/images/pixel.gif' width='13' height='1'>");
	  document.write("</td>");
  }
//  else if (siteName == "show_all") {
//	  document.write("<td class=home_news>");
//	  document.write("<img src='/images/pixel.gif' width='13' height='1'>");
//	  document.write("<img src='/images/headers/zoonews.gif' vspace='12' border='0'>");
//	  document.write("</td>");
// }
  else if (siteName == "survey") {
	  document.write("<td class=home_news>");
	  document.write("<img src='/images/pixel.gif' width='13' height='11' vspace='12'>");
	  document.write("</td>");
  }
  else {
	  document.write("<td class=home_news><img src='/images/pixel.gif' width='152' height='11' hspace='15' vspace='12'></td>");
  }




  if (siteName == "zooyork/index") {
	  document.write("");
  }
  else if (subsiteName == "news-tour-dates") {
	  document.write("</tr></tr>");
	  document.write("<td class=site_back><img src='/images/subnav_bottom_tourdates.jpg' width='726' height='227' border='0'><br>");
	  document.write("<img src='/images/headers/background_tourdates.jpg' width='726' height='87' border='0'></td>");
  }
  else if (subsiteName == "company-register") {
	  document.write("</tr></tr>");
	  document.write("<td class=site_back><img src='/images/subnav_bottom_register.jpg' width='726' height='286' border='0'><br>");
	  document.write("<img src='/images/headers/background_register.jpg' width='726' height='87' border='0'></td>");
  }
  else if (subsiteName == "-delete") {
	  document.write("</tr></tr>");
	  document.write("<td class=site_back><img src='/images/subnav_bottom_register_delete.jpg' width='726' height='286' border='0'><br>");
	  document.write("<img src='/images/headers/background_register.jpg' width='726' height='87' border='0'></td>");
  }
  else {
	  document.write("</tr></tr>");
	  document.write("<td class=site_back><img src='/images/" + thedirectory + "subnav_bottom.gif' width='726' height='3' border='0'></td>");
  }

 document.write("</tr></table>");

}



