﻿
function checkEmail(email){
 	Auth.checkEmail(email, checkEmailCallBack);
}
function checkEmailCallBack(Arg) {
     getMovie("flash").checkEmailCallBack(Arg);
}

function isDate(year, month, day) {
    Auth.isDate(year, month, day, isDateCallBack);
}

function isDateCallBack(Arg) {
    getMovie("flash").isDateCallBack(Arg);
} 

function isDOBValid(year, month, day) {
    Auth.isDOBValid(year, month, day, isDOBValidCallBack);
}

function isDOBValidCallBack(Arg) {
    getMovie("flash").isDOBValidCallBack(Arg);
} 

//**************************************

function getProducts(brand){
    StoreLocator.getProducts(brand,getProductsCallBack);
}

function getProductsCallBack(Arg){
    getMovie("flash").getProductsReturn(xmlToString(Arg));
}

function getStores(Zipcode, ProductId, SearchRadius){
    StoreLocator.getStores(Zipcode, ProductId, SearchRadius, getStoresCallBack);
}

function getStoresCallBack(Arg){
    getMovie("flash").getStoresReturn(xmlToString(Arg));
}

//*************************************

function getProductCategories(brand){
    StoreLocator.getProductCategories(brand,getProductCategoriesCallBack);
}

function getProductCategoriesCallBack(Arg){
    getMovie("flash").getProductCategoriesReturn(Arg);
}

function getProductsList(brand, CategoryID){
    StoreLocator.getProductsList(brand, CategoryID ,getProductsListCallBack);
}

function getProductsListCallBack(Arg){
    getMovie("flash").getProductsListReturn(Arg);
}

function getSizeList(brand, ProductID){
    StoreLocator.getSizeList(brand, ProductID,getSizeListCallBack);
}

function getSizeListCallBack(Arg){
    getMovie("flash").getSizeListReturn(Arg);
}

function getMovie(movieName) {
    if (window[movieName]){
        return window[movieName];
    } else {
        return document[movieName];
    }
}

function xmlToString(xmlObj) {
    if(navigator.appName == "Microsoft Internet Explorer") {
        return xmlObj.xml;
    } else {
		return (new XMLSerializer()).serializeToString(xmlObj);
	}
}