var gwidth=4;window.addEvent('domready',function(){var platform=Browser.parseUA(window.navigator.userAgent,window.navigator.platform);if(platform.platform=='ios'){$('wrapper').addClass('ios');}
if(platform.platform=='android'){$('wrapper').addClass('android');}
if(platform.platform=='win'){$('wrapper').addClass('win');}
myScroll=new Fx.SmoothScroll({duration:400},window);$$('a[rel="external"], a.external').set('target','_blank');$$('a[data-email]').each(function(el){el.set('href','mailto:'+el.get('data-email').replace('|','@').replace('/',''));});$$('div[data-image]').each(function(el){var img=el.getElement('img');el.setStyle('background-image','url('+img.get('src')+')');img.hide();});$$('form[data-validate]').each(function(obj){var form=new Form.Validator.Inline(obj,{serial:false,useTitles:true,scrollToErrorsOnSubmit:false,ignoreHidden:false,errorPrefix:'',onFormValidate:function(passed,form,event){form.store('data-validation',passed);if(passed){new Element('input',{type:'hidden',name:'nospam',value:1}).inject(form);}},onHideAdvice:function(element,advice){$(advice).destroy();}});obj.store('validate',form);obj.getElements('.validation-failed').each(function(field){form.validateField(field);});});if($('grid')){grid();var pckry=new Packery($('grid'),{itemSelector:'.grid-item',gutter:0});}
doServices();if($('slideshow')){$('slideshow').getElements('div').each(function(el){var img=el.getElement('img');el.setStyle('background-image','url('+img.get('src')+')');img.hide();});function render(){var s=$(window).getSize();var min=parseInt($('ss').getStyle('min-height'));if(s.y<min){s.y=min;}
var p=s.y/s.x;$('ss').getElements('div.item').setStyles({width:s.x,height:s.y});$('slideshow').getElements('div.item').each(function(obj){var arg=[];arg.push((p<=0.5625)?'100%':'auto');arg.push((p<=0.5625)?'auto':'100%');obj.setStyle('background-size',arg.join(' '));});}
render();window.addEvent('load',render);window.addEvent('resize',render);new Element('a',{id:'down',href:'#book'}).addClass('icon-down-open').inject($('ss').getElement('figcaption'),'bottom').addEvent('click',function(e){e.preventDefault();var y=$('info').getPosition().y;myScroll.anchor='info';myScroll.start(0,y);});}
if($('tabs')){var elements=[];$('tabcontent').getElements('.tab').each(function(element,j){elements[j]=new Fx.Slide(element,{resetHeight:true,duration:400,onStart:function(e){$(this.element).setStyle('overflow','hidden');$(this.element.parentNode).setStyle('overflow','hidden');}}).hide();});var hash=document.location.hash;if(hash){var tab=$('tabs').getElement('li[data-id="'+hash.substr(1)+'"]');if(tab){$('tabs').getElements('li').removeClass('active');tab.addClass('active');}}
var tabs=$('tabs').getElements('li');tabs.each(function(tab,j){if(tab.hasClass('active')){elements[j].show();elements[j].wrapper.setStyle('height','');var id=$(tab).get('data-id');document.location.hash=id;}});tabs.each(function(tab,i){$(tab).addEvent('click',function(e){e.preventDefault();if(!this.hasClass('active')){tabs.removeClass('active');this.addClass('active');elements.each(function(element){element.stop();});elements.each(function(element,j){if(j==i){element.slideIn();}else{element.slideOut();}});var id=$(this).get('data-id');document.location.hash=id;myScroll.anchor=id;if(this.getStyle('float')!=='left'){myScroll.toElement($('tabcontent'));}}else{tabs.removeClass('active');elements.each(function(element){element.stop();element.slideOut();});if(this.getStyle('float')!=='left'){myScroll.toElement($('tabcontent'));}}});});}
if($('quickform')){var forms=[];$('quickform').getElements('.form').each(function(form,j){forms[j]=new Fx.Slide(form,{resetHeight:true,duration:400,onStart:function(e){$(this.element).setStyle('overflow','hidden');$(this.element.parentNode).setStyle('overflow','hidden');},onComplete:function(e){if(e.retrieve('active')==1){$(this.element).setStyle('overflow','visible');$(this.element.parentNode).setStyle('overflow','visible');}}}).hide();form.store('active',0);});var felements=$('quickform').getElements('input[name="enquiry"]');felements.each(function(element,j){if(element.get('checked')){forms[j].show();forms[j].element.store('active',1);forms[j].element.setStyle('overflow','visible');forms[j].wrapper.setStyle('height','');forms[j].wrapper.setStyle('overflow','visible');}});felements.each(function(element,i){$j(element).on('ifChanged',function(e){forms.each(function(form){form.stop();});forms.each(function(form,j){if(j==i){form.slideIn();form.element.store('active',1);}else{form.slideOut();form.element.store('active',0);}});});});}});window.addEvent('resize',function(){if($('grid')){grid();}
doServices();});function grid(){var size=$('grid').getComputedSize(),w=size.width-size.computedLeft-size.computedRight,windowSize=window.getSize().x,columnNum=1,columnWidth=0;switch(true){case(windowSize>1184):columnNum=6;break;case(windowSize>968):columnNum=4;break;case(windowSize>752):columnNum=3;break;case(windowSize>479):columnNum=2;break;}
columnWidth=Math.floor(w/columnNum);$$('.item-small').setStyles({margin:gwidth/2,width:((columnWidth)-gwidth)+'px',height:Math.round(((columnWidth)-gwidth)*0.7777777)+'px'});$$('.item-high').setStyles({margin:gwidth/2,width:((columnWidth)-gwidth)+'px',height:Math.round(((columnWidth*2)-gwidth+2)*0.7777777)+'px'});if(w<480){$$('.item-wide').setStyles({margin:gwidth/2,width:((columnWidth)-gwidth)+'px',height:Math.round(((columnWidth)-gwidth)*0.7777777)+'px'});$$('.item-long').setStyles({margin:gwidth/2,width:((columnWidth)-gwidth)+'px',height:Math.round(((columnWidth)-gwidth)*0.7777777/2)+'px'});}else{$$('.item-wide').setStyles({margin:gwidth/2,width:((columnWidth*2)-gwidth)+'px',height:Math.round(((columnWidth*2)-gwidth+2)*0.7777777)+'px'});$$('.item-long').setStyles({margin:gwidth/2,width:((columnWidth*2)-gwidth)+'px',height:Math.round(((columnWidth)-gwidth)*0.7777777)+'px'});}}
window.addEvent('load',function(){if($('mapbox')){L.mapbox.accessToken='pk.eyJ1IjoiYXJpZWxzaG93YW5kdGVsbCIsImEiOiJjaW1weGxxYWIwMDludnFsdXR6c2lmemd6In0.95wJiZD6QUs29cPVkbo0nA';var map=L.mapbox.map('mapbox','arielshowandtell.pk6b9g07',{zoomControl:false,shareControl:false,infoControl:false,attributionControl:false}).setView([-37.763,144.751],12);map.scrollWheelZoom.disable();new L.Control.Zoom({position:'topleft'}).addTo(map);map.featureLayer.on('mouseover',function(e){e.layer.openPopup();});map.featureLayer.on('mouseout',function(e){e.layer.closePopup();});};doServices();if($('thank-you')){myScroll.anchor='thanks';myScroll.toElement('thanks');}});function doServices(){if($('services')){if($(window).getSize().x>=969){var h=0;var elements=$('services').getElements('.service');elements.setStyle('height','auto');elements.each(function(obj){var th=obj.getSize().y;if(th>h){h=th;}});elements.setStyle('height',h);}else{var elements=$('services').getElements('.service');elements.setStyle('height','auto');}}}