/******************** begining of functions for old interface *******************

var iammc=true,city=0,ifvideo=false,iftransit=false,ifacity=false,mysite=window.location.host;

window.adon=false;
adimg=new Image(468,60);

/*addmc*/
function addmc(){

  var mylist,mypair,length,i,pos,content;
  var userid,password;
  mylist = document.cookie.split("; ");
  length=mylist.length;
  for(i=0;i<length;i++){
    pos=mylist[i].indexOf("=");
    tag=mylist[i].substr(0,pos);
    content=mylist[i].substr(pos+1);
    if(tag == "userid"){
      userid=unescape(content);
    }
    if(tag == "pass"){
      password=unescape(content);
    }
  }
//  if(parent.text.location.href.search(/&title=[^&]/) != -1) {
//  if ( isNewInterface ) {
    if(!password){
      // showinexitinfo( "" );
      // top.exitinfo.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=" + escape("Add+Report+Password");
      // showinexitinfo( "/cgi-bin/metro/mc_emaildb.pl?OP=" + escape("Add+report+password") );
      theurl=unescape(top.text.location.href);
      var oldurl = theurl;
      theurl = oldurl.replace(/_temp/ig, "");   // using the g modifier in case of multiple pgtype in url
      top.text.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=" + escape("Add+report+password") + "&theurl=" + escape(theurl);
    } else {
      // showinexitinfo( "" );
      // top.exitinfo.location.href="/mc/built.html";
      theurl=unescape(top.text.location.href);
      var oldurl = theurl;
      theurl = oldurl.replace(/_temp/ig, "");   // using the g modifier in case of multiple pgtype in url
      top.text.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=Add+report&thename=" + escape(userid) + "&thepassword=" + escape(password) + "&theurl=" + escape(theurl);
      showinexitinfo( "/mc/built.html" );
    }
//  } else {
//    if(!password){
//      top.exitinfo.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=" + escape("Add+report+password");
//    } else {
//      theurl=unescape(top.text.location.href);
//      top.text.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=Add+report&thename=" + escape(userid) + "&thepassword=" + escape(password) + "&theurl=" + escape(theurl);
//      top.exitinfo.location.href="/mc/built.html";
//    }
//  }
//  else {
//    top.exitinfo.location.href="/mc/addtitle.html";
//  }
//  }
}


/*changead*/
function changead(myhref,mysrc,myiframe){
  var ua=navigator.userAgent,ie4=ua.indexOf("MSIE");
  if(window.adon){
    if(ie4!=-1){
      parent.navbar.document.frames[0].src=myiframe;
    } else {
      mylen=parent.navbar.document.links.length-6;
      parent.navbar.document.links[mylen].href=myhref;
      mylen=parent.navbar.document.images.length-8;
      parent.navbar.document.images[mylen].src=mysrc;
    }
  }
}


/*changead2*/
function changead2(myhref,mysrc,mytarget){
  var ua=navigator.userAgent,ie4=ua.indexOf("MSIE"),d,i,hold,holdh;
  if(window.adon){
    hold=mysrc;
    holdh=myhref;
    d = parent.frames["navbar"].document;
    mylen=d.links.length-6;
    d.links[mylen].href=holdh;
    if(mytarget){
      d.links[mylen].target=mytarget;
    } else {
      d.links[mylen].target="adwindow";
    }
    mylen=d.images.length-8;
    d.images[mylen].src='';
    d.images[mylen].src=hold;
  }
}


/*changeadtext*/
function changeadtext(myhref,mysrc){
  var ua=navigator.userAgent,ie4=ua.indexOf("MSIE"),d,i,hold,holdh;
  if(window.adon){
    hold=mysrc;
    holdh=myhref;
    d = parent.frames["navbar"].document;
    mylen=d.links.length-6;
    d.links[mylen].href=holdh;
    d.links[mylen].target="text";
    mylen=d.images.length-8;
    MM_preloadImages(hold);
    d.images[mylen].src='';
    d.images[mylen].src=hold;
  }
}


