//CVV  pre-R08 workaround 
try {
	showCVVDescModal = function(n) {};
	showSavedCVVDescModal = function(n) {};
} catch(e) { }

function simpleCVVModal() {
	var x = window.open('//img.disneystore.com/content/hub/checkout11/cvvmodals/default.html', 'DisneyStore', 'width=595,height=430,scrollbars=no'); return false;
}

$(document).ready(function() {
	$('p#saved_cvvSection a').click(simpleCVVModal);
	$('p#cvvSection a').click(simpleCVVModal);
});

function open_guest_services_window(pageName) {
	var GuestServices;
	if (pageName == "") pageName = "mainmenu";
	GuestServices = open("http://img.disneystore.com/content/global/guest_services10/"+pageName+".html","GuestServices","height=470,width=570,toolbar=no,menubar=yes,resizable=yes,scrollbars=yes");
	GuestServices.focus();
	return true;
}

function open_gs_window(path) {
	var newPath = path.replace(/\//gi,"").toLowerCase();
	if (newPath.indexOf("sizeinfo") >= 0) {
		newPath = "sizes";
	}
	if (newPath.indexOf("giftcardsmain") >= 0) {
		newPath = "giftcards";
	}
	if (newPath.indexOf("contactus") >= 0) {
		newPath = "contact";
	}
	return open_guest_services_window(newPath);
}

// dsy_ic_redirector added 10/22/07 by gschlott, updated 11/14/07 & 4/30/09
// This function is used by Instant Credit landing page links in the DisneyStore.com site.
// It determines which CELL code should be passed to the landing page based on the business rules around the disneystore.com domain.
// NOTE that is the function is used in a footer link, the parameters should be blank so that the CELL values can be overridden when special events are scheduled.
function dsy_ic_redirector(param_cell_dsi,param_cell_dsy) {
	var ic_url = "https://www.disneystore.com/disney/store/DSIInstantCreditCardSelectionDisplay?storeId=10054&langId=-1&catalogId=10002";
	var chosen_cell_dsi = param_cell_dsi;
	var chosen_cell_dsy = param_cell_dsy;
	try {
		if (ic_cell_footer_dstore_dsi != null && ic_cell_footer_dstore_dsi != "" && param_cell_dsi == "") chosen_cell_dsi = ic_cell_footer_dstore_dsi;
		if (ic_cell_footer_dstore_dsy != null && ic_cell_footer_dstore_dsy != "" && param_cell_dsi == "") chosen_cell_dsy = ic_cell_footer_dstore_dsy;
	} catch (e) { alert(e); }
	if (chosen_cell_dsy != "" && document.cookie.indexOf("SOURCE=325310") >= 0) ic_url += "&CELL="+chosen_cell_dsy;
	else if (chosen_cell_dsi != "") ic_url += "&CELL="+chosen_cell_dsi;
	window.location.href = ic_url;
}

// BEGIN - BAYNOTE OBSERVER TAG CODE
function baynote_getTotalPurchases() {
	if(!baynote_tag.attrs) baynote_tag.attrs = new Object();
	if (typeof(bnOrderTotal) != "undefined" && bnOrderTotal != null && bnOrderTotal != "")
		baynote_tag.attrs.totalPurchases = parseFloat(bnOrderTotal);
	if (typeof(bnOrderId) != "undefined" && bnOrderId != null && bnOrderId != "")
		baynote_tag.attrs.purchaseId = bnOrderId;
        if (typeof(bnOrderDetails) != "undefined" && bnOrderDetails != null && bnOrderDetails != "")
               baynote_tag.attrs.purchaseDetails = bnOrderDetails;
}
try {
var bn_location_href = window.location.href;
if (bn_location_href.indexOf("https://") == 0) {
	baynote_tag.server = "https://disney-store.baynote.net";
} else {
	baynote_tag.server = "http://disney-store.baynote.net";
}
baynote_tag.customerId = "disney";
baynote_tag.code = "store";
baynote_tag.type = "baynoteObserver";
baynote_getTotalPurchases();
var bn_testCondition = getCookie("EXP_segment");
if(bn_testCondition == "ScenarioB")
	baynote_tag.conditionName = "B";
else if(bn_testCondition == "ScenarioC")
	baynote_tag.conditionName = "C";
baynote_tag.show();
} catch (e) { };
// END - BAYNOTE OBSERVER TAG CODE

// include ForeSee survey
try {
if (foresee_trigger_included == "f" && getCookie("testSurvey") != "f") {
foresee_trigger_included = "t";
document.writeln('<script type="text/javascript" src="//img.disneystore.com/content/misc/surveys/foresee/foresee-trigger.js"></script>');
}} catch (e) { ; };
