// JScript File

// 0=Why Choose Us
// 1=Fleet &amp; Rates
// 2=Specialized Tours
// 3=Reservations
// 4=Contact Us
// 5=Worldwide

if(document.layers){
    var h='hide';
    var v='show'
}else{
    var h='hidden';
    var v='visible'
} 

function getDivObj(id){ 
    var obj = getObj(id);
    
    if(typeof obj != 'undefined'){
        return obj.style
    } 
    return null; 
} 


function hideDivObj(id){ 
    var oObj = getDivObj(id)
    if(oObj != null){
        oObj.visibility=h; 
        oObj.display = 'none';
    }
}

function showDivObj(id){ 

    var oObj = getDivObj(id) 
    
    if(oObj != null){
        oObj.visibility=v; 
        oObj.display = 'inline';
    }
}  

var content = ["<!--Why Choose Us -->" +
               "<span  class=\"highlight\">\"We have been using them since 1975, " +
               "Metropolitan is Chicago's best!\"</span><br><br>" +
               "<span class=\"caption\">- Jon Winke<br>" +
               "Chef Concierge, <br>" +
               "Chicago" +
               "Ritz-Carlton</span>"
               ,
               "<!--Fleet &amp; Rates -->" +
               "<span class=\"highlight\">Contact us today for our rates or to request a car:<br><br></span>" +
               "<span class=\"highlight2\">(312) 808-8000</span>" +
               "<span class=\"highlight\"><br>toll free:<br></span>" +
               "<span class=\"highlight2\">(800) 437-1700</span>"
               ,
               "<!--Specialized Tours -->" +
               "<span class=\"highlight\">Chicago should be seen and celebrated for what it is today.</span>"
               ,
               "<!--Reservations -->" +
               "<span  class=\"highlight\">Call us 24 hours a day, seven days a week:<br><br></span>" +
               "<span class=\"highlight2\">(312) 808-8000</span>" +
               "<span  class=\"highlight\"><br>toll free:<br></span>" +
               "<span class=\"highlight2\">(800) 437-1700<br><br>" +
               "or book online from anywhere at any time.</span>"
               ,
               "<!--Contact Us -->" +
               "<span class=\"highlight\">Contact us today for our rates or to request a car:<br><br></span>" +
               "<span class=\"highlight2\">(312) 808-8000</span>" +
               "<span class=\"highlight\"><br>toll free:<br></span>" +
               "<span class=\"highlight2\">(800) 437-1700</span>" +
               "<p><b>24-hour Fax:</b></p>" +
               "<p><font color=\"#FFFF00\"><b>(312) 225-9025</b></font>"
               ,
               "<!--Worldwide -->" +
               "<span class=\"highlight\">Contact us today for our rates or to request a car:<br><br></span>" +
               "<span class=\"highlight2\">(312) 808-8000</span>" +
               "<span class=\"highlight\"><br>toll free:<br></span>" +
               "<span class=\"highlight2\">(800) 437-1700</span>" +
               "<p><b>24-hour Fax:</b></p>" +
               "<p><font color=\"#FFFF00\"><b>(312) 225-9025</b></font>"
];

// <span class="highlight">Metropolitan Limousine is honored to be a part of Dav-El's worldwide limousine network, with affiliates in almost every major city. </span>

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// get a reference to an element
function getObj(id){ 
    var obj;
    var ns=(document.layers); 
    var ie=(document.all); 
    var w3=(document.getElementById && !ie); 
    if(ns && typeof document.layers[id] != 'undefined'){obj = document.layers[id]} 
    else if(ie && typeof document.all[id] != 'undefined'){obj = document.all[id]} 
    else if(w3 && typeof document.getElementById(id) != 'undefined'){obj = document.getElementById(id)} 
    return obj; 
} 

function ShowContent(contentId){

    var obj;
        obj = getObj('divContent');
    
    obj.innerHTML = content[contentId];    

}

// array of thumbnails

function ShowThumbnails() { 

    var _thumbnails = ["Bus002", 
                       "Bus003", 
                       "Bus016", 
                       "Bus026", 
                       "Bus031", 
                       "Bus033", 
                       "Bus053", 
                       "Bus059", 
                       "Bus080", 
                       "Bus081", 
                       "RRFront", 
                       "RRRear", 
                       "RRIntDrive", 
                       "RRBackSeat", 
                       "RRIntTVs", 
                       "RRIntRoof",
                       "IMG_0889",
                       "IMG_0909",
                       "IMG_0913",
                       "IMG_0917",
                       "IMG_0930",
                       "IMG_0934",
                       "Mercedes-Benz-S-Class",
                       "IMG_0939",
                       "IMG_0948",
                       "IMG_0964",
                       "IMG_0965",
                       "IMG_0969",
                       "IMG_0973",
                       "IMG_0984",
                       "DSC00481",
                       "DSC00503"];
                       
    var _content = ["<!--Bus002-->56 Passenger Motor Coach", 
                    "<!--Bus003-->56 Passenger Motor Coach", 
                    "<!--Bus016-->32 Passenger Coach Rear Cap", 
                    "<!--Bus026-->32 Passenger Coach", 
                    "<!--Bus031-->32 Passenger Coach", 
                    "<!--Bus033-->32 Passenger Coach", 
                    "<!--Bus053-->Executive Mini Coach", 
                    "<!--Bus059-->Executive Mini Coach", 
                    "<!--Bus080-->28 Passenger Coach Interior", 
                    "<!--Bus081-->Coach Interior",
                    "Rolls Royce",
                    "Rolls Royce",
                    "Rolls Royce",
                    "Rolls Royce",
                    "Rolls Royce",
                    "Rolls Royce",
                    "<!--IMG_0889-->Executive Mini Coach rear cap ",
                    "<!--IMG_0909-->Sedan interior amenities tray",
                    "<!--IMG_0913-->Sedan interior",
                    "<!--IMG_0917-->Stretch Limo interior",
                    "<!--IMG_0930-->SUV rear luggage space and folding third row",
                    "<!--IMG_0934-->SUV interior",
                    "Mercedes-Benz-S-Class",
                    "<!--IMG_0939-->Benz interior",
                    "<!--IMG_0948-->8 Passenger Stretch Limo interior",
                    "<!--IMG_0964-->Towncar trunk",
                    "<!--IMG_0965-->Benz trunk",
                    "<!--IMG_0969-->Passenger Van Interior",
                    "<!--IMG_0973-->Van rear interior with one row out showing luggage space",
                    "<!--IMG_0984-->14 Passenger Van",
                    "<!--DSC00481-->Executive Van",
                    "<!--DSC00503-->Executive Van Interior"];

  // loop through thumbnails
  var i = 0;

  for(i=0;i<_thumbnails.length;i++){

    // alert('_thumbnails[i]=' + _thumbnails[i] + ', _content[i]=' + _content[i]);
    //alert('                  onclick="javascript:setImageAndContent(' + _thumbnails[i] + '_500.jpg, ' + _content[i] + ');" \n');

	document.write('\n');
	document.write(' <td><img src="/images/spacer.gif" width="2" height="200"></td>\n');
	document.write('  <td valign="top"><table style="height: 215px;" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#5F6160">\n');
	document.write('      <tr> \n');
	document.write('        <td align="center" valign="top"><table width="100%" \n');
	document.write('            border="0" cellspacing="0" cellpadding="3">\n');
	document.write('            <tr> \n');
	document.write('              <td bgcolor="#303030"><img \n');
	document.write('                  src="/images/vehicle/' + _thumbnails[i] + '_240.jpg" \n');
	document.write('                  onclick="javascript:setImageAndContent(\'' + _thumbnails[i] + '_500.jpg\', \'' + _content[i] + '\');" \n');
	document.write('                  height="180"></td>\n');
	document.write('            </tr>\n');
	document.write('          </table>\n');
	document.write('          ' + _content[i] + '\n');
	document.write('        </td>\n');
	document.write('      </tr>\n');
	document.write('    </table>\n');
	document.write('  </td>	\n');
  }	
}

function setImageAndContent(imgSrc, content)
{
    // alert('imgSrc=' + imgSrc + ', content=' + content);
    
    var img;
        img = getObj('imgLarge');
        
    if(img != null){
      //alert('found img');
        img.src = '/images/vehicle/' + imgSrc;
    }           
    
    var div;
        div = getObj('divImgContent');

    if(img != null){
      //alert('found div');
        div.innerHTML = content;
    }           
        
}

function SilverlightTest(index)
{
    createSilverlightPhotoGallary(index);

    if(Silverlight.available)
    {
        hideDivObj('NonSilverlightControl');
        showDivObj('SilverlightControl');
    }
    else
    {
        showDivObj('NonSilverlightControl');
        hideDivObj('SilverlightControl');
    }
}