/* changemc */
function changemc(){
  var mylist,mypair,length,i,pos,content;
  var userid,password;
  mylist = document.cookie.split("; ");
  length=mylist.length;
  for(i=0;i<length;i++){
    pos=mylist[i].indexOf("=");
    tag=mylist[i].substr(0,pos);
    content=mylist[i].substr(pos+1);
    if(tag == "userid"){
      userid=unescape(content);
    }
    if(tag == "pass"){
      password=unescape(content);
    }
  }
  if(!password){
    parent.exitinfo.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=" + escape("Edit/Delete Entry");
  } else {
    parent.text.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=Edit+Mailings&thename=" + escape(userid) + "&thepassword=" + escape(password);
    parent.exitinfo.location.href="/mc/change.html";
  }
}


/* checkbuild */
function checkbuild(){
  pos= parent.text.location.href.indexOf('showmsg=byroad');
  if(pos>2){
    parent.exitinfo.location.href="/mc/pleasepress.html";
    return false;
  } else {
    return true;
  }
}


/*FSParChg*/
function FSParChg(FSId,FSPar,FSParVal){
  if (document.getElementById){
    switch(FSPar){
      case "rows":
        if(top.document.getElementById(FSId).rows!=FSParVal){
          top.document.getElementById(FSId).rows=FSParVal;
        }
        break;
      case "cols":
        if(top.document.getElementById(FSId).cols!=FSParVal){
          top.document.getElementById(FSId).cols=FSParVal;
        }
        break;
        default:
    }
  }
}


/* getcity */
function getcity(){
  var mylist,mypair,length,i,pos,mycity,content;
  mylist = document.cookie.split("; ");
  length=mylist.length;
  ifshow=false;
  for(i=0;i<length;i++){
    pos=mylist[i].indexOf("=");
    tag=mylist[i].substr(0,pos);
    content=mylist[i].substr(pos+1);
    if(tag == "city"){
	    return(content);
    }
  }
  return("www");
}


/*gotomc*/
function gotomc(){
  var mylist,mypair,mylength,myselect,i,pos,userid,mycity,password,content;
  mycity="";
  mylist = document.cookie.split("; ");
  mylength=mylist.length;
  for(i=0;i<mylength;i++){
    pos=mylist[i].indexOf("=");
    tag=mylist[i].substr(0,pos);
    content=mylist[i].substr(pos+1);
    switch(tag){
      case "userid":
        userid=unescape(content);
        break;
      case "pass":
        password=unescape(content);
        break;
      case "city":
        mycity=unescape(content);
        break;
      default:
        break;
    }
  }
  myselect=document.nav.city;
  if(myselect.options[myselect.selectedIndex].value=="usa"){
    if(mycity != "usa"){
      setcity(mycity);
    }
//    else{
//      FSParChg('site_content','cols','*,368')
//    }
  }
  if(!userid){
    parent.exitinfo.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=" + escape("Edit/Delete Entry");
  } else {
    parent.exitinfo.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=Show+Reports&thename=" + escape(userid);
    parent.text.location.href="/mc/mymc.html";
  }
}


/*gotopage*/
function gotopage(){
  var myhref,oldhref;
  var a=gotopage.arguments;
  myselect=document.nav.city;
  if(a[0]){
    if(a.length==4){
      top.exitinfo.location.href=a[3];
    }
    if(a.length>=2){
      myhref = "http://" + mysite + a[1] + myselect.options[myselect.selectedIndex].value;
      if(a.length>=3){
        myhref = "http://" + mysite + a[1] + myselect.options[myselect.selectedIndex].value + a[2];
      }
    } else {
      myhref = '';
      myhref = "http://" + mysite + a[1];
    }
//    oldhref=top.text.location.href;
//    if(oldhref!=myhref){
      top.text.location.href=myhref;
//    }
  }
  return false;
}


/*gotopage2*/
function gotopage2(){
  var href;
  var a=gotopage.arguments;
  if(a[0]){
    parent.exitinfo.location.href=a[1];	
  }
  return false;
}


