function externalLinks(){if(!document.getElementsByTagName){return}var c=document.getElementsByTagName("a");for(var b=0;b<c.length;b++){var a=c[b];if(a.getAttribute("href")&&a.getAttribute("rel")=="external"){a.onclick=function(){return launchWindow(this.href)}}else{if(a.getAttribute("href")&&a.getAttribute("rel")=="external_image"){a.onclick=function(){return launchImageWindow(this.href)}}}}}function launchWindow(a){if(a==""||!a){return}window.open(a);return false}function launchImageWindow(d){if(d==""||!d){return}var c=new Image();c.src=d;var b=0;var a=0;if(c.width!=""&&c.height!=""){b=c.width+20;a=c.height+20}if(b==0||a==0){return}window.open(d,"","width="+b+",height="+a+",location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes");return false}function selectPage(b,a){b.preventDefault();hideAnswers();document.title="TimmyMe - "+a;document.getElementById("about_link").firstChild.className="";document.getElementById("faq_link").firstChild.className="";document.getElementById("support_link").firstChild.className="";document.getElementById(a.toLowerCase()+"_link").firstChild.className="selected";document.getElementById("about_content").className="";document.getElementById("faq_content").className="";document.getElementById("support_content").className="";document.getElementById(a.toLowerCase()+"_content").className="selected";document.getElementById("support_form").style.display="block";document.getElementById("support_message").innerHTML='Please fill in the form below for any questions or concerns you have regarding the TimmyMe Mobile App. For general Tim Hortons enquiries, please visit <a href="http://www.timhortons.com/ca/en/contactform.html" rel="external">timhortons.com</a>.';document.getElementById("inputName").value="";document.getElementById("inputEmail").value="";document.getElementById("inputComments").value=""}function hideAnswers(){$j("#faq_content p.question").css({background:"url(/common/images/faq_arrow_left.png) no-repeat 0 18px","border-top":"1px dotted #fff",cursor:"pointer",padding:"10px 0 10px 11px"});$j("#faq_content p#q1").css({"border-top":"none"});$j("#faq_content p.answer").css({display:"none",margin:"0","padding-bottom":"10px"})}function showAnswer(b,a){if($j("#faq_content p#"+a).css("display")=="none"){hideAnswers();$j("#faq_content p#q"+a.substring(1)).css({"background-image":"url(/common/images/faq_arrow_down.png)"});$j("#faq_content p#"+a).css({display:"block"})}else{hideAnswers()}}function selectDevice(b,a){b.preventDefault();document.getElementById("iphone_selector").firstChild.className="";document.getElementById("blackberry_selector").firstChild.className="";document.getElementById(a+"_selector").firstChild.className="selected";document.getElementById("iphone_device").className="device_container";document.getElementById("blackberry_device").className="device_container";document.getElementById(a+"_device").className="device_container selected";document.getElementById("iphone_screen").className="";document.getElementById("blackberry_screen").className="";document.getElementById(a+"_screen").className="selected";current_device=a;setScreen("")}function setScreen(d){var b=214;if(current_device=="blackberry"){b=224}var a=(current_screen-1)*b;if(d==""){$j("#"+current_device+"_screen").css({"background-position":"-"+a+"px 0"})}else{if(old_screen==7){$j("#"+current_device+"_screen").stop().animate({backgroundPosition:"-"+((old_screen-1)*b)+"px 0"},{duration:500}).animate({backgroundPosition:"0 0"},{duration:0})}else{if(old_screen==0){$j("#"+current_device+"_screen").stop().animate({backgroundPosition:"-"+(6*b)+"px 0"},{duration:0}).animate({backgroundPosition:"-"+a+"px 0"},{duration:500})}else{$j("#"+current_device+"_screen").stop().animate({backgroundPosition:"-"+a+"px 0"},{duration:500})}}}var c=(6-current_screen)*16;$j("#indicator").css({"background-position":"-"+c+"px 0"})}var current_screen=1;var old_screen=1;var $j=jQuery.noConflict();$j(document).ready(function(){$j("#go_left a").click(function a(d){d.preventDefault();current_screen--;if(current_screen==0){current_screen=6;old_screen=0}else{old_screen=current_screen}setScreen("previous")});$j("#go_right a").click(function c(d){d.preventDefault();current_screen++;if(current_screen==7){current_screen=1;old_screen=7}else{old_screen=current_screen}setScreen("next")});$j("#support_form").submit(function b(d){$j.post("/common/includes/support_form_process.php",$j("#support_form").serialize(),function(e){if(e!=""){$j("#support_message").html(e)}else{$j("#support_message").html("Thank you, your support request has been submitted.");$j("#support_form").css({display:"none"})}});return false})});YUI().use("node-base","anim",function(a){a.on("click",selectPage,"#about_link a",a,"About");a.on("click",selectPage,"#faq_link a",a,"FAQ");a.on("click",selectPage,"#support_link a",a,"Support");a.on("click",selectDevice,"#iphone_selector a",a,"iphone");a.on("click",selectDevice,"#blackberry_selector a",a,"blackberry");a.on("click",showAnswer,"#faq_content p#q1",a,"a1");a.on("click",showAnswer,"#faq_content p#q2",a,"a2");a.on("click",showAnswer,"#faq_content p#q3",a,"a3");a.on("click",showAnswer,"#faq_content p#q4",a,"a4");a.on("click",showAnswer,"#faq_content p#q5",a,"a5");a.on("contentready",externalLinks,"body")});
