window.addEvent('domready',function(){myScroll=new Fx.SmoothScroll({duration:400},window);var objs=$$('a');objs.each(function(obj,i){if((obj.get('href')&&(obj.get('rel')=='external'))||(obj.hasClass('external'))){obj.set('target','_blank');}});if(Browser.Engine.trident||Browser.Engine.webkit){var nav=$$('#nav ul li');nav.each(function(navs,i){navs.addEvent("mouseenter",function(event){this.addClass('hover');});navs.addEvent("mouseleave",function(event){this.removeClass('hover');});});}
if(Browser.Engine.trident){var objs=$$('button');objs.each(function(obj,i){obj.addEvent("mouseover",function(event){this.addClass('hover');});obj.addEvent("mouseout",function(event){this.removeClass('hover');});});var objs=$$('input').extend($$('textarea'));objs.each(function(obj,i){obj.addEvent("focus",function(event){this.addClass('focus');});obj.addEvent("blur",function(event){this.removeClass('focus');});});}
var searchform=$$('#searchform input');var searchform_value=searchform.get('value');searchform.addEvent('focus',function(event){event.stop();if($(this).get('value')==searchform_value){$(this).set('value','');}});$$('.email').each(function(el){el.set('href','mailto:'+el.get('rel').replace('|','@').replace('/',''));});if($('keyword')){new Autocompleter.Request.JSON('keyword','console/execute/search.json.txt',{postVar:'keyword',minLength:3,maxChoices:10,autoSubmit:false,cache:true,delay:200});}
if($('newsh')){newshAjax(false);}
var obj=$('creekholder');if(obj){obj.getElements('a').each(function(element,index){var content=element.get('title').split('|');var title=content[0].split('-');var titletxt='<strong>'+title[0]+'</strong>';if(title[1]){titletxt+='<br />'+title[1];}
element.store('tip:title',titletxt);element.store('tip:text',content[1]);element.store('tip:id',element.get('id'));});var tipz=new Tips(obj.getElements('a'),{className:'tool-tip',offset:{'x':-20,'y':20}});tipz.addEvents({'show':function(tip){tip.fade('in');},'hide':function(tip){tip.fade('out');}});}
var obj=$('creekgallery');if(obj){new Asset.image('http://static.kayakdorrigo.com.au/images/newsh-loader.gif',{id:'loader3'}).inject($('mainimage')).hide();var objs=obj.getElements('a');objs.each(function(element,i){element.addEvent("mouseover",function(event){if(!this.hasClass('active')){$$('#creekgallery a').removeClass('active');this.addClass('active');$('mainimg').dispose();$('loader3').show();new Asset.image('image/'+this.get('href')+'?w=300',{id:'mainimg',onload:function(){$('loader3').hide();$(this).fade('in');}}).inject($('mainimage')).fade('hide');}});});var writecomment=$('writecomment');$('name').addEvent('focus',function(event){if($(this).get('value')=='name'){$(this).set('value','');}});$('name').addEvent('blur',function(event){if($(this).get('value')==''){$(this).set('value','name');}});$('email').addEvent('focus',function(event){if($(this).get('value')=='email address'){$(this).set('value','');}});$('email').addEvent('blur',function(event){if($(this).get('value')==''){$(this).set('value','email address');}});$('comment').addEvent('focus',function(event){if($(this).get('html')=='comments'){$(this).set('html','');}});$('comment').addEvent('blur',function(event){if($(this).get('html')==''){$(this).set('html','comments');}});$$('#writecomment form').addEvent('submit',function(event){var req=new Request({method:'post',data:{creekid:$('creekid').get('value'),name:$('name').get('value'),email:$('email').get('value'),comments:$('comment').get('value')},url:'console/execute/creek.commentsubmit.txt',onRequest:function(){$('loader').show();},onComplete:function(response){var results=JSON.decode(response);if(results['errors']['name']){$('name').addClass('error');}else{$('name').removeClass('error');}
if(results['errors']['email']){$('email').addClass('error');}else{$('email').removeClass('error');}
if(results['errors']['comments']){$('comment').addClass('error');}else{$('comment').removeClass('error');}
$('loader').hide();if(results['success']){$('writecomment').set('html','<div class="success"><h3>Success</h3><ul><li>Your comment has been successfully posted.</li></ul><input type="hidden" name="creekid" id="creekid" value="'+$('creekid').get('value')+'" /></div>');reloadComments();}}}).send();return false;});new Fx.Accordion($$('#postcomment a'),$$('div.element'),{alwaysHide:true,opacity:true,display:0,onActive:function(toggler,element){toggler.addClass('active');element.addClass('active');},onBackground:function(toggler,element){(function(){toggler.removeClass('active');element.removeClass('active');}).delay(400);}});}});function reloadComments(){var req=new Request({method:'get',data:{creekid:$('creekid').get('value')},url:'console/execute/creek.getcomments.txt',onRequest:function(){$$('#postcomment a').dispose();$$('.element').dispose();$('loader2').show();},onComplete:function(response){var results=JSON.decode(response);$('loader2').hide();$('postcomment').set('html',results['postcomment']);$('comments').set('html',$('comments').get('html')+results['comments']);var myAccordion=new Fx.Accordion($$('#postcomment a'),$$('div.element'),{alwaysHide:true,opacity:true,display:0,onActive:function(toggler,element){toggler.addClass('active');element.addClass('active');},onBackground:function(toggler,element){(function(){toggler.removeClass('active');element.removeClass('active');}).delay(400);}});$$('#postcomment a').each(function(element,i){element.addEvent("click",function(event){event.preventDefault();myAccordion.display(parseInt($(this).get('html'))-1);myScroll.toElement('comments');});});myScroll.toElement('comments');}}).send();if(req){return false;}}
function newshAjax(flush){if($('newsh')){var req=new Request({method:'get',url:(flush==true)?'console/execute/newsh.realtime.txt?flush':'console/execute/newsh.realtime.txt',onRequest:function(){$('newsh-loader').show();$('newsh-content').set('html','<p class="small" style="margin-top: 23px;"><small>Requesting data...</small></p>');},onComplete:function(response){$('newsh-loader').hide();$('newsh-content').set('html',response);if($('newsh-flush')){$('newsh-flush').addEvent('click',function(event){event.stop();newshAjax(true);return false;});}}}).send();if(req){return false;}}}
Cufon.replace('h2',{fontFamily:'Handwriting - Dakota'});Cufon.replace('#h2overlay',{fontFamily:'Swis721 Blk BT'});
