var imageArray = {
 1:{'path':'images/inline/Shah and Nina Wadia.jpg',
    'title':'Tiffin Cup finalists',
    'subtext':' - third place presented by Nina Wadia',
    'linktext':'click to view find out more',
    'linkurl':'news.php?id=22'
    },
 2:{'path':'images/inline/curries.jpg',
    'title':'chefs specials',
    'subtext':' - special chicken makoni, special murgi masala, many more...',
    'linktext':'click to view our menu',
    'linkurl':'the_menu.php'
    },
 3:{'path':'images/inline/shopfront.jpg',
    'title':'chefs specials',
    'subtext':' - come down to leytonstone highroad and have a taste',
    'linktext':'click for more details',
    'linkurl':'the_menu.php'
    },
 4:{'path':'images/inline/award.jpg',
    'title':'Star of India awarded restaurant of the year 2009',
    'subtext':'by Waltham Forest Gaurdian',
    'linktext':'click to see more about our awards',
    'linkurl':'news.php?section=Excellence+Award'
    },
 5:{'path':'images/inline/saffron.jpg',
    'title':'inspiring recipes',
    'subtext':' - we only use the finest ingredients to make our fresh curries',
    'linktext':'click to view our recipes of the month',
    'linkurl':'recipes.php'
    },
 6:{'path':'images/inline/shopfront.jpg',
    'title':'chefs specials',
    'subtext':' - come down to leytonstone highroad and have a taste',
    'linktext':'click for more details',
    'linkurl':'the_menu.php'
    }
/* 6:{'path':'images/inline/buffet.jpg',
    'title':'buffet nights',
    'subtext':' - try our delicious buffet curries',
    'linktext':'click for more details',
    'linkurl':'./'
    }*/
};

var numImages = 0;
for(var i in imageArray) numImages++;
var currentImage = 1;

function imageViewerLoad(image){
 currentImage = image;
 var prevImage = (image>1 ? image - 1 : numImages);
 var nextImage = (image<numImages ? image + 1 : 1);
 var navHTML = '';
 navHTML+= '<a href="javascript:imageViewerLoad('+prevImage+');" class="arrow-back"><div></div></a>';
 for(var i=1;i<=numImages;i++){
  navHTML+=  '<a href="javascript:imageViewerLoad('+i+');"'+(i==image ? ' class="selected"' : '')+'><div>'+i+'</div></a>';
 }
 navHTML+= '<a href="javascript:imageViewerLoad('+nextImage+');" class="arrow-forward" ><div></div></a>';
 getElem("image-nav").innerHTML = navHTML;
 var windowHTML = '';
 windowHTML+= '<div class="image-overlay" id="image-overlay">'
 +'<div class="image-overlay-bgnd"></div>'
 +'<div class="image-overlay-text">'
 +'<b>'+imageArray[image]['title']+'</b>'
 +'<br/><i>'+imageArray[image]['subtext']+'</i>'
 +'<br/><a href="'+imageArray[image]['linkurl']+'" class="image-overlay-hyperlink">'+imageArray[image]['linktext']+'</a>'
 +'</div></div>'
 +'<img src="'+imageArray[image]['path']+'" />';
 jQuery('#image-window2').show();
 getElem("image-window2").innerHTML = getElem("image-window1").innerHTML;
 jQuery('#image-window1').hide();
 getElem("image-window1").innerHTML = windowHTML;
 jQuery('#image-window2').fadeOut(500);
 setTimeout("jQuery('#image-window1').fadeIn(500);",100);
}

var overlayGreen = '#00A600';
var overlayRed = '#A90000';
var overlayBrown = '#743D00';
var overlayBlue = '#3C4AD1';

var spotlightArray = {
 1:{'path':'images/inline/takeaway.jpg',
    'linktext':'order fast <font style="color:#ffff00;">home delivery</font><br/>click here',
    'overlaycolor':overlayGreen,
    'linkurl':'online_ordering.php'
    },
/* 2:{'path':'images/inline/buffet-sm.jpg',
    'linktext':'<font style="color:#F6921E;">buffet nights</font><br/>for more info click here',
    'overlaycolor':overlayRed,
    'linkurl':'the_menu.php'
    },
 3:{'path':'images/inline/curries-sm.jpg',
    'linktext':'<font style="color:#F6921E;">40% off</font> dine in only<br/>click here for details',
    'overlaycolor':overlayBrown,
    'linkurl':'./'
    },*/
 2:{'path':'images/inline/curryclub-sm.jpg',
    'linktext':'<font style="color:#F6921E;">curry club</font><br/>for more info click here',
    'overlaycolor':overlayRed,
    'linkurl':'events_and_offers.php?section=curry+club'
    },
 3:{'path':'images/inline/giftvouchers-sm.jpg',
    'linktext':'<font style="color:#F6921E;">gift vouchers</font> the perfect gift<br/>click here for details',
    'overlaycolor':overlayBrown,
    'linkurl':'events_and_offers.php?section=gift+vouchers'
    },
 4:{'path':'images/inline/dinner.jpg',
    'linktext':'<font style="color:#ffff00;">private functions</font><br/>contact for further details',
    'overlaycolor':overlayBlue,
    'linkurl':'contact_us.php?section=private_functions'
    },
/* 5:{'path':'images/inline/shopfront-sm.jpg',
    'linktext':'click here to view a gallery of our pictures',
    'overlaycolor':overlayRed,
    'linkurl':'recipes.php'
    }*/
 5:{'path':'images/inline/thestar-sm.jpg',
    'linktext':'<font style="color:#ffff00;">the star</font> magazine<br/>click here to read',
    'overlaycolor':overlayRed,
    //'linkurl':'http://www.thestarmagazineuk.com/'
    'linkurl':'http://issuu.com/larag/docs/dish_taster_taster_issue" target="_blank'
    }
};
var numSpotlights = 0;
for (var i in spotlightArray) numSpotlights++;

function spotlightLoad(spotlight,target) {
 var spotlightHTML = '';
 spotlightHTML+= '<a href="'+spotlightArray[spotlight]['linkurl']+'"><div class="spotlight-overlay">'
 +'<div class="spotlight-overlay-bgnd" style="background-color:'+spotlightArray[spotlight]['overlaycolor']+';"></div>'
 +'<div class="spotlight-overlay-text">'
 +'<div class="spotlight-overlay-hyperlink">'+spotlightArray[spotlight]['linktext']
 +'<img src="gfx/arrow-forward-on-trans-sm.png" style="position:relative;top:1px;left:5px;" />'
 +'</div>'
 +'</div></div>'
 +'<img src="'+spotlightArray[spotlight]['path']+'" /></a>';
 getElem(target).innerHTML = spotlightHTML;
}


