﻿//Indici basket d=[]
//var bsk_id=0;var bsk_descr=1;
//var bsk_code=2;var bsk_prz=3;var bsk_discountedprz=4;var bsk_percdisc=5;var bsk_exchange=6;var bsk_vat=7;
//var bsk_qta=8;var bsk_size=9;var bsk_color=10;var bsk_img=11;var des_descr=12;
//var bsk_preorder=13;var bsk_qtdisp=14;
//var bsk_sizeId=15;var bsk_colorId=16;var bsk_preorddate=17;
//var bsk_maxqty=18;var bsk_preordqty=19;var bsk_splitted=20;
//var bsk_season=21;var bsk_paid=22;var bsk_sizenaz=23;
//var bsk_seasonmemocode=24;var bsk_desimg=25;var bsk_gender=26;var bsk_riga=27;var bsk_VendorColor=28;
//var bsk_prodCurrencyID=29;var bsk_extrasc=30;var bsk_przpromo=31;
//// 17/07/2009 [FP] - Further Reduction
//var bsk_notepromo=32;var bsk_flgAddExtraSc=33;
//// 13/11/2009 [FP] - Gift Card
//var bsk_giftcard=34; var bsk_notaRiga=35;
//// 20/11/2009 [FP] - Nota Riga 2
//var bsk_notaRiga2=36;

//var bsk_id=0,bsk_season=1,bsk_sizeId=2,bsk_colorId=3,bsk_preorder=4,bsk_qta=5, bsk_qtdisp=6;

//var bsk_descr=7,bsk_code=8;
//var bsk_prz=9,bsk_discountedprz=10,bsk_percdisc=11,bsk_exchange=12,bsk_vat=13;
//var bsk_size=14,bsk_color=15,bsk_img=16,des_descr=17;
//var bsk_preorddate=18,bsk_maxqty=19,bsk_preordqty=20,bsk_splitted=21;
//var bsk_sizenaz=22,bsk_seasonmemocode=23,bsk_desimg=24,bsk_gender=25,bsk_riga=26,bsk_VendorColor=27;
//var bsk_prodCurrencyID=28,bsk_extrasc=29,bsk_przpromo=30;
//// 17/07/2009 [FP] - Further Reduction
//var bsk_notepromo=31,bsk_flgAddExtraSc=32;
//// 13/11/2009 [FP] - Gift Card
//var bsk_giftcard=33,bsk_notaRiga=34;
//// 20/11/2009 [FP] - Nota Riga 2
//var bsk_notaRiga2=35;

//Indici PrCode
//var prm_code=0;var prm_tipo=1;var prm_scval=2;var prm_scperc=3;var prm_userok=4; // var prm_target=4;var prm_userok=5; var prm_listaID=6; 22/03/2010 [FP]
// 06/07/2009 [FP] - Promozione 'RS1'
//var prm_currency=5;
// 22/03/2010 [FP] - non utilizzo più i dati lato client
// 03/11/2009 [FP] - tabella promotipo
//var prm_oneshot=8; var prm_noPAB=9;
var TIPO_PROMO_RESI = "RS1";
//indici currency e country su _base
//var pay_code=0; var pay_account=1; var pay_dettagli = 2; 
// 06/08/2009 [FP] - Dollaro con PayPal
//var pay_currency=3;
//var paydt_id=0; var paydt_type=1; var paydt_img=2;
// 06/08/2009 [FP] - Dollaro con PayPal
//var paycur_id=0; var paycur_sedeLVR=1;
//var COUNTRY_NOT_DEFINED = "XX";
// Indici state
//var state_cty=0;var statedett_id=0;var statedett_name=1; - spostato in basket_base

// 02/09/2009 [FP] - New Sessione per forzare in caso di scadenza della sessione lo scarico dei dati utente
//var newSessCurrAndShip = false;

//Indici userinfos (confirmUserInfo) - spostati in basket_base
////NB: SE VIENE AGGIORNATO MODIFICARE enum eUserInfo di DataUtil
//var sa_fn=0;var sa_ln=1;var sa_em=2;var sa_ph=3;var sa_sa=4;var sa_zc=5;var sa_cy=6;var sa_ctr=7;var sa_state=20;var sa_3digitcode=22;
//var ba_fn=8;var ba_ln=9;var ba_em=10;var ba_ph=11;var ba_sa=12;var ba_zc=13;var ba_cy=14;var ba_ctr=15;var ba_codfisc=16;var ba_state=21;var ba_3digitcode=23;
//var info_em=17;var info_fn=18;var info_ln=19;
//var info_max=24;//NB:AGGIORNARE AD OGNI AGGIUNTA

//Indici Indirizzi dShipping e dBilling
//var addr_ph = 0; var addr_sa = 1; var addr_zc = 2; var addr_cy = 3; var addr_ctr = 4; var addr_vatt = 5;
//var addr_fn = 7; var addr_ln = 8; var addr_state = 11;

//Indici vetrine
var vetr_id=0; var vetr_auto=1; var vetr_resource=2;var vetr_coordsarr=3;var vetr_vetrinaid=4;var vetr_flashvars=5;//[BV] 08/03/2010
var vetrauto_designer=3;var vetrauto_artcode=4;var vetrauto_artseason=6;
var vetrarea_coords=0;var vetrarea_artcode=1; var vetrarea_designer=2;
var vetrarea_description=3;var vetrarea_artseason=4
var vetrlnk_vetrinaid=0;var vetrlnk_url=1;var vetrlnk_coords=2;var vetrlnk_tooltip=3;
//[BV] 09/03/2010 look vetrine
var vetrLook=[];
var vlook_id=0;vlook_tag=1;vlook_res=2;vlook_link=3,vlook_ttip=4;vlook_items=5;
var vlook_itm_season=0;vlook_itm_coll=1;vlook_itm_id=2;vlook_itm_img=3;vlook_itm_prz=4;vlook_itm_disc=5;vlook_itm_exch=6;vlook_itm_vat=7;vlook_itm_curr=8;vlook_itm_designer=9;vlook_itm_przdisc=10;

//var myBag= new Array();

var dLineDisp= new Array();
var isStyleDisp = true;
//var isNewArrivalsDisp = false;

// Immagini da caricare dinamicamente
var g_aContextLoader = [];
// Mapping-area prodotto
var g_aProductArea = [];
// Link al prodotto se disponibile
var g_aProductLink = [];

//Path immagini
var action_bnt_imgpath = "immagini/action_buttons/";

//[BV] IP ADDRESS UTENTE: usato per stabilire il server imgf da usare
var ipAddress="0";

//[BV] 23/07/2009 - MYRETURNS
var MYAREA_TYPE_ORDER="O";//[BV] 17/12/2009
var MYAREA_TYPE_RETURN="R";//[BV] 17/12/2009
var MYAREA_TYPE_MEX="X";//[BV] 22/12/2009

//[BV] 08/08/2009 - layer con elenco lingue disponibili (footer) 
var LANG_IMG_HEIGHT = 14;
var LANG_IMG_WIDTH = 78;

//[BV] 26/08/2009 
var LOGO_LUISA ="luisaviaroma2.gif";
//[BV] 01/09/2009 
var arr_image_language=new Array();
var arr_image_act_language=new Array();
var arr_image_on_language=new Array();


var regOk=false;//[BV] 02/09/2009 - reso necessario dopo spostamento eval

//[BV] 24/09/2009 back su lista prodotti
var timeViewedListaProd=0;
var previousHash="";
var lastScrollTop = 0;

// 15/10/2009 [FP] - LastNewsletter
var lastNewsLetter = "";
var imgNewsLetter = "";
var widthNewsLetter = "";

//[BV] 02/03/2010
var curIdArtVetr="";

var LOG_PAGE_DESIGNER = "designer";
var LOG_PAGE_ADDTOSHOPPINGBAG = "add_to_shopping_bag";
var LOG_PAGE_SHOPPINGBAGEMPTY = "shopping_bag_empty";
var LOG_PAGE_NEWSLETTER = "newsletter";
var LOG_PAGE_USERMSG = "user_msg"; // 18/12/2009 [FP]
var LOG_PAGE_HAITI = "haiti";//HAITI

