$(document).ready(function(){function showSection(section,godown){var clickos=0;if(godown==true&&$("body").scrollTop()!=($("#mm").offset().top-1)){$('html:not(:animated),body:not(:animated)').animate({scrollTop:$("#mm").offset().top-1},500);clickos=300;}
$("#body").children().hide();$("#section_"+section).show();$("#mm").children().each(function(){$(this).removeClass("init");if($(this).attr("id").search(section)==-1){$(this).addClass("inactive");$(this).removeClass("active");$(this).find("span").animate({bottom:"-6px"},500);}else{$(this).addClass("active");$(this).removeClass("inactive");$(this).find("span").delay(clickos).animate({bottom:"0px"},500);}});setTimeout(function(){$("#track").attr("src","track/"+section+"/")},500);window.location.hash=section}
$("#mm").children().click(function(){showSection($(this).attr("id").split("_")[1],true);});if(window.location.hash&&document.referrer!=window.location){showSection(window.location.hash.replace("#",""),false);}
$('#sshow').cycle({fx:'fade',speed:'slow',random:0,sync:1,timeout:5000,pager:'#nav',pagerAnchorBuilder:function(idx,slide){return'#nav li:eq('+(idx)+') a';}});$('#sshow').click(function(){$(this).cycle('next');});function show_pause(){$('#pause-show').fadeOut('fast');$('#play-show').delay('fast').fadeIn('fast');$('#sshow').cycle('pause');$('#paused').css('display','block');$('#paused').fadeOut(1500);}
function show_play(){$('#play-show').fadeOut('fast');$('#pause-show').delay('fast').fadeIn('fast');$('#sshow').cycle('resume',true);}
$('#pause-show').click(function(){show_pause();});$('#play-show').click(function(){show_play();});var arrquotes=$('#quotes').children();$(arrquotes[0]).css({'display':'block'});var curq=0;$("#quotes").height($(arrquotes[0]).height());$('#quotes').click(function(){if($(':animated').length){return false;}
if((curq+1)>=arrquotes.length){nxtq=0;}else{nxtq=curq+1;}
$(arrquotes[curq]).fadeOut(300);indelay=300;if($(arrquotes[nxtq]).height()!=$("#quotes").height()){$("#quotes").delay(100).animate({height:$(arrquotes[nxtq]).height()},300);indelay=600;}
$(arrquotes[nxtq]).delay(indelay).fadeIn(300);curq=nxtq;});Shadowbox.init({overlayOpacity:0.81,flashVars:{backcolor:'0xffffff',frontcolor:'0x000000',lightcolor:'0x000000'}});var arrsections=$('#act_sections').children('a');$("a[href='#"+arrsections[0].name+"']").parent().addClass("current");function animateMenu(menu){var scrollposition=$(window).scrollTop();var top=$("a[name='"+menu+"']").offset().top;var sectionheight=$("a[name='"+menu+"']").next().outerHeight();if(((top-100)<scrollposition)&&((top+sectionheight-80)>scrollposition)){$("a[href='#"+menu+"']").parent().addClass("current");}else if(scrollposition<540){$("a[href='#"+arrsections[0].name+"']").parent().addClass("current");}else{$("a[href='#"+menu+"']").parent().removeClass("current");}}
$(window).scroll(function(){var top=0;top=$(window).scrollTop();if(top>460){$("#act_cat").css("top",40);}else{$("#act_cat").css("top",500-top);}
for(var i=0;i<arrsections.length;i++){animateMenu(arrsections[i].name);}});$("#act_cat a").click(function(event){event.preventDefault();var loc=$(this).attr("href");var loc=loc.substring(1);var dest=0;if(loc==""){dest=0;}else if($(this).attr("id")=="act_cat1"){dest=$("a[name='"+loc+"']").offset().top-92;}else{dest=$("a[name='"+loc+"']").offset().top;}
$("body, html").stop().animate({scrollTop:dest-10},{duration:1500},"swing");});$('#input_msg').autoResize({onResize:function(){$(this).css({opacity:0.8});},animateCallback:function(){$(this).css({opacity:1});},animateDuration:300,extraSpace:2});var formoptions={target:'#formresponsetxt',replaceTarget:true,beforeSubmit:validate,success:showResponse,data:{ajax:1}};$('#contact_form').ajaxForm(formoptions);function validate(){$('#contact_form').hide();$("#contact_required").hide();var err1=false;var err2=false;var err3=false;var err4=false;if($("#input_name").val()=="Your Name"){err1=true;}else if($("#input_name").val()==""){$("#input_name").val("Your Name");err1=true;}
if($("#input_contact").val()=="Your return Email or Phone"){err2=true;}else if($("#input_contact").val()==""){$("#input_contact").val("Your return Email or Phone");err2=true;}
if($("#input_msg").val()=="Your Message"){err3=true;}else if($("#input_msg").val()==""){$("#input_msg").val("Your Message");err3=true;}
if($("#answer").val()!=(parseInt($("#n1").html())+parseInt($("#n2").html()))){err4=true;}
if(err1){$("#input_name").css("color","red");}
if(err2){$("#input_contact").css("color","red");}
if(err3){$("#input_msg").css("color","red");}
if(err4==true){$("span.captcha").css("color","red");$("#answer").css("color","red");}
if(err1||err2||err3||err4){$('#contact_form').show();$("#contact_required").show();$("#contact_required").css("color","red");return false;}else{$("#formresponsetxt").text('please wait..');}}
$("#input_name").focus(function(){if($(this).val()=="Your Name"){$(this).val("");}
$(this).css("color","#3f3d3b");});$("#input_name").blur(function(){if($(this).val()==""){$(this).val("Your Name");$(this).css("color","#b2ada4");}else{$(this).css("color","#3f3d3b");}});$("#input_contact").focus(function(){if($(this).val()=="Your return Email or Phone"){$(this).val("");}
$(this).css("color","#3f3d3b");});$("#input_contact").blur(function(){if($(this).val()==""){$(this).val("Your return Email or Phone");$(this).css("color","#b2ada4");}else{$(this).css("color","#3f3d3b");}});$("#input_msg").focus(function(){if($(this).val()=="Your Message"){$(this).val("");}
$(this).css("color","#3f3d3b");});$("#input_msg").blur(function(){if($(this).val()==""){$(this).val("Your Message");$(this).css("color","#b2ada4");}else{$(this).css("color","#3f3d3b");}});$("#answer").focus(function(){$(this).css("color","#3f3d3b");$("span.captcha").css("color","#f5ead9");});function showResponse(responseText,statusText,xhr,$form){}
$("a[href^='http']:not([href*='eaglehammer.com.au'])").attr('target','_blank');});
