// JavaScript Document
	function set_cookie (name, value, exp_y, exp_m, exp_d, path, domain, secure){
		  var cookie_string = name + "=" + escape (value);		
		  if (exp_y)
		  {
			var expires = new Date (exp_y, exp_m, exp_d);
			cookie_string += "; expires=" + expires.toGMTString();
		  }		
		  if (path)
				cookie_string += "; path=" + escape (path);		
		  if (domain)
				cookie_string += "; domain=" + escape (domain);		  
		  if (secure)
				cookie_string += "; secure";		  
		  document.cookie = cookie_string;
		}
		
		function get_cookie (cookie_name){
		  var results = document.cookie.match ('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
		
		  if (results)
			return (unescape (results[2]));
		  else
			return null;
		}
		
		function readCookie() {
			var isCookie = get_cookie('whichMenu');
			if (isCookie == 'menuChoosen') {
				hide('introQuestion'); 
				show('returnQuestion');
			}
			else {
				show('introQuestion');
				hide('returnQuestion');
			}
		}
		
		function thisMovie(movieName) {
			///console.log("thisMovie ::: " + movieName);
			var isIE = navigator.appName.indexOf("Microsoft") != -1;
			return (isIE) ? window[movieName] : document[movieName];
		}
		
		function makeCall(str) {
			if (document.getElementById("applebeesHeader")) {
				thisMovie("applebeesHeader").asFunc(str);
			}
		}
				
		if(navigator.userAgent.indexOf('Mac') != -1){
			document.write ('<style type="text/css">.radioSpace {margin-top: 5px;}</style>');
		}
		
		
		
		/*SHOW/HIDE DIV*/
		
		
		function hidediv(div) {
			//alert("hidediv()");
			//console.log("hide div" + div);
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(div).style.visibility = 'hidden';
			}else {
				if (document.layers) { // Netscape 4
					document.div.visibility = 'hidden';
				}else { // IE 4
					document.all.div.style.visibility = 'hidden';
				}
			}
			
			//start our animation
			
			if(div == "realBurgers"){
				start();
			}
			
		}
			
		function showdiv(div) {
			//alert ('show div' + div);
			//console.log("show div" + div);
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(div).style.visibility = 'visible';
			}else {
				if (document.layers) { // Netscape 4
				document.div.visibility = 'visible';
				}else { // IE 4
					document.all.div.style.visibility = 'visible';
				}
			}
		}
		

		/*BROWSER SHAKE	*/
		function quake(n) {

			var browser=navigator.appName;
			var version=navigator.appVersion;
			
			//if we are firefox on pc
			if(navigator.userAgent.indexOf("Firefox")!= -1 && navigator.userAgent.indexOf("Windows")!= -1 ){
					//alert("you have FF PC");
			}else{
				if (parent.moveBy) {
				
					for (i = 5; i > 0; i--) {
				
						for (j = n; j > 0; j--) {
				
							parent.moveBy(0,i);
				
							parent.moveBy(i,0);
							
							parent.moveBy(0,-i);
							
							parent.moveBy(-i,0);
	
						}
	
					}
	
				}
			}

		}
		
		
		/*intializer function */
		function main(){
			//console.log("main");
			$(document).ready(function(){
   			// Your code here
			//alert("first Visit");
				startInit();

 		});

				
		}
		
		function startInit(){
			//hide our footer so it doesn't show below overlay
			hidediv('footerSub');
			
			//show our overlay
			showOverlay();
		}

		function hideTVSpotBkgd(){
			//alert('hideTVSpotBkgd');
			hidediv('tvSpotBkgd');
			showdiv('footerSub');
		}
		
		function hideTVSpot(){
			
			//console.log("hideTVSPot");
			//alert("hideTVSpot");
			hidediv('tvSpot');
			//play footer
			//thisMovie("footer").init();
			
			//clear our show spot cookie
			eraseCookie('showSpot');
		}
		
		
		/*
		onLoad = function(){
			Response.Expires = 0
			Response.Cache.SetNoStore();
			Response.AppendHeader("Pragma", "no-cache");
		}
		*/
		
		function eraseCookie(name) {
			//alert("erase : " + name);
			createCookie(name,"",-1);
		}
		
		function createCookie(name,value,days) {
			var expires = "";
			document.cookie = name+"="+value+expires+"; path=/";
		}
		
		function headerFade(){
			thisMovie("header").init();
		}
		
		
		/*reveals our shadow underneath the header
		called from vetsDayHero*/
		function fadeShadow(){
			//alert('fadeshadow');
			//showdiv('topShadowHome');
			
			$(document).ready(function(){
									   //alert('fade');
				//$("div.topShadowHome").fadeIn("slow");
				$("div.topShadowHome").show();
			 });
			
			
			

		}
		
		/*called from our gift card landing page */
		function checkBalance(){
			window.open('','WBI','scrollbars=no,dependent=no,directories=no,hotkeys=no,resizable=no,screenX=0,screenY=0,menubar=no,toolbar=no,location=no,personalbar=no,status=no,height=405,width=390');
		}
		
		//called when our intro movie is finished playing
		function movieComplete(){
			//console.log("movieComplete");
			//hide our spot bkgd
			hideTVSpot();
			
			//advance our hero animation
			thisMovie("hero").movieComplete();
		}
		
		//called when loader is done loading...
			//called when our intro movie is finished playing
		function onLoadComplete(){
			//console.log("onLoadComplete");
			hideTVSpotBkgd();
			hidediv('wrappingPaper');
			
		}
		
	
		function closeOverlay(showFooter){
			$(document).ready(function(){  
				$("#under550_overlay").fadeOut();
				$("#under550_bkgd").fadeOut();
			}); 
			
			//show our footer
			if(showFooter == 'false'){
			}else{
				showdiv('footerSub');
				//call init in our hero to begin animation
				thisMovie("hero").init();
			}
			
			
		}

		/*Call this function to show the overlay*/
		
		function showOverlay(){
			$(document).ready(function(){  
				$("#under550_overlay").fadeIn();
				$("#under550_bkgd").fadeIn();
			});  
		}
		
	
		function showTV(){
			//alert('showTV');
			
			if(isSafari()){
				embedTV();
			}
			$(document).ready(function(){  
				$("#tvSpot").fadeIn();
				$("#tvSpotBkgd").fadeIn();
			});  
		}
		
		
		function closeTV(){
			$(document).ready(function(){  
				$("#tvSpot").fadeOut();
				$("#tvSpotBkgd").fadeOut();
			});  
		}
		
		function seeourtvads(){
			//alert("seeourtvads();");
			//closeOverlay();
			showTV();
		}
		
		function secondVisit(){
			//console.log("second visit");
			$(document).ready(function(){ 
				//console.log("on ready");
				$("#footerSub").toggle();
				$("#footerSub").toggle();
			
			});
		}

