﻿var siteUrl = 'http://www.CeramicDepot.co.il';

//------------------- endregion SETTING CART PROPERTY --------------------
//------------------------------------------------------------------------
//------------------- region SETTING PROPERTY ----------------------------
function wsfSetPropertySelect(idProduct, idGroup, idProperty)
{
    CeramicDepot.He.WebServices.wsStore.SetPropertySelect(
        idProduct,
        idGroup,
        idProperty,
        wsfSetPropertySelectOnSucceeded,
        wsfSetPropertySelectOnFailed);
}
function wsfSetPropertySelectOnSucceeded(json)
{
	if(null != (e = $get('m_cphBody_ucProduct_spanPriceSite')))
	    e.innerHTML = json.sPriceSiteFormatted + '&nbsp;' + json.sCoin;

	if(null != (e = $get('m_cphBody_ucProduct_spanSaving')))
	    e.innerHTML = json.sSavingFormatted + '&nbsp;' + json.sCoin;

    if(null != (e = $get('m_cphBody_ucProduct_divPicture')))
        if(e.innerHTML != json.sPicture)
            e.innerHTML = json.sPicture;

	if(json.sStockMatrix == 'true')
	{
	    if(null != (e = $get('m_cphBody_ucProduct_spanCN')))
	        e.innerHTML = json.sCN;

	    if(null != (e = $get('m_cphBody_ucProduct_spanStockLevel')))
	        e.innerHTML = json.sStockLevelMinusQuantity;

	    if(null != (e = $get('m_cphBody_ucProduct_spanStockLevelStatus')))
	        e.innerHTML = json.sStockLevelStatus;
    }
}
function wsfSetPropertySelectOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetPropertyCheckBox(idProduct, idGroup, idProperty, isChecked)
{
    CeramicDepot.He.WebServices.wsStore.SetPropertyCheckBox(
        idProduct,
        idGroup,
        idProperty,
        isChecked,
        wsfSetPropertyCheckBoxOnSucceeded,
        wsfSetPropertyCheckBoxOnFailed);
}
function wsfSetPropertyCheckBoxOnSucceeded(json)
{
	if(null != (e = $get('m_cphBody_ucProduct_spanPriceSite')))
	    e.innerHTML = json.sPriceSiteFormatted + '&nbsp;' + json.sCoin;

	if(null != (e = $get('m_cphBody_ucProduct_spanSaving')))
	    e.innerHTML = json.sSavingFormatted + '&nbsp;' + json.sCoin;
}
function wsfSetPropertyCheckBoxOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetPropertyRadioButton(idProduct, idGroup, idProperty)
{
    CeramicDepot.He.WebServices.wsStore.SetPropertyRadioButton(
        idProduct,
        idGroup,
        idProperty,
        wsfSetPropertyRadioButtonOnSucceeded,
        wsfSetPropertyRadioButtonOnFailed);
}
function wsfSetPropertyRadioButtonOnSucceeded(json)
{
	if(null != (e = $get('m_cphBody_ucProduct_spanPriceSite')))
	    e.innerHTML = json.sPriceSiteFormatted + '&nbsp;' + json.sCoin;

	if(null != (e = $get('m_cphBody_ucProduct_spanSaving')))
	    e.innerHTML = json.sSavingFormatted + '&nbsp;' + json.sCoin;
}
function wsfSetPropertyRadioButtonOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetPropertyTextBox(idProduct, idGroup, idProperty, value)
{
    CeramicDepot.He.WebServices.wsStore.SetPropertyTextBox(
        idProduct,
        idGroup,
        idProperty,
        value,
        wsfSetPropertyTextBoxOnSucceeded,
        wsfSetPropertyTextBoxOnFailed);
}
function wsfSetPropertyTextBoxOnSucceeded(json){}
function wsfSetPropertyTextBoxOnFailed(err){}
//------------------- endregion SETTING PROPERTY -------------------------
//------------------------------------------------------------------------
function wsfInfiniteSession()
{
    CeramicDepot.He.WebServices.wsStore.InfiniteSession(
        wsfInfiniteSessionOnSucceeded,
        wsfInfiniteSessionOnFailed);
}
function wsfInfiniteSessionOnSucceeded(s){/*alert('infinite');*/}
function wsfInfiniteSessionOnFailed(s){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfQuickToCart(idProductToCart)
{
    CeramicDepot.He.WebServices.wsStore.QuickToCart(
        idProductToCart,
        wsfQuickToCartOnSucceeded,
        wsfQuickToCartOnFailed);
}
function wsfQuickToCartOnSucceeded(json)
{
    if(null != json)
    {
        if(null != json.sUrl)
            window.location = json.sUrl;
    }
}
function wsfQuickToCartOnFailed(err){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfBuyNow(idProductToCart)
{
    CeramicDepot.He.WebServices.wsStore.BuyNow(
        idProductToCart,
        wsfBuyNowOnSucceeded,
        wsfBuyNowOnFailed);
}
function wsfBuyNowOnSucceeded(json)
{
    if(null != json)
    {
        if(null != json.sUrl)
            window.location = json.sUrl;
    }
}
function wsfBuyNowOnFailed(err){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfQuickBuyNow()
{
    CeramicDepot.He.WebServices.wsStore.QuickBuyNow(
        wsfQuickBuyNowOnSucceeded,
        wsfQuickBuyNowOnFailed);
}
function wsfQuickBuyNowOnSucceeded(json)
{
    if(null != json)
    {
        if(null != json.sUrl)
            window.location = json.sUrl;
    }
}
function wsfQuickBuyNowOnFailed(err){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfDeleteHistoryProduct(idProductToDelete, idProductException)
{
    CeramicDepot.He.WebServices.wsStore.DeleteHistoryProduct(
        idProductToDelete,
        idProductException,
        wsfDeleteHistoryProductOnSucceeded,
        wsfDeleteHistoryProductOnFailed);
}
function wsfDeleteHistoryProductOnSucceeded(json)
{
    if(null != json)
    {
	    if(null != (e = $get('divSideHistory')))
	        if(null != json.sHistory)
	            e.innerHTML = json.sHistory;
    }
}
function wsfDeleteHistoryProductOnFailed(err){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfDeleteCartProduct(idProduct, idCartRowIndex)
{
    CeramicDepot.He.WebServices.wsStore.DeleteCartProduct(
        idProduct,
        idCartRowIndex,
        wsfDeleteCartProductOnSucceeded,
        wsfDeleteCartProductOnFailed);
}
function wsfDeleteCartProductOnSucceeded(json)
{
	if(null != (e = $get('divSideCart')))
        if(null != json.sSideCart)
    	    e.innerHTML = json.sSideCart;

	if(null != (e = $get('divSideCartSummation')))
        if(null != json.sSideCartSummation)
    	    e.innerHTML = json.sSideCartSummation;

	if(null != (e = $get('divFullCart')))
        if(null != json.sFullCart)
    	    e.innerHTML = json.sFullCart;

	if(null != (e = $get('divFullCartSummation')))
        if(null != json.sFullCartSummation)
	        e.innerHTML = json.sFullCartSummation;

	if(null != (e = $get('divFullCartQuantity')))
	    if(null != json.sFullCartQuantity)
	        e.innerHTML = json.sFullCartQuantity;

	if(null != (e = $get('divOrderCart')))
	    if(null != json.sOrderCart)
	        e.innerHTML = json.sOrderCart;

	if(null != (e = $get('divOrderCartSummation')))
        if(null != json.sOrderCartSummation)
    	    e.innerHTML = json.sOrderCartSummation;

	if(null != (e = $get('divShipments')))
        if(null != json.sShipments)
            e.innerHTML = json.sShipments;

	if(null != (e = $get('divCreditCardPayments')))
        if(null != json.sCreditCardPayments)
            e.innerHTML = json.sCreditCardPayments;
}
function wsfDeleteCartProductOnFailed(err){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfUpdateCartProductQuantity(idProduct, idCartRowIndex, quantity)
{
    CeramicDepot.He.WebServices.wsStore.UpdateCartProductQuantity(
        idProduct,
        idCartRowIndex,
        quantity,
        wsfUpdateCartProductQuantityOnSucceeded,
        wsfUpdateCartProductQuantityOnFailed);
}
function wsfUpdateCartProductQuantityOnSucceeded(json)
{
    var id = '@' + json.sPID + '@' + json.sCRI;

	if(null != (e = $get('spanSideCartQuantity' + id)))
        if(null != json.sQuantity)
    	    e.innerHTML = json.sQuantity;

	if(null != (e = $get('spanSideCartPrice' + id)))
        if(null != json.sPriceFormatted)
    	    e.innerHTML = json.sPriceFormatted;

	if(null != (e = $get('divSideCartSummation')))
        if(null != json.sSideCartSummation)
    	    e.innerHTML = json.sSideCartSummation;

	if(null != (e = $get('spanFullCartPrice' + id)))
        if(null != json.sPriceFormatted)
    	    e.innerHTML = json.sPriceFormatted;

	if(null != (e = $get('spanFullCartPrice')))
        if(null != json.sFullCartPriceFormatted)
    	    e.innerHTML = json.sFullCartPriceFormatted;
	
	if(null != (e = $get('spanFullCartQuantity')))
        if(null != json.sFullCartQuantity)
    	    e.innerHTML = json.sFullCartQuantity;
	
	if(null != (e = $get('spanFullCartOrderTax')))
        if(null != json.sOrderTaxFormatted)
    	    e.innerHTML = json.sOrderTaxFormatted;
	
	if(null != (e = $get('spanFullCartOrderPrice')))
        if(null != json.sOrderPriceFormatted)
    	    e.innerHTML = json.sOrderPriceFormatted;

    for(i = 0; i < json.csStockLevels.length; i++)
    {
        id = '@' + json.csStockLevels[i].sPID + '@' + json.csStockLevels[i].sCRI;
        
	    if(null != (e = $get('divFullCartStockLevelStatus' + id)))
            if(null != json.csStockLevels[i].sStockLevelStatus)
    	        e.innerHTML = json.csStockLevels[i].sStockLevelStatus;
    	        
	    if(null != (e = $get('divFullCartStockLevelStatusPicture' + id)))
            if(null != json.csStockLevels[i].sStockLevelStatusPicture)
    	        e.innerHTML = json.csStockLevels[i].sStockLevelStatusPicture;
    }

	if(null != (e = $get('spanFullCartShipment')))
        if(null != json.sFullCartShipment)
            e.innerHTML = json.sFullCartShipment;
	if(null != (e = $get('divFullCartShipmentDescription')))
        if(null != json.sFullCartShipmentDescription)
            e.innerHTML = json.sFullCartShipmentDescription;
	if(null != (e = $get('spanFullCartShipmentPrice')))
        if(null != json.sFullCartShipmentPrice)
            e.innerHTML = json.sFullCartShipmentPrice;

	if(null != (e = $get('divShipments')))
        if(null != json.sShipments)
            e.innerHTML = json.sShipments;
            
	if((null != (tr = $get('trFullCartShipmentPrice'))) && (null != (e = $get('txtFullCartShipmentPrice'))))
	{
        if((jsfTrim(e.value).length == 0) && (trFullCartShipmentPrice.style.display != 'none'))
        {
            if(null != (tr = $get('trFullCartSupplyTime')))
                tr.className = tr.className == 'trFCRBW' ? 'trFCRBB':'trFCRBW';
            if(null != (tr = $get('trFullCartOrderTax')))
                tr.className = tr.className == 'trFCRBW' ? 'trFCRBB':'trFCRBW';
            if(null != (tr = $get('trFullCartOrderPrice')))
                tr.className = tr.className == 'trFCRBW' ? 'trFCRBB':'trFCRBW';
        }
        
	    trFullCartShipmentPrice.style.display = (jsfTrim(e.value).length == 0) ? 'none' : 'block';
    }
}
function wsfUpdateCartProductQuantityOnFailed(err){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfSuddenClearCart()
{
    CeramicDepot.He.WebServices.wsStore.SuddenClearCart(
        wsfSuddenClearCartOnSucceeded,
        wsfSuddenClearCartOnFailed);
}
function wsfSuddenClearCartOnSucceeded(json)
{
	if(null != (e = $get('divSideCart')))
        if(null != json.sSideCart)
    	    e.innerHTML = json.sSideCart;

	if(null != (e = $get('divSideCartSummation')))
        if(null != json.sSideCartSummation)
    	    e.innerHTML = json.sSideCartSummation;

	if(null != (e = $get('divFullCart')))
        if(null != json.sFullCart)
	        e.innerHTML = json.sFullCart;

	if(null != (e = $get('spanFullCartPrice')))
        if(null != json.sFullCartPriceFormatted)
	        e.innerHTML = json.sFullCartPriceFormatted;
	    
	if(null != (e = $get('spanFullCartQuantity')))
        if(null != json.sFullCartQuantity)
    	    e.innerHTML = json.sFullCartQuantity;

	if(null != (e = $get('divOrderCart')))
        if(null != json.sOrderCart)
	        e.innerHTML = json.sOrderCart;

	if(null != (e = $get('divOrderCartSummation')))
        if(null != json.sOrderCartSummation)
	        e.innerHTML = json.sOrderCartSummation;

	if(null != (e = $get('divShipments')))
        if(null != json.sShipments)
            e.innerHTML = json.sShipments;

	if(null != (e = $get('divCreditCardPayments')))
        if(null != json.sCreditCardPayments)
    	    e.innerHTML = json.sCreditCardPayments;
}
function wsfSuddenClearCartOnFailed(err){}
//------------------------------------------------------------------------
function wsfBindQuickBuyById(id)
{
    CeramicDepot.He.WebServices.wsStore.BindQuickBuyById(id,
        wsfBindQuickBuyByIdOnSucceeded,
        wsfBindQuickBuyByIdOnFailed);
}
function wsfBindQuickBuyByIdOnSucceeded(json)
{
    if(json != null)
    {
	    if(null != (e = $get('divQuickBuy')))
	        if(null != json.sQuickBuy) {
	            e.innerHTML = json.sQuickBuy;
	            e.style.display = 'block';
                    jsfCalcQuickBuyOffset();}
    }
    else
    {
        alert('.מספר דגם שציינת לא קיים במערכת');
    }
}
function wsfBindQuickBuyByIdOnFailed(){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfBindQuickProductPicture(id)
{
    CeramicDepot.He.WebServices.wsStore.BindQuickProductPicture(id,
        wsfBindQuickProductPictureOnSucceeded,
        wsfBindQuickProductPictureOnFailed);
}
function wsfBindQuickProductPictureOnSucceeded(innerHTML)
{
    if(null != (e = $get('divQuickProductPicture')))
        if(null != innerHTML) {
            e.innerHTML = innerHTML;
            e.style.display = 'block';
                jsfCalcQuickProductPictureOffset();}
}
function wsfBindQuickProductPictureOnFailed(){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfQuickBuy()
{
    CeramicDepot.He.WebServices.wsStore.QuickBuy(
        wsfQuickBuyOnSucceeded,
        wsfQuickBuyOnFailed);
}
function wsfQuickBuyOnSucceeded(json)
{
    if(json != null)
    {
	    if(null != (e = $get('divSideCart')))
            if(null != json.sSideCart)
    	        e.innerHTML = json.sSideCart;

	    if(null != (e = $get('divSideCartSummation')))
	        if(null != json.sSideCartSummation)
    	        e.innerHTML = json.sSideCartSummation;

	    if(null != (e = $get('divFullCart')))
	        if(null != json.sFullCart)
	            e.innerHTML = json.sFullCart;

	    if(null != (e = $get('divFullCartSummation')))
	        if(null != json.sFullCartSummation)
    	        e.innerHTML = json.sFullCartSummation;

    	if(null != (e = $get('divFullCartQuantity')))
	        if(null != json.sFullCartQuantity)
	            e.innerHTML = json.sFullCartQuantity;
    }
    else
    {
        alert('.מספר דגם שציינת לא קיים במערכת');
    }
}
function wsfQuickBuyOnFailed(){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfSetProductQuantity(quantity)
{
    CeramicDepot.He.WebServices.wsStore.SetProductQuantity(
        quantity,
        wsfSetProductQuantityOnSucceeded,
        wsfSetProductQuantityOnFailed);
}
function wsfSetProductQuantityOnSucceeded(json)
{
	if(null != (e = $get('divStockLevel')))
	    if(null != json.sStockLevelMinusQuantity)
	        e.innerHTML = (json.sStockLevelMinusQuantity < 0 ) ?
	            '0' : json.sStockLevelMinusQuantity;

	if(null != (e = $get('divStockLevelStatus')))
	    if(null != json.sStockLevelStatus)
	        e.innerHTML = json.sStockLevelStatus;

    //----------- from nyga -----------------    
    
	if(null != (e = $get('spanStockLevel')))
	    if(null != json.sStockLevelMinusQuantity)
	        e.innerHTML = (json.sStockLevelMinusQuantity < 0 ) ?
	            '0' : json.sStockLevelMinusQuantity;

	if(null != (e = $get('spanStockLevelStatus')))
	    if(null != json.sStockLevelStatus)
	        e.innerHTML = json.sStockLevelStatus;
}
function wsfSetProductQuantityOnFailed(err){ window.location=siteUrl; }
//------------------------------------------------------------------------


//------------------------------------------------------------------------
//-- checkout 1 start ----------------------------------------------------
//------------------------------------------------------------------------
function wsfUpdateCustomerDetails(o)
{
    CeramicDepot.He.WebServices.wsStore.UpdateCustomerDetails(o,
        wsfUpdateCustomerDetailsOnSucceeded,
        wsfUpdateCustomerDetailsOnFailed);
}
function wsfUpdateCustomerDetailsOnSucceeded(json){}
function wsfUpdateCustomerDetailsOnFailed(err){}
//------------------------------------------------------------------------
function wsfContinueCheckout()
{
    CeramicDepot.He.WebServices.wsStore.ContinueCheckout(
        wsfContinueCheckoutOnSucceeded,
        wsfContinueCheckoutOnFailed);
}
function wsfContinueCheckoutOnSucceeded(answer)
{
    if(answer != null)
    {
        if(answer == '0' )
        {
            var msg = 
                '.הדואר האלקטרוני רשום במערכת' + '\n' +
                '.יש להשתמש בסיסמא בה נרשמתם בעבר' + '\n' +
                '.במידה ושכחת סיסמא ניתן לבצע שיחזור סיסמא בחלקו השמאלי של המסך';
            alert(msg);
        }
        else
        {
            window.location = answer;
        }
    }
}
function wsfContinueCheckoutOnFailed(err){}
//------------------------------------------------------------------------
function wsfReminder(customerEmail, customerFirstName)
{
    CeramicDepot.He.WebServices.wsStore.Reminder(
        customerEmail,
        customerFirstName,
        wsfReminderOnSucceeded,
        wsfReminderOnFailed);
}
function wsfReminderOnSucceeded(tf)
{
    if(tf != null)
    {
        if(null != (e = $get('trReminderWrongEmail')))
            e.style.display = tf ? 'none':'block';
        if(null != (e = $get('trReminderRightEmail')))
            e.style.display = tf ? 'block':'none';
        
        var prefix = 'm_cphBody_ucCheckout_';
        
        if(null != (e = $get(prefix + 'txtReminderEmail')))
            e.value = '';
        if(null != (e = $get(prefix + 'txtReminderCustomerFirstName')))
            e.value = '';
    }
}
function wsfReminderOnFailed(err){}
//------------------------------------------------------------------------
function wsfSignIn(o)
{
    CeramicDepot.He.WebServices.wsStore.SignIn(o,
        wsfSignInOnSucceeded,
        wsfSignInOnFailed);
}
function wsfSignInOnSucceeded(json)
{
    if(json != null)
    {
        if(null != json.sID && json.sID != '0')
        {
            var prefix = 'm_cphBody_ucCheckout_';
            
            if(null != (e = $get(prefix + 'txtCustomerFirstName')) && null != json.sFirstName)
                e.value = json.sFirstName;
            if(null != (e = $get(prefix + 'txtCustomerLastName')) && null != json.sLastName)
                e.value = json.sLastName;
            if(null != (e = $get(prefix + 'txtCustomerCompany')) && null != json.sCompany)
                e.value = json.sCompany;
          
            if(null != (e = $get(prefix + 'txtCustomerCity')) && null != json.sCity)
                e.value = json.sCity;
            if(null != (e = $get(prefix + 'txtCustomerStreet')) && null != json.sStreet)
                e.value = json.sStreet;
            if(null != (e = $get(prefix + 'txtCustomerHome')) && null != json.sHome)
                e.value = json.sHome;
            if(null != (e = $get(prefix + 'txtCustomerZIP')) && null != json.sZIP)
                e.value = json.sZIP;
            if(null != (e = $get(prefix + 'txtCustomerPhone')) && null != json.sPhone)
                e.value = json.sPhone;
            if(null != (e = $get(prefix + 'txtCustomerCellular')) && null != json.sCellular)
                e.value = json.sCellular;
            if(null != (e = $get(prefix + 'txtCustomerFax')) && null != json.sFax)
                e.value = json.sFax;

            if(null != json.sCountryID)
                wsfSelect(prefix + 'ddlCustomerCountry', json.sCountryID);
            if(null != json.sBirthday)
                wsfSelect(prefix + 'ddlCustomerBirthdayMonth', json.sBirthday.split('.')[0]);
            if(null != json.sBirthday)
                wsfSelect(prefix + 'ddlCustomerBirthdayDay', json.sBirthday.split('.')[1]);
            if(null != json.sBirthday)
                wsfSelect(prefix + 'ddlCustomerBirthdayYear', json.sBirthday.split('.')[2]);
            if(null != json.sCustomerTypeID)
                wsfSelect(prefix + 'ddlCustomerType', json.sCustomerTypeID);
                
            if( null != (e1 = $get(prefix + 'txtCustomerEmail')) &&
                null != (e2 = $get(prefix + 'txtCustomerEmailHidden')) &&
                null != json.sEmail) e1.value = e2.value = json.sEmail;
                
            if( null != (e1 = $get(prefix + 'txtCustomerPassword')) &&
                null != (e2 = $get(prefix + 'txtCustomerPasswordHidden')) &&
                null != json.sEmail) e1.value = e2.value = json.sPassword;
                
            if(null != (e = $get(prefix + 'txtCustomerComments')) && null != json.sComments)
                e.value = json.sComments;
            if(null != (e = $get(prefix + 'txtCustomerSchoolName')) && null != json.sSchoolName)
                e.value = json.sSchoolName;
            
            if(null != (e = $get('trUserDoesNotExist')))
                e.style.display = 'none';
        }
        else
        {
            if(null != (e = $get('trUserDoesNotExist')))
                e.style.display = '';
        }
    }

    if(null != (e = $get(prefix + 'txtSignInEmail')))
        e.value = '';
    if(null != (e = $get(prefix + 'txtSignInPassword')))
        e.value = '';
}
function wsfSignInOnFailed(err){}
function wsfSelect(id, value)
{
    if(null != (e = $get(id))) {
        for(i=0;i<e.length;i++) {
            if(e.options[i].value == value) {
                e.selectedIndex = i; break; }}}
}
//------------------------------------------------------------------------
function wsfUpdateShipmentHours(from, to)
{
    CeramicDepot.He.WebServices.wsStore.UpdateShipmentHours(
        from, to,
        wsfUpdateShipmentHoursOnSucceeded,
        wsfUpdateShipmentHoursOnFailed);
}
function wsfUpdateShipmentHoursOnSucceeded(json){}
function wsfUpdateShipmentHoursOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateShipmentAddress(o)
{
    CeramicDepot.He.WebServices.wsStore.UpdateShipmentAddress(o,
        wsfUpdateShipmentAddressOnSucceeded,
        wsfUpdateShipmentAddressOnFailed);
}
function wsfUpdateShipmentAddressOnSucceeded(res){}
function wsfUpdateShipmentAddressOnFailed(err){}
//------------------------------------------------------------------------
function wsfCatalogueToShipment(catToShip)
{
    CeramicDepot.He.WebServices.wsStore.CatalogueToShipment(
        catToShip,
        wsfCatalogueToShipmentOnSucceeded,
        wsfCatalogueToShipmentOnFailed);
}
function wsfCatalogueToShipmentOnSucceeded(json){}
function wsfCatalogueToShipmentOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdatePurchaseDetails(idPurchase)
{
    CeramicDepot.He.WebServices.wsStore.UpdatePurchaseDetails(
        idPurchase,
        wsfUpdatePurchaseDetailsOnSucceeded,
        wsfUpdatePurchaseDetailsOnFailed);
}
function wsfUpdatePurchaseDetailsOnSucceeded(res){}
function wsfUpdatePurchaseDetailsOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateShipmentDetails(idShipment)
{
    CeramicDepot.He.WebServices.wsStore.UpdateShipmentDetails(idShipment,
        wsfUpdateShipmentDetailsOnSucceeded,
        wsfUpdateShipmentDetailsOnFailed);
}
function wsfUpdateShipmentDetailsOnSucceeded(json)
{
	if(null != (e = $get('divSideCart')))
        if(null != json.sSideCart)
    	    e.innerHTML = json.sSideCart;

	if(null != (e = $get('divSideCartSummation')))
        if(null != json.sSideCartSummation)
    	    e.innerHTML = json.sSideCartSummation;

	if(null != (e = $get('divFullCart')))
        if(null != json.sFullCart)
    	    e.innerHTML = json.sFullCart;

	if(null != (e = $get('divFullCartSummation')))
        if(null != json.sFullCartSummation)
	        e.innerHTML = json.sFullCartSummation;

	if(null != (e = $get('divFullCartQuantity')))
	    if(null != json.sFullCartQuantity)
	        e.innerHTML = json.sFullCartQuantity;

	if(null != (e = $get('divOrderCart')))
	    if(null != json.sOrderCart)
	        e.innerHTML = json.sOrderCart;

	if(null != (e = $get('divOrderCartSummation')))
        if(null != json.sOrderCartSummation)
    	    e.innerHTML = json.sOrderCartSummation;

	if(null != (e = $get('divShipments')))
        if(null != json.sShipments)
            e.innerHTML = json.sShipments;

	if(null != (e = $get('divCreditCardPayments')))
        if(null != json.sCreditCardPayments)
            e.innerHTML = json.sCreditCardPayments;
}
function wsfUpdateShipmentDetailsOnFailed(err){}
//------------------------------------------------------------------------
//-- checkout 1 end ------------------------------------------------------
//------------------------------------------------------------------------
//-- checkout 2 begin ------------------------------------------------------
//------------------------------------------------------------------------
function wsfUpdateCreditCardDetails(o)
{
    CeramicDepot.He.WebServices.wsStore.UpdateCreditCardDetails(o,
        wsfUpdateCreditCardDetailsOnSucceeded,
        wsfUpdateCreditCardDetailsOnFailed);
}
function wsfUpdateCreditCardDetailsOnSucceeded(res){}
function wsfUpdateCreditCardDetailsOnFailed(err){ window.location=siteUrl; }
//------------------------------------------------------------------------
function wsfUpdateStandardsAcceptance(accepted)
{
    CeramicDepot.He.WebServices.wsStore.UpdateStandardsAcceptance(
        accepted,
        wsfUpdateStandardsAcceptanceOnSucceeded,
        wsfUpdateStandardsAcceptanceOnFailed);
}
function wsfUpdateStandardsAcceptanceOnSucceeded(json){}
function wsfUpdateStandardsAcceptanceOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateGift(accepted)
{
    CeramicDepot.He.WebServices.wsStore.UpdateGift(
        accepted,
        wsfUpdateGiftOnSucceeded,
        wsfUpdateGiftOnFailed);
}
function wsfUpdateGiftOnSucceeded(json){}
function wsfUpdateGiftOnFailed(err){}
//-- checkout 2 end ------------------------------------------------------
//------------------------------------------------------------------------
function wsfHotProduct(divId)
{
    CeramicDepot.He.WebServices.wsStore.HotProduct(
        divId,
        wsfHotProductOnSucceeded,
        wsfHotProductOnFailed);
}
function wsfHotProductOnSucceeded(json)
{
    if( (null != json) &&
        (null != json.Key) &&
        (null != json.Value) &&
        (null != (e = $get(json.Key))))
            e.innerHTML = json.Value;
}
function wsfHotProductOnFailed(){}
//------------------------------------------------------------------------
function wsfUpdateShipmentPriceWithCountry(shipmentId, countryId)
{
    CeramicDepot.He.WebServices.wsStore.UpdateShipmentPriceWithCountry(
        shipmentId, countryId,
        wsfUpdateShipmentPriceWithCountryOnSucceeded,
        wsfUpdateShipmentPriceWithCountryOnFailed);
}
function wsfUpdateShipmentPriceWithCountryOnSucceeded(json)
{
	if(null != (e = $get('divSideCart')))
        if(null != json.sSideCart)
    	    e.innerHTML = json.sSideCart;

	if(null != (e = $get('divSideCartSummation')))
        if(null != json.sSideCartSummation)
    	    e.innerHTML = json.sSideCartSummation;

	if(null != (e = $get('divFullCart')))
        if(null != json.sFullCart)
    	    e.innerHTML = json.sFullCart;

	if(null != (e = $get('divShipments')))
        if(null != json.sShipments)
            e.innerHTML = json.sShipments;
}
function wsfUpdateShipmentPriceWithCountryOnFailed(){}
//------------------------------------------------------------------------
function wsfContactUs()
{
    var o = new Object();
        o.sName = $get('txtContactName').value;
        o.sCompany = $get('txtContactCompany').value;
        o.sPhone = $get('txtContactPhone').value;
        o.sCellular = $get('txtContactCellular').value;
        o.sEmail = $get('txtContactEmail').value;
        o.sRegistered = $get('rbRegistered').checked ? 'true':'false';
        o.sSubject = $get('txtContactSubject').value;
        o.sContent = $get('txtContactContent').value;
        o.sMailing =  $get('chbMailing').checked ? 'true':'false';

    CeramicDepot.He.WebServices.wsStore.ContactUs(o,
        wsfContactUsOnSucceeded,
        wsfContactUsOnFailed);
}
function wsfContactUsOnSucceeded(json)
{
    window.location = 'ContactSent.aspx';
}
function wsfContactUsOnFailed()
{
    alert('failure');
}
//------------------------------------------------------------------------