var LOG_ACTION_SELGENDER = "sel_gender";
var LOG_ACTION_SELSEASON = "sel_season";
var LOG_ACTION_SELGROUP = "sel_group";
var LOG_ACTION_NEWARRIVALS = "new_arrivals";
var LOG_ACTION_SEARCH = "search";
var LOG_ACTION_AFFILIATE = "affiliate";
var LOG_ACTION_LISTPROD = "list_of_prod";
var LOG_ACTION_LIMITED_ED = "limited_edition";
var LOG_ACTION_SELDESIGNER = "sel_designer";
var LOG_ACTION_SCROLLTOP = "scroll_top";
var LOG_ACTION_SELPAGE = "select_page";
var LOG_ACTION_TOTAL_LOOK = "total_look";

var LOG_ACTION_MODADDRESS = "modify_addresses";
var LOG_ACTION_ADDRESS = "addresses";
var LOG_ACTION_PRINT = "print";
var LOG_ACTION_MOREINFO = "more_info";
var LOG_ACTION_SIZECHART = "size_chart";
var LOG_ACTION_COMPCHART = "composition_chart";
var LOG_ACTION_NEWWINDOW = "new_window";    // 15/10/2009 [FP]
var LOG_ACTION_READMSG = "read_msg";    // 18/12/2009 [FP]

var UNIQUE_CODE="04|1"; //[BV] 27/10/2009

var img_newcollections_name="";var img_sale_name="";

var ONLOADING_LEFT=450;

// spostato getServerImgf in common_base

function viewShipFee(fromBasket)
{
    var obj;
    // 07/10/2009 [FP] - add2Log
    // 29/07/2010 [FP] – ContactUs Shipping (Russia)
    //var mySection = "freeship";
    var mySection = "shipment";
    add2LogContactUs((fromBasket ? LOG_PAGE_SHOPPINGBAG : LOG_PAGE_PRODUCT), mySection);
    /*
    var url = document.getElementById("httpSiteUrl").value + myURL_CONTACTUS() + "?section="+mySection;
    window.open(url, obj,'scrollbars=yes,width=775,height=680');
    if (window.event)
        window.event.returnValue=false;
    */
    viewNewContactUs(mySection);
}
//[BV] 30/06/2009 - Link sulle vetrine danno bad request con IE
function openVetrineLink(url)
{
    self.location =url;
       
    if (is_ie) //[BV] 18/12/2009 ennessimo mal funzionamento su ie
    {
        setTimeout('self.location.reload();',1000);
    }
    if (window.event)   
        window.event.returnValue=false;
}

//Ritorno alla vetrina su base ultima selezione utente da MyArea
function continueShopFromMyArea(fromRegister, fromBasket, fromAccount)
{
    // 07/10/2009 [FP] - add2Log
    var myPage = "";
    if (fromRegister && registerAccount)
        myPage = LOG_PAGE_REGISTER;
    else if (fromAccount || fromRegister)
        myPage = LOG_PAGE_MYAREA;
    else if (fromBasket !== undefined)
    {
        if (fromBasket == "basket_empty")
            myPage = LOG_PAGE_SHOPPINGBAGEMPTY;
        else if (fromBasket == "basket")
            myPage = LOG_PAGE_SHOPPINGBAG;
    }
    if (myPage != "")
        add2Log(myPage, LOG_ACTION_CONTINUESHOPPING);
    self.location =document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season="+document.getElementById("qry_season").value+"&gender="+document.getElementById("qry_gender").value+"&group=";
    if (window.event)   window.event.returnValue=false;
}

//Ritorno alla vetrina di default da pagine diverse da index.aspx
function continueShopping()
{
    self.location =document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season=actual&gender=women&group=";
    if (window.event)
        window.event.returnValue=false;
}

function ShowSubscriveNews(fromHyst)
{
    newsletter=true;
    if (!fromHyst)
    {
        var url ="getData.aspx|CallType=Vetrine&season="+curSeason+"&gender="+curGender+"&newsletter=1";
        makeHistory(url);
    }
    GetLastNewsLetter();
}

//function ResponseNewsLetter(responseText) [BV] 09/02/2010 spostato in newsletter.js
//function AutoImageResizing(obj, fixedSize)  [BV] 09/02/2010 spostato in newsletter.js
//function subscribeNewsLetter() [BV] 09/02/2010 spostato in vetrine8.js

// Visualizza No Boring Contributions
function showContributions(fromHyst)
{
    contributions = true;
    // 26/03/2009 [FP] - resetAll(fromHyst, 1=noResetLine, 2=noResetDesigner, 3=noResetMenuViewedItems, 4=noResetMenuSearch, 5=noResetNewArrivals, 6=noResetListaID, 7=noResetAddThisUrl, 8=noResetStyle, 9=noResetDiv)
    resetAll(fromHyst, false, false, false, false, false, false, false, false, false);

    DisplayDivBlock("pnlContributions");
    var el = document.getElementById("img_contributions");
    el.src="immagini/contributions/"+document.getElementById("txtLangDir").value+"no_boring_contributions.gif";
    if (!fromHyst)
    {
        var url ="getData.aspx|CallType=Vetrine&season="+curSeason+"&gender="+curGender+"&contributions=1";
        makeHistory(url);
    }
    contributions = false;
}

// Visualizza Affiliate Program
function showAffiliate(fromHyst)
{
    affiliate = true;
    // 26/03/2009 [FP] - resetAll(fromHyst, 1=noResetLine, 2=noResetDesigner, 3=noResetMenuViewedItems, 4=noResetMenuSearch, 5=noResetNewArrivals, 6=noResetListaID, 7=noResetAddThisUrl, 8=noResetStyle, 9=noResetDiv)
    resetAll(fromHyst, false, false, false, false, false, false, false, false, false);

    DisplayDivBlock("pnlAffiliate");
    var el = document.getElementById("img_affiliate");
    el.src="immagini/promo/affiliate_program/"+document.getElementById("txtLangDir").value+"affiliate_program.jpg";
    if (!fromHyst)
    {
        var url ="getData.aspx|CallType=Vetrine&season="+curSeason+"&gender="+curGender+"&affiliate=1";
        makeHistory(url);
    }
    affiliate = false;
}

// Aggiunge immagine da caricare dinamicamente
// img: id immagine
// src: file immagine
function addContextLoader(img, src)
{
    g_aContextLoader[g_aContextLoader.length] = {};
    g_aContextLoader[g_aContextLoader.length-1].img = img;
    g_aContextLoader[g_aContextLoader.length-1].src = src;
}

// Aggiunge mapping-area prodotto
// map: id mappa
// item: codice prodotto
// coords: coordinate area
function addProductArea(map, item, coords)
{
    g_aProductArea[g_aProductArea.length] = {};
    g_aProductArea[g_aProductArea.length-1].map = map;
    g_aProductArea[g_aProductArea.length-1].item = item;
    g_aProductArea[g_aProductArea.length-1].coords = coords;
}

// Visualizza file html template
function showHuntSale()
{
	huntsale = true;
    // 26/03/2009 [FP] - resetAll(fromHyst, 1=noResetLine, 2=noResetDesigner, 3=noResetMenuViewedItems, 4=noResetMenuSearch, 5=noResetNewArrivals, 6=noResetListaID, 7=noResetAddThisUrl, 8=noResetStyle, 9=noResetDiv)
    resetAll(fromHyst, false, false, false, false, false, false, false, false, false);

    DisplayOnLoading(1);
    var i;
    var items = "";
    for (i = 0; i < g_aProductArea.length; i++)
    {
        if (items != "")
            items += ".";
        items += g_aProductArea[i].item;
    }
    var url="getData.aspx|CallType=productLink&ItemCodes="+items;
    makeRequest(url, "productLink");
}

// Risposta server richiesta dati visualizzazione file html template
function productLink(responseText)
{
    DisplayOnLoading(0);
    var i;
    var obj;
    for (i = 0; i < g_aContextLoader.length; i++)
    {
        obj = document.getElementById(g_aContextLoader[i].img);
        obj.src = g_aContextLoader[i].src;
    }
    var map;
    for (i = 0; i < g_aProductArea.length; i++)
    {
        if (g_aProductLink[i] != "")
        {
            obj = document.createElement("area");
            obj.setAttribute("shape", "poly");
            obj.setAttribute("coords", g_aProductArea[i].coords);
            obj.setAttribute("alt", "");
            obj.setAttribute("href", g_aProductLink[i]);
            map = document.getElementById(g_aProductArea[i].map);
            map.appendChild(obj);
        }
    }
    DisplayDivBlock("pnlHuntSale");
    var el = document.getElementById("img_huntsale");
    el.src="immagini/promo/lanvin/lanvin_26_02_09.jpg";
    setScrollTop(0);
    huntsale = false;
}