/*ordersv*/
function ordersv(OrdTyp){
  var mylist,mylength,pos,tag,content,i,userid,password;
  mylist = document.cookie.split("; ");
  mylength=mylist.length;
  for(i=0;i<mylength;i++){
    pos=mylist[i].indexOf("=");
    tag=mylist[i].substr(0,pos);
    content=mylist[i].substr(pos+1);
    switch(tag){
      case "userid":
        userid=unescape(content);
        break;
      case "pass":
        password=unescape(content);
        break;
      default:
    }
  }

  if ( isNewInterface ) {
    switch(OrdTyp){
      case "pb":
        top.text.location.href="http://mc2.metrocommute.com/mc/marketingpb.html";
        showinexitinfo( "http://mc2.metrocommute.com/mc/null.html" );
        break;
      case "tm":
        top.text.location.href="http://mc2.metrocommute.com/mc/marketingtext.html";
        showinexitinfo( "http://mc2.metrocommute.com/mc/null.html" );
        break;
      case "em":
        top.text.location.href="http://mc2.metrocommute.com/mc/marketingemail.html";
        showinexitinfo( "http://mc2.metrocommute.com/mc/embsb.html" );
        break;
      case "fpb":
        if(userid){
          top.text.location.href="http://mc2.metrocommute.com/cgi-bin/metro/phonelist";    
          showinexitinfo( "http://mc2.metrocommute.com/mc/pbsb.html" );
        } else {
          showinexitinfo( "http://mc2.metrocommute.com/mc/orderlogin2.php3?otype=fpb" );
        }
        break;
      case "opb":
        if(userid){
          top.text.location.href="http://mc2.metrocommute.com/mc/ol_order.php3";
          showinexitinfo( "http://mc2.metrocommute.com/mc/pbsb.html" );
        } else {
          showinexitinfo( "http://mc2.metrocommute.com/mc/orderlogin2.php3?otype=opb" );
        }
        break;
      default:
        break;
    }
  } else {
    switch(OrdTyp){
      case "pb":
        top.text.location.href="http://" + mysite + "/mc/marketingpb.html";
        top.exitinfo.location.href="http://" + mysite + "/mc/null.html";
        break;
      case "tm":
        top.text.location.href="http://" + mysite + "/mc/marketingtext.html";
        top.exitinfo.location.href="http://" + mysite + "/mc/null.html";
        break;
      case "em":
        top.text.location.href="http://" + mysite + "/mc/marketingemail.html";
        top.exitinfo.location.href="http://" + mysite + "/mc/embsb.html";
        break;
      case "fpb":
        if(userid){
          top.text.location.href="http://" + mysite + "/cgi-bin/metro/phonelist";    
          top.exitinfo.location.href="http://" + mysite + "/mc/fpbsb.html";
        } else {
          top.exitinfo.location.href="http://" + mysite + "/mc/orderlogin.php3?otype=fpb";
        }
        break;
      case "opb":
        if(userid){
          top.text.location.href="http://" + mysite + "/mc/ol_order.php3";
          top.exitinfo.location.href="http://" + mysite + "/mc/opbsb.html";
        } else {
          top.exitinfo.location.href="http://" + mysite + "/mc/orderlogin.php3?otype=opb";
        }
        break;
      default:
        break;
    }
  }
}

				  
/*gotoweather*/
function gotoweather(){
  switch(city){
    case "newyork":
      changead2('http://www.wunderground.com/US/NY/New_York.html','http://banners.wunderground.com/banner/default_both/US/NY/New_York.gif');
      break;
    case "hartford":
      changead2('http://www.wunderground.com/US/CT/Hartford.html','http://banners.wunderground.com/banner/default_both/US/CT/Hartford.gif');
      break;
    case "sanfrancisco":
      changead2('http://www.wunderground.com/US/CA/San_Francisco.html','http://banners.wunderground.com/banner/default_both/US/CA/San_Francisco.gif');
      break;
    case "losangeles":
      changead2('http://www.wunderground.com/US/CA/Los_Angeles.html','http://banners.wunderground.com/banner/default_both/US/CA/Los_Angeles.gif');
      break;
    case "houston":
      changead2('http://www.wunderground.com/US/TX/Houston.html','http://banners.wunderground.com/banner/default_both/US/TX/Houston.gif');
      break;
    default:
      break;
  }
}


/* ifshowmc */
function ifshowmc(){
  var mylist,mypair,length,i,pos,ifshow,content;
  mylist = document.cookie.split("; ");
  length=mylist.length;
  ifshow=false;
  for(i=0;i<length;i++){
    pos=mylist[i].indexOf("=");
    tag=mylist[i].substr(0,pos);
    content=mylist[i].substr(pos+1);
    if(tag == "texthref"){
      ifshow=true;
      return(ifshow);
    }
  }
  return(ifshow);
}


/*resetbuttons*/
function resetbuttons(){
  var myselect;
  myselect=document.nav.city;
  newcity=myselect.options[myselect.selectedIndex].value;
  if(city != newcity){
    city=newcity;
    if(city=="usa"){
      ifacity=false;
      MM_deactivateImage('navbar_r2_c9','','/images/navbar_r2_c9_f3.gif',1);
      MM_deactivateImage('navbar_r2_c14','','/images/navbar_r2_c14_f3.gif',1);
      MM_deactivateImage('navbar_r3_c9','','/images/navbar_r3_c9_f3.gif',1);
      MM_deactivateImage('navbar_r3_c14','','/images/navbar_r3_c14_f3.gif',1);
      MM_deactivateImage('navbar_r5_c9','','/images/navbar_r5_c9_f3.gif',1);
      MM_deactivateImage('navbar_r5_c14','','/images/navbar_r5_c14_f3.gif',1);
//    top.text.location.href="/mc/splash.html";
//    top.exitinfo.location.href="/mc/null.html";
//    FSParChg("site_content","cols","*,1");
    } else {
      ifacity=true;
      setexitinfo(true,'/cgi-bin/metro/zoommap.pl?area=','&showmsg=headlines');
      MM_activateImage('navbar_r2_c9','','/images/navbar_r2_c9.gif',1);
      MM_activateImage('navbar_r3_c9','','/images/navbar_r3_c9.gif',1);
      MM_activateImage('navbar_r5_c9','','/images/navbar_r5_c9.gif',1);
      MM_activateImage('navbar_r5_c14','','/images/navbar_r5_c14.gif',1);
      FSParChg("site_content","cols","*,368");
    }
    switch(city){
      case "newyork":
        ifvideo=true;
        MM_activateImage('navbar_r2_c14','','/images/navbar_r2_c14.gif',1);
        iftransit=true;
        MM_activateImage('navbar_r3_c14','','/images/navbar_r3_c14.gif',1);
        break;
      case "hartford":
        ifvideo=true;
        MM_activateImage('navbar_r2_c14','','/images/navbar_r2_c14_f3.gif',1);
        iftransit=false;
        MM_deactivateImage('navbar_r3_c14','','/images/navbar_r3_c14_f3.gif',1);
        break;
      default:
        ifvideo=false;
        MM_deactivateImage('navbar_r2_c14','','/images/navbar_r2_c14_f3.gif',1);
        iftransit=false;
        MM_deactivateImage('navbar_r3_c14','','/images/navbar_r3_c14_f3.gif',1);
    }
  }
}


/* savemc */
function savemc(){
  var expires,dat;
//  if(checkbuild()){
//    if(!ifshowmc()){
//      MM_activateImage('Image36','','/images/top_r2_c16.gif',1);
//    }
  dat = new Date();
  dat.setFullYear(dat.getFullYear() + 1);
  expires=dat.toGMTString();
  document.cookie= 'city=' + city  + "; path=/; expires=" + expires;
  document.cookie= 'texthref=' + escape(top.text.location.href) +"; path=/; expires=" + expires;
//  if ( isNewInterface ) {
    showinexitinfo( "/mc/mc_startpageset.html" );
//  } else {
//    setexitinfo(1,'/mc/mc_startpageset.html');
//  }
//  }
}


