// Rollover Object version 1.0
// written by: Jon M. Toribio

function Rollover(tgt, on_img) {
   arg = Rollover.arguments;
   if (arg.length < 2) {
      alert("new Rollover: wrong number of parameters passed. Expecting at least 2.");
      return null;
   }

   // Properties
   this.active = true;

   imgObj = eval("document."+tgt);
   if (imgObj && imgObj.length) { 
      this.tgt = "document."+tgt+"[0]"; 
   }
   else { 
      this.tgt = "document."+tgt; 
   }
   
   // if a Layer ID has been specified change this.tgt
   if (arg[4]) {
      if (document.layers) {
         this.tgt = "document.layers['" + arg[4] + "'].document.images['"+tgt+"']";
      } 
      if (document.all) {
         this.tgt = "document."+tgt; 
      }
   }

   if (document.images) {
      this.on_image = new Image();
      this.on_image.src = on_img;
      if (arg[2]) {
         this.off_image = new Image();
         this.off_image.src = arg[2];
      }
      if (arg[3]) {
         this.down_image = new Image();
         this.down_image.src = arg[3];
      }
   }
   return this;
}

// ===========================================================================
// Methods
// ===========================================================================

function Rollover_on() {
   if (document.images && this.on_image && this.active) {
      theObj = eval(this.tgt);
      if (theObj) { theObj.src = this.on_image.src; }
   }
}

function Rollover_off() {
   if (document.images && this.off_image && this.active) {
      theObj = eval(this.tgt);
      if (theObj) { theObj.src = this.off_image.src; }
   }
}

function Rollover_down() {
   if (document.images && this.down_image && this.active) {
      theObj = eval(this.tgt);
      if (theObj) { theObj.src = this.down_image.src; }
   }
}

function Rollover_activate() { this.active = true; }
function Rollover_deactivate() { this.active = false; }

// Assigning the methods to the prototype
Rollover.prototype.on         = Rollover_on;
Rollover.prototype.off        = Rollover_off;
Rollover.prototype.down       = Rollover_down;
Rollover.prototype.activate   = Rollover_activate;
Rollover.prototype.deactivate = Rollover_deactivate;


// ===========================================================================
// RolloverMenu Object version 0.1
// written by: Jon M. Toribio
// ===========================================================================

function RolloverMenu() {
        this.menuItems = new Array();
        return this;
}

RolloverMenu.prototype.addMenuItem    = RolloverMenu_addMenuItem;
RolloverMenu.prototype.selectMenuItem = RolloverMenu_selectMenuItem;
RolloverMenu.prototype.selectMenuItemLed = RolloverMenu_selectMenuItemLed;
RolloverMenu.prototype.resetMenu      = RolloverMenu_resetMenu;

function RolloverMenu_addMenuItem(rollover_object) {
        this.menuItems[this.menuItems.length] = rollover_object;
}

function RolloverMenu_selectMenuItem(idx) {
        for (i = 0 ; i < this.menuItems.length ; i++) {
                if (i == idx) {
                        this.menuItems[i].on();
                        this.menuItems[i].deactivate();
                }
                else {
                        this.menuItems[i].activate();
                        this.menuItems[i].off();
                }
        }
}

function RolloverMenu_selectMenuItemLed(idx) {
        for (i = 0 ; i < this.menuItems.length ; i++) {
                if (i == idx) {
                        this.menuItems[i].down();
                        this.menuItems[i].deactivate();
                }
                else {
                        this.menuItems[i].activate();
                        this.menuItems[i].off();
                }
        }
}

function RolloverMenu_resetMenu() {
        for (i = 0 ; i < this.menuItems.length ; i++) {
                this.menuItems[i].activate();
                this.menuItems[i].off();
        }
}
// ===========================================================================
// End Rollover script
// ===========================================================================

// MAIN NAV
school = new Rollover("schoolImg","../images/nav/school_on.gif","../images/nav/school.gif", "", "");
catering = new Rollover("cateringImg","../images/nav/catering_on.gif","../images/nav/catering.gif", "", "");
corporate = new Rollover("corporateImg","../images/nav/corporate_on.gif","../images/nav/corporate.gif", "", "");
partydish = new Rollover("partydishImg","../images/nav/partydish_on.gif","../images/nav/partydish.gif", "", "");
cafe = new Rollover("cafeImg","../images/nav/cafe_on.gif","../images/nav/cafe.gif", "", "");
retail = new Rollover("retailImg","../images/nav/retail_on.gif","../images/nav/retail.gif", "", "");
media_img = new Rollover("mediaImg","../images/nav/media_on.gif","../images/nav/media.gif", "", "");
about = new Rollover("aboutImg","../images/nav/about_dish_on.gif","../images/nav/about_dish.gif", "", "");
contact = new Rollover("contactImg","../images/nav/contact_us_on.gif","../images/nav/contact_us.gif", "", "");
ezine = new Rollover("ezineImg","../images/nav/dish_ezine_on.gif","../images/nav/dish_ezine.gif", "", ""); 
book = new Rollover("bookImg","../images/nav/book_classes_on.gif","../images/nav/book_classes.gif", "", "");