//[BV] 16/09/2009 - Errore su style.com: per tamponare link a designers non venduti in USA
//function LoadHomePage()
//{
//    var url;
//    
//    url=document.getElementById("httpSiteUrl").value+"home.aspx";
//    self.location =url;
//    
//    if (window.event)
//        window.event.returnValue=false;
//}

function LoadHomeFromMyBag(seas, gender, sale)
{
    var url;
    if (sale)
    {
        if (seas=="actual")
            url=document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Sales&gender="+gender;
        else
            url=document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season=actual&gender="+gender;
    }
    else
        url=document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season="+seas+"&gender="+gender+"&group=";
    self.location =url;
    
    if (window.event)
        window.event.returnValue=false;
}

function FormatItemCode(seasonId, itemCode)
{
    return seasonId + "-" + itemCode;
}

// 18/09/2009 [FP] - View Price
/* 03/06/2010 [FP] - usa common_price
function getViewPrice(objViewPrice, viewFattCurrency)
{
    var itmPrz = getPrice2(objViewPrice.itemCurrency, objViewPrice.itemPrz);
    var itmSconto = 0;
    if (objViewPrice.itemSconto !== undefined) // è corretta la sintassi !== (con due uguali)
        itmSconto = objViewPrice.itemSconto;
    var itmPrzScontato = itmPrz;
    if (objViewPrice.itemPrzScontato !== undefined) // è corretta la sintassi !== (con due uguali)
        itmPrzScontato = getPrice2(objViewPrice.itemCurrency, objViewPrice.itemPrzScontato);
    var itmExtraSconto = 0;
    if (objViewPrice.itemExtraSconto !== undefined) // è corretta la sintassi !== (con due uguali)
        itmExtraSconto = objViewPrice.itemExtraSconto;
    var itmPrzFinale = itmPrzScontato;
    if (objViewPrice.itemPrzFinale !== undefined) // è corretta la sintassi !== (con due uguali)
        itmPrzFinale = getPrice2(objViewPrice.itemCurrency, objViewPrice.itemPrzFinale);
        
    var viewCurrency = fattCurrency;
    var viewCurrDec = fattCurrDec;
    var viewCurrSepMigl = fattCurrSepMigl;
    if (!viewFattCurrency && shipCurrID!=fattCurrID)   
    {
        // Devo convertire ricalcolando i prezzi dall'ultimo prezzo
        if (objViewPrice.itemToolTip !== undefined)
        {
            var txtTT;
		    txtTT=STR_PRICE_TOOLTIP;
		    txtTT+=fattCurrDescr + " "+ FormatPrz(itmPrzFinale,fattCurrDec, fattCurrSepMigl);
            txtTT+="<br/>(1 "+fattCurrDescr+" = "+shipCurrExchange+" "+shipCurrDescr+")";
            objViewPrice.itemToolTip=txtTT;
        }
        itmPrzFinale = roundTo(itmPrzFinale*shipCurrExchange,shipCurrRnd);
        if (itmExtraSconto != 0)
            itmPrzScontato = roundTo(((itmPrzFinale * 100) / (100 - itmExtraSconto)), shipCurrRnd);
        else
            itmPrzScontato = itmPrzFinale;
        if (itmSconto != 0)
            itmPrz = roundTo(((itmPrzScontato * 100) / (100 - itmSconto)), shipCurrRnd);
        else
            itmPrz = itmPrzFinale;
        viewCurrency = shipCurrency;
        viewCurrDec = shipCurrDec;
        viewCurrSepMigl = shipCurrSepMigl;
    }
    if (objViewPrice.itemViewPrz !== undefined) 
        objViewPrice.itemViewPrz = viewCurrency + " " + FormatPrz(itmPrz,viewCurrDec, viewCurrSepMigl);
    if (itmSconto != 0 && objViewPrice.itemViewPrzScontato !== undefined)
        objViewPrice.itemViewPrzScontato = viewCurrency + " " + FormatPrz(itmPrzScontato,viewCurrDec, viewCurrSepMigl);
    if (itmExtraSconto != 0 && objViewPrice.itemViewPrzFinale !== undefined)
        objViewPrice.itemViewPrzFinale = viewCurrency + " " + FormatPrz(itmPrzFinale,viewCurrDec, viewCurrSepMigl);
}
*/
function getPrice(itemCurrency,itemPrice,itemExchange)
{
    // 12/05/2009 [FP] - Attenzione se viene cambiato il modo di calcolare il prezzo
    // è necessario intervenire anche lato Server su gestCart.CreateOrder
    var prz=0;
    itemPrice=""+itemPrice;
    itemExchange=""+itemExchange;
	if (itemCurrency == fattCurrID || (shipCurrID != FATT_DEFAULT_CURRENCY && itemCurrency != shipCurrID))
        prz = roundTo(itemPrice.replace(",","."),fattCurrDec);
    else
        prz = roundTo(itemPrice.replace(",",".")/itemExchange.replace(",","."),fattCurrDec);
    
    return prz;
}

// 06/07/2009 [FP] - Promozione 'RS1'
/* 03/06/2010 [FP] - usa common_price 
function getPrice2(itemCurrency, itemPrice)
{
    var prz = 0;
    if (itemCurrency != fattCurrID)
    {
        if (itemCurrency == FATT_DEFAULT_CURRENCY) // "EUR"
            prz = itemPrice * fattCurrExchange;
        else
            prz = itemPrice / fattDefaultExchange;
    }
    else
        prz = itemPrice;
    prz = roundTo(prz, fattCurrDec)
    return prz;
    
}
*/
function showPlCurrency(itemCurrency,itemPrice,itemExchange,currPrz,NoVatMex)
{
    var txt="";
    if (!NoVatMex)
        txt=getVatMex(itemCurrency,itemPrice,itemExchange);
	if (currPrz!="")
	{
	    if (!NoVatMex)
		    txt+="<br/>";
		txt+=currPrz;
	}
    
//    var html='<span id=\"tt_designer\">'+txt+'</span><br/>';
//    Tip(html, LEFT, true, BGCOLOR, 'white', FADEIN, 400,OFFSETX,0,OFFSETY,13);
    showToolTip(txt,0,13);
}

function showToolTip(msg, offsetX, offsetY)
{
    var html='<span id=\"tt_designer\">'+msg+'</span><br/>';
    Tip(html, LEFT, true, BGCOLOR, 'white', FADEIN, 400,OFFSETX,offsetX,OFFSETY,offsetY);

}

function getVatMex(itemCurrency,itemPrice,itemExchange)
{
	if (shipFlgDazi != "0")
	{
        if (shipCountrSpedCost==0)
            return TXT_IMPORT_FEE.replace("@SHIPPING@",TXT_SHIPPING);
        else
            return TXT_IMPORT_FEE.replace("@SHIPPING@","");
    }
    else
    {
        if (shipCountrVatt=="True")
            return TXT_VAT_YES;
        else
            return TXT_VAT_NO;
    }
}
//function cfgPaymentMethods(payCode, el, biCty, shCty, currency) [BV] 09/02/2010 spostato in payments.js
//function chkCurrencyActive(currency, shCty) [BV] 09/02/2010 spostato in payments.js
//function chkPayActive(payCode, biCty, shCty, currency, noChkEURO) [BV] 09/02/2010 spostato in payments.js
//function displayCardPayments(bview) [BV] 09/02/2010 spostato in payments.js

