// JavaScript Document
function showSubMenus()
{
   
   document.getElementById("subSystemMenu").style.visibility = 'visible';
}
function hideSubMenus()
{
   document.getElementById("subSystemMenu").style.visibility = 'hidden';
}
function pointerOn(theElement)
{
   document.getElementById(theElement).style.cursor = 'hand';
}
function pointerOff()
{
   document.getElementById("theBody").style.cursor = 'default';
}
function mouseDown()
{
   carRunDisplay();
}
function menuColourOn(cell)
{

      
      /*if (navigator.appName != "Netscape")  {
         document.getElementById(cell).filters[0].opacity = 100;
      }
      else
      {
         document.getElementById(cell).style.opacity = 1;
      }*/
      

      if (navigator.appName != "Netscape")  {
   document.getElementById(cell).style.filter ="revealTrans(duration=0.5, transition=12)";
      document.getElementById(cell).filters.revealTrans.apply();
      document.getElementById(cell).filters.revealTrans.Play();
      }
      document.getElementById(cell).style.backgroundImage = "URL(pics/redRounded.jpg)";
	  
      document.getElementById(cell).style.color = "black";
      document.getElementById(cell).style.fontWeight = "bold";

      pointerOn(cell);
      
      
      if (cell != "systemCell")
      {  
         hideSubMenus();
      }
}



function menuColourOff(cell)
{

     /* if (navigator.appName != "Netscape")  {
         document.getElementById(cell).filters[0].opacity = 95;
      }
      else
      {
         document.getElementById(cell).style.opacity = 0.95;
      }*/
      
      document.getElementById(cell).style.backgroundImage = "URL(pics/blackRounded.jpg)";
      document.getElementById(cell).style.color = "white";
      pointerOff(cell);
}
var carPos = mainLeftBorder + 20;
function carRunDisplay()
{

document.getElementById("clipCarL").style.visibility = 'visible';
document.getElementById("clipCarL").style.left = carPos;


   if (carPos < centre)
      {
         carPos = carPos + 20;
         window.setTimeout("carRunDisplay()", 5);
      }
   else
      {
         
         carPos = mainLeftBorder + 20;
      }
}
var theMes = new Array();
theMes[1] = "Renfrewshire's <A>Largest</A> and <A>Best</A> Private Hire Company";
theMes[2] = "Manager Email:"+'<A HREF="mailto:management@renfrewshirecabco.co.uk">management@renfrewshirecabco.co.uk</A>';
theMes[3] = "Manager Tel : <A>0141 889 0000</A>";
theMes[4] = "Admin Email:"+'<A HREF="mailto:admin@renfrewshirecabco.co.uk">admin@renfrewshirecabco.co.uk</A>';
theMes[5] = "Admin Tel : <A>0141 889 0666</A>";
theMes[6] = "Fax : <A>0141 849 6335</A>";
theMes[7] = "For a quote please " + '<A HREF="mailto:management@renfrewshirecabco.co.uk">email</A>' + " or call <A>0141 889 0000<A>."
var theString = "";
var counter = 1;
var mesCounter = 1;
function mesTicker()
{
   theString = theString + theMes[mesCounter].substr(0, counter);
   document.getElementById("topTableData").innerHTML = theString;
   if (counter < theMes[mesCounter].length)
   {
     counter++;
     theString = "";
     window.setTimeout("mesTicker()", 5);
   }
   else
   {
       counter = 1;
       theString = "";
       if (mesCounter < 1)
       {
         mesCounter++;
       }
       else
       {
          mesCounter = 1;
       }
       
       window.setTimeout("mesTicker()", 5000);
          
   }
   
}


function openLink()
{
window.open('http://maps.google.co.uk/maps?hl=en&tab=wl','googleMaps', 'height=600, width=800', true);
}
function openCarpark()
{
   window.open('pics/airportMap.jpg','airportMap', 'height=600, width=600', true);;
}

function enlargePic(theSrc)
{
   
   var thePic = new Image();
   thePic.src = "pics/" + theSrc;
   
   var bigPic = new Object();
   bigPic = window.open(thePic.src, "bigWindow", "location=0, resizable=1");
   if (theSrc != "ad1Big2.jpg")
   {
      bigPic.focus();
   }   
   
}

function calculateMileage()
{
   var entry = parseFloat(document.getElementById("mileageText").value);

   var result;
  
   if ((entry.length !== 0) && (!isNaN(entry)) && (entry !== 0))
   {
      result = ((parseFloat(entry) - 1) * 1.3) + 3.3;
      if (result < 3.3)
      {
         result = 3.3;
      }
      checkScroll();
      var displayNum = Math.round((result.toFixed(2)) * 10) / 10;
      document.getElementById("quoteResult").innerHTML = "The estimated cost for your journey is <B CLASS='airportHighlight'>£" + displayNum.toFixed(2) + '</B>';

   }
   else
   {
      window.alert("Please enter a valid number.");
   }
}
function checkScroll()
{
      
      var scrollVal;
      if (navigator.appName == "Netscape")
      {
        
        
       
        
           document.getElementById("theBody").scrollTop = 240;
        
      }
      else
      { 
         scrollVal = document.getElementById("theBody").scrollTop;
         if (scrollVal < 150)
         {
            document.getElementById("theBody").scrollTop = 180;
         }
      }
      
      
      

}      
///colour change///
var strChar = "0123456789ABCDEF";
var hexChar = new Array();

for (i = 0;i < 16; i++)  {
hexChar[i] = strChar.substr(i, 1);

}





   




function openMap()
{
   window.alert("MAP");
}
var sideMessages = new Array();
sideMessages[0] = "Fast and Reliable Service";
sideMessages[1] = "24hrs A Day - 7 Days a Week - 365 Days a Year";
sideMessages[2] = "All Vehicles tracked by GPS";
sideMessages[3] = 'Callback or Textback on Approach' ;
sideMessages[4] = 'Around 500 Vehicles Available' ;
sideMessages[5] = 'State of the Art Booking and Dispatch' ;
sideMessages[6] = 'Great Value Customer Accounts' ;
sideMessages[7] = 'IVR Automated Booking' ;
var chooseMes = 0;
var displayStr = "";
var c = 0;
var lastc = -1;
function rotMes(theElement)
{
   
   c = Math.floor(Math.random() * 8);
   if (lastc == c)
   {
      c = Math.floor(Math.random() * 8);
   }  
   lastc = c;
  if (navigator.appName != "Netscape")  {
   document.getElementById(theElement).style.filter ="revealTrans(duration=1, transition=12)";
      document.getElementById(theElement).filters.revealTrans.apply();
      document.getElementById(theElement).filters.revealTrans.Play();
      }
      document.getElementById(theElement).innerHTML = sideMessages[c];
       
      window.setTimeout("fadeOutRotMes('" + theElement + "')", 5000); 

   
}

function fadeOutRotMes(theElement)  {

      if (navigator.appName != "Netscape")  {
         document.getElementById(theElement).style.filter ="revealTrans(duration=1, transition=12)";
         document.getElementById(theElement).filters.revealTrans.apply();
         document.getElementById(theElement).filters.revealTrans.Play();
      }
      
      document.getElementById(theElement).innerHTML = "";
      window.setTimeout("rotMes('" + theElement + "')", 1000);
}
function fadeOutNumbers(theElement)  {

      if (navigator.appName != "Netscape")  {
         document.getElementById(theElement).style.filter ="revealTrans(duration=1, transition=12)";
         document.getElementById(theElement).filters.revealTrans.apply();
         document.getElementById(theElement).filters.revealTrans.Play();
      }
      
      document.getElementById(theElement).innerHTML = "";
      window.setTimeout("showNumbers('" + theElement + "')", 1000);
}
var randSlideNum = 0;
var lastNum = -1;
var loopCounts = 0;

function runSlideShow(theElement)
{
  // alert("show show is " + showShow);
   if (!showShow)
   {
      return;
   }
   randSlideNum = Math.round((Math.random())*8);
   while (randSlideNum == lastNum)
   {
      randSlideNum = Math.round((Math.random())*8);
      
   }
   lastNum = randSlideNum;
   //document.getElementById('homeCell').innerHTML = randSlideNum;
   

      if (navigator.appName != "Netscape")  {
        document.getElementById(theElement).style.filter="blendTrans(duration=2)";
        
        document.getElementById(theElement).filters.blendTrans.apply();
        document.getElementById(theElement).filters.blendTrans.Play(); 
        
           document.getElementById(theElement).src = slidePicArray[randSlideNum].src;
				
      }
      else
      {
         
         firefoxBlend(theElement, randSlideNum);
         
      }

     
     
     
     
         window.setTimeout("runSlideShow('" + theElement + "')", 6000);
        
     
}


var numbersArray = new Array("0141 887 7770", "0141 889 7770", "0141 887 0505", "0141 889 0505", "0141 886 6666");
var theNum = 0;
function showNumbers(theElement)
{
   theNum = Math.round(Math.random()*4);
   if (navigator.appName != "Netscape")
   {
         document.getElementById(theElement).style.filter ="revealTrans(duration=1, transition=12)";
         document.getElementById(theElement).filters.revealTrans.apply();
         document.getElementById(theElement).filters.revealTrans.Play();
   }

   
   document.getElementById(theElement).innerHTML = numbersArray[theNum];
   
   window.setTimeout("fadeOutNumbers('" + theElement + "')", 5000);
}

/////
//firefox blend///
var opac = 0;
var opac2 = 0;
var fadeOut = true;
var fadeOut2 = true;
function firefoxBlend(theElement)
{
   if (theElement == "homeSlide")
   {
      firefoxFadeIn(theElement);
   }
   else
   {
      firefoxFadeIn2(theElement);
   }
   document.getElementById(theElement).src = slidePicArray[randSlideNum].src;
}

function firefoxFadeOut(theElement)
{
   opac = opac - 0.5;
   if (opac <= 0)
   {
      
      opac = 0;
      fadeOut = false;
   }
   else
   {
      document.getElementById(theElement).style.opacity = opac / 10;
      window.setTimeout("firefoxFadeOut('" + theElement + "')", 50);
   }   
}
function firefoxFadeIn(theElement)
{
   opac = opac + 0.5;
   if (opac >= 10)
   {
      opac = 10;
      window.setTimeout("firefoxFadeOut('" + theElement + "')", 4000);
   }
   else
   {
      document.getElementById(theElement).style.opacity = opac / 10;
      window.setTimeout("firefoxFadeIn('" + theElement + "')", 50);
   }   
}
function firefoxFadeOut2(theElement)
{
   opac2 = opac2 - 0.5;
   if (opac2 <= 0)
   {
      
      opac2 = 0;
      fadeOut2 = false;
   }
   else
   {
      document.getElementById(theElement).style.opacity = opac2 / 10;
      window.setTimeout("firefoxFadeOut2('" + theElement + "')", 10);
   }   
}
function firefoxFadeIn2(theElement)
{
   opac2 = opac2 + 0.5;
   if (opac2 >= 10)
   {
      opac2 = 10;
      window.setTimeout("firefoxFadeOut2('" + theElement + "')", 4000);
   }
   else
   {
      document.getElementById(theElement).style.opacity = opac2 / 10;
      window.setTimeout("firefoxFadeIn2('" + theElement + "')", 50);
   }   
}
//////
/////Phone number flash///
var phoneNum = 1;
function numberFlash()
{

   if (phoneNum > 1)
   {
      document.getElementById("num" + (phoneNum - 1)).style.color = "black";
   }   
   document.getElementById("num" + phoneNum).style.color = "red";
   if (phoneNum < 9)
   {
      phoneNum++;
      window.setTimeout("numberFlash()", 80);
   }   
}