// HOME SUBNAV
home_school = new Rollover("schoolImg","images/home/subnav/school_on.gif","images/home/subnav/school.gif", "", "");
home_catering = new Rollover("cateringImg","images/home/subnav/catering_on.gif","images/home/subnav/catering.gif", "", "");
home_corporate = new Rollover("corporateImg","images/home/subnav/corporate_on.gif","images/home/subnav/corporate.gif", "", "");
home_partydish = new Rollover("partydishImg","images/home/subnav/partydish_on.gif","images/home/subnav/partydish.gif", "", "");
home_cafe = new Rollover("cafeImg","images/home/subnav/cafe_on.gif","images/home/subnav/cafe.gif", "", "");
home_retail = new Rollover("retailImg","images/home/subnav/retail_on.gif","images/home/subnav/retail.gif", "", "");
home_media_img = new Rollover("mediaImg","images/home/subnav/media_on.gif","images/home/subnav/media.gif", "", "");
home_about = new Rollover("aboutImg","images/home/subnav/about_dish_on.gif","images/home/subnav/about_dish.gif", "", "");
home_contact = new Rollover("contactImg","images/home/subnav/contact_us_on.gif","images/home/subnav/contact_us.gif", "", "");
home_ezine = new Rollover("ezineImg","images/home/subnav/dish_ezine_on.gif","images/home/subnav/dish_ezine.gif", "", ""); 
home_book = new Rollover("bookImg","images/home/subnav/book_classes_on.gif","images/home/subnav/book_classes.gif", "", "");

// CLASS SUBNAV
scheduled_class = new Rollover("scheduled_classImg","../images/school/subnav/scheduled_classes_calendar_on.gif","../images/school/subnav/scheduled_classes_calendar.gif", "", "");
private_classes = new Rollover("private_classesImg","../images/school/subnav/private_classes_on.gif","../images/school/subnav/private_classes.gif", "", "");
class_recipes = new Rollover("class_recipesImg","../images/school/subnav/class_recipes_on.gif","../images/school/subnav/class_recipes.gif", "", "");
teacher_chef = new Rollover("teacher_chefImg","../images/school/subnav/teachers_chefs_on.gif","../images/school/subnav/teachers_chefs.gif", "", "");
register_class = new Rollover("register_classImg","../images/school/subnav/register_class_on.gif","../images/school/subnav/register_class.gif", "", "");

// CATERING SUBNAV
cater_cocktails = new Rollover("cater_cocktailsImg","../images/catering/subnav/cocktails_on.gif","../images/catering/subnav/cocktails.gif", "", "");
cater_dinners = new Rollover("cater_dinnersImg","../images/catering/subnav/dinners_on.gif","../images/catering/subnav/dinners.gif", "", "");
cater_dishcorp = new Rollover("cater_dishcorpImg","../images/catering/subnav/dish_corporate_on.gif","../images/catering/subnav/dish_corporate.gif", "", "");
cater_holiday = new Rollover("cater_holidayImg","../images/catering/subnav/dish_holiday_on.gif","../images/catering/subnav/dish_holiday.gif", "", "");
cater_additional = new Rollover("cater_additionalImg","../images/catering/subnav/additional_info_on.gif","../images/catering/subnav/additional_info.gif", "", "");




function openMailing(theURL) {
	heightOffSet=50;
	theWidth=550;
	theHeight=330;
	winLocX=screen.width/2-theWidth/2;
	winLocY=screen.height/2-theHeight/2-heightOffSet;
	window.open(theURL,'mailing_list','toolbar=no,location=no,directories=no,status=0,menubar=0,scrollbars=1,resizable=0,menu=no,width='+theWidth+',height='+theHeight+',screenx='+winLocX+',screeny='+winLocY+',left='+winLocX+',top='+winLocY);
}

function openEzine(theURL) {
	heightOffSet=50;
	theWidth=700;
	theHeight=500;
	winLocX=screen.width/2-theWidth/2;
	winLocY=screen.height/2-theHeight/2-heightOffSet;
	window.open(theURL,'newsletter','toolbar=no,location=no,directories=no,status=0,menubar=0,scrollbars=1,resizable=0,menu=no,width='+theWidth+',height='+theHeight+',screenx='+winLocX+',screeny='+winLocY+',left='+winLocX+',top='+winLocY);
}

function openDishCard(theURL) {
	heightOffSet=50;
	theWidth=480;
	theHeight=450;
	winLocX=screen.width/2-theWidth/2;
	winLocY=screen.height/2-theHeight/2-heightOffSet;
	window.open(theURL,'dishCard','toolbar=no,location=no,directories=no,status=0,menubar=0,scrollbars=1,resizable=0,menu=no,width='+theWidth+',height='+theHeight+',screenx='+winLocX+',screeny='+winLocY+',left='+winLocX+',top='+winLocY);
}

function openEmailFriend(theURL) {
	heightOffSet=50;
	theWidth=535;
	theHeight=360;
	winLocX=screen.width/2-theWidth/2;
	winLocY=screen.height/2-theHeight/2-heightOffSet;
	window.open(theURL,'dishCard','toolbar=no,location=no,directories=no,status=0,menubar=0,scrollbars=0,resizable=0,menu=no,width='+theWidth+',height='+theHeight+',screenx='+winLocX+',screeny='+winLocY+',left='+winLocX+',top='+winLocY);
}

function openPDFPopup(theURL) {
	heightOffSet=50;
	theWidth=520;
	theHeight=290;
	winLocX=screen.width/2-theWidth/2;
	winLocY=screen.height/2-theHeight/2-heightOffSet;
	window.open(theURL,'pdfPU','toolbar=no,location=no,directories=no,status=0,menubar=0,scrollbars=0,resizable=0,menu=no,width='+theWidth+',height='+theHeight+',screenx='+winLocX+',screeny='+winLocY+',left='+winLocX+',top='+winLocY);
}







		  
