﻿function getY( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetTop;
oElement = oElement.offsetParent;
}
return iReturnValue;
}
function getX( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}
function wsfQuickBuy()
{
    wsStoreSite.QuickBuy(
        wsfQuickBuyOnSucceeded,
        wsfQuickBuyOnFailed);
}
function wsfQuickBuyOnSucceeded(json)
{
    if(json != null)
    {
	    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('divSideCartSummation')))
	        if(null != json.sSideCartSummation)
    	        e.innerHTML = json.sSideCartSummation;
    }
    else
    {
        alert('.מספר דגם שציינת לא קיים במערכת');
    }
}
function wsfQuickBuyOnFailed(){ alert('failure'); }
//------------------------------------------------------------------------

function jsfBindLightbox()
{   
    if(null != (e = $get('divlight2')))
        {
            if(null != (h = $get('divtblsizes')))
            {
                t=getY(h);
                l=getX(h);          
                t+='px';
                l+='px';      
                e.style.top = t;
                e.style.left = l;                
                e.style.display = 'block';
            }
        }  
}
function jsfSetLightbox(htmlc)
{
    if(null != (p = $get('divPicAT')))
        {
            p.innerHTML='<img id="picat" alt="" src="' + htmlc + '" />';
        }
}
function wsfBindQuickBuyByCn(cn)
{
    wsStoreSite.BindQuickBuyByCn(cn,
        wsfBindQuickBuyByCnOnSucceeded,
        wsfBindQuickBuyByCnOnFailed);
}
function wsfBindQuickBuyByCnOnSucceeded(json)
{
    if(json != null)
    {
	    if(null != (e = $get('divQuickBuyByCN')))
	        if(null != json.sQuickBuy) {
	            e.innerHTML = json.sQuickBuy;	            
	            e.style.display = 'block';
                    jsfCalcQuickBuyOffset();} 
        if(null != (l = $get('picat'))) 
        {
            if(l.getAttribute('src')!="")   
            {                
                jsfBindLightbox();
                setTimeout("jsfBindLightbox()",100);  
            }
        }                
    }
    else
    {
        alert('.מספר דגם שציינת לא קיים במערכת');
    }
}
function wsfBindQuickBuyByCnOnFailed(){ alert('failure'); }
//------------------------------------------------------------------------
function wsfBindQuickBuyById2(id,co)
{
    jsfSetLightbox(co);
    wsStoreSite.BindQuickBuyById(id,
        wsfBindQuickBuyByIdOnSucceeded,
        wsfBindQuickBuyByIdOnFailed);
}
function wsfBindQuickBuyById(id)
{    
    if(null != (p = $get('divPicAT')))
    {
        p.innerHTML='';
    }
    wsStoreSite.BindQuickBuyById(id,
        wsfBindQuickBuyByIdOnSucceeded,
        wsfBindQuickBuyByIdOnFailed);
}
function wsfBindQuickBuyByIdOnSucceeded(json)
{
    var t=0;
    var l=0;
    if(json != null)
    {
	    if(null != (e = $get('divQuickBuyByCN')))
	        if(null != json.sQuickBuy) {
	            e.innerHTML = json.sQuickBuy;
	            e.style.display = 'block';
                    jsfCalcQuickBuyOffset();}        
        if(null != (l = $get('picat'))) 
        {
            if(l.getAttribute('src')!="")   
            {                
                jsfBindLightbox();
                setTimeout("jsfBindLightbox()",100);  
            }
        }                                    
    }
    else
    {
        alert('.מספר דגם שציינת לא קיים במערכת');
    }
}
function wsfBindQuickBuyByIdOnFailed(){ alert('failure'); }
//------------------------------------------------------------------------
function wsfUpdateShipmentHours(from, to)
{
    wsStoreSite.UpdateShipmentHours(
        from, to,
        wsfUpdateShipmentHoursOnSucceeded,
        wsfUpdateShipmentHoursOnFailed);
}
function wsfUpdateShipmentHoursOnSucceeded(json){}
function wsfUpdateShipmentHoursOnFailed(err){}
//------------------------------------------------------------------------
function wsfCatalogueToShipment(catToShip)
{
    wsStoreSite.CatalogueToShipment(
        catToShip,
        wsfCatalogueToShipmentOnSucceeded,
        wsfCatalogueToShipmentOnFailed);
}
function wsfCatalogueToShipmentOnSucceeded(json){}
function wsfCatalogueToShipmentOnFailed(err){}
//------------------------------------------------------------------------
function wsfBindSilentProductByCn(cn)
{
    wsStoreSite.BindSilentProductByCn(cn,
        wsfBindSilentProductByCnOnSucceeded,
        wsfBindSilentProductByCnOnFailed);
}
function wsfBindSilentProductByCnOnSucceeded(json)
{
    if(json != null)
    {
	    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 wsfBindSilentProductByCnOnFailed(){ alert('failure'); }
//------------------------------------------------------------------------
function wsfUpdateCoupon(coupon)
{
    wsStoreSite.UpdateCoupon(coupon,
        wsfUpdateCouponOnSucceeded,
        wsfUpdateCouponOnFailed);
}
function wsfUpdateCouponOnSucceeded(s){}
function wsfUpdateCouponOnFailed(s){}
//------------------------------------------------------------------------
function wsfBindCoupon()
{
    wsStoreSite.BindCoupon(
        wsfBindCouponOnSucceeded,
        wsfBindCouponOnFailed);
}
function wsfBindCouponOnSucceeded(json)
{
    if(json != null)
    {
	    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 != json.sMessage && json.sMessage != '')
	        alert(json.sMessage);
    }
//    else
//    {
//        alert('.מספר קופון שציינת לא קיים במערכת');
//    }
}
function wsfBindCouponOnFailed(){ alert('failure'); }
//------------------------------------------------------------------------
//------------------- region SETTING CART PROPERTY -----------------------
function wsfSetCartPropertySelect(iCartRow, idProduct, idGroup, idProperty)
{
    wsStoreSite.SetCartPropertySelect(
        iCartRow,
        idProduct,
        idGroup,
        idProperty,
        wsfSetCartPropertySelectOnSucceeded,
        wsfSetCartPropertySelectOnFailed);
}
function wsfSetCartPropertySelectOnSucceeded(json){ if(json != null) { wsfSetCartProperty(json); }}
function wsfSetCartPropertySelectOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetCartPropertyCheckBox(iCartRow, idProduct, idGroup, idProperty, isChecked)
{
    wsStoreSite.SetCartPropertyCheckBox(
        iCartRow,
        idProduct,
        idGroup,
        idProperty,
        isChecked,
        wsfSetCartPropertyCheckBoxOnSucceeded,
        wsfSetCartPropertyCheckBoxOnFailed);
}
function wsfSetCartPropertyCheckBoxOnSucceeded(json){ if(json != null) { wsfSetCartProperty(json); }}
function wsfSetCartPropertyCheckBoxOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetCartPropertyRadioButton(iCartRow, idProduct, idGroup, idProperty)
{
    wsStoreSite.SetCartPropertyRadioButton(
        iCartRow,
        idProduct,
        idGroup,
        idProperty,
        wsfSetCartPropertyRadioButtonOnSucceeded,
        wsfSetCartPropertyRadioButtonOnFailed);
}
function wsfSetCartPropertyRadioButtonOnSucceeded(json){ if(json != null) { wsfSetCartProperty(json); }}
function wsfSetCartPropertyRadioButtonOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetCartPropertyTextBox(iCartRow, idProduct, idGroup, idProperty, value)
{
    wsStoreSite.SetCartPropertyTextBox(
        iCartRow,
        idProduct,
        idGroup,
        idProperty,
        value,
        wsfSetCartPropertyTextBoxOnSucceeded,
        wsfSetCartPropertyTextBoxOnFailed);
}
function wsfSetCartPropertyTextBoxOnSucceeded(json){ if(json != null) { wsfSetCartProperty(json); }}
function wsfSetCartPropertyTextBoxOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetCartProperty(json)
{
    if((json.sSideCart != null) && (json.sFullCart!=null))
    {
	    if(null != (e = $get('divSideCart')))
	        e.innerHTML = json.sSideCart;

	    if(null != (e = $get('divFullCart')))
	        e.innerHTML = json.sFullCart;
    }
    else
    {
        var id = '@' + json.sPID + '@' + json.sCRI;

	    if(null != (e = $get('spanSideCartCN'+id)))
	        e.innerHTML = json.sCN;

	    if(null != (e = $get('spanSideCartQuantity'+id)))
	        e.innerHTML = json.sQuantity;
	        
	    if(null != (e = $get('spanSideCartPriceSite'+id)))
	        e.innerHTML = json.sPriceSiteFormatted;

	    if(null != (e = $get('spanSideCartPrice'+id)))
	        e.innerHTML = json.sPriceFormatted;
	        
	    if(null != (e = $get('spanFullCartCN'+id))) {
	        e.innerHTML = json.sCN;}

	    if(null != (e = $get('spanFullCartPriceSite'+id)))
	        e.innerHTML = json.sPriceSiteFormatted;

	    if(null != (e = $get('spanFullCartPrice'+id)))
	        e.innerHTML = json.sPriceFormatted;

	    if(null != (e = $get('divFullCartPicture'+id)))
	        e.innerHTML = json.sPicture;

        if(json.csStockLevels!=null)
        {
            for(i = 0; i < json.csStockLevels.length; i++)
            {
                id = '@' + json.csStockLevels[i].sPID + '@' + json.csStockLevels[i].sCRI;
	            if(null != (e = $get('divFullCartStockLevelStatus'+id)))
	                e.innerHTML = json.csStockLevels[i].sStockLevelStatus;
            }
        }
    }

	if(null != (e = $get('divSideCartSummation')))
	    e.innerHTML = json.sSideCartSummation;

	if(null != (e = $get('divFullCartSummation')))
	    e.innerHTML = json.sFullCartSummation;
}
//------------------- endregion SETTING CART PROPERTY --------------------
//------------------------------------------------------------------------
//------------------- region SETTING PROPERTY ----------------------------
function wsfSetPropertySelect(idProduct, idGroup, idProperty)
{
    wsStoreSite.SetPropertySelect(
        idProduct,
        idGroup,
        idProperty,
        wsfSetPropertySelectOnSucceeded,
        wsfSetPropertySelectOnFailed);
}
function wsfSetPropertySelectOnSucceeded(json)
{
	if(null != (e = $get('divSitePrice')))
	    e.innerHTML = json.sCoin + '&nbsp;' + json.sPriceSiteHiddenFormatted;

	if(null != (e = $get('divSaving')))
	    e.innerHTML = json.sCoin + '&nbsp;' + json.sSavingFormatted;

//    if(null != (e = $get('divPicture')))
//        e.innerHTML = json.sPicture;

	if(json.sStockMatrix == 'true')
	{
	    if(null != (e = $get('divCN')))
	        e.innerHTML = json.sCN;

	    if(null != (e = $get('divStockLevel')))
	        e.innerHTML = json.sStockLevelMinusQuantity;

	    if(null != (e = $get('divStockLevelStatus')))
	        e.innerHTML = json.sStockLevelStatus;
	        
	        	if(null != (e = $get('divStockLevelMinus')))
	    e.innerHTML = (json.sStockLevelMinusQuantity < 0 ) ?
	     'אנו מצטערים אולם הפריט אותו רציתם להזמין אזל ולא יהיה יותר במלאי!' : '';

    }
}
function wsfSetPropertySelectOnFailed(err){}
function wsfSetPropertySelectQB(idProduct, idGroup, idProperty)
{
    wsStoreSite.SetPropertySelectQB(
        idProduct,
        idGroup,
        idProperty,
        wsfSetPropertySelectQBOnSucceeded,
        wsfSetPropertySelectQBOnFailed);
}
function wsfSetPropertySelectQBOnSucceeded(json)
{
	if(null != (e = $get('divSitePrice')))
	    e.innerHTML = json.sCoin + '&nbsp;' + json.sPriceSiteHiddenFormatted;

	if(null != (e = $get('divSaving')))
	    e.innerHTML = json.sCoin + '&nbsp;' + json.sSavingFormatted;

//    if(null != (e = $get('divPicture')))
//        e.innerHTML = json.sPicture;

	if(json.sStockMatrix == 'true')
	{
	    if(null != (e = $get('divCN')))
	        e.innerHTML = json.sCN;

	    if(null != (e = $get('divStockLevel')))
	        e.innerHTML = json.sStockLevelMinusQuantity;

	    if(null != (e = $get('divStockLevelStatusQB')))
	        e.innerHTML = json.sStockLevelStatus;
	        
	        	if(null != (e = $get('divStockLevelMinus')))
	    e.innerHTML = (json.sStockLevelMinusQuantity < 0 ) ?
	     'אנו מצטערים אולם הפריט אותו רציתם להזמין אזל ולא יהיה יותר במלאי!' : '';

    }
}
function wsfSetPropertySelectQBOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetPropertyCheckBox(idProduct, idGroup, idProperty, isChecked)
{
    wsStoreSite.SetPropertyCheckBox(
        idProduct,
        idGroup,
        idProperty,
        isChecked,
        wsfSetPropertyCheckBoxOnSucceeded,
        wsfSetPropertyCheckBoxOnFailed);
}
function wsfSetPropertyCheckBoxOnSucceeded(json)
{
	if(null != (e = $get('divSitePrice')))
	    e.innerHTML = json.sPriceSiteFormatted + json.sCoin;

	if(null != (e = $get('divSaving')))
	    e.innerHTML = json.sSavingFormatted + json.sCoin;
}
function wsfSetPropertyCheckBoxOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetPropertyRadioButton(idProduct, idGroup, idProperty)
{
    wsStoreSite.SetPropertyRadioButton(
        idProduct,
        idGroup,
        idProperty,
        wsfSetPropertyRadioButtonOnSucceeded,
        wsfSetPropertyRadioButtonOnFailed);
}
function wsfSetPropertyRadioButtonOnSucceeded(json)
{
	if(null != (e = $get('divSitePrice')))
	    e.innerHTML = json.sPriceSiteFormatted + json.sCoin;

	if(null != (e = $get('divSaving')))
	    e.innerHTML = json.sSavingFormatted + json.sCoin;
}
function wsfSetPropertyRadioButtonOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateStandardsAcceptance(accepted)
{
    wsStoreSite.UpdateStandardsAcceptance(
        accepted,
        wsfUpdateStandardsAcceptanceOnSucceeded,
        wsfUpdateStandardsAcceptanceOnFailed);
}
function wsfUpdateStandardsAcceptanceOnSucceeded(json){}
function wsfUpdateStandardsAcceptanceOnFailed(err){}
//------------------------------------------------------------------------
function wsfSetPropertyTextBox(idProduct, idGroup, idProperty, value)
{
    wsStoreSite.SetPropertyTextBox(
        idProduct,
        idGroup,
        idProperty,
        value,
        wsfSetPropertyTextBoxOnSucceeded,
        wsfSetPropertyTextBoxOnFailed);
}
function wsfSetPropertyTextBoxOnSucceeded(json){}
function wsfSetPropertyTextBoxOnFailed(err){}
//------------------- endregion SETTING PROPERTY -------------------------
//------------------------------------------------------------------------
function wsfSetProductQuantity(quantity)
{
    wsStoreSite.SetProductQuantity(
        quantity,
        wsfSetProductQuantityOnSucceeded,
        wsfSetProductQuantityOnFailed);
}
function wsfSetProductQuantityOnSucceeded(json)
{
	if(null != (e = $get('divStockLevel')))
	    e.innerHTML = (json.sStockLevelMinusQuantity < 0 ) ?
	        '0' : json.sStockLevelMinusQuantity;
    

	if(null != (e = $get('divStockLevelStatus')))
	    e.innerHTML = json.sStockLevelStatus;
}
function wsfSetProductQuantityOnFailed(err){}
//------------------------------------------------------------------------
function wsfDeleteCartProduct(idProduct, idCartRowIndex)
{
    wsStoreSite.DeleteCartProduct(
        idProduct,
        idCartRowIndex,
        wsfDeleteCartProductOnSucceeded,
        wsfDeleteCartProductOnFailed);
}
function wsfDeleteCartProductOnSucceeded(json)
{
	if(null != (e = $get('divSideCart')))
	    e.innerHTML = json.sSideCart;

	if(null != (e = $get('divSideCartSummation')))
	    e.innerHTML = json.sSideCartSummation;

	if(null != (e = $get('divFullCart')))
	    e.innerHTML = json.sFullCart;

	if(null != (e = $get('divFullCartSummation')))
	    e.innerHTML = json.sFullCartSummation;

	if(null != (e = $get('divFullCartQuantity')))
	    e.innerHTML = json.sFullCartQuantity;

	if(null != (e = $get('divOrderCart')))
	    e.innerHTML = json.sOrderCart;

	if(null != (e = $get('divOrderCartSummation')))
	    e.innerHTML = json.sOrderCartSummation;

	if(null != (e = $get('divCreditCardPayments')))
	    e.innerHTML = json.sCreditCardPayments;
}
function wsfDeleteCartProductOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateCartProductQuantity(idProduct, idCartRowIndex, quantity)
{
    wsStoreSite.UpdateCartProductQuantity(
        idProduct,
        idCartRowIndex,
        quantity,
        wsfUpdateCartProductQuantityOnSucceeded,
        wsfUpdateCartProductQuantityOnFailed);
}
function wsfUpdateCartProductQuantityOnSucceeded(json)
{
    var id = '@' + json.sPID + '@' + json.sCRI;

	if(null != (e = $get('spanSideCartQuantity'+id)))
	    e.innerHTML = json.sQuantity;
	    
	if(null != (e = $get('spanFullCartPoints'+id)))
	    e.innerHTML = json.sPoints;
	    
	if(null != (e = $get('spanSideCartPrice'+id)))
	    e.innerHTML = json.sPriceFormatted;

	if(null != (e = $get('divSideCartSummation')))
	    e.innerHTML = json.sSideCartSummation;

	if(null != (e = $get('spanFullCartPrice'+id)))
	    e.innerHTML = json.sPriceFormatted;

	if(null != (e = $get('divFullCartSummation')))
	    e.innerHTML = json.sFullCartSummation;

	if(null != (e = $get('divFullCartQuantity')))
	    e.innerHTML = json.sFullCartQuantity;

	if(null != (e = $get('spanFullCartCouponDiscount')))
	    e.innerHTML = json.sFullCartCouponDiscount;

    for(i = 0; i < json.csStockLevels.length; i++)
    {
        id = '@' + json.csStockLevels[i].sPID + '@' + json.csStockLevels[i].sCRI;
	    if(null != (e = $get('divFullCartStockLevelStatus'+id)))
	        e.innerHTML = json.csStockLevels[i].sStockLevelStatus;
    }
}
function wsfUpdateCartProductQuantityOnFailed(err){}
//------------------------------------------------------------------------
function wsfDeleteHistoryProduct(idProductToDelete, idProductException)
{
    wsStoreSite.DeleteHistoryProduct(
        idProductToDelete,
        idProductException,
        wsfDeleteHistoryProductOnSucceeded,
        wsfDeleteHistoryProductOnFailed);
}
function wsfDeleteHistoryProductOnSucceeded(json)
{
	if(null != (e = $get('divHistory')))
	    e.innerHTML = json.sHistory;
}
function wsfDeleteHistoryProductOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateOrderComment(idComment, comment)
{
    wsStoreSite.UpdateOrderComment(
        idComment,
        comment,
        wsfUpdateOrderCommentOnSucceeded,
        wsfUpdateOrderCommentOnFailed);
}
function wsfUpdateOrderCommentOnSucceeded(json){}
function wsfUpdateOrderCommentOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateCustomerDetails(o)
{
    wsStoreSite.UpdateCustomerDetails(o,
        wsfUpdateCustomerDetailsOnSucceeded,
        wsfUpdateCustomerDetailsOnFailed);
}
function wsfUpdateCustomerDetailsOnSucceeded(json){}
function wsfUpdateCustomerDetailsOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateShipmentAddress(o)
{
    wsStoreSite.UpdateShipmentAddress(o,
        wsfUpdateShipmentAddressOnSucceeded,
        wsfUpdateShipmentAddressOnFailed);
}
function wsfUpdateShipmentAddressOnSucceeded(res){}
function wsfUpdateShipmentAddressOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateShipmentDetails(idShipment)
{
    wsStoreSite.UpdateShipmentDetails(idShipment,
        wsfUpdateShipmentDetailsOnSucceeded,
        wsfUpdateShipmentDetailsOnFailed);
}
function wsfUpdateShipmentDetailsOnSucceeded(res){}
function wsfUpdateShipmentDetailsOnFailed(err){}
//------------------------------------------------------------------------
function wsfUpdateCreditCardDetails(o)
{
    wsStoreSite.UpdateCreditCardDetails(o,
        wsfUpdateCreditCardDetailsOnSucceeded,
        wsfUpdateCreditCardDetailsOnFailed);
}
function wsfUpdateCreditCardDetailsOnSucceeded(res){}
function wsfUpdateCreditCardDetailsOnFailed(err){alert('failure');}
//------------------------------------------------------------------------
function wsfUpdatePurchaseDetails(idPurchase)
{
    wsStoreSite.UpdatePurchaseDetails(
        idPurchase,
        wsfUpdatePurchaseDetailsOnSucceeded,
        wsfUpdatePurchaseDetailsOnFailed);
}
function wsfUpdatePurchaseDetailsOnSucceeded(res){}
function wsfUpdatePurchaseDetailsOnFailed(err){}
//------------------------------------------------------------------------
function wsfSignIn(o)
{           

    wsStoreSite.SignIn(o,
        wsfSignInOnSucceeded,
        wsfSignInOnFailed);
}
function wsfSignInOnSucceeded(json)
{
    if(json.sID != '0')
    {
        $get('m_cphBody_ucPurchaseStep1_txtCustomerFirstName').value = json.sFirstName;
        $get('m_cphBody_ucPurchaseStep1_txtCustomerLastName').value = json.sLastName;
        $get('m_cphBody_ucPurchaseStep1_txtCustomerSchoolName').value = json.sSchoolName;
        $get('m_cphBody_ucPurchaseStep1_txtCustomerStreet').value = json.sStreet;
        $get('m_cphBody_ucPurchaseStep1_txtCustomerHome').value = json.sHome;
        $get('m_cphBody_ucPurchaseStep1_txtCustomerCity').value = json.sCity;
            wsfSelect('m_cphBody_ucPurchaseStep1_ddlCustomerCountry', json.sCountryID);
        $get('m_cphBody_ucPurchaseStep1_txtCustomerZIP').value = json.sZIP;
        $get('m_cphBody_ucPurchaseStep1_txtCustomerPhone').value = json.sPhone;
        $get('m_cphBody_ucPurchaseStep1_txtCustomerCellular').value = json.sCellular;
        $get('m_cphBody_ucPurchaseStep1_txtCustomerFax').value = json.sFax;
            wsfSelect('m_cphBody_ucPurchaseStep1_ddlCustomerBirthdayMonth', json.sBirthday.split('.')[0]);
            wsfSelect('m_cphBody_ucPurchaseStep1_ddlCustomerBirthdayDay', json.sBirthday.split('.')[1]);
            wsfSelect('m_cphBody_ucPurchaseStep1_ddlCustomerBirthdayYear', json.sBirthday.split('.')[2]);
            wsfSelect('m_cphBody_ucPurchaseStep1_ddlCustomerType', json.sCustomerTypeID);
        $get('m_cphBody_ucPurchaseStep1_txtCustomerEmail').value = 
            $get('m_cphBody_ucPurchaseStep1_txtCustomerEmailHidden').value = json.sEmail;
        
        if ('<%=Session["emailConfirmed"].ToString();%>'==true)
        {
            $get('m_cphBody_ucPurchaseStep1_txtCustomerEmailValidate').value = json.sEmail;
        }
        $get('m_cphBody_ucPurchaseStep1_txtCustomerPassword').value = json.sPassword;
            $get('m_cphBody_ucPurchaseStep1_txtCustomerPasswordHidden').value = json.sPassword;
        
        $get('m_cphBody_ucPurchaseStep1_txtCustomerCompany').value = json.sCompany;
           
        $get('m_cphBody_ucPurchaseStep1_txtCustomerComments').value = json.sComments;

//        $get('m_cphBody_ucPurchaseStep1_txtShipmentFirstName').value = json.sFirstName;
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentLastName').value = json.sLastName;
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentCompany').value = json.sCompany;
//            wsfSelect('m_cphBody_ucPurchaseStep1_ddlShipmentCountry', json.sCountryID);
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentCity').value = json.sCity;
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentStreet').value = json.sStreet;
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentHome').value = json.sHome;
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentZIP').value = json.sZIP;
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentPhone').value = json.sPhone;
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentCellular').value = json.sCellular;
//        $get('m_cphBody_ucPurchaseStep1_txtShipmentFax').value = json.sFax;
        
        $get('divUserDoesNotExist').style.display = 'none';
    }
    else $get('divUserDoesNotExist').style.display = '';

    $get('m_cphBody_ucPurchaseStep1_txtSignInEmail').value = '';
    $get('m_cphBody_ucPurchaseStep1_txtSignInPassword').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 wsfSelect2(id,value)
{
    if(null != (e = $get(id))) {
        for(i=0;i<e.length;i++) {
            if(e.options[i].text == value) {
                e.selectedIndex = i; break; }}}
}//------------------------------------------------------------------------
function wsfInfiniteSession()
{
    wsStoreSite.InfiniteSession(
        wsfInfiniteSessionOnSucceeded,
        wsfInfiniteSessionOnFailed);
}
function wsfInfiniteSessionOnSucceeded(s){/*alert('infinite');*/}
function wsfInfiniteSessionOnFailed(s){/*alert('failure');*/}
//------------------------------------------------------------------------
//------------------------------------------------------------------------
//------------------------------------------------------------------------
