﻿function onLoadPage() {
    autoLogin();
    detectNavigator();
    setOrdersCount();
    if (getElement('GA_Tracking').value == 'on'){
        setTracker();
        classifyVisitors();
    }
}
function autoLogin() {
    var userCredential = getElement('userCredential').value;
    if (userCredential.length > 0){
        var clientOffset = getElement('clientOffset').value;
        argument = clientOffset + ';' + userCredential;
        context = "AutoLogin";
        if (typeof (WebForm_DoCallback) != "undefined" && WebForm_DoCallback != null) {
	        WebForm_DoCallback('__Page', argument, onAutoLogin, context, null, true);
        }
    }
}
function onAutoLogin(argument, context) {
    var retVal = argument.split(';');
    if (retVal[0] == 'ERROR'){
        if (retVal.length == 3 && typeof(retVal[2])!='undefined' && retVal[2] != ''){
            window.location.replace(retVal[2]);
        }
        alert(retVal[1]);
    }else if (typeof(argument)!='undefined' && argument != ''){
        window.location.replace(argument);
    }
}