var activeimage='';var currentpage='';var galleryimage=0;var homepage='';var slideshowimage=0;var slideshowtimer=6000;var subslideshowtimer=6000;var timercount=0;var subimagecount=1;var subimageslength=1;function createMusicPlayer(){$("#mplayer").jPlayer({ready:function(){$(this).setFile('/assets/site-music.mp3').play()}});$("#mplayer").onSoundComplete(function(){$(this).play();});}
function enlargeImage($src){$('img#galleryimage').remove();var img=new Image();img.src=$src;img.id='galleryimage';$(img).load(function(){$("#imageholder").append(img);$(img).css('display','block');$('img#'+activeimage).css('display','none');});}
function displayHome(){$('div#txt_gallery').html('');loadGallery();$('#altnavigation').slideToggle('normal');$('#sitedetail').slideToggle('normal',function(){$('div#txt_'+currentpage).jScrollPane();$('div#txt_'+currentpage).fadeIn(2500);$('img#'+activeimage).fadeIn(2500);startSlideshow();var params={};var attributes={};var flashvars={};params.wmode='transparent';swfobject.embedSWF("/assets/ribbon.swf","flashcontent","380","38","10.0.0","",flashvars,params,attributes);});}
function formSubmission(){var n=$("input#Name13_138").val();var a=$("input#Address13_261").val();var t=$("input#Telephone13_328").val();var e=$("input#Email13_432").val();var na=$("input#Nationality13_517").val();if(n!=''&&a!=''&&t!=''&&e!=''&na!=''){var urlpost=jsdomain+'/index.cfm';var urlstr='?go=formProcess';urlstr+=$('#register_form').serialize();urlstr+='&ajaxform=true';urlstr+='&_customform=true';$.ajax({type:"POST",url:urlpost,data:urlstr,success:function(){$('p#submitform span').remove();$('p#submitform').append('<span>Details submitted</span>');window.open("http://www.mayfairlounge.com/thankyou.html");}});}else{$('p#submitform').append('<span>All fields are compulsory</span>');}}
function getFlashMovie(movieName){var isIE=navigator.appName.indexOf("Microsoft")!=-1;return(isIE)?window[movieName]:document[movieName];}
function init($homepage){currentpage=$homepage;homepage=$homepage;activeimage=currentpage+'_'+subimagecount;updateImagePreloader();preloadSlideshow();}
function loadGallery(){if(galleryimage<jsGallery.length){var img=new Image();img.src=g+jsGallery[galleryimage];img.id=jsGallery[galleryimage].split('.')[0];$(img).load(function(){var a=$('<a/>').attr({href:'#',onClick:"enlargeImage('"+img.src.replace('_thumb','')+"'); return false;",title:img.id.split('-')[1].split('_').join(' ')});$("div#txt_gallery").append(img);$(this).wrap(a);galleryimage++;loadGallery();});}else{galleryimage=0;}}
function navigation($title,$scroll,$logo){$('#imageholder').stopTime('imagechange');$('#imageholder').stopTime('subimagechange');if($logo!=null)startSlideshow();$('div.content').jScrollPaneRemove();$('div.content').css('display','none');$('div.alt_content').css('display','none');$('img#'+activeimage).fadeOut('slow',function(){$('div.content').jScrollPaneRemove();$('div.content').css('display','none');$('div.alt_content').css('display','none');subimagecount=1;if($scroll)$('div#txt_'+$title).jScrollPane();if($('div#txt_'+$title).parent().attr('id')!="alt_navigation"){$('div#txt_'+$title).fadeIn('fast');$('img#'+$title+'_'+subimagecount).fadeIn(500);}else{$('img#'+$title+'_'+subimagecount).fadeIn(500,function(){$('div#txt_'+$title).fadeIn(166);});}
currentpage=$title;activeimage=currentpage+'_'+subimagecount;if($logo==null){startSubSlideshow();}});}
function preloadSlideshow(){if(slideshowimage<jsSlideshow.length){var img=new Image();img.src=s+jsSlideshow[slideshowimage];img.id=jsSlideshow[slideshowimage].split('.')[0];$(img).load(function(){$("#imageholder").append(img);slideshowimage++;updateImagePreloader();preloadSlideshow();});}else{$("#preloader").remove();displayHome();}}
function slideshowImageChange(){if($('img#'+activeimage+':not(:animated)')){$('img#'+activeimage).fadeOut('slow',function(){timercount++;if(timercount>jsMainPage.length-1)timercount=0;activeimage=jsMainPage[timercount].split('.')[0];$('img#'+activeimage).fadeIn(833);});}}
function subSlideshowImageChange(){$('img#'+currentpage+'_'+subimagecount).fadeOut('slow',function(){subimagecount++;if(subimagecount>subimageslength-1)subimagecount=1;activeimage=currentpage+'_'+subimagecount;$('img#'+currentpage+'_'+subimagecount).fadeIn(833);});}
function startSlideshow(){timercount=0;$('#imageholder').everyTime(slideshowtimer,'imagechange',slideshowImageChange);}
function startSubSlideshow(){subimageslength=1;for(var i=1;i<jsSlideshow.length;i++){if(jsSlideshow[i].split('_')[0]==currentpage)subimageslength++;}
if(currentpage==homepage&&subimageslength!=1)subimageslength++;if(subimageslength>2)$('#imageholder').everyTime(subslideshowtimer,'subimagechange',subSlideshowImageChange);}
function updateImagePreloader(){$('span#loadimages').html(slideshowimage+' / '+jsSlideshow.length+' ');}
function volumeControl(){var musicstr=$('#playercontrol').text();if(musicstr=='Music Off'){$('#mplayer').volume(0);$('#playercontrol').text('Music On');}else if(musicstr=='Music On'){$('#mplayer').volume(100);$('#playercontrol').text('Music Off');}}
function resize(){if($(window).height()<$('#holder').height()){$('#container').css('top','0px');$('#holder').css('top','0px');}else{$('#container').css('top','50%');$('#holder').css('top','-'+($('#holder').height()/2)+'px');}
if($(window).width()<$('#holder').width()){$('#holder').css('left',($('#holder').width()/2)+'px');}else{$('#holder').css('left','50%');}}
$(document).ready(function(){resize();})
$(window).bind("resize",function(){resize();});