/* sendmc */
function sendmc(){
  var mylist,mypair,length,i,pos,content;
  var userid,password;
  if(checkbuild()){
    mylist = document.cookie.split("; ");
    length=mylist.length;
    for(i=0;i<length;i++){
      pos=mylist[i].indexOf("=");
      tag=mylist[i].substr(0,pos);
      content=mylist[i].substr(pos+1);
      if(tag == "userid"){
        userid=unescape(content);
      }
      if(tag == "pass"){
        password=unescape(content);
      }
    }
    if(!password){
      parent.exitinfo.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=" + escape("Add+report+password");
    } else {
      parent.text.location.href="/cgi-bin/metro/mc_emaildb.pl?OP=Add+report&thename=" + escape(userid) + "&thepassword=" + escape(password);
    }
  }
}


/*setcity*/
function setcity(newcity){

  city = newcity;

/*
  var mylength,i,myselect;
  myselect=document.nav.city;
  mylength=myselect.options.length;
  for(i=0;i<mylength;i++){
    if(newcity == myselect.options[i].value){
      myselect.selectedIndex=i;
      i=mylength;
    }
  }
  resetbuttons();
*/
}



/*setcityandpage*/
function setcityandpage(newcity){
  var mylength,i,myselect;
  myselect=document.nav.city;
  mylength=myselect.options.length;
  for(i=0;i<mylength;i++){
    if(newcity == myselect.options[i].value){
      myselect.selectedIndex=i;
      setpage();
      i=mylength;
    }
  }
  resetbuttons();
}


/*setexitinfo*/
function setexitinfo(){
  var myhref,a=setexitinfo.arguments;
  myselect=document.nav.city;
  if(a[0]){
    if(a.length>=3){
      myhref = "http://" + mysite + a[1] + myselect.options[myselect.selectedIndex].value + a[2];
    } else {
      myhref = "http://" + mysite + a[1]
    }
//    if(parent.exitinfo.location.href!=myhref){
      parent.exitinfo.location.href=myhref;
//    }
  }
  return false;
}


/*setfirstcity*/
function setfirstcity(){
  parent.adOK=true;
  myselect=document.nav.city;
  if(myselect.selectedIndex == 0){
    pos=mysite.indexOf('metrocommute.com');
    if(pos>2){
      newcity=mysite.substring(0,pos-1);
      if(newcity == "www"){
        newcity=getcity();
        setcityandpage(newcity);
      } else {
        setcity(newcity);
      }
    } else {
      newcity=getcity();
      if(newcity!= "www"){
        setcityandpage(newcity);
      } else {
        resetbuttons();
      }
    }
  }
}


/*setpage*/
function setpage(){
  myselect=document.nav.city;
  newcity=myselect.options[myselect.selectedIndex].value;
  if(city != newcity){
    if(newcity == "usa"){
      parent.text.location.href="/mc/splash.html";
      setexitinfo(true,"/mc/null.html");
    } else {
      gotopage(true,'/cgi-bin/metro/zoommap.pl?region=intro&area=','&control=off&info=Headline&info=Accident+Alert&info=Delay&info=Special+Event&info=Cameras');
    }
  } 
  resetbuttons();
}
/*settext*/
function settext(){
  var myhref,a=settext.arguments;
  myselect=document.nav.city;
  if(a[0]){
    if(a.length>=3){
      myhref= "http://" + mysite + a[1] + myselect.options[myselect.selectedIndex].value + a[2];
    } else {
      myhref= "http://" + mysite + a[1];
    }
//    if(top.text.location.href!=myhref){
      top.text.location.href=myhref;
//    }      
  }
  return false;
}


/* showmc */
function showmc(mymcset){
  var mylist,mypair,length,i,pos,content;
  mylist = document.cookie.split("; ");
  length=mylist.length;
  for(i=0;i<length;i++){
    pos=mylist[i].indexOf("=");
    tag=mylist[i].substr(0,pos);
    content=mylist[i].substr(pos+1);
    if(tag == "city"){
      setcity(content);
    }
    if(tag == "texthref"){
      mymcset = "1";
      top.text.location.href=unescape(content);
//      setexitinfo(1,'/mc/startpageview.html');            
    }
  }
  if(!mymcset){
    if ( isNewInterface ) {
      showinexitinfo( "/mc/mc_startpageunset.html" );
    } else {
      setexitinfo(1,'/mc/mc_startpageunset.html');
    }
  }
}


window.adon=true;
/* End MC site functions */











/* here */