function setNoScriptLink()
{
    //[BV] 06/04/2009 - i link href sono INUTILI ne caso di una navigazione con javascript attivo!!!
    var obj = document.getElementById("a_men");
    obj.setAttribute("href", "javascript:;");
    obj = document.getElementById("a_women");
    obj.setAttribute("href", "javascript:;");
    // 31/07/2009 [FP] - New Collection in header
    obj = document.getElementById("a_new_collections");
    obj.setAttribute("href", "javascript:;");
    obj = document.getElementById("a_sale");
    obj.setAttribute("href", "javascript:;");
	obj = document.getElementById("a_clothing");
	if (obj) obj.setAttribute("href", "javascript:;");
	obj = document.getElementById("a_bags");
	if (obj) obj.setAttribute("href", "javascript:;");
	obj = document.getElementById("a_shoes");
	if (obj) obj.setAttribute("href", "javascript:;");
	obj = document.getElementById("a_accessories");
	if (obj) obj.setAttribute("href", "javascript:;");
	// 30/07/2009 [FP] - Jewellery
	obj = document.getElementById("a_jewellery");
	if (obj) obj.setAttribute("href", "javascript:;");
	obj = document.getElementById("a_designers");
	if (obj) obj.setAttribute("href", "javascript:;");
}

function initHomeImgHeader(myImgPath,suffLang,pubImgHeader)
{
    el = document.getElementById("img_men");
    el.setAttribute("alt", "");
    el.setAttribute("title", "");
    el.setAttribute("src", myImgPath+"header/"+suffLang+"men.gif");
    setEventCode(el, "onmouseover","this.src = '"+myImgPath+"header/"+suffLang+"men_on.gif'");
    setEventCode(el, "onmouseout","this.src = '"+myImgPath+"header/"+suffLang+"men.gif'");
    el = document.getElementById("img_women");
    el.setAttribute("alt", "");
    el.setAttribute("title", "");
    el.setAttribute("src", myImgPath+"header/"+suffLang+"women.gif");
    setEventCode(el, "onmouseover","this.src = '"+myImgPath+"header/"+suffLang+"women_on.gif'");
    setEventCode(el, "onmouseout","this.src = '"+myImgPath+"header/"+suffLang+"women.gif'");
    el = document.getElementById("img_sale");
    el.setAttribute("alt", "");
    el.setAttribute("title", "");
    el.setAttribute("src", myImgPath+"header/"+suffLang+img_sale_name+".gif");
    setEventCode(el, "onmouseover","this.src = '"+myImgPath+"header/"+suffLang+img_sale_name+"_on.gif"+pubImgHeader+"'");
    setEventCode(el, "onmouseout","this.src = '"+myImgPath+"header/"+suffLang+img_sale_name+".gif"+pubImgHeader+"'");
    el = document.getElementById("img_new_collections");
    el.setAttribute("alt", "");
    el.setAttribute("title", "");
    el.setAttribute("src", myImgPath+"header/"+suffLang+img_newcollections_name+"_act.gif"+pubImgHeader);
}

// [BV] 27/08/2009 - Inizializzazione include per messaggi
function initIncludeMex()
{
    var el;
    var myImgPath = document.getElementById("template_img_path").value;
    var suffLang=document.getElementById("txtLangDir").value;
    var suffMyArea="";
    
    if (inMyArea) suffMyArea="../";
    el=document.getElementById("img_att_info");
    if (el)
        el.setAttribute("src",myImgPath+"information.gif");
    el=document.getElementById("img_mex_quest");
    if (el)
        el.setAttribute("src",myImgPath+"question.gif");
    el=document.getElementById("LblOnLoading");
    if (el)
        el.setAttribute("src",myImgPath+"loading.gif");
    
}