function load_menu_page(section, page) {
 jQuery('#online-menu-lhs').html('');
 jQuery('#online-menu-rhs').html('');
 jQuery('#menu-color-strip').css({'background-color':'transparent'});
 jQuery('#online-menu-tabs').css({'visibility':'visible'});
 jQuery('#menu-tabs-cover').css({'visibility':'hidden','z-index':'8'});
 
 jQuery('#menu-tabs-welcome').css({'z-index':'7','background-image':"url('gfx/menu2-tab_welcome-off.png')"});
 jQuery('#menu-tabs-fish').css({'z-index':'6','background-image':"url('gfx/menu2-tab_fish-off.png')"});
 jQuery('#menu-tabs-vegetarian').css({'z-index':'5','background-image':"url('gfx/menu2-tab_vegetarian-off.png')"});
 jQuery('#menu-tabs-others').css({'z-index':'4','background-image':"url('gfx/menu2-tab_others-off.png')"});
 jQuery('#menu-tabs-main').css({'z-index':'3','background-image':"url('gfx/menu2-tab_main-off.png')"});
 jQuery('#menu-tabs-specials').css({'z-index':'2','background-image':"url('gfx/menu2-tab_specials-off.png')"});
 jQuery('#menu-tabs-sides').css({'z-index':'1','background-image':"url('gfx/menu2-tab_sides-off.png')"});
 
 switch(section){
		case 'cover':
					jQuery('#online-menu-lhs').attr('class','transparent');//.get(0).onclick=function(){};
					jQuery('#online-menu-rhs').attr('class','cover');//.get(0).onclick=function(){load_menu_page('welcome');};
					jQuery('.menu-logo').css({'display':'block','background-image':"url('gfx/menu-cover_logo.png')",'left':'480px'});
					jQuery('#menu-tabs-cover').css({'z-index':'10','visibility':'visible'});
			break;
		case 'welcome':
					jQuery('#online-menu-lhs').attr('class','cover');//.get(0).onclick=function(){load_menu_page('cover');};
					jQuery('#online-menu-rhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('fish');};
					jQuery('.menu-logo').css({'display':'block','background-image':"url('gfx/menu-page_logo.png')",'left':'360px'});
					jQuery('#menu-tabs-welcome').css({'z-index':'10','background-image':"url('gfx/menu2-tab_welcome.png')"});
			break;
		case 'fish':
					jQuery('#online-menu-lhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('welcome');};
					jQuery('#online-menu-rhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('vegetarian');};
					jQuery('.menu-logo').css({'display':'none'});
					jQuery('#menu-tabs-fish').css({'z-index':'10','background-image':"url('gfx/menu2-tab_fish.png')"});
					jQuery('#menu-color-strip').css({'background-color':'#24bcee'});
			break;
		case 'vegetarian':
					jQuery('#online-menu-lhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('fish');};
					jQuery('#online-menu-rhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('others');};
					jQuery('.menu-logo').css({'display':'none'});
					jQuery('#menu-tabs-vegetarian').css({'z-index':'10','background-image':"url('gfx/menu2-tab_vegetarian.png')"});
					jQuery('#menu-color-strip').css({'background-color':'#19a84a'});
			break;
		case 'others':
					jQuery('#online-menu-lhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('vegetarian');};
					jQuery('#online-menu-rhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('main');};
					jQuery('.menu-logo').css({'display':'none'});
					jQuery('#menu-tabs-others').css({'z-index':'10','background-image':"url('gfx/menu2-tab_others.png')"});
					jQuery('#menu-color-strip').css({'background-color':'#8a3795'});
			break;
		case 'main':
					jQuery('#online-menu-lhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('others');};
					jQuery('#online-menu-rhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('last');};
					jQuery('.menu-logo').css({'display':'none'});
					jQuery('#menu-tabs-main').css({'z-index':'10','background-image':"url('gfx/menu2-tab_main.png')"});
					jQuery('#menu-color-strip').css({'background-color':'#c42026'});
			break;
		case 'specials':
					jQuery('#online-menu-lhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('others');};
					jQuery('#online-menu-rhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('last');};
					jQuery('.menu-logo').css({'display':'none'});
					jQuery('#menu-tabs-specials').css({'z-index':'10','background-image':"url('gfx/menu2-tab_specials.png')"});
					jQuery('#menu-color-strip').css({'background-color':'#20c4be'});
			break;
		case 'sides':
					jQuery('#online-menu-lhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('others');};
					jQuery('#online-menu-rhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('last');};
					jQuery('.menu-logo').css({'display':'none'});
					jQuery('#menu-tabs-sides').css({'z-index':'10','background-image':"url('gfx/menu2-tab_sides.png')"});
					jQuery('#menu-color-strip').css({'background-color':'#cdba41'});
			break;
		case 'last':
					jQuery('#online-menu-lhs').attr('class','page');//.get(0).onclick=function(){load_menu_page('main');};
					jQuery('#online-menu-rhs').attr('class','cover');//.get(0).onclick=function(){load_menu_page('back');};
					jQuery('.menu-logo').css({'display':'none'});
					jQuery('#menu-tabs-cover').css({'z-index':'10','visibility':'visible'});
			break;
		case 'back':
					jQuery('#online-menu-lhs').attr('class','cover');//.get(0).onclick=function(){load_menu_page('last');};
					jQuery('#online-menu-rhs').attr('class','transparent');//.get(0).onclick=function(){};
					jQuery('.menu-logo').css({'display':'none'});
					jQuery('#online-menu-tabs').css({'visibility':'hidden'});
			break;
			default:
					load_menu_page('welcome');
			break;
   }
 
 jQuery.post('online_menu-page.php','section='+section+'&page='+(2*page-1),function(data){ jQuery('#online-menu-lhs').html(data); });
 jQuery.post('online_menu-page.php','section='+section+'&page='+(2*page),function(data){ jQuery('#online-menu-rhs').html(data); });
 
 }

function update_bill() {
 ajaxload('online_menu-bill.php','','online-menu-bill',null);
 }

function bill_info(id,side,section,page){
 var params = {};
 params.id = id;
 params.side = side;
 params.section = section;
 params.page = page;
 
 dw = jQuery(document).width();
 dh = jQuery(document).height();
 thetop = jQuery(window).scrollTop()+jQuery(window).height()/3;
 
 html = ''
 +'<div id="popup20" class="popup-wrap" style="width:'+dw+'px;height:'+dh+'px;"><div class="popup-bgnd" onclick="/*jQuery(this).parent().remove();*/"></div>'
 +'<div class="inner-content" style="background-color:#f1ede5;border:solid 1px #572102;width:500px;position:relative;top:'+thetop+'px;margin:0px auto;">'
 +'<img src="css/ajax-loader.gif" style="display:block;margin:20px auto;"/></div></div>';
 jQuery(document.body).append(html);
 jQuery('#popup20 .inner-content').load('online_menu-bill_info.php',params);

 }

function checkout() {
 //closepopup();
 window.location = 'checkout.php';
}

function open_menu(){

 jQuery.ajax(
{url:'online_menu.php'
,data:{ }
,type:'GET'
,success:function(data,status,XMLHttp){
 
 if(jQuery('#popup3').size()>0)jQuery('#popup3').remove();
 var width = jQuery(document).width();
 var height = jQuery(document).height();
 var top = jQuery(window).scrollTop()+49;//jQuery(window).height()/3;
 var left = jQuery(window).width()/2-908/2; if(left<0)left=0;
  
 var html = ''
 +'<div id=\'popup3\' class=\'popup-wrap\' style=\'width:'+width+'px;height:'+height+'px;\'><div class=\'popup-bgnd\'></div>'
 +'<div style=\'text-align:center;position:relative;top:'+top+'px;\'>'
 +data
 +'</div>'
 +'</div>';
 jQuery(document.body).append(html);
 //jQuery(window).scrollTop(0);
 
 jQuery('#online-menu').css({'margin-left':left+'px'});
 jQuery('#popup3 .popup-bgnd').click(function(e){
  jQuery('#popup3').remove();
  if(window.location.href.indexOf('checkout')>0) window.location.reload(true);
  });
 
 jQuery(window)
 .bind('resize',function(e){
  jQuery('#popup3')
 .css({'width':100+'%','height':100+'%'})
 .css({'width':jQuery(document).width()+'px','height':jQuery(document).height()+'px'});
  var left = jQuery(window).width()/2-908/2; if(left<0)left=0;
  jQuery('#online-menu').css({'margin-left':left+'px'});
  })
 .bind('scroll',function(e){
  
  });

 }
,cache:false
,dataType:'script'
});

 }

function save_all(event){
 init_loader();
 if(jQuery(event.data.jq).size()>0){
  save_next(jQuery(event.data.jq).get(),event.data.fn,event.target);
  }
 else{ event.data.fn(event.target); }
 }

function save_next(a,oncomplete,original){
 var f = jQuery(a.shift());
 jQuery.ajax({
 url:jQuery(f).attr('action')
,data:jQuery(f).serialize()
,type:'POST'
,success:function(data,status,XMLHttp){
 if(a.length>0){ save_next(a,oncomplete,original); }
 else{ oncomplete(original); }
 }
,cache:false
,dataType:'html'
});
 }


