function hpTakeOverStart() {
	if (getCookie('hpAnimation') != '1') {
		$("#NKHPeelBack_image").hide();
		$("#scoobyCalloutMain_homePage").hide();
		var flashvars = {};
		var attributes = {'wmode':'transparent'};
		var params = {'wmode':'transparent'};
		attributes.id = "scoobyPoof";
		swfobject.embedSWF("/assets/templates/arbys/flash/scooby_homePage_anim_poof_noTrail.swf", "takeOverContentTarget", "1100", "500", "9.0.0", false, flashvars, params, attributes);	
		$("#takeOver").show();
	} else {
		$("#NKHPeelBack_image").hide();
		$("#scoobyCalloutMain_homePage").hide();
		nkhCornerPeel1();
	}
}

function hpTakeOverFinish() {
	$("#scoobyCalloutMain_homePage").show();
	$("#takeOver").hide();
	setCookie('hpAnimation','1');
	nkhCornerPeel1();
}

function angusTakeOverStart() {
	if (getCookie('angusAnimation') != '1') {
		$("#main-content").hide();
		$("#footer").hide();
		var flashvars = {};
		var params = {'wmode':'transparent'};
		var attributes = {'wmode':'transparent'};
		attributes.id = "angusBeef";
		swfobject.embedSWF("/assets/templates/arbys/flash/angusFlyIn.swf", "takeOverContentTarget", "1100", "600", "9.0.0", false, flashvars, params, attributes);	
		$("#takeOver").show();
	} else {
		$("#main-content").show();
		$("#footer").show();
	}
}

function angusTakeOverFinish() {
	setCookie('angusAnimation','1');
	$("#takeOver").hide();	
	$("#main-content").show();
	$("#footer").show();	
}

function kidsMenuTakeOverFinish() {
	$("#takeOver").hide();
	$("#scoobyCalloutMain_kidsMenu").show();
	setCookie('kidsMenuAnimation','1');
}

function kidsMenuTakeOverStart() {
	if (getCookie('kidsMenuAnimation') != '1') {
		$("#scoobyCalloutMain_kidsMenu").hide();
		var flashvars = {};
		var params = {'wmode':'transparent'};
		var attributes = {'wmode':'transparent'};
		attributes.id = "kidsMenu";
		swfobject.embedSWF("/assets/templates/arbys/flash/scooby_kidsPage_anim_poof.swf", "takeOverContentTarget", "1100", "500", "9.0.0", false, flashvars, params, attributes);	
		$("#takeOver").show();
	} else {
		$("#scoobyCalloutMain_kidsMenu").show();
	}
}

function nkhCornerPeel1() {
    var flashvars = {};
	var attributes = {'wmode':'transparent'};
	var params = {'wmode':'transparent'};
	attributes.id = "peelBackContent";
	swfobject.embedSWF("/assets/templates/arbys/flash/peelBack1.swf", "peelBackContent", "110", "130", "9.0.0", false, flashvars, params, attributes);	
	$("#peelBack").show();   
}

function nkhCornerPeel2() {
    var flashvars = {};
	var attributes = {'wmode':'transparent'};
	var params = {'wmode':'transparent'};
	attributes.id = "peelBackContent";
	swfobject.embedSWF("/assets/templates/arbys/flash/peelBack2.swf", "peelBackContent", "225", "270", "9.0.0", false, flashvars, params, attributes);	
	$("#peelBack").show();   
	//$("#NKHPeelBack_image").hide();
}

function peelBackShowImage(){
	$("#NKHPeelBack_image").show();
	$("#peelBack").hide();   
}

function checkTakeOver() {
	//if not ipad
	if (!isiPad()) {
		//get current page
		var angusMatch=/angus\.html/;
		var kidsMenuMatch=/kids-menu.html/;
		var homeMatch1=/^\/$/;
		var homeMatch2=/^\/index.php$/;
		//alert(location.pathname);
		if (location.pathname.search(angusMatch)!=-1) {
			angusTakeOverStart();
		} else if (location.pathname.search(kidsMenuMatch)!=-1) {
			//kidsMenuTakeOverStart();
		} else if (location.pathname.search(homeMatch1)!=-1) {
			//$("#NKHPeelBack_image").hide();
			//nkhCornerPeel1();		
		} else if (location.pathname.search(homeMatch2)!=-1) {
			//$("#NKHPeelBack_image").hide();
			//nkhCornerPeel1();	
		}	
	}
}

function setCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = ";expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function deleteCookie(name) {
    setCookie(name,"",-1);
}

function isiPad(){
    return (navigator.platform.indexOf("iPad") != -1);
}