function cngSeasonGender()
{
//    if (!inMyArea && !inLanding && !inHomePage)
//    {
        var el = document.getElementById("a_WhoAmI");
        el.setAttribute("href", document.getElementById("SiteHttpsUrl").value+"myarea/myAccount.aspx?season="+curSeason+"&profile=true&gender="+curGender);
        el = document.getElementById("a_myaccount");
        if (el)
            el.setAttribute("href", document.getElementById("SiteHttpsUrl").value+"myarea/myAccount.aspx?season="+curSeason+"&profile=true&gender="+curGender);
        el = document.getElementById("lnkBottomAffiliate");
        el.setAttribute("href", document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season="+curSeason+"&gender="+curGender+"&group=&affiliate=1");
        el = document.getElementById("lnkBottomContributions"); // Trasformato in GET A GIFT
        el.setAttribute("href", document.getElementById("httpSiteUrl").value+"landing.aspx?page=treat_and_gift&season="+curSeason+"&gender="+curGender);
        el = document.getElementById("lnkGiftCard"); //[BV] 13/11/2009 GIFT CARD
        el.setAttribute("href", document.getElementById("httpSiteUrl").value+"GiftCard.aspx?season="+curSeason+"&gender="+curGender);
//    }
    
}

function setGenderMenuImgLink()
{
    var gender = "women";
    if (inMyArea || inLanding)
    {
        var img_Path = document.getElementById("template_img_path").value + "header/" + document.getElementById("txtLangDir").value;
        if (document.getElementById("qry_gender"))
            gender=document.getElementById("qry_gender").value;
        var obj = document.getElementById("img_"+gender);
        obj.src = img_Path+gender+"_act.gif";
        //setEventCode(obj,"onmouseout","javascript:this.src='"+img_Path+gender+"_act.gif';" );
        setEventCode(obj,"onmouseout","javascript:;" );
        setEventCode(obj,"onmouseover","javascript:;" );        
    }
}
//[BV] 12/02/2010 BUY IT FIRST non deve essere contestualizzato
function curSeasonSetImages(seas)
{
    var imgPath = document.getElementById("template_img_path").value + "header/" + document.getElementById("txtLangDir").value;
    var pubImgHeader= "";
    var el= document.getElementById("pubImgHeader");
    if (el) pubImgHeader=el.value;
    if (pubImgHeader!="") pubImgHeader="?"+pubImgHeader;
    var obj = document.getElementById("img_new_collections");
    if (seas=="actual")
    {
        obj.src= imgPath+img_newcollections_name+"_act.gif"+pubImgHeader;   
        setEventCode(obj,"onmouseout","javascript:;" );
        setEventCode(obj,"onmouseover","javascript:;" );        
    }
    else
    {
        obj.src= imgPath+img_newcollections_name+".gif";
        setEventCode(obj,"onmouseout","javascript:this.src='"+imgPath+img_newcollections_name+".gif"+pubImgHeader+"';" );
        setEventCode(obj,"onmouseover","javascript:this.src='"+imgPath+img_newcollections_name+"_on.gif"+pubImgHeader+"';" );
    
    }
}
function setSaleMenuImgLink()
{
    var imgPath = document.getElementById("template_img_path").value + "header/" + document.getElementById("txtLangDir").value;
    var seas = "actual";
    //[BV] 07/12/2009
    var pubImgHeader= "";
    var el= document.getElementById("pubImgHeader");
    if (el) pubImgHeader=el.value;
    if (pubImgHeader!="") pubImgHeader="?"+pubImgHeader;
    
    if (!inMyArea && !inHomePage)
    {
        var obj = document.getElementById("img_newarrivals");
        changeOfImgMenuNewArrivals(obj, "new_arrivals.gif");
        seas = curSeason;
    }
    else
    {
        if (document.getElementById("qry_season"))
            seas=document.getElementById("qry_season").value;
    }
    if (!inMyArea && !inHomePage&& !inLanding)
    {
        curSeasonSetImages(seas);//[BV] 12/02/2010 BUY IT FIRST non deve essere contestualizzato
        obj = document.getElementById("img_sale");
        if (seas=="actual")
        {   
            obj.src= imgPath+img_sale_name+".gif"+pubImgHeader;
            setEventCode(obj,"onmouseout","javascript:this.src='"+imgPath+img_sale_name+".gif"+pubImgHeader+"';" );
            setEventCode(obj,"onmouseover","javascript:this.src='"+imgPath+img_sale_name+"_on.gif"+pubImgHeader+"';" );
        }
        else
        {            
            obj.src= imgPath+img_sale_name+"_act.gif"+pubImgHeader;  
            setEventCode(obj,"onmouseout","javascript:;" );
            setEventCode(obj,"onmouseover","javascript:;" );        
        }
    }
    else 
    {
        if (seas=="actual")
        {   
            var obj = document.getElementById("img_new_collections");
            obj.src= imgPath+img_newcollections_name+"_act.gif"+pubImgHeader;
            setEventCode(obj,"onmouseout","javascript:;" );
            setEventCode(obj,"onmouseover","javascript:;" );        
        } 
        else
        {
            obj = document.getElementById("img_new_collections");
            obj.src= imgPath+img_newcollections_name+".gif"+pubImgHeader;
            obj = document.getElementById("img_sale");
            obj.src= imgPath+img_sale_name+"_act.gif"+pubImgHeader;
            setEventCode(obj,"onmouseout","javascript:;" );
            setEventCode(obj,"onmouseover","javascript:;" );        
        }
    }
    if (!inHomePage) //[BV] 19/04/2010 corretto dopo segnalazione MR; per home page viene già fatto in initHomeImgHeader
    {
        var el = document.getElementById("img_sale");
        el.setAttribute("alt", "");
        el.setAttribute("title", "");
        el = document.getElementById("img_new_collections");
        el.setAttribute("alt", "");
        el.setAttribute("title", "");
    }
}

function initTriangol()
{
    var siteUrl=document.getElementById("httpSiteUrl").value;
    var flashvars = {};
    var params = {};
    var movieT="immagini/extra2.swf"
    if (!is_Flash) movieT="immagini/template/header/triangle2.gif"
    if (!inMyArea) movieT=siteUrl+movieT;
    
    if (inMyArea) movieT="../"+movieT;

    if (!is_Flash)
    {
        var el= document.getElementById("triangle");
        el.innerHTML="";
        var lnk = document.createElement("a");
        lnk.setAttribute("href", "http://www.luisaviaroma.com/extra/");
        var img=document.createElement("img");
        img.src=movieT;
        lnk.appendChild(img);
        el.appendChild(lnk);
        return;
    }

    params.movie=movieT;
    params.flashvars="fileNames=";
    params.wmode="transparent";
    params.quality="high";

    var attributes = {};
    attributes.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
    
    swfobject.embedSWF(movieT, "triangle_player", "45", "45", "9.0.0", "", flashvars, params, attributes);
}

// 23/06/2009 [FP] - Unico Footer
function initFooter()
{
    var myImgPath = document.getElementById("template_img_path").value;
    var mylang = document.getElementById("txtLangDir").value;
    var myUrl = document.getElementById("httpSiteUrl").value;
    var myPathHome = (home_fixed ? "_home" : ""); // 25/01/2010 [FP]
    
    //[BV] 08/09/2009
    var pubImgFooter= "";
    var el= document.getElementById("pubImgFooter");
    if (el) pubImgFooter=el.value;
    if (pubImgFooter!="") pubImgFooter="?"+pubImgFooter;
    
    var myseason = "actual";
    var mygender = "women";
    if (inMyArea || inLanding)
    {
        var el = document.getElementById("qry_season");
        if (el) myseason = el.value;
        var el = document.getElementById("qry_gender");
        if (el) mygender = el.value;
    }
    else if (!inHomePage)
    {
        myseason = curSeason;
        mygender = curGender;
    }
    //Inizializzazione layers messaggi comuni
    initIncludeMex();//[BV] 27/08/2009
    
    // LINGUA
    el = document.getElementById("languages");
    if (el)
    {
        var txtLang = el.value.split("|");
        for (var i = 0; i < txtLang.length; i++)
        {
            g_aLanguage[i] = txtLang[i].split(",");
        }
    }
    
    if ((g_aLanguage.length==1 && g_aLanguage[0]=="") || g_aLanguage.length==0)//[BV] 10/09/2009 SOLDOUT.ASPX
    {
        if (!document.getElementById("img_languages")) 
        {
            dv = document.getElementById("pnlLanguages");
            img = document.createElement("img");
            img.setAttribute("id", "img_languages");
            img.setAttribute("src", myImgPath+ "footer" + myPathHome + "/EN/language.gif");   // volutamente visualizza l'inglese
            dv.appendChild(img);            
        }    
    }
    if (g_aLanguage.length > 2)
    {
        var img;
        var anc;
        var dv;
        var lingua;
        if (!document.getElementById("img_languages")) 
        {
            dv = document.getElementById("pnlLanguages");
            anc = document.createElement("a");
            anc.setAttribute("href", "javascript:;");//[BV] 07/08/2009 
            setEventCode(anc,"onclick","javascript:showLanguages();" ); //[BV] 07/08/2009 
            img = document.createElement("img");
            img.setAttribute("id", "img_languages");
            img.setAttribute("src", myImgPath+ "footer" + myPathHome + "/EN/language.gif");   // volutamente visualizza l'inglese
            setEventCode(img,"onmouseover","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/EN/language_on.gif"+"';" ); 
            setEventCode(img,"onmouseout","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/EN/language.gif"+"';" ); 
            anc.appendChild(img);
            dv.appendChild(anc);            
            PreLoadLanguage();//[BV] 01/09/2009
        }

        for (var i = 0; i < g_aLanguage.length; i++)
        { 
            lingua = (g_aLanguage[i][lang_code]).toLowerCase();
            DisplayDivNone("lang_" + lingua);
            DisplayDivNone("pipe_" + lingua);
        }
    }
    else
    {
        var img;
        var lingua;
        for (var i = 0; i < g_aLanguage.length; i++)
        { 
            lingua = (g_aLanguage[i][lang_code]).toLowerCase();
            el = document.getElementById("lang_" + lingua)
            if (el)
            {
                var folder = (g_aLanguage[i][lang_folder]).toLowerCase();
                el.innerHTML = "";
                if (!inHomePage || inLanding)
                    el.setAttribute("href", "javascript:;");
                el.setAttribute("class","lang_link");
                img = document.createElement("img");
                if (mylang.substring(0,2) == g_aLanguage[i][lang_folder])
                {
                    img.setAttribute("src", myImgPath+ "footer/" + folder + "_act.gif");
                    if (!inHomePage || inLanding)
                        setEventCode(img,"onclick","javascript:;" ); 

                }
                else
                {
                    img.setAttribute("src", myImgPath+ "footer/" + folder + ".gif");
                    setEventCode(img,"onmouseover","javascript:this.src='" + myImgPath+ "footer/" + folder + "_on.gif';" );
                    setEventCode(img,"onmouseout","javascript:this.src='" + myImgPath+ "footer/" + folder + ".gif';" );
                    if (!inHomePage || inLanding)
                        setEventCode(img,"onclick","javascript:changeLanguage('" + g_aLanguage[i][lang_code] + "');return false;" ); 
                }
                el.appendChild(img);
            }
            el = document.getElementById("pipe_" + lingua)
            if (el)
                el.setAttribute("class","lang_link");
        }
    }
    
   
    // SHARE
    el = document.getElementById("imgShare");
    if (el)
    {
        el.setAttribute("src", myImgPath+ "footer" + myPathHome + "/" + mylang + "share.gif"+pubImgFooter);
        setEventCode(el,"onmouseover","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "share_on.gif"+pubImgFooter+"';");
        setEventCode(el,"onmouseout","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "share.gif"+pubImgFooter+"';");
    }
    
    // CONTACT US
    el = document.getElementById("a_contactus");
    if (el) 
    {
        // 29/07/2010 [FP] – ContactUs Shipping (Russia)
        //setEventCode(el, "onclick", "javascript:add2LogContactUs('" + LOG_PAGE_FOOTER + "', '');window.open('" + myUrl + myURL_CONTACTUS() + "','','scrollbars=yes,width=775,height=680');");   // 07/10/2009 [FP] - add2Log
        setEventCode(el, "onclick", "javascript:add2LogContactUs('" + LOG_PAGE_FOOTER + "', '');viewNewContactUs('');");   // 07/10/2009 [FP] - add2Log
        el = document.getElementById("imgContactUs");
        if (el) 
        {
            el.setAttribute("src", myImgPath+ "footer" + myPathHome + "/" + mylang + "contact_us.gif"+pubImgFooter);
            if (home_fixed) // 25/01/2010 [FP]
            {
                setEventCode(el,"onmouseover","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "contact_us_on.gif"+pubImgFooter+"';");
                setEventCode(el,"onmouseout","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "contact_us.gif"+pubImgFooter+"';");
            }
        }
    }
    // NEWSLETTER
    el = document.getElementById("a_newsletter");
    if (el) 
    {
        if (!inMyArea && !inHomePage)//[BV] 25/06/2009 - Nella index non si deve ricaricare l'intera pagina;
        {
            el.setAttribute("href", "javascript:;");
            setEventCode(el,"onclick","javascript:add2Log('" + LOG_PAGE_FOOTER + "', '" + LOG_ACTION_NEWSLETTER +"');ShowSubscriveNews();");    // 07/10/2009 [FP] - add2Log
        }
        else
        {
            el.setAttribute("href", myUrl+"index.aspx#getData.aspx|CallType=Vetrine&season="+myseason+"&gender="+mygender+"&group=&newsletter=1");
            setEventCode(el,"onclick","");
        }
        el = document.getElementById("imgNewsletter");
        if (el) 
        {
            el.setAttribute("src", myImgPath+ "footer" + myPathHome + "/" + mylang + "newsletter.gif"+pubImgFooter);
            if (home_fixed) // 25/01/2010 [FP]
            {
                setEventCode(el,"onmouseover","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "newsletter_on.gif"+pubImgFooter+"';");
                setEventCode(el,"onmouseout","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "newsletter.gif"+pubImgFooter+"';");
            }
        }
    }
    //BLOG [BV] 28/09/2009
    el = document.getElementById("a_blog");
    if (el) 
    {
        el.setAttribute("href", "http://blog.luisaviaroma.com/");
        setEventCode(el, "onclick", "javascript:add2Log('" + LOG_PAGE_FOOTER + "', '" + LOG_ACTION_BLOG +"');");  // 07/10/2009 [FP] - add2Log
        el = document.getElementById("imgBlog");
        if (el) 
        {
            el.setAttribute("src", myImgPath+ "footer" + myPathHome + "/" + mylang + "blog.gif"+pubImgFooter);
            if (home_fixed) // 25/01/2010 [FP]
            {
                setEventCode(el,"onmouseover","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "blog_on.gif"+pubImgFooter+"';");
                setEventCode(el,"onmouseout","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "blog.gif"+pubImgFooter+"';");
            }
        }
    }
    // FREE SHIPPING
    el = document.getElementById("a_freeship");
    if (el) 
    {
        // 29/07/2010 [FP] – ContactUs Shipping (Russia)
        //var mySection = "freeship";
        //setEventCode(el, "onclick", "javascript:add2LogContactUs('" + LOG_PAGE_FOOTER + "', '" + mySection +"');window.open('" + myUrl + myURL_CONTACTUS() + "?section=" + mySection +"','','scrollbars=yes,width=775,height=680');");  // 07/10/2009 [FP] - add2Log
        var mySection = "shipment";
        setEventCode(el, "onclick", "javascript:add2LogContactUs('" + LOG_PAGE_FOOTER + "', '" + mySection +"');viewNewContactUs('" + mySection +"');");  // 07/10/2009 [FP] - add2Log
        el = document.getElementById("imgFreeShipping");
        if (el) 
        {
            el.setAttribute("src", myImgPath+ "footer" + myPathHome + "/" + mylang + "free_shipping.gif"+pubImgFooter);
            if (home_fixed) // 25/01/2010 [FP]
            {
                setEventCode(el,"onmouseover","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "free_shipping_on.gif"+pubImgFooter+"';");
                setEventCode(el,"onmouseout","javascript:this.src='"+myImgPath+ "footer" + myPathHome + "/" + mylang + "free_shipping.gif"+pubImgFooter+"';");
            }
            el.setAttribute("alt", TXT_FREE_SHIP_TOOLTIP_EXT);
            el.setAttribute("title", TXT_FREE_SHIP_TOOLTIP_EXT);
        }
    }
    // AFFILIATE
    el = document.getElementById("lnkBottomAffiliate");
    if (el) 
    {
        //[BV] 10/11/2009 - se si era sulla index, su IE non si riusciva a visualizzare la pagina degli affiliati
        if (!home_fixed) el.innerHTML = TXT_AFFILIATE;
        if (inHomePage || inMyArea)
        {
            el.setAttribute("href", myUrl+"index.aspx#getData.aspx|CallType=Vetrine&season="+myseason+"&gender="+mygender+"&group=&affiliate=1");
        }
        else
        {
            el.setAttribute("href","javascript:;");
            setEventCode(el, "onclick","javascript:showAffiliate(false);");
        }
    }
    // GET A GIFT
    el = document.getElementById("lnkBottomContributions"); // Trasformato in GET A GIFT
    if (el) 
    {
        el.setAttribute("href", myUrl+"landing.aspx?page=treat_and_gift&season="+myseason+"&gender="+mygender);
        el.innerHTML = TXT_GETAGIFT;
    }    
    // GIFT CARD
    el = document.getElementById("lnkGiftCard"); //[BV] 13/11/2009
    if (el) 
    {
        el.setAttribute("href", myUrl+"GiftCard.aspx?season="+myseason+"&gender="+mygender);
        //[BV] 28/01/2010 per filenotfound.aspx & co
        el = document.getElementById("imgGiftCard");
        if (el && !home_fixed) 
        {
            el.setAttribute("src", myImgPath+ "footer" + "/" + mylang + "gift_card.gif");
            setEventCode(el,"onmouseover","javascript:this.src='"+myImgPath+ "footer" + "/" + mylang + "gift_card_on.gif';");
            setEventCode(el,"onmouseout","javascript:this.src='"+myImgPath+ "footer"  + "/" + mylang + "gift_card.gif';");
            
        }
    }
    
}

function EliminateOldLanguage(el)
{
    if (el.hasChildNodes())
    {
        var n = el.childNodes.length;
        for (var i = n -1; i >= 0; i--)
        {
            if (el.childNodes[i].nodeName.toUpperCase()=="A") 
                el.removeChild(el.childNodes[i]); 
        }
    }    
    return el;
}
//[BV] 31/08/2009
var left_lang=0;
var top_lang=0;
var height_lang=0;
var width_lang=86;
//[BV] 28/01/2010
function OutOfLanguageDiv(e, chkTop, chkBottom)
{
    var pos = getMousePosition(e);
    var yOffSet =((home_fixed && !is_ie6) ? getScrollTop() : 0);

    if (!chkTop && (is_ie7 || is_ie8) && yOffSet>0)
    { 
        yOffSet+=5;
    }
    if (pos[0]<left_lang || pos[0]>(left_lang+width_lang))
        DisplayDivNone('div_languages');
        
    if (pos[1]<(top_lang+height_lang+5) && !chkTop) return;
    if (pos[1]>(top_lang+height_lang) && !chkBottom) return;
    
    if ((pos[1]<top_lang) || pos[1]>(top_lang+height_lang+yOffSet))
    {
        DisplayDivNone('div_languages');
    }
}

function getMousePosition(e){
	if(!e) e=window.event;

	var vDoc=(document.documentElement && document.documentElement.scrollTop)?document.documentElement:document.body;

	var mouseX=(e.pageX)?e.pageX:e.clientX+vDoc.scrollLeft;
	var mouseY=(e.pageY)?e.pageY:e.clientY+vDoc.scrollTop;

	return [mouseX,mouseY];
}

//[BV] 01/09/2009
function PreLoadLanguage()
{ 
    var preload_image_object;
    var myImgPath = document.getElementById("template_img_path").value+"footer/";
    arr_image_language= new Array();
    arr_image_act_language= new Array();
    arr_image_on_language= new Array();
    for (var i=0; i<g_aLanguage.length; i++)
    {
        preload_image_object = new Image();
        preload_image_object.src = myImgPath+g_aLanguage[i][lang_folder].toLowerCase()+".gif";
        arr_image_language[i]=preload_image_object;
        preload_image_object = new Image();
        preload_image_object.src = myImgPath+g_aLanguage[i][lang_folder].toLowerCase()+"_act.gif";
        arr_image_act_language[i]=preload_image_object;
        preload_image_object = new Image();
        preload_image_object.src = myImgPath+g_aLanguage[i][lang_folder].toLowerCase()+"_on.gif";
        arr_image_on_language[i]=preload_image_object;
    }
}

//[BV] 07/08/2009
function showLanguages()
{
    //[BV] 15/03/2010
    if (inHomePage && home_fixed && !is_ie6) setScrollTop(0);
    var myImgPath = document.getElementById("template_img_path").value;
    var mylang = document.getElementById("txtLangDir").value;
    var myUrl = document.getElementById("httpSiteUrl").value;
    var lingua="";
    var html='';//'<div id=\"div_select_lang\"  style=\"border: 0px solid red;height:@h@px;\" onmouseover=\"javascript:;\">';//OutOfLanguageDiv(event)
    var div_sel;
    var img;
    var anc;
    var el_lang=document.getElementById("div_lang_body");
    el_lang.innerHTML="";
    
    height_lang=LANG_IMG_HEIGHT/2;
       
    for (var i = 0; i < g_aLanguage.length; i++)
    { 
        height_lang+=LANG_IMG_HEIGHT;
        lingua = (g_aLanguage[i][lang_code]).toLowerCase();
        var folder = (g_aLanguage[i][lang_folder]).toLowerCase();
        
        div_sel = document.createElement("div");
        div_sel.setAttribute("id", "divlang_sel_"+lingua);
        div_sel.className = "sel_language";
        img=document.createElement("img");
        img.setAttribute("id", "imglang_sel_"+lingua);
        if (mylang.substring(0,2) == g_aLanguage[i][lang_code])
        {
            img.setAttribute("src", arr_image_act_language[i].src);
            div_sel.appendChild(img);            
        }
        else
        {
            anc=document.createElement("a");
            anc.setAttribute("id", "alang_sel_"+lingua);
            if (!inHomePage || inLanding)
            {
                anc.setAttribute("href", "javascript:;");
                setEventCode(anc,"onclick","javascript:changeLanguage('" + g_aLanguage[i][lang_code] + "');"); 
            }
            else
                anc.setAttribute("href", "home.aspx?userlang=" + g_aLanguage[i][lang_code]);//[BV] 17/09/2009
            //setEventCode(img,"onmouseout","this.src='"+ arr_image_language[i].src+ "';" ); 
            setEventCode(img,"onmouseover","this.src='"+ arr_image_on_language[i].src+ "';" ); 
            img.setAttribute("src", arr_image_language[i].src);
            anc.appendChild(img);            
            div_sel.appendChild(anc);            
        }
        el_lang.appendChild(div_sel); 
        DisplayDivNone("lang_" + lingua);
        DisplayDivNone("pipe_" + lingua);
    }

    //[BV] 27/01/2010
    if (home_fixed)
    {
        el = document.getElementById("rightContainer");
        top_lang=el.offsetTop+el.offsetHeight-height_lang-18;
        //left_lang=document.getElementById("pnlLanguages").offsetLeft+el.offsetLeft+10;
        left_lang=getleftPos(document.getElementById("pnlLanguages"))+10;  
        if (is_ie7)
            top_lang=el.offsetTop+el.offsetHeight-height_lang-15;
        if (is_ie8)
        {
            //left_lang+=el.offsetLeft-60; - 06/09/2010 [FP] - Errore su IE8 Ver. 8.0.6001.18828
            left_lang+=getleftPos(document.getElementById("header_container"));
        }
    }
//    else if (home_fixed) // 25/01/2010[FP]
//    {
//        el = document.getElementById("rightContainer");
//        top_lang=el.offsetTop+el.offsetHeight-height_lang-20;
//        left_lang=document.getElementById("pnlLanguages").offsetLeft+el.offsetLeft+10;
//    }
    else
    {
        top_lang=document.getElementById("footer").offsetTop+28-height_lang;   
        left_lang=document.getElementById("allContainer").offsetLeft;
    }
    
    el_lang=document.getElementById("div_languages");
    var css = el_lang.style;
	if (!home_fixed) css.position = "absolute";
	css.overflow = "hidden";
	css.width = width_lang+"px";
	css.height = height_lang+"px";
	css.top= top_lang+"px";
	css.left= left_lang+"px";
    DisplayDivBlock("div_languages");
    //Tip(html,STICKY,true,CLOSEBTN,false,CENTERMOUSE,false,CLICKCLOSE,true, FADEIN, 400, BGCOLOR, 'white',FOLLOWMOUSE,false,FIX,[left,top],WIDTH,LANG_IMG_WIDTH)
    
}

function DisplayLanguages()
{
    var minWidth = 75;  
    var top = document.getElementById("pnlLanguages").offsetTop;
    var width = document.getElementById("img_languages").width;
    if (width < minWidth) width = minWidth;
//[BV] 07/08/2009
//    var dv = document.getElementById("div_languages");
//    dv.style.top = (top-35)+"px";
//    dv.style.width = width+"px";
//    dv.style.display="block";
}

// 28/07/2009 [FP] spostata changeOfImgHeader da vetrina8.js
function changeOfImgHeader(obj, srcImg)
{
    if (obj.id=="img_"+curGender)
        return;
    obj.src = document.getElementById("template_img_path").value + "header/" + document.getElementById("txtLangDir").value + srcImg;
}


// 07/10/2009 [FP] - add2Log
function add2LogGender(genderSel)
{
    var objParam =
        {
            gender: genderSel
            , season: curSeason
        };
    add2Log(LOG_PAGE_HEADER, LOG_ACTION_SELGENDER, objParam);

}

// 07/10/2009 [FP] - add2Log
function add2LogSeason(selSeason)
{
    var objParam =
        {
            gender: curGender
            , season: selSeason
        };
    add2Log(LOG_PAGE_HEADER, LOG_ACTION_SELSEASON, objParam);

}

function add2LogMyArea(fromPage)
{
    //  07/10/2009 [FP] - add2Log
    var objParam =
        {
            user: uId
        };
    add2Log(fromPage, LOG_ACTION_MYAREA, objParam);
}


// 07/10/2009 [FP] - add2Log
function getLogListaID()
{
    var myLista = searchListaID;
    if (viewNewArrivalsPage)
        myLista = "NA";
    return myLista;
}


// TODO in common_price la funzione getLogItemCode è stata rinominata getFormatItemCode (formatta itemID con "0")
// 07/10/2009 [FP] - add2Log
function getLogItemCode(mySeason, myCollItem)
{
    var myCode = myCollItem.substring(3);
    while (myCode.length < 3)
        myCode = "0" + myCode;
    
    myCode = mySeason + "-" + myCollItem.substring(0,3) + myCode;
    return myCode
}

// 20/10/2009 [FP] - initMex
function initMex()
{
    var suff = "";
    if (inMyArea) suff = "../";
    var el = document.getElementById("img_bnt_info");
    if (el) el.src = suff + "immagini/action_buttons/"+document.getElementById("txtLangDir").value+"ok.gif";
}

function popUpUserMsg(myUserMsgFlag, myMsgUserTipo, myMsgUserID, myMsgUserNota)
{
    var left=document.getElementById("allContainer").offsetLeft;
    
    var el=document.getElementById("div_msguser");
    el.style.left=(left+250)+"px";

    el=document.getElementById("containerUserAlert");
    el.style.height=GetWindowHeight()+"px";
    el.style.width=document.documentElement.clientWidth+"px";
    setLayerOpacity(el);
    
    el=document.getElementById("img_msguser_flagnota");
    if (myUserMsgFlag==userMsgFlag_ALERT)
    {
        el.src=document.getElementById("template_img_path").value + document.getElementById("txtLangDir").value + "attention.gif";
        DisplayDivBlock("div_msguser_flagnota");
    }
    else if (myUserMsgFlag==userMsgFlag_WARNING)
    {
        el.src=document.getElementById("template_img_path").value + document.getElementById("txtLangDir").value + "information.gif";
        DisplayDivBlock("div_msguser_flagnota");
    }
    else
        DisplayDivNone("div_msguser_flagnota");
    el=document.getElementById("txt_msguser_nota");
    el.innerHTML = decodeNoteJs(myMsgUserNota);
    el = document.getElementById("anc_msguser_btn");
    setEventCode(el,"onclick","javascript:msgRead('" + myUserMsgFlag + "','" + myMsgUserTipo + "'," + myMsgUserID + ");");
}

function decodeNoteJs(nota)
{
    nota = replaceAll(nota,"@CR@","\n");
    nota = replaceAll(nota,"@CM@",",");
    nota = replaceAll(nota,"@EC@","&");
    nota = replaceAll(nota,"@PP@","|");
    return nota;
}

function msgRead(myUserMsgFlag,myMsgUserTipo, myMsgUserID)
{
    var objParam =
        {
            user: uId
            , msgFlag: myUserMsgFlag
            , msgTipo: myMsgUserTipo
            , msgID: myMsgUserID
        };
    add2Log(LOG_PAGE_USERMSG, LOG_ACTION_READMSG, objParam);
    DisplayDivNone('div_msguser');
    DisplayDivNone('containerUserAlert');
    var url="getLogIn.aspx?CallType=MsgRead&userMsgTipo=" + myMsgUserTipo + "&userMsgID=" + myMsgUserID;
    if (!inMyArea)
        url = "myarea/" + url;
    makeRequest(url, "msgRead"); 
}
//[BV] 13/01/2010
function StopFlashSound(elId,wEl,hEl )
{
    if (is_ie)
    {
        var el=document.getElementById(elId);
        if (el  && el=="[object]") 
        {
            swfobject.embedSWF("http://www.luisaviaroma.com/template/stop_sound.swf", elId, wEl, hEl, "7.0.0", null, null, null);
        }
    }
}

//L'header deve essere rimesso "a posto" in base alla lingua dell'utente perché sulla homepage potrebbe venire da link esterni che non impostano la lingua utente
function initHeader()
{   
    var el;
    var myImgPath = document.getElementById("template_img_path").value;
    var suffLang=document.getElementById("txtLangDir").value;
    
    var pubImgHeader= "";
    var el= document.getElementById("pubImgHeader");
    if (el) pubImgHeader=el.value;
    if (pubImgHeader!="") pubImgHeader="?"+pubImgHeader;
    
    if (!inHomePageSite())
    {
        el = document.getElementById("anc_logo_head");
        if (el)
        {
            el.setAttribute("href", document.getElementById("httpSiteUrl").value+"index.htm?userlang="+suffLang.replace("/",""));
            setEventCode(el, "onclick","javascript:add2LogHome();");
        }
    }
    if (inHomePage)//se inLanding = true allora anche inHomePage = true 
    {
        el = document.getElementById("a_WhoAmI");
        if (el)
        {
            el.setAttribute("href", document.getElementById("SiteHttpsUrl").value+"myarea/myAccount.aspx?season=actual&profile=true&gender=women");
            setEventCode(el, "onclick","javascript:add2LogMyArea('" + LOG_PAGE_HEADER + "');");
        }
        el = document.getElementById("a_myaccount");
        if (el) 
        {
            el.setAttribute("href", document.getElementById("SiteHttpsUrl").value+"myarea/myAccount.aspx?season=actual&profile=true&gender=women");
            setEventCode(el, "onclick","javascript:add2LogMyArea('" + LOG_PAGE_HEADER + "');");
        }
        initHomeImgHeader(myImgPath,suffLang,pubImgHeader);
    }
    else if (inMyArea )// se inSurvey = true allora anche inMyArea=true
    {     
        el=document.getElementById("img_logo_head");
        el.setAttribute("src", myImgPath+ "header/"+LOGO_LUISA);     
        el = document.getElementById("a_men");
        el.setAttribute("href", document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season="+document.getElementById("qry_season").value+"&gender=men&group=");
        el = document.getElementById("a_women");
        el.setAttribute("href", document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season="+document.getElementById("qry_season").value+"&gender=women&group=");
        el = document.getElementById("a_new_collections");
        el.setAttribute("href", document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season=actual&gender="+document.getElementById("qry_gender").value);
        el = document.getElementById("a_sale");
        el.setAttribute("href", document.getElementById("httpSiteUrl").value+"index.aspx#getData.aspx|CallType=Vetrine&season=sale&gender="+document.getElementById("qry_gender").value);
        if (!inMyAccount) 
        {
            DisplayDivNone("shopping_bag");
            el = document.getElementById("a_WhoAmI");
            el.setAttribute("href", document.getElementById("SiteHttpsUrl").value+"myarea/myAccount.aspx?season="+document.getElementById("qry_season").value+"&profile=true&gender="+document.getElementById("qry_gender").value);
            el = document.getElementById("a_myaccount");
            if (el) el.setAttribute("href", document.getElementById("SiteHttpsUrl").value+"myarea/myAccount.aspx?season="+document.getElementById("qry_season").value+"&profile=true&gender="+document.getElementById("qry_gender").value);
        }
        if (inSurvey) DisplayDivNone("currAndShip");
    }
    else
    {
        el = document.getElementById("a_WhoAmI");
        if (el)
        {
            el.setAttribute("href", document.getElementById("SiteHttpsUrl").value+"myarea/myAccount.aspx?season="+curSeason+"&profile=true&gender="+curGender);
            setEventCode(el, "onclick","javascript:add2LogMyArea('" + LOG_PAGE_HEADER + "');");
        }
        el = document.getElementById("a_myaccount");
        if (el)
        {
            el.setAttribute("href", document.getElementById("SiteHttpsUrl").value+"myarea/myAccount.aspx?season="+curSeason+"&profile=true&gender="+curGender);
            setEventCode(el, "onclick","javascript:add2LogMyArea('" + LOG_PAGE_HEADER + "');");
        }
        el = document.getElementById("a_men");
        if (el)
            setEventCode(el, "onclick","javascript:selGender(this,'men');return false;");
        el = document.getElementById("a_women");
        if (el)
            setEventCode(el, "onclick","javascript:selGender(this,'women');return false;");
        el = document.getElementById("a_new_collections");
        if (el)
            setEventCode(el, "onclick","javascript:viewNewCollection();return false;");
        el = document.getElementById("a_sale");
        if (el)
            setEventCode(el, "onclick","javascript:viewSale(false,true);return false;");  // 07/10/2009 [FP] - impostato logAction = True      
    }
    el = document.getElementById("alogout");
    if (el) setEventCode(el, "onclick","javascript:LogOut();");
    
    if (!inMyArea || inMyAccount)
    {
        el = document.getElementById("a_shopping_bag");
        if (el) setEventCode(el, "onclick","javascript:viewMyBagFromHomePage();");
    }
    setCurrAndShipLink(document.getElementById("a_currAndShip"));
    
    setGenderMenuImgLink();
    setSaleMenuImgLink();
    initTriangol();
    // 07/10/2009 [FP] - add2Log
    if (logActive && (inHomePage || inMyArea))
    {
        el = document.getElementById("a_men");
        setEventCode(el, "onclick","javascript:add2LogGender('men');");
        el = document.getElementById("a_women");
        setEventCode(el, "onclick","javascript:add2LogGender('women');");
        el = document.getElementById("a_new_collections");
        setEventCode(el, "onclick","javascript:add2LogSeason('actual');");
        el = document.getElementById("a_sale");
        setEventCode(el, "onclick","javascript:add2LogSeason('sale');");
    }
    
}

function setCurrAndShipLink(el)
{
    if (inMyArea || inHomePage)
    {
        var url=document.getElementById("httpSiteUrl").value+"index.aspx#getLogIn.aspx|CallType=CurrAndShip&action=vis";
        if (inMyArea)
        {
            url+="&season="+document.getElementById("qry_season").value+"&gender="+document.getElementById("qry_gender").value;
            if (inSurvey) // 28/07/2009 [FP] - Survey
                url+="&fromSurvey=true";        
            else if (!inMyAccount) 
                url+="&fromBasket=true";
            else 
                url+="&fromMyAccount=true";
        }
        else if (inHomePage)
            url+="&season=actual&gender=women";
        el.setAttribute("href",url);
        el.setAttribute("onclick", "");
    }
    else
    {
        el.setAttribute("href", "javascript:;");
        setEventCode(el,"onclick","javascript:getCurrAndShip(false,-1);" ); 
    }
    return url;//[BV] PROMO/CREDIT
}

function viewMyBagFromHomePage()
{
    var mySeason = "actual";
    var myGender="women";
    var url=document.getElementById("SiteHttpsUrl").value;
    var qryStr="";
    
    if (!inHomePage && !inMyAccount)
    {
        mySeason=curSeason;
        myGender=curGender;
    }
    else if (inMyAccount)
    {
       mySeason=document.getElementById("qry_season").value;
       myGender=document.getElementById("qry_gender").value; 
    }
    if (!isMobile) qryStr="?season="+mySeason+"&gender="+myGender;
    //  07/10/2009 [FP] - add2Log
    add2Log(LOG_PAGE_HEADER, LOG_ACTION_SHOPPINGBAG);
    window.location.href =url+"myarea/myCart.aspx"+qryStr;
    if (window.event)
        window.event.returnValue=false;
}