﻿//function ShowConfirm() {
//    alert("Your shopping cart has been updated.");

//}

function confirmShoppingCartUpdate() {
    var message = document.getElementById('hiddenField1'); 
      
    if (message.value != "") {
             alert(message.value);
        }
}

function GetConfirmationFromServer(result, context) {
    var i = result;
    if (i == '0')
    { alert('You have been successfully added to the mailing list'); }
    else if (i == '1')
    { alert('email exists'); }
    else if (i == '2')
    { alert('You have been successfully removed from the mailing list'); }
    else if (i == '3')
    { alert('There is no subscription associated to this email address');}
}

function MailingListConfirmation() {
    var txtName = document.getElementById('txtName');
    var txtEmail = document.getElementById('txtEmail');
    var optSubscribe = document.getElementById('optSubscribe');
    var reg = new RegExp("^[\\w-_\.+]*[\\w-_\.]\@([\\w]+\\.)+[\\w]+[\\w]$");
    
    if (txtName.value == '' && txtEmail.value == '') {
            alert('Please enter a name and email address');
            txtName.focus();
            return false;
        }
    if (optSubscribe.checked) {
        
        if (txtName.value == '') {
            alert('Please enter a name');
            txtName.focus();
            return false;
        }
        else if (!reg.test(txtEmail.value)) {
            alert('Please provide a valid email address');
            txtEmail.focus();
            return false;
        }
        else {
            UseCallback(txtEmail.value + '|' + txtName.value, "");
        }
    }
    else 
    {
        if (!reg.test(txtEmail.value)) {
            alert('Please provide a valid email address');
            txtEmail.focus;
            return false;
        }
        else {
            UseCallback(txtEmail.value, "");
        }
    }
}

function ShoppingCartUpdated(obj) {

    var txtButtonId = obj.toString();
    var txtQty = document.getElementById('txtQty' + txtButtonId.substring(6, txtButtonId.length));
    alert(txtQty.value);
 
    UseCallback(txtButtonId + '|' + txtQty.value);
}

function Clienttime() {
    var today = new Date();

    var clientSideText = document.getElementById('txtTimeZoneExperiment');
    clientSideText.value = today.toDateString() + today.toLocaleTimeString().toString();
    var offsetText = document.getElementById('txtBoxUTCOffset');
    offsetText.value = today.getTimezoneOffset() / 60;
    //alert(today.getTimezoneOffset()/60);
    
}