// <script>
  // Preload images:

  if (document.images) {
    // Tab images:

    homeOn = new Image; homeOn.src = "/images/layout/new-menu/home-new.png";
    homeOff = new Image; homeOff.src = "/images/layout/new-menu/home-new.png";
	menuOn = new Image; menuOn.src = "/images/layout/new-menu/menu-new.png";
    menuOff = new Image; menuOff.src = "/images/layout/new-menu/menu-new.png";
    orderOn = new Image; orderOn.src = "/images/layout/new-menu/order-new.png";
    orderOff = new Image; orderOff.src = "/images/layout/new-menu/order-new.png";
    eventsOn = new Image; eventsOn.src = "/images/buttons/events_tab_on.gif";
    eventsOff = new Image; eventsOff.src = "/images/buttons/events_tab_off.gif";
	magicOn = new Image; magicOn.src = "/images/layout/new-menu/magic-catering-new.png";
    magicOff = new Image; magicOff.src = "/images/layout/new-menu/magic-catering-new.png";
	cateringOn = new Image; cateringOn.src = "/images/buttons/catering-tab-on.jpg";
    cateringOff = new Image; cateringOff.src = "/images/buttons/catering-tab-off.jpg";
	contactOn = new Image; contactOn.src = "/images/layout/new-menu/contact-new.png";
    contactOff = new Image; contactOff.src = "/images/layout/new-menu/contact-new.png";
    aboutOn = new Image; aboutOn.src = "/images/layout/new-menu/about-new.png";
    aboutOff = new Image; aboutOff.src = "/images/layout/new-menu/about-new.png";
    opportunitiesOn = new Image; opportunitiesOn.src = "/images/layout/new-menu/franchise-new.png";
    opportunitiesOff = new Image; opportunitiesOff.src = "/images/layout/new-menu/franchise-new.png";
    cartOn = new Image; cartOn.src = "/images/buttons/cart_tab_on.gif";
    cartOff = new Image; cartOff.src = "/images/buttons/cart_tab_off.gif";

    // Other images:
    if (document.all) {
      loadingGif = new Image; loadingGif.src = "/images/layout/loading.gif";
    }    
  }

// Image Swapper

  function hiLite(imgName, imgObjName) {
    if (document.images) {
		  document.images[imgName].src = eval(imgObjName + ".src");
		}
  }

// Turn off all the tabs
  
  function tabsOff() {
    parent.mo_top_bottom.document.images.home_tab.src = '/images/layout/new-menu/home-new.png'
    parent.mo_top_bottom.document.images.order_tab.src = '/images/layout/new-menu/order-new.png'
    parent.mo_top_bottom.document.images.magiccircle_tab.src = '/images/layout/new-menu/magic-catering-new.png'
    parent.mo_top_bottom.document.images.contact_tab.src = '/images/layout/new-menu/contact-new.png'
    parent.mo_top_bottom.document.images.about_tab.src = '/images/layout/new-menu/about-new.png'
    parent.mo_top_bottom.document.images.opportunities_tab.src = '/images/layout/new-menu/franchise-new.png'
	  
	
  }

// Change pages
  
  function pleaseWait(atab) {
    if (document.all) {
      parent.mo_main.main.innerHTML = '<table border="0" cellspacing="0" cellpadding="5" width="100%" height="100%"><tr><td width="100%" align="center" valign="middle"><img id="loadingGif" src="/images/layout/loading.gif"></td></tr></table>'
    }
    else if (document.getElementById) {
      parent.mo_main.document.getElementById('main').innerHTML = '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="5" style="height: 100%;"><tr><td width="100%" align="center"><br><br><br><br><img id="loadingGif" src="/images/layout/loading.gif" border="0" align="middle" alt=""></td></tr></table>'
    }
      tabsOff()
//      if (document.images && (atab != null)) {
      if (document.images) {
        if (document.all) {
          var changeOn = atab + '_tab'
            parent.mo_top_bottom.document.images[changeOn].src = eval(atab + 'On.src')
        }
        else if (document.layers) {
          var changeOn = atab + '_tab'
          var imageObj = parent.mo_top_bottom.document.images.changeOn
          imageObj.src = eval(atab + 'On.src')
        }
      }
  }

// Turn on a tab

  function tabs(atab) {
    var changeOn = atab + '_tab'
      if (document.images) {
        tabsOff()
        parent.mo_top_bottom.document.images[changeOn].src = eval(atab + 'On.src')
      }
  }

// Measure Screen
  function measureScreen() {
    var pointB = (screen.width / 2) - 225
    var pointA = (screen.height / 2) - 150
    var placement = "screenX=" + pointA + ",screenY=" + pointB + ",top=" + pointA + ",left=" + pointB
    return placement
  }

// Window popup  

  function popup_win(auto) {
    if (auto == 'yes') {
      if (readCookie('showpopup') != 3) {
        popper = window.open('map/map.html','map',measureScreen())
        popper.focus()
      }
    }
    else {
      popper = window.open('map/map.html','map',measureScreen())
      popper.focus()
    }
    measureScreen()
  }

// Map popup  

  function map_win(store,map,wURL,args) {
      mo_store = '/map.php?map=' + map + '&store=' + store + '&' + args
        popper = window.open(mo_store,'map','width=450,height=300,'+measureScreen())
        popper.focus()
  }

// Crusts popup

  function crust_popup() {
    popper = window.open('crusts.html','map','width=200,height=300,'+measureScreen())
    popper.focus()
  }
        
  function new_popup(wURL,wName,wWidth,wHeight,wScroll) {
    popper = window.open(wURL,wName,'width='+wWidth+',height='+wHeight+','+measureScreen()+',scrollbars='+wScroll)
    popper.focus()
  }
        
// Cookie reading monster!
  
  function readCookie (CookieName) {
  var CookieString = document.cookie
  var CookieSet = CookieString.split (';')
  var SetSize = CookieSet.length
  var CookiePieces
  var ReturnValue = ""
  var x = 0

  for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++) {
  
    CookiePieces = CookieSet[x].split ('=')

    if (CookiePieces[0].substring (0,1) == ' ') {
      CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length)
    }

    if (CookiePieces[0] == CookieName) {
      ReturnValue = CookiePieces[1]
    }
  }
    return ReturnValue
  }
  

