
function isTrue(_boolean){if(_boolean==null){return false;}return _boolean;}
function getXmlAsString(_iDepth, _oNode){var i=0;var oChild=null;var sResult='';if(_oNode==null){return '[null]';}for(i=0;i<_iDepth;i++){sResult=sResult+' ';}
sResult=sResult+'<'+_oNode.nodeName;sResult=sResult+'>\r\n';if(_oNode.childNodes==null || _oNode.childNodes.length==0){sResult=sResult+getNodeValue(_oNode);}else{for(i=0;i<_oNode.childNodes.length;i++){oChild=_oNode.childNodes[i];sResult=sResult+getXmlAsString(_iDepth+1, oChild);}}for(i=0;i<_iDepth;i++){sResult=sResult+' ';}
sResult=sResult+'</'+_oNode.nodeName+'>\r\n';return sResult;}
function isNotTrue(_boolean){if(_boolean==null){return true;}return !_boolean;}
function isFalse(_boolean){if(_boolean==null){return false;}return !_boolean;}
function isNotFalse(_boolean){if(_boolean==null){return true;}return _boolean;}
function defaultVoidString(_string){if(_string==null){return '';}return _string;}
function defaultValue(_value, _nullCaseValue){if(_value==null){return _nullCaseValue;}return _value;}
function isEqualsTo(_value1, _value2){try{return _value1==_value2;}catch(e){return false;}}
function isNotEqualsTo(_value1, _value2){try{return _value1 != _value2;}catch(e){return true;}}
function gcObject(joObject){var oAttrs=null;var oChildren=null;var i=0;var iNbRemove=0;if(joObject==null){return 0;}for(var i in joObject){sObjName=i;if(typeof joObject[i]=='function'){iNbRemove=iNbRemove+1;joObject[i]=null;}else if(joObject[i] instanceof Array){var j=0;for(j=0;j<joObject[i].length;j++){if(joObject[i][joObject[i][j]] != undefined){iNbRemove=iNbRemove+gcObject(joObject[i][joObject[i][j]]);}}while(joObject[i].length>0){joObject[i].pop();}}else if(typeof joObject[i]=='object'){iNbRemove=iNbRemove+gcObject(joObject[i]);}}return iNbRemove;}
function JoValue(){this.integer=null;this.decimal=null;}
JoValue.prototype.getInteger=function(){return defaultValue(this.integer, 0);}
JoValue.prototype.getDecimal=function(){return defaultValue(this.decimal, 0);}
JoValue.prototype.setInteger=function(_integer){this.integer=_integer;}
JoValue.prototype.setDecimal=function(_decimal){this.decimal=_decimal;}
JoValue.prototype.equals=function(_oValue){if(_oValue==null){return false;}try{if(this.integer==null){if(_oValue.integer != null){return false;}}else{if(_oValue.integer==null){return false;}}if(this.decimal==null){if(_oValue.decimal != null){return false;}}else{if(_oValue.decimal==null){return false;}}return((this.integer * 1)==(_oValue.integer * 1)&&(this.decimal * 1)==(_oValue.decimal * 1));}catch(e){return false;}}
JoValue.prototype.toString=function(){return 'Value : '+this.integer+'.'+this.decimal;}
var VALUE_NODE_NAME='val';
function getDomToValue(_oNodeValue){if(_oNodeValue==null){return null;}try{var sValue=getNodeValue(_oNodeValue);if(sValue==null){return null;}
var tValue=sValue.split(',');if(tValue.length != 2){tValue=sValue.split('.');}if(tValue.length != 2){return null;}else if(tValue[0]==null || tValue[1]==null){return null;}
var oValue=new JoValue();oValue.setInteger(tValue[0]);oValue.setDecimal(tValue[1]);return oValue;}catch(e){return null;}}
function JoDate(_serviceId){this.serviceId=_serviceId;this.kind=null;this.day=null;this.month=null;this.year=null;this.hour=null;this.minute=null;this.second=null;}
JoDate.prototype.getServiceId=function(){return this.serviceId;}
JoDate.prototype.getKind=function(){return this.kind;}
JoDate.prototype.getDay=function(){return defaultValue(this.day, '01');}
JoDate.prototype.getMonth=function(){return defaultValue(this.month, '01');}
JoDate.prototype.getYear=function(){return defaultValue(this.year, '0000');}
JoDate.prototype.getHour=function(){return defaultValue(this.hour, '00');}
JoDate.prototype.getMinute=function(){return defaultValue(this.minute, '00');}
JoDate.prototype.getSecond=function(){return defaultValue(this.second, '00');}
JoDate.prototype.setKind=function(_kind){this.kind=_kind;}
JoDate.prototype.setDay=function(_day){this.day=_day;}
JoDate.prototype.setMonth=function(_month){this.month=_month;}
JoDate.prototype.setYear=function(_year){this.year=_year;}
JoDate.prototype.setHour=function(_hour){this.hour=_hour;}
JoDate.prototype.setMinute=function(_minute){this.minute=_minute;}
JoDate.prototype.setSecond=function(_second){this.second=_second;}
JoDate.prototype.toString=function(){with(this){return 'Date ['+kind+']: '+day+' / '+month+' / '+year+' '+hour+':'+minute+':'+second;}}
JoDate.prototype.equals=function(_oDate){if(_oDate==null){return false;}with(this){try{return(day==_oDate.day && month==_oDate.month && year==_oDate.year && hour==_oDate.hour && minute==_oDate.minute && second==_oDate.second);}catch(e){return false;}}}
JoDate.prototype.after=function(_oDate){var iLocalTimestamp=null;var iRemoteTimestamp=null;var sLocalTimestamp=null;var sRemoteTimestamp=null;if(_oDate==null){return false;}if(_oDate.year==null){return false;}if(_oDate.month==null){return false;}if(_oDate.day==null){return false;}with(this){try{sLocalTimestamp=''+year+month+day+hour+minute+second+'';sRemoteTimestamp=''+_oDate.year+_oDate.month+_oDate.day+_oDate.hour+_oDate.minute+_oDate.second+'';iLocalTimestamp=sLocalTimestamp * 1;iRemoteTimestamp=sRemoteTimestamp * 1;return(iLocalTimestamp > iRemoteTimestamp);}catch(e){return false;}}}
JoDate.prototype.before=function(_oDate){return !this.equals(_oDate)&& !this.after(_oDate)};JoDate.prototype.getLiteralDate=function(_sFormat){if(_sFormat==null){return null;}with(this){if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_DD_MM_YYYY){return day+'/'+month+'/'+year;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_MM_DD_YYYY){return month+'/'+day+'/'+year;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_YYYY_MM_DD){return year+'/'+month+'/'+day;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_DD_MM_YY){return day+'/'+month+'/'+year.substring(2,4);}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_MM_DD_YY){return month+'/'+day+'/'+year.substring(2,4);}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_YY_MM_DD){return year.substring(2,4)+'/'+month+'/'+day;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_DD_MM_YYYY_HH_MI_SS){return day+'/'+month+'/'+year+' '+hour+':'+minute+':'+second;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_MM_DD_YYYY_HH_MI_SS){return month+'/'+day+'/'+year+' '+hour+':'+minute+':'+second;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_YYYY_MM_DD_HH_MI_SS){return year+'/'+month+'/'+day+' '+hour+':'+minute+':'+second;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_DD_MM_YY_HH_MI_SS){return day+'/'+month+'/'+year.substring(2,4)+' '+hour+':'+minute+':'+second;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_MM_DD_YY_HH_MI_SS){return month+'/'+day+'/'+year.substring(2,4)+' '+hour+':'+minute+':'+second;}else if(_sFormat==SERVICE_CONSTANTS.DATE_FORMAT_YY_MM_DD_HH_MI_SS){return year.substring(2,4)+'/'+month+'/'+day+' '+hour+':'+minute+':'+second;}else{var sDate=_sFormat;sDate=sDate.replace("dd", day);sDate=sDate.replace("MM", month);sDate=sDate.replace("yyyy", year);sDate=sDate.replace("yy", year.substring(2,4));sDate=sDate.replace("HH", hour);sDate=sDate.replace("mm", minute);sDate=sDate.replace("ss", second);return sDate;}}}
JoDate.prototype.getFormatedLiteralDate=function(){var oFormatDate=null;if(this.kind==SERVICE_CONSTANTS.DATE_KIND_PRICE_BEGIN
|| this.kind==SERVICE_CONSTANTS.DATE_KIND_PRICE_END){if(getServiceContent(this.getServiceId())!= null){oFormatDate=getServiceContent(this.getServiceId()).getDateFormat(SERVICE_CONSTANTS.DATE_FORMAT_KIND_PRICE);}}else if(this.kind==SERVICE_CONSTANTS.DATE_KIND_SERVER){if(getServiceContent(this.getServiceId())!= null){oFormatDate=getServiceContent(this.getServiceId()).getDateFormat(SERVICE_CONSTANTS.DATE_FORMAT_KIND_SERVER);}}else if(this.kind==SERVICE_CONSTANTS.DATE_KIND_SOLD_BEGIN
|| this.kind==SERVICE_CONSTANTS.DATE_KIND_SOLD_END){if(getServiceContent(this.getServiceId())!= null){oFormatDate=getServiceContent(this.getServiceId()).getDateFormat(SERVICE_CONSTANTS.DATE_FORMAT_KIND_SOLD);}}if(oFormatDate==null){return null;}return this.getLiteralDate(oFormatDate.format);}
var DATE_NODE_NAME='dat';var TIME_NODE_NAME='time';var DATE_ATTR_KIND='dat-knd';var TIME_ATTR_KIND='tim-knd';
function getDomToDateTime(_oNodeDate, _iServiceId){try{if(_oNodeDate==null){return null;}
var sDateKind=getAttributeValue(_oNodeDate, DATE_ATTR_KIND);if(sDateKind==null){sDateKind=getAttributeValue(_oNodeDate, TIME_ATTR_KIND);}
var sDateValue=getNodeValue(_oNodeDate);if(sDateValue==null){if(sDateKind==SERVICE_CONSTANTS.DATE_KIND_END || sTimeKind==SERVICE_CONSTANTS.DATE_KIND_END){oEndDate=new JoDate(_iServiceId);oEndDate.setKind(SERVICE_CONSTANTS.DATE_KIND_PRICE_END);oEndDate.setDay(SERVICE_CONSTANTS.END_DATE_DAY);oEndDate.setMonth(SERVICE_CONSTANTS.END_DATE_MONTH);oEndDate.setYear(SERVICE_CONSTANTS.END_DATE_YEAR);oEndDate.setHour(SERVICE_CONSTANTS.END_DATE_HOUR);oEndDate.setMinute(SERVICE_CONSTANTS.END_DATE_MINUTE);oEndDate.setSecond(SERVICE_CONSTANTS.END_DATE_SECONDE);return oEndDate;}return null;}
var tDate=sDateValue.split('-');if(tDate.length != 3 && tDate.length != 6){return null;}
var oDate=new JoDate(_iServiceId);oDate.setKind(sDateKind);oDate.setDay(tDate[0]);oDate.setMonth(tDate[1]);oDate.setYear(tDate[2]);if(tDate.length > 3){oDate.setHour(tDate[3]);oDate.setMinute(tDate[4]);oDate.setSecond(tDate[5]);}return oDate;}catch(e){return null;}}
function JoCurrency(){this.id=null;this.symbol=null;this.decimalNumber=null;this.decimalDelimiter=null;this.thousandDelimiter=null;this.behind=null;}
JoCurrency.prototype.getId=function(){return this.id;}
JoCurrency.prototype.isBehind=function(){return isNotFalse(this.behind);}
JoCurrency.prototype.isFront=function(){return !this.isBehind();}
JoCurrency.prototype.getSymbol=function(){return defaultVoidString(this.symbol);}
JoCurrency.prototype.getDecimalNumber=function(){return defaultValue(this.decimalNumber, 0);}
JoCurrency.prototype.getDecimalDelimiter=function(){return defaultVoidString(this.decimalDelimiter);}
JoCurrency.prototype.getThousandDelimiter=function(){return defaultVoidString(this.thousandDelimiter);}
JoCurrency.prototype.setId=function(_id){this.id=_id;}
JoCurrency.prototype.setBehind=function(){this.behind=true;}
JoCurrency.prototype.setFront=function(){this.behind=false;}
JoCurrency.prototype.setSymbol=function(_symbol){this.symbol=_symbol;}
JoCurrency.prototype.setDecimalNumber=function(_decimalNumber){this.decimalNumber=_decimalNumber;}
JoCurrency.prototype.setDecimalDelimiter=function(_decimalDelimiter){this.decimalDelimiter=_decimalDelimiter;}
JoCurrency.prototype.setThousandDelimiter=function(_thousandDelimiter){this.thousandDelimiter=_thousandDelimiter;}
JoCurrency.prototype.toString=function(){var oStringValue=new JoValue();oStringValue.setInteger('7888');oStringValue.setDecimal('99');return 'Currency ['+this.getId()+']: '+this.formatValue(oStringValue);}
JoCurrency.prototype.equals=function(_oCurrency){if(_oCurrency==null){return false;}return isEqualsTo(this.id, _oCurrency.id);}
JoCurrency.prototype.formatInteger=function(_oValue){var i=0;var sFormat='';var sInteger=null;var sFinalInteger='';var sChar=null;if(_oValue==null){return null;}if(_oValue.getInteger()==null){return null;}
sInteger=new String(_oValue.getInteger());for(i=0;i < sInteger.length;i++){sChar=sInteger.charAt(sInteger.length -(i+1));if(i % 3==0 && i != 0){sFinalInteger=sChar+this.getThousandDelimiter()+sFinalInteger;}else{sFinalInteger=sChar+sFinalInteger;}}return sFinalInteger;}
JoCurrency.prototype.formatDecimal=function(_oValue){var i=0;var sDecimal=null;if(_oValue==null){return null;}if(_oValue.getDecimal()==null){return null;}
sDecimal=new String(_oValue.getDecimal());if(sDecimal.length > this.getDecimalNumber()){return sDecimal.substring(0, this.getDecimalNumber());}else if(sDecimal.length < this.getDecimalNumber()){while(sDecimal.length < this.getDecimalNumber()){sDecimal=sDecimal+'0';}return sDecimal;}else{return sDecimal;}}
JoCurrency.prototype.formatValue=function(_oValue){var i=0;var sValue='';var sInteger=null;var sDecimal=null;if(_oValue==null){return null;}
sInteger=this.formatInteger(_oValue);if(sInteger==null){return null;}
sDecimal=this.formatDecimal(_oValue);if(sDecimal==null){return null;}if(this.isFront()){sValue=this.getSymbol()+' ';}
sValue=sValue+sInteger+this.getDecimalDelimiter()+sDecimal;if(this.isBehind()){sValue=sValue+' '+this.getSymbol();}return sValue;}
var CUR_NODE_NAME='cur';var CUR_SYMBOL_NODE_NAME='cur-smb';var CUR_DECIMAL_NUMBER_NODE_NAME='cur-dcm-nmb';var CUR_DECIMAL_DELIMITER_NODE_NAME='cur-dcm-dlm';var CUR_THOUSAND_DELIMITER_NODE_NAME='cur-ths-dlm';var CUR_POSITION_NODE_NAME='cur-pst';var CUR_POSITION_NODE_VALUE_BEHIND='B';var CUR_POSITION_NODE_VALUE_FRONT='F';var CUR_ATTR_ID='cur-id';
function getDomToCurrency(_oNodeCurrency){var oCurrency=null;try{if(_oNodeCurrency==null){return null;}
var _id=getAttributeValue(_oNodeCurrency, CUR_ATTR_ID);var _thousandDelimiter=getChildNodeValue(_oNodeCurrency, CUR_THOUSAND_DELIMITER_NODE_NAME);var _decimalDelimiter=getChildNodeValue(_oNodeCurrency, CUR_DECIMAL_DELIMITER_NODE_NAME);var _position=getChildNodeValue(_oNodeCurrency, CUR_POSITION_NODE_NAME);if(_id==null){return null;}if(isEqualsTo(_decimalDelimiter, 'space')){_decimalDelimiter=' ';}if(isEqualsTo(_thousandDelimiter, 'space')){_thousandDelimiter=' ';}
oCurrency=new JoCurrency();oCurrency.setId(_id);oCurrency.setSymbol(getChildNodeValue(_oNodeCurrency, CUR_SYMBOL_NODE_NAME));oCurrency.setDecimalNumber(getChildNodeValue(_oNodeCurrency, CUR_DECIMAL_NUMBER_NODE_NAME));oCurrency.setDecimalDelimiter(_decimalDelimiter);oCurrency.setThousandDelimiter(_thousandDelimiter);if(isEqualsTo(CUR_POSITION_NODE_VALUE_FRONT, _position)){oCurrency.setFront();}else{oCurrency.setBehind();}return oCurrency;}catch(e){return null;}}
function JoCurrencies(){this.lCurrencies=new Array();}
JoCurrencies.prototype.addCurrency=function(_currency){if(_currency==null){return null;}if(_currency.getId()==null){return null;}if(this.lCurrencies['#'+_currency.getId()+'#']==null){this.lCurrencies.push('#'+_currency.getId()+'#');}this.lCurrencies['#'+_currency.getId()+'#']=_currency;}
JoCurrencies.prototype.getCurrency=function(_id){if(_id==null){return null;}return this.lCurrencies['#'+_id+'#'];}
JoCurrencies.prototype.getCurrencies=function(){return this.lCurrencies;}
JoCurrencies.prototype.getSize=function(){return this.lCurrencies.length;}
var CURRENCIES_NODE_NAME='crs';
function getDomToCurrencies(_oNodeCurrencies){var i=0;var oCurrencies=new JoCurrencies();if(_oNodeCurrencies==null){return null;}try{var lNodeCurrencies=_oNodeCurrencies.getElementsByTagName(CUR_NODE_NAME);for(i=0;i < lNodeCurrencies.length;i++){oCurrencies.addCurrency(getDomToCurrency(lNodeCurrencies[i]));}return oCurrencies;}catch(e){return null;}}
function JoDateFormat(){this.kind=null;this.format=null;}
JoDateFormat.prototype.getKind=function(){return this.kind;}
JoDateFormat.prototype.format=function(){return this.format;}
JoDateFormat.prototype.setKind=function(_kind){this.kind=_kind;}
JoDateFormat.prototype.setFormat=function(_format){this.format=_format;}
JoDateFormat.prototype.toString=function(){return 'Date Format ['+this.getKind+']: '+this.getFormat;}
JoDateFormat.prototype.equals=function(_oDateFormat){if(_oDateFormat==null){return false;}return isEqualsTo(this.kind, _oDateFormat.kind);}
var FMT_DATE_NODE_NAME='fmt-dte';var FMT_DATE_KIND='knd';
function getDomToDateFormat(_oNodeDateFormat){var oDateFormat=null;try{if(_oNodeDateFormat==null){return null;}
var _kind=getAttributeValue(_oNodeDateFormat, FMT_DATE_KIND);var _format=getNodeValue(_oNodeDateFormat);if(_kind==null){return null;}if(_format==null){return null;}
oDateFormat=new JoDateFormat();oDateFormat.setKind(_kind);oDateFormat.setFormat(_format);return oDateFormat;}catch(e){return null;}}
function JoDateFormats(){this.lDateFormats=new Array();}
JoDateFormats.prototype.addDateFormat=function(_dateFormat){if(_dateFormat==null){return null;}if(_dateFormat.getKind()==null){return null;}if(this.lDateFormats['#'+_dateFormat.getKind()+'#']==null){this.lDateFormats.push('#'+_dateFormat.getKind()+'#');}this.lDateFormats['#'+_dateFormat.getKind()+'#']=_dateFormat;}
JoDateFormats.prototype.getDateFormat=function(_kind){if(_kind==null){return null;}return this.lDateFormats['#'+_kind+'#'];}
JoDateFormats.prototype.getDateFormats=function(){return this.lDateFormats;}
JoDateFormats.prototype.getSize=function(){return this.lDateFormats.length;}
var FMT_DATES_NODE_NAME='fts-dte';
function getDomToDateFormats(_oNodeDateFormats){var i=0;var oDateFormats=new JoDateFormats();if(_oNodeDateFormats==null){return null;}try{var lNodeDateFormats=_oNodeDateFormats.getElementsByTagName(FMT_DATE_NODE_NAME);for(i=0;i < lNodeDateFormats.length;i++){oDateFormats.addDateFormat(getDomToDateFormat(lNodeDateFormats[i]));}return oDateFormats;}catch(e){return null;}}
function JoHomogeneous(){this.kind=null;this.price=null;this.begin=null;this.end=null;}
JoHomogeneous.prototype.isKindHomo=function(){return isTrue(this.kind);}
JoHomogeneous.prototype.isPriceHomo=function(){return isTrue(this.price);}
JoHomogeneous.prototype.isBeginHomo=function(){return isTrue(this.begin);}
JoHomogeneous.prototype.isEndHomo=function(){return isTrue(this.end);}
JoHomogeneous.prototype.isPeriodHomo=function(){return this.isBeginHomo()&& this.isEndHomo();}
JoHomogeneous.prototype.setKindHomo=function(_kind){this.kind=_kind;}
JoHomogeneous.prototype.setPriceHomo=function(_price){this.price=_price;}
JoHomogeneous.prototype.setBeginHomo=function(_begin){this.begin=_begin;}
JoHomogeneous.prototype.setEndHomo=function(_end){this.end=_end;}
JoHomogeneous.prototype.toString=function(){with(this){return 'Homogeneous [Kind:'+kind+' - Value:'+price+' - Begin:'+begin+' - End:'+end+']';}}
var HOMO_KIND_NODE_VALUE='K';var HOMO_PRICE_NODE_VALUE='P';var HOMO_BEGIN_NODE_VALUE='B';var HOMO_END_NODE_VALUE='E';
function getDomToHomogeneous(_oNodeHomogeneous){var sHomogeneous=null;var homogeneous=null;try{if(_oNodeHomogeneous==null){return null;}
homogeneous=new JoHomogeneous();sHomogeneous=getNodeValue(_oNodeHomogeneous);if(sHomogeneous==null){return homogeneous;}
homogeneous.setKindHomo(sHomogeneous.indexOf(HOMO_KIND_NODE_VALUE)!= -1);homogeneous.setPriceHomo(sHomogeneous.indexOf(HOMO_PRICE_NODE_VALUE)!= -1);homogeneous.setBeginHomo(sHomogeneous.indexOf(HOMO_BEGIN_NODE_VALUE)!= -1);homogeneous.setEndHomo(sHomogeneous.indexOf(HOMO_END_NODE_VALUE)!= -1);return homogeneous;}catch(e){return null;}}
function JoPrice(_serviceId){this.serviceId=_serviceId;this.kind=null;this.begin=null;this.end=null;this.value=null;this.currencyId=null;this.homogeneous=null;this.markdown=null;this.minReduce=null;}
JoPrice.prototype.getServiceId=function(){return this.serviceId;}
JoPrice.prototype.getKind=function(){return this.kind;}
JoPrice.prototype.isPermanent=function(){return isEqualsTo(this.getKind(), SERVICE_CONSTANTS.PRICE_PERMANENT);}
JoPrice.prototype.isPromo=function(){return(isEqualsTo(this.getKind(), SERVICE_CONSTANTS.PRICE_PROMO)|| isEqualsTo(this.getKind(), SERVICE_CONSTANTS.PRICE_PROMO_B));}
JoPrice.prototype.isSold=function(){return(isEqualsTo(this.getKind(), SERVICE_CONSTANTS.PRICE_SOLD)|| isEqualsTo(this.getKind(), SERVICE_CONSTANTS.PRICE_SOLD_B));}
JoPrice.prototype.isWEEE=function(){return isEqualsTo(this.getKind(), SERVICE_CONSTANTS.PRICE_WEEE);}
JoPrice.prototype.getBegin=function(){return this.begin;}
JoPrice.prototype.getEnd=function(){return this.end;}
JoPrice.prototype.getValue=function(){return this.value;}
JoPrice.prototype.getPriceCurrencyId=function(){return this.currencyId;}
JoPrice.prototype.getPriceCurrency=function(){if(getServiceContent(this.getServiceId())==null){return null;}return(getServiceContent(this.getServiceId()).getCurrency(this.getCurrencyId()));}
JoPrice.prototype.getDateFormat=function(){var oDateFormat=null;if(getServiceContent(this.getServiceId())==null){return null;}
oDateFormat=getServiceContent(this.getServiceId()).getDateFormat(SERVICE_CONSTANTS.DATE_FORMAT_KIND_PRICE);if(oDateFormat==null){return null;}return(oDateFormat.format);}
JoPrice.prototype.getHomogeneous=function(){return this.homogeneous;}
JoPrice.prototype.isDateHomogeneous=function(){if(this.getHomogeneous()==null){return false;}return this.homogeneous.isPeriodHomo();}
JoPrice.prototype.isBeginDateHomogeneous=function(){if(this.getHomogeneous()==null){return false;}return this.homogeneous.isBeginHomo();}
JoPrice.prototype.isEndDateHomogeneous=function(){if(this.getHomogeneous()==null){return false;}return this.homogeneous.isEndHomo();}
JoPrice.prototype.isPriceHomogeneous=function(){if(this.getHomogeneous()==null){return false;}return this.homogeneous.isPriceHomo();}
JoPrice.prototype.isKindHomogeneous=function(){if(this.getHomogeneous()==null){return false;}return this.homogeneous.isKindHomo();}
JoPrice.prototype.getMarkdown=function(){return this.markdown;}
JoPrice.prototype.isRespectMinReduceThreshold=function(){return this.minReduce;}
JoPrice.prototype.setKind=function(_kind){this.kind=_kind;}
JoPrice.prototype.setBegin=function(_begin){this.begin=_begin;}
JoPrice.prototype.setEnd=function(_end){this.end=_end;}
JoPrice.prototype.setValue=function(_value){this.value=_value;}
JoPrice.prototype.setCurrency=function(_currency){this.currencyId=_currency;}
JoPrice.prototype.setHomogeneous=function(_homogeneous){this.homogeneous=_homogeneous;}
JoPrice.prototype.setMarkdown=function(_markdown){if(_markdown==null){this.markdown=0;}else{this.markdown=_markdown;}}
JoPrice.prototype.setMinReduce=function(_minReduce){if(_minReduce==null){this.minReduce=true;}else{this.minReduce=_minReduce;}}
JoPrice.prototype.toString=function(){var sToString=null;var sBegin=null;var sEnd=null;var sValue=null;with(this){sToString='Price['+kind+'] ';if(value==null){sToString=sToString+'No value ';}else if(currency==null){sToString=sToString+value.toString();}else{sToString=sToString+currency.formatValue(value);}if(markdown != null){sToString=sToString+' / Markdown -'+markdown+'%';}if(minReduce != null){sToString=sToString+' / MinReduce -'+minReduce+'%';}if(begin==null){sToString=sToString+' / No Begin Date ';}else{sToString=sToString+' / Begin : '+begin.toString();}if(end==null){sToString=sToString+' / No End Date ';}else{sToString=sToString+' / End : '+end.toString();}if(homogeneous != null){sToString=sToString+' / '+homogeneous.toString();}return sToString;}}
var PRICE_NODE_NAME='prc';var PRICE_BKO_KIND_NODE_NAME='prc-bko-knd';var PRICE_HOMO_NODE_NAME='prc-homo';var PRICE_MARKDOWN_NODE_NAME='prc-mkd';var PRICE_MIN_REDUCE_NODE_NAME='min-threshold';var PRICE_FO_KIND_ATTR_NAME='prc-fo-knd';var PRICE_KIND_MAIN_VALUE_NAME='main';var PRICE_KIND_STRIKE_VALUE_NAME='stk';var PRICE_KIND_WEEE_VALUE_NAME='weee';
function getDomToPrice(_oNodePrice, _iServiceId, _sCurrencyId){var oPrice=null;try{if(_oNodePrice==null){return null;}
var sFoPriceKind=getAttributeValue(_oNodePrice, PRICE_FO_KIND_ATTR_NAME);var sBkoPriceKind=getChildNodeValue(_oNodePrice, PRICE_BKO_KIND_NODE_NAME);var sMarkdown=getChildNodeValue(_oNodePrice, PRICE_MARKDOWN_NODE_NAME);var sMinReduce=getChildNodeValue(_oNodePrice, PRICE_MIN_REDUCE_NODE_NAME);var oValueNode=getDomToValue(getChild(_oNodePrice, VALUE_NODE_NAME));var oHomoNode=getDomToHomogeneous(getChild(_oNodePrice, PRICE_HOMO_NODE_NAME));var oBeginDate=getDomToDateTime(getChildWithAttribute(_oNodePrice, DATE_NODE_NAME, DATE_ATTR_KIND, SERVICE_CONSTANTS.DATE_KIND_PRICE_BEGIN), _iServiceId);var oEndDate=getDomToDateTime(getChildWithAttribute(_oNodePrice, DATE_NODE_NAME, DATE_ATTR_KIND, SERVICE_CONSTANTS.DATE_KIND_PRICE_END), _iServiceId);if(oEndDate==null){oEndDate=new JoDate(_iServiceId);oEndDate.setKind(SERVICE_CONSTANTS.DATE_KIND_PRICE_END);oEndDate.setDay(SERVICE_CONSTANTS.END_DATE_DAY);oEndDate.setMonth(SERVICE_CONSTANTS.END_DATE_MONTH);oEndDate.setYear(SERVICE_CONSTANTS.END_DATE_YEAR);oEndDate.setHour(SERVICE_CONSTANTS.END_DATE_HOUR);oEndDate.setMinute(SERVICE_CONSTANTS.END_DATE_MINUTE);oEndDate.setSecond(SERVICE_CONSTANTS.END_DATE_SECONDE);}
oPrice=new JoPrice(_iServiceId);oPrice.setKind(sBkoPriceKind);oPrice.setBegin(oBeginDate);oPrice.setEnd(oEndDate);oPrice.setValue(oValueNode);oPrice.setCurrency(_sCurrencyId);oPrice.setHomogeneous(oHomoNode);oPrice.setMarkdown(sMarkdown);oPrice.setMinReduce(sMinReduce);return oPrice;}catch(e){return null;}}
function JoPrices(_serviceId){this.serviceId=_serviceId;this.main=null;this.strike=null;this.weee=null;this.currencyId=null;}
JoPrices.prototype.getServiceId=function(){return this.serviceId;}
JoPrices.prototype.getMain=function(){return this.main;}
JoPrices.prototype.getStrike=function(){return this.strike;}
JoPrices.prototype.getWeee=function(){return this.weee;}
JoPrices.prototype.getCurrency=function(){if(getServiceContent(this.getServiceId())==null){return null;}return(getServiceContent(this.getServiceId()).getCurrency(this.getCurrencyId()));}
JoPrices.prototype.getDateFormat=function(){var oDateFormat=null;if(getServiceContent(this.getServiceId())==null){return null;}
oDateFormat=getServiceContent(this.getServiceId()).getDateFormat(SERVICE_CONSTANTS.DATE_FORMAT_KIND_PRICE);if(oDateFormat==null){return null;}return(oDateFormat.format);}
JoPrices.prototype.getCurrencyId=function(){return this.currencyId;}
JoPrices.prototype.setMain=function(_main){this.main=_main;}
JoPrices.prototype.setStrike=function(_strike){this.strike=_strike;}
JoPrices.prototype.setWeee=function(_weee){this.weee=_weee;}
JoPrices.prototype.setCurrency=function(_currency){this.currencyId=_currency;}
var PRICE_CURRENCY_NODE_NAME='prc-cur';var PRICES_NODE_NAME='prices';
function getDomToPrices(_serviceId, _oNodePrices){var oPrices=null;var oServiceCollector=getServiceCollector();try{if(_oNodePrices==null || oServiceCollector==null){return null;}
oPrices=new JoPrices(_serviceId);oPrices.setCurrency(getChildNodeValue(_oNodePrices, PRICE_CURRENCY_NODE_NAME));if(oPrices.getCurrencyId()==null){return null;}
oPrices.setMain(getDomToPrice(getChildWithAttribute(_oNodePrices, PRICE_NODE_NAME, PRICE_FO_KIND_ATTR_NAME, PRICE_KIND_MAIN_VALUE_NAME), oPrices.getServiceId(), oPrices.getCurrencyId()));if(oPrices.getMain()==null){return null;}
oPrices.setStrike(getDomToPrice(getChildWithAttribute(_oNodePrices, PRICE_NODE_NAME, PRICE_FO_KIND_ATTR_NAME, PRICE_KIND_STRIKE_VALUE_NAME), oPrices.getServiceId(), oPrices.getCurrencyId()));oPrices.setWeee(getDomToPrice(getChildWithAttribute(_oNodePrices, PRICE_NODE_NAME, PRICE_FO_KIND_ATTR_NAME, PRICE_KIND_WEEE_VALUE_NAME), oPrices.getServiceId(), oPrices.getCurrencyId()));return oPrices;}catch(e){return null;}}
function JoMarketing(){this.brand=null;this.brand_kind=null;this.literal=null;this.picture=null;this.designFor=null;this.unit=null;this.weight=null;this.url=null;this.kind=null;}
JoMarketing.prototype.getBrand=function(){return this.brand;}
JoMarketing.prototype.getBrandKind=function(){return this.brand_kind;}
JoMarketing.prototype.isPassionBrand=function(){if(this.getBrandKind()==null){return false;}return this.getBrandKind()==SERVICE_CONSTANTS.BRAND_KIND_PASSION;}
JoMarketing.prototype.isAMIBrand=function(){if(this.getBrandKind()==null){return false;}return this.getBrandKind()==SERVICE_CONSTANTS.BRAND_KIND_AMI;}
JoMarketing.prototype.getLiteral=function(){return this.literal;}
JoMarketing.prototype.getPicture=function(){return this.picture;}
JoMarketing.prototype.getDesignFor=function(){return this.designFor;}
JoMarketing.prototype.getUnit=function(){return this.unit;}
JoMarketing.prototype.getWeight=function(){return this.weight;}
JoMarketing.prototype.getUrl=function(){return this.url;}
JoMarketing.prototype.getSurroundedUrl=function(_surroundCharacter){if(this.url==null){return null;}if(_surroundCharacter==null){return this.getUrl();}return _surroundCharacter+this.url+_surroundCharacter;}
JoMarketing.prototype.isBlue=function(){return isEqualsTo(this.kind, 'B');}
JoMarketing.prototype.setBrand=function(_brand){this.brand=_brand;}
JoMarketing.prototype.setBrandKind=function(_brandKind){this.brand_kind=_brandKind;}
JoMarketing.prototype.setLiteral=function(_literal){this.literal=_literal;}
JoMarketing.prototype.setPicture=function(_picture){this.picture=_picture;}
JoMarketing.prototype.setDesignFor=function(_designFor){this.designFor=_designFor;}
JoMarketing.prototype.setUnit=function(_unit){this.unit=_unit;}
JoMarketing.prototype.setWeight=function(_weight){this.weight=_weight;}
JoMarketing.prototype.setUrl=function(_url){this.url=_url;}
JoMarketing.prototype.setBlue=function(_bBlue){if(isTrue(_bBlue)){this.kind='B';}else{this.kind='A';}}
JoMarketing.prototype.setKind=function(_kind){this.kind=_kind;}
var MARKETING_NODE_NAME='marketing';var MRK_BRAND_NODE_NAME='mrk-brd';var MRK_BRAND_KIND_NODE_NAME='mrk-brd-knd';var MRK_KIND_NODE_NAME='mrk-mkd';var MRK_LITERAL_NODE_NAME='mrk-lit';var MRK_PICTURE_NODE_NAME='mrk-pic';var MRK_UNIT_NODE_NAME='mrk-unt';var MRK_WEIGHT_NODE_NAME='mrk-wgt';var MRK_DESIGN_FOR_NODE_NAME='mrk-dnf';var MRK_URL_NODE_NAME='mrk-url';
function getDomToMarketing(_oNodeMarketing){var oMarketing=null;try{if(_oNodeMarketing==null){return null;}
oMarketing=new JoMarketing();oMarketing.setBrand(getChildNodeValue(_oNodeMarketing, MRK_BRAND_NODE_NAME));oMarketing.setBrandKind(getChildNodeValue(_oNodeMarketing, MRK_BRAND_KIND_NODE_NAME));oMarketing.setLiteral(getChildNodeValue(_oNodeMarketing, MRK_LITERAL_NODE_NAME));oMarketing.setPicture(getChildNodeValue(_oNodeMarketing, MRK_PICTURE_NODE_NAME));oMarketing.setDesignFor(getChildNodeValue(_oNodeMarketing, MRK_DESIGN_FOR_NODE_NAME));oMarketing.setUnit(getChildNodeValue(_oNodeMarketing, MRK_UNIT_NODE_NAME));oMarketing.setWeight(getChildNodeValue(_oNodeMarketing, MRK_WEIGHT_NODE_NAME));oMarketing.setUrl(getChildNodeValue(_oNodeMarketing, MRK_URL_NODE_NAME));oMarketing.setKind(getChildNodeValue(_oNodeMarketing, MRK_KIND_NODE_NAME));return oMarketing;}catch(e){return null;}}
function JoMix(){this.avaibility=null;this.range=null;this.stock=null;this.step=null;}
JoMix.prototype.getAvaibility=function(){return this.avaibility;}
JoMix.prototype.getRange=function(){return this.range;}
JoMix.prototype.getStep=function(){return this.step;}
JoMix.prototype.getStock=function(){return this.stock;}
JoMix.prototype.setAvaibility=function(_avaibility){this.avaibility=_avaibility;}
JoMix.prototype.setRange=function(_range){this.range=_range;}
JoMix.prototype.setStep=function(_step){this.step=_step;}
JoMix.prototype.setStock=function(_stock){this.stock=_stock;}
var MIX_NODE_NAME='mix';var MIX_AVAIBILITY_NODE_NAME='mix-avl';var MIX_RANGE_NODE_NAME='mix-rng';var MIX_STOCK_NODE_NAME='mix-stk';var MIX_STEP_NODE_NAME='mix-stp';
function getDomToMix(_oNodeMix){var oMix=null;try{if(_oNodeMix==null){return null;}
oMix=new JoMix();oMix.setAvaibility(getChildNodeValue(_oNodeMix, MIX_AVAIBILITY_NODE_NAME));oMix.setRange(getChildNodeValue(_oNodeMix, MIX_RANGE_NODE_NAME));oMix.setStep(getChildNodeValue(_oNodeMix, MIX_STEP_NODE_NAME));oMix.setStock(getChildNodeValue(_oNodeMix, MIX_STOCK_NODE_NAME));return oMix;}catch(e){return null;}}
function JoChild(){this.id=null;this.order=null;this.step=null;}
JoChild.prototype.getId=function(){return this.id;}
JoChild.prototype.getOrder=function(){return this.order;}
JoChild.prototype.getStep=function(){return this.step;}
JoChild.prototype.getKey=function(){if(this.id==null){return null;}return '#'+this.id+'#';}
JoChild.prototype.setId=function(_id){this.id=_id;}
JoChild.prototype.setOrder=function(_order){this.order=_order;}
JoChild.prototype.setStep=function(_step){this.step=_step;}
function JoChildren(){this.children=new Array();}
JoChildren.prototype.addChild=function(_child){if(_child==null){return;}if(_child.getKey()==null){return;}if(this.children[_child.getKey()]==null){this.children.push(_child.getKey());}this.children[_child.getKey()]=_child;}
JoChildren.prototype.getChild=function(_id){return this.children['#'+_id+'#'];}
JoChildren.prototype.getChildrenId=function _getChildrenChildId(){var lChildrenId=new Array();var i=0;for(i=0;i<this.children.length;i++){if(this.children[i] != null && this.children[this.children[i]] != null){lChildrenId.push(this.children[i]);lChildrenId[this.children[i]]=this.children[this.children[i]].getId();}}return lChildrenId;}
JoChildren.prototype.getChildOrder=function(_id){var _child=this.getChild(_id);if(_child==null){return null;}return _child.getOrder();}
JoChildren.prototype.getChildStep=function(_id){var _child=this.getChild(_id);if(_child==null){return null;}return _child.getStep();}
JoChildren.prototype.isContainsChild=function(_id){return isNotEqualsTo(this.getChild(_id), null);}
var CHILDREN_NODE_NAME='children';var CHILD_NODE_NAME='child';var CHILD_ORDER_NODE_NAME='chd-order';var CHILD_STEP_NODE_NAME='chd-stp';var CHILD_ID_ATTR_NAME='id';
function getDomToChildren(_oNodeChildren){var i=0;var oChildren=new JoChildren();var oChild=null;try{if(_oNodeChildren==null){return null;}
var oChildrenNodes=_oNodeChildren.getElementsByTagName(CHILD_NODE_NAME);for(i=0;i < oChildrenNodes.length;i++){var _id=getAttributeValue(oChildrenNodes[i], CHILD_ID_ATTR_NAME);var _step=getChildNodeValue(oChildrenNodes[i], CHILD_STEP_NODE_NAME);var _order=getChildNodeValue(oChildrenNodes[i], CHILD_ORDER_NODE_NAME);if(_id != null){oChild=new JoChild();oChild.setId(_id);oChild.setStep(_step);oChild.setOrder(_order);oChildren.addChild(oChild);}}return oChildren;}catch(e){return null;}}
function JoVariations(){this.variations=new Array();}
JoVariations.prototype.addVariation=function(_id, _literal){var lLiterals=null;if(_id==null || _literal==null){return;}if(this.variations['#'+_id+'#']==null){this.variations.push('#'+_id+'#');lLiterals=new Array();}else{lLiterals=this.variations['#'+_id+'#'];}
lLiterals.push(_literal);this.variations['#'+_id+'#']=lLiterals;}
JoVariations.prototype.getVariations=function(_id){return this.variations['#'+_id+'#'];}
JoVariations.prototype.getBiggestLiteral=function(_id){var sLiteral=null;var i=0;var lLiterals=this.variations['#'+_id+'#'];if(lLiterals==null){return null;}for(i=0;i < lLiterals.length;i++){if(sLiteral==null){sLiteral=lLiterals[i];}else if(lLiterals[i].length > sLiteral.lengh){sLiteral=lLiterals[i];}}return sLiteral;}
var VARIATIONS_NODE_NAME='vts';var VARIATION_NODE_NAME='vrt';var VARIATION_LITERAL_NODE_NAME='vrt-lit';var VARIATION_ID_ATTR_NAME='vrt-id';
function getDomToVariations(_oNodeVariations){var i=0;var j=0;var oVariations=new JoVariations();try{if(_oNodeVariations==null){return null;}
var oChildrenVariations=_oNodeVariations.getElementsByTagName(VARIATION_NODE_NAME);for(i=0;i < oChildrenVariations.length;i++){var _id=getAttributeValue(oChildrenVariations[i], VARIATION_ID_ATTR_NAME);var oLiterals=oChildrenVariations[i].getElementsByTagName(VARIATION_LITERAL_NODE_NAME);for(j=0;j < oLiterals.length;j++){oVariations.addVariation(_id, getNodeValue(oLiterals[j]));}}return oVariations;}catch(e){return null;}}
function JoItem(_serviceId){this.serviceId=_serviceId;this.id=null;this.kind=null;this.familyId=null;this.source=null;this.state=null;this.order=null;this.mix=null;this.prices=null;this.marketing=null;this.children=null;this.variations=null;}
JoItem.prototype.getServiceId=function(){return this.serviceId;}
JoItem.prototype.getId=function(){return this.id;}
JoItem.prototype.isModel=function(){return isEqualsTo(this.kind, SERVICE_CONSTANTS.ITEM_KIND_MODEL);}
JoItem.prototype.isArticle=function(){return isEqualsTo(this.kind, SERVICE_CONSTANTS.ITEM_KIND_ARTICLE);}
JoItem.prototype.getKind=function(){return this.kind;}
JoItem.prototype.getFamilyId=function(){return this.familyId;}
JoItem.prototype.isEnable=function(){return this.state;}
JoItem.prototype.isCentral=function(){return isEqualsTo(this.source, SERVICE_CONSTANTS.CENTRAL_SOURCE);}
JoItem.prototype.isStore=function(){return isEqualsTo(this.source, SERVICE_CONSTANTS.STORE_SOURCE);}
JoItem.prototype.getSource=function(){return this.source;}
JoItem.prototype.getOrder=function(){return this.order;}
JoItem.prototype.getMix=function(){return this.mix;}
JoItem.prototype.getAvaibility=function(){if(this.getMix()==null){return null;}return this.getMix().getAvaibility();}
JoItem.prototype.isAvailable=function(){return isEqualsTo(this.getAvaibility(), SERVICE_CONSTANTS.AVAILABLE);}
JoItem.prototype.isPartiallyAvailable=function(){return isEqualsTo(this.getAvaibility(), SERVICE_CONSTANTS.PARTIALLY_AVAILABLE);}
JoItem.prototype.isUnavailable=function(){return isEqualsTo(this.getAvaibility(), SERVICE_CONSTANTS.UNAVAILABLE);}
JoItem.prototype.getRange=function(){if(this.getMix()==null){return null;}return this.getMix().getRange();}
JoItem.prototype.isInRange=function(){return isEqualsTo(this.getRange(), SERVICE_CONSTANTS.IN_RANGE);}
JoItem.prototype.isPartiallyInRange=function(){return isEqualsTo(this.getRange(), SERVICE_CONSTANTS.PARTIALLY_IN_RANGE);}
JoItem.prototype.isNotInRange=function(){return isEqualsTo(this.getRange(), SERVICE_CONSTANTS.NOT_IN_RANGE);}
JoItem.prototype.getStep=function(){if(this.getMix()==null){return null;}return this.getMix().getStep();}
JoItem.prototype.isStepHomogeneous=function(){return isNotEqualsTo(this.getStep, -1);}
JoItem.prototype.getStock=function(){if(this.getMix()==null){return null;}return this.getMix().getStock();}
JoItem.prototype.getPrices=function(){return this.prices;}
JoItem.prototype.getMainPrice=function(){if(this.getPrices()==null){return null;}return this.getPrices().getMain();}
JoItem.prototype.getStrikePrice=function(){if(this.getPrices()==null){return null;}return this.getPrices().getStrike();}
JoItem.prototype.getWeeePrice=function(){if(this.getPrices()==null){return null;}return this.getPrices().getWeee();}
JoItem.prototype.getMarketing=function(){return this.marketing;}
JoItem.prototype.getBrand=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().getBrand();}
JoItem.prototype.getLiteral=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().getLiteral();}
JoItem.prototype.getPicture=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().getPicture();}
JoItem.prototype.getDesignFor=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().getDesignFor();}
JoItem.prototype.getUrl=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().getUrl();}
JoItem.prototype.getUnit=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().getUnit();}
JoItem.prototype.getWeight=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().getWeight();}
JoItem.prototype.getSurroundedUrl=function(_surroundCharacter){if(this.getMarketing()==null){return null;}return this.getMarketing().getSurroundedUrl(_surroundCharacter);}
JoItem.prototype.isBlue=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().isBlue();}
JoItem.prototype.isPassionBrand=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().isPassionBrand();}
JoItem.prototype.isAMIBrand=function(){if(this.getMarketing()==null){return null;}return this.getMarketing().isAMIBrand();}
JoItem.prototype.setId=function(_id){this.id=_id;}
JoItem.prototype.setKind=function(_kind){this.kind=_kind;}
JoItem.prototype.setFamilyId=function(_familyId){this.familyId=_familyId;}
JoItem.prototype.setSource=function(_source){this.source=_source;}
JoItem.prototype.setState=function(_state){this.state=_state;}
JoItem.prototype.setOrder=function(_order){this.order=_order;}
JoItem.prototype.setMix=function(_mix){this.mix=_mix;}
JoItem.prototype.setPrices=function(_prices){this.prices=_prices;}
JoItem.prototype.setMarketing=function(_marketing){this.marketing=_marketing;}
JoItem.prototype.setChildren=function(_children){this.children=_children;}
JoItem.prototype.setVariations=function(_variations){this.variations=_variations;}
JoItem.prototype.getChildren=function(){if(this.children==null){return null;}return this.children.getChildrenId();}
JoItem.prototype.getChildOrder=function(_id){if(this.children==null){return null;}return this.children.getChildOrder(_id);}
JoItem.prototype.getChildStep=function(_id){if(this.children==null){return null;}return this.children.getChildStep(_id);}
JoItem.prototype.isContainsChild=function(_id){if(this.children==null){return false;}return this.children.isContainsChild(_id);}
JoItem.prototype.getVariations=function(){return this.variations;}
JoItem.prototype.getChildVariations=function(_id){var oVariations=this.getVariations();if(oVariations==null){return null;}return oVariations.getVariations(_id);}
JoItem.prototype.getChildBiggestLiteral=function(_id){var oVariations=this.getVariations();if(oVariations==null){return null;}return oVariations.getBiggestLiteral(_id);}
JoItem.prototype.isRuleEnable=function(_name, _defaultValue){var oServiceContent=getServiceContent(this.getServiceId());if(oServiceContent==null){return _defaultValue;}
var oRuleSet=oServiceContent.getRuleSet();if(oRuleSet==null){return _defaultValue;}
var oMainPrice=this.getMainPrice();if(oMainPrice==null){return _defaultValue;}
var oValue=null;if(this.isCentral()){oValue=oRuleSet.getRuleValue(SERVICE_CONSTANTS.CENTRAL_RULE, this.getStep(), oMainPrice.getKind(), _name);}else if(this.isStore()){oValue=oRuleSet.getRuleValue(SERVICE_CONSTANTS.STORE_RULE, this.getStep(), oMainPrice.getKind(), _name);}if(oValue==null){return _defaultValue;}return oValue;}
JoItem.prototype.isGotRule=function(_name){var oValue=this.isRuleEnable(_name, null);return(oValue != null);}
JoItem.prototype.isBDFR1=function(){with(this){if(getMainPrice()==null){return false;}if(!getMainPrice().isPromo()&& !getMainPrice().isSold()){return false;}if(isBDFR2()){return false;}if(getStrikePrice()!= null){return false;}return true;}}
JoItem.prototype.isBDFR2=function(){with(this){if(getMainPrice()==null){return false;}if(getMainPrice().kind==null){return false;}if(getMainPrice().kind==SERVICE_CONSTANTS.PRICE_SOLD_B || getMainPrice().kind==SERVICE_CONSTANTS.PRICE_PROMO_B){return true;}return false;}}
var ITEM_NODE_NAME='item';var ITEM_ORDER_NODE_NAME='order';var ITEM_ID_ATTR_NAME='id';var ITEM_KIND_ATTR_NAME='knd';var ITEM_FAM_ATTR_NAME='fam';var ITEM_SOURCE_ATTR_NAME='src';var ITEM_STATE_ATTR_NAME='state';
function getDomToItem(_serviceId, _oNodeItem){var oItem=null;if(_oNodeItem==null){return null;}try{oItem=new JoItem(_serviceId);oItem.setId(getAttributeValue(_oNodeItem, ITEM_ID_ATTR_NAME));oItem.setKind(getAttributeValue(_oNodeItem, ITEM_KIND_ATTR_NAME));oItem.setSource(getAttributeValue(_oNodeItem, ITEM_SOURCE_ATTR_NAME));oItem.setState(isEqualsTo(getAttributeValue(_oNodeItem, ITEM_STATE_ATTR_NAME), 'enable'));oItem.setFamilyId(getAttributeValue(_oNodeItem, ITEM_FAM_ATTR_NAME));oItem.setOrder(getChildNodeValue(_oNodeItem, ITEM_ORDER_NODE_NAME));if(oItem.getId()==null || oItem.getSource()==null || oItem.isEnable()==null || oItem.getKind()==null){return null;}
oItem.setMix(getDomToMix(getChild(_oNodeItem, MIX_NODE_NAME)));oItem.setPrices(getDomToPrices(_serviceId, getChild(_oNodeItem, PRICES_NODE_NAME)));oItem.setMarketing(getDomToMarketing(getChild(_oNodeItem, MARKETING_NODE_NAME)));oItem.setChildren(getDomToChildren(getChild(_oNodeItem, CHILDREN_NODE_NAME)));oItem.setVariations(getDomToVariations(getChild(_oNodeItem, VARIATIONS_NODE_NAME)));return oItem;}catch(e){return;}}
function JoItems(_serviceId){this.serviceId=_serviceId;this.lItems=new Array();}
JoItems.prototype.getServiceId=function _getItemsServiceId(){return this.serviceId;}
JoItems.prototype.getItem=function(_id){if(_id==null){return null;}return this.lItems['#'+_id+'#'];}
JoItems.prototype.getItems=function(){return this.lItems;}
JoItems.prototype.isEnable=function(_id){var oItem=this.getItem(_id);if(oItem==null){return false;}return isTrue(oItem.isEnable());}
JoItems.prototype.addItem=function(_item){if(_item==null){return;}if(_item.getId()==null){return;}if(this.lItems['#'+_item.getId()+'#']==null){this.lItems.push('#'+_item.getId()+'#');}this.lItems['#'+_item.getId()+'#']=_item;}
JoItems.prototype.getSize=function(){return this.lItems.length;}
var ITEMS_NODE_NAME='items';
function getDomToItems(_serviceId, _oNodeItems){var i=0;if(_serviceId==null){return null;}if(_oNodeItems==null){return null;}try{var oItems=new JoItems(_serviceId);var lNodeItems=_oNodeItems.getElementsByTagName(ITEM_NODE_NAME);for(i=0;i < lNodeItems.length;i++){var oItem=getDomToItem(_serviceId, lNodeItems[i]);oItems.addItem(oItem);}return oItems;}catch(e){return null;}}
function getRulesKey(_source, _step, _kind){if(_source==null || _step==null || _kind==null){return null;}return '#'+_source+'#'+_step+'#'+_kind+'#';}
function JoRule(){this.name=null;this.value=null;}
JoRule.prototype.getName=function(){return this.name;}
JoRule.prototype.getValue=function(){return this.value;}
JoRule.prototype.setName=function(_name){this.name=_name;}
JoRule.prototype.setValue=function(_value){this.value=_value;}
function JoRules(){this.source=null;this.step=null;this.kind=null;this.rules=new Array();}
JoRules.prototype.getKey=function(){return getRulesKey(this.source, this.step, this.kind);}
JoRules.prototype.getSource=function(){return this.source;}
JoRules.prototype.getStep=function(){return this.step;}
JoRules.prototype.getKind=function(){return this.kind;}
JoRules.prototype.setSource=function(_source){this.source=_source;}
JoRules.prototype.setStep=function(_step){this.step=_step;}
JoRules.prototype.setKind=function(_kind){this.kind=_kind;}
JoRules.prototype.addRule=function(_rule){if(_rule==null){return;}if(_rule.getName()==null){return;}if(this.rules['#'+_rule.getName()+'#']==null){this.rules.push('#'+_rule.getName()+'#');}this.rules['#'+_rule.getName()+'#']=_rule;}
JoRules.prototype.getRule=function(_name){return this.rules['#'+_name+'#'];}
JoRules.prototype.getRuleValue=function(_name){if(this.getRule(_name)==null){return null;}return this.getRule(_name).getValue();}
function JoRuleSet(){this.rules=new Array();}
JoRuleSet.prototype.addRule=function(_source, _step, _kind, _name, _value){var sKey=getRulesKey(_source, _step, _kind);var oRules=null;var oRule=null;if(sKey==null){return;}if(this.rules[sKey]==null){this.rules.push(sKey);}else{oRules=this.rules[sKey];}if(oRules==null){oRules=new JoRules();oRules.setSource(_source);oRules.setStep(_step);oRules.setKind(_kind);}
oRule=new JoRule();oRule.setName(_name);oRule.setValue(_value);oRules.addRule(oRule);this.rules[sKey]=oRules;}
JoRuleSet.prototype.getRules=function(_source, _step, _kind){return this.rules[getRulesKey(_source, _step, _kind)];}
JoRuleSet.prototype.getRule=function(_source, _step, _kind, _name){var oRules=this.getRules(_source, _step, _kind);if(oRules==null){return null;}return oRules.getRule(_name);}
JoRuleSet.prototype.getRuleValue=function(_source, _step, _kind, _name){var oRules=this.getRules(_source, _step, _kind);if(oRules==null){return null;}return oRules.getRuleValue(_name);}
var RULES_SET_NODE_NAME='rules-set';var RULES_NODE_NAME='rules';var RULE_NODE_NAME='rule';var RULE_NAME_ATTR_NAME='name';var RULES_KIND_ATTR_NAME='knd';var RULES_SOURCE_ATTR_NAME='src';var RULES_STEP_ATTR_NAME='stp';
function getDomToRuleSet(_oNodeRuleSet){var i=0;var j=0;var source=null;var step=null;var kind=null;var name=null;var value=null;var oRuleSet=new JoRuleSet();if(_oNodeRuleSet==null){return null;}try{var lNodeRules=_oNodeRuleSet.getElementsByTagName(RULES_NODE_NAME);for(i=0;i < lNodeRules.length;i++){source=getAttributeValue(lNodeRules[i], RULES_SOURCE_ATTR_NAME);step=getAttributeValue(lNodeRules[i], RULES_STEP_ATTR_NAME);kind=getAttributeValue(lNodeRules[i], RULES_KIND_ATTR_NAME);var lNodeRule=lNodeRules[i].getElementsByTagName(RULE_NODE_NAME);for(j=0;j < lNodeRule.length;j++){name=getAttributeValue(lNodeRule[j], RULE_NAME_ATTR_NAME);value=getNodeValue(lNodeRule[j]);oRuleSet.addRule(source, step, kind, name, isEqualsTo(value, 'true'));}}return oRuleSet;}catch(e){return null;}}
function JoServiceContent(_serviceId){this.serviceId=_serviceId;this.items=null;this.currencies=null;this.dateFormats=null;this.ruleSet=null;this.disponibilities=null;this.switches=null;this.thirds=null;}
JoServiceContent.prototype.getDisponibilities=function(){return this.disponibilities;}
JoServiceContent.prototype.getSwitches=function(){return this.switches;}
JoServiceContent.prototype.getThirds=function(){return this.thirds;}
JoServiceContent.prototype.getServiceId=function(){return this.serviceId;}
JoServiceContent.prototype.getItems=function(){return this.items;}
JoServiceContent.prototype.getItem=function(_id){if(this.getItems()==null){return null;}return this.getItems().getItem(_id);}
JoServiceContent.prototype.getItemsList=function(){if(this.getItems()==null){return null;}return this.getItems().getItems();}
JoServiceContent.prototype.getSwitches=function(){return this.switches;}
JoServiceContent.prototype.getSwitchByKey=function(_key){if(this.getSwitches()==null){return null;}return this.getSwitches().getSwitchByKey(_key);}
JoServiceContent.prototype.getSwitch=function(_name, _thirdKind, _thirdNumber, _thirdSubNumber, _language){if(_name==null || _thirdKind==null || _thirdNumber==null || _thirdSubNumber==null){return null;}
var sKey='#'+_name+'#'+_thirdKind+'#'+_thirdNumber+'#'+_thirdSubNumber+'#';if(_language != null){sKey=sKey+_language+'#';}return this.getSwitchByKey(sKey);}
JoServiceContent.prototype.getSwitchesList=function(){if(this.getSwitches()==null){return null;}return this.getSwitches().getSwitches();}
JoServiceContent.prototype.getThird=function(_key){if(this.getThirds()==null){return null;}return this.getThirds().getThirdByKey(_key);}
JoServiceContent.prototype.getThirdsList=function(){if(this.getThirds()==null){return null;}return this.getThirds().getThirds();}
JoServiceContent.prototype.getCurrencies=function(){return this.currencies;}
JoServiceContent.prototype.getDateFormats=function(){return this.dateFormats;}
JoServiceContent.prototype.getCurrency=function(_id){if(this.getCurrencies()==null){return null;}return this.getCurrencies().getCurrency(_id);}
JoServiceContent.prototype.getDateFormat=function(_kind){if(this.getDateFormats()==null){return null;}return this.getDateFormats().getDateFormat(_kind);}
JoServiceContent.prototype.getRuleSet=function(){return this.ruleSet;}
JoServiceContent.prototype.setDisponibilities=function(_disponibilities){this.disponibilities=_disponibilities;}
JoServiceContent.prototype.setSwitches=function(_switches){this.switches=_switches;}
JoServiceContent.prototype.setThirds=function(_thirds){this.thirds=_thirds;}
JoServiceContent.prototype.setItems=function(_items){this.items=_items;}
JoServiceContent.prototype.setCurrencies=function(_currencies){this.currencies=_currencies;}
JoServiceContent.prototype.setDateFormats=function(_dateFormats){this.dateFormats=_dateFormats;}
JoServiceContent.prototype.setRulesSet=function(_ruleSet){this.ruleSet=_ruleSet;}
var SERVICE_CONTENT_NODE_NAME='service-content';
function getDomToServiceContent(_serviceId, _oNodeServiceContent){if(_serviceId==null){return null;}if(_oNodeServiceContent==null){return null;}try{var oServiceContent=new JoServiceContent(_serviceId);oServiceContent.setCurrencies(getDomToCurrencies(getChild(_oNodeServiceContent, CURRENCIES_NODE_NAME)));oServiceContent.setDateFormats(getDomToDateFormats(getChild(_oNodeServiceContent, FMT_DATES_NODE_NAME)));oServiceContent.setRulesSet(getDomToRuleSet(getChild(_oNodeServiceContent, RULES_SET_NODE_NAME)));oServiceContent.setItems(getDomToItems(_serviceId, getChild(_oNodeServiceContent, ITEMS_NODE_NAME)));oServiceContent.setDisponibilities(getDomToDisponibilities(_serviceId, getChild(_oNodeServiceContent, DISPOS_NODE_NAME)));oServiceContent.setSwitches(getDomToSwitches(_serviceId, getChild(_oNodeServiceContent, SWITCHES_NODE_NAME)));oServiceContent.setThirds(getDomToThirds(_serviceId, getChild(_oNodeServiceContent, THIRDS_NODE_NAME)));return oServiceContent;}catch(e){return null;}}
function JoServiceHeader(){this.sName=null;this.sClient=null;this.oTime=null;this.nbPage=null;this.pageNumber=null;this.modelNumber=null;this.nbModelForPage=null;}
JoServiceHeader.prototype.getName=function(){return this.sName;}
JoServiceHeader.prototype.getClient=function(){return this.sClient;}
JoServiceHeader.prototype.getTime=function(){return this.oTime;}
JoServiceHeader.prototype.getNumberOfPage=function(){return this.nbPage;}
JoServiceHeader.prototype.getPageNumber=function(){return this.pageNumber;}
JoServiceHeader.prototype.getNumberOfModel=function(){return this.modelNumber;}
JoServiceHeader.prototype.getNumberOfModelForAPage=function(){return this.nbModelForPage;}
JoServiceHeader.prototype.setName=function(_sName){this.sName=_sName;}
JoServiceHeader.prototype.setClient=function(_sClient){this.sClient=_sClient;}
JoServiceHeader.prototype.setTime=function(_oTime){this.oTime=_oTime;}
JoServiceHeader.prototype.setNumberOfPage=function(_nbPage){this.nbPage=_nbPage;}
JoServiceHeader.prototype.setPageNumber=function(_pageNumber){this.pageNumber=_pageNumber;}
JoServiceHeader.prototype.setNumberOfModel=function(_modelNumber){this.modelNumber=_modelNumber;}
JoServiceHeader.prototype.setNumberOfModelForAPage=function(_nbModelForPage){this.nbModelForPage=_nbModelForPage;}
var SERVICE_HEADER_NODE_NAME='service-header';var SERVICE_NAME_NODE_NAME='service-name';var SERVICE_CLIENT_NODE_NAME='service-client';var SERVICE_PAGE_NODE_NAME='service-client';var NODE_NAME_PAGE_NUMBER='page-page-number';var NODE_NAME_NUMBER_PAGE='page-number-page';var NODE_NAME_MODEL_PAGE='page-model-page';var NODE_NAME_MODEL_NUMBER='page-model-number';
function getDomToServiceHeader(_oNodeServiceHeader, _iServiceId){var _oServiceHeader=null;try{if(_oNodeServiceHeader==null){return null;}
_oServiceHeader=new JoServiceHeader();_oServiceHeader.setName(getChildNodeValue(_oNodeServiceHeader, SERVICE_NAME_NODE_NAME));_oServiceHeader.setClient(getChildNodeValue(_oNodeServiceHeader, SERVICE_CLIENT_NODE_NAME));_oServiceHeader.setTime(getDomToDateTime(getChildWithAttribute(_oNodeServiceHeader, TIME_NODE_NAME, TIME_ATTR_KIND, SERVICE_CONSTANTS.DATE_KIND_SERVER), _iServiceId));_oServiceHeader.setNumberOfPage(getChildNodeValue(_oNodeServiceHeader, NODE_NAME_NUMBER_PAGE));_oServiceHeader.setPageNumber(getChildNodeValue(_oNodeServiceHeader, NODE_NAME_PAGE_NUMBER));_oServiceHeader.setNumberOfModel(getChildNodeValue(_oNodeServiceHeader, NODE_NAME_MODEL_NUMBER));_oServiceHeader.setNumberOfModelForAPage(getChildNodeValue(_oNodeServiceHeader, NODE_NAME_MODEL_PAGE));if(_oServiceHeader.getName()==null || _oServiceHeader.getClient()==null){return null;}return _oServiceHeader;}catch(e){return null;}}
function JoServiceError(_sMsg, _iId){this.sMsg=_sMsg;this.iId=_iId;}
JoServiceError.prototype.getId=function(){return this.iId;}
JoServiceError.prototype.getMessage=function(){return this.sMsg;}
var SERVICE_ERROR_NODE_NAME='error';var ERROR_ID_ATTR_NAME='error-id';
function getDomToServiceError(_oNode, _iServiceId){var _oServiceError=null;try{if(_oNode==null){return null;}
_iErrorId=getAttributeValue(_oNode, ERROR_ID_ATTR_NAME);_sErrorMsg=getNodeValue(_oNode);_oServiceError=new JoServiceError(_sErrorMsg, _iErrorId);return _oServiceError;}catch(e){return null;}}
function _getCardinalityKey(_joCardinality){if(_joCardinality==null){return null;}if(_joCardinality.getKind()==null){return null;}return '#'+_joCardinality.getKind()+'#';}
function _getCardinalitySubKey(_joCardinality){if(_joCardinality==null){return null;}if(_joCardinality.getKind()==null){return null;}if(_joCardinality.getValue()==null){return null;}return '#'+_joCardinality.getKind()+'#'+_joCardinality.getValue()+'#';}
function JoCardinality(_cardKind, _cardValue, _cardModel){this.sCardKind=_cardKind;this.sCarValue=_cardValue;this.iCardModel=_cardModel;this.children=new Array();}
JoCardinality.prototype.getChildren=function(){return this.children;}
JoCardinality.prototype.addChild=function(_joCardinality){var sIndexKey=null;sIndexKey=_getCardinalitySubKey(_joCardinality);if(sIndexKey==null){return false;}if(this.children[sIndexKey]==null){this.children.push(sIndexKey);}this.children[sIndexKey]=_joCardinality;return true;}
JoCardinality.prototype.getKind=function(){return this.sCardKind;}
JoCardinality.prototype.getValue=function(){return this.sCarValue;}
JoCardinality.prototype.getModelCardinality=function(){return this.iCardModel;}
var CARDS_NODE_NAME="service-cardinalities";var CARD_NODE_NAME="card";var CARD_ATTR_KIND="card-knd";var CARD_ATTR_VALUE="card-name";var CARD_ATTR_CARD="card-value";
function getDomToCardinality(_oNode){var _kind=null;var _value=null;var _card=null;var _joCardinality=null;var _joChildCardinality=null;if(_oNode==null){return null;}
_kind=getAttributeValue(_oNode, CARD_ATTR_KIND);_value=getAttributeValue(_oNode, CARD_ATTR_VALUE);_card=getAttributeValue(_oNode, CARD_ATTR_CARD);if(_kind==null || _value==null || _card==null){return null;}
_joCardinality=new JoCardinality(_kind, _value, _card);if(_oNode.childNodes==null){return _joCardinality;}if(_oNode.childNodes.length==0){return _joCardinality;}for(i=0;i<_oNode.childNodes.length;i++){_oChildNode=_oNode.childNodes[i];if(_oChildNode.nodeName==CARD_NODE_NAME){_joChildCardinality=getDomToCardinality(_oChildNode);if(_joChildCardinality != null){_joCardinality.addChild(_joChildCardinality);}}}return _joCardinality;}
function JoCardinalities(){this.lCardinalities=new Array();this.lCardinalitiesKind=new Array();}
JoCardinalities.prototype.add=function _addCardinalities(_joCardinality){var sIndexKey=null;var sSubIndexKey=null;var lCards=null;sIndexKey=_getCardinalityKey(_joCardinality);sSubIndexKey=_getCardinalitySubKey(_joCardinality);if(sIndexKey==null){return false;}if(sSubIndexKey==null){return false;}with(this){if(lCardinalities[sIndexKey]==null){lCardinalities.push(sIndexKey);}else{lCards=lCardinalities[sIndexKey];}if(lCardinalitiesKind[sIndexKey]==null){lCardinalitiesKind.push(sIndexKey);}
lCardinalitiesKind[sIndexKey]=_joCardinality.getKind();if(lCards==null){lCards=new Array();}if(lCards[sSubIndexKey]==null){lCards.push(sSubIndexKey);lCards[sSubIndexKey]=_joCardinality;}
lCardinalities[sIndexKey]=lCards;}return true;}
JoCardinalities.prototype.getKind=function(){return this.lCardinalitiesKind;}
JoCardinalities.prototype.getCardinalities=function(_kind){return this.lCardinalities['#'+_kind+'#'];}
JoCardinalities.prototype.getCardinality=function(_kind, _name){var i=0;var lCard=this.getCardinalities(_kind);if(_name==null){return null;}if(lCard==null){return null;}for(i=0;i < lCard.length;i++){if(lCard[lCard[i]].getValue()==_name){return lCard[lCard[i]];}}return null;}
function getDomToCardinalities(oNode){var _cardinalities=null;var _cardinality=null;var _oChildrenNode=null;var _oChildNode=null;var i=0;var j=0;if(oNode==null){return new JoCardinalities();}if(oNode.childNodes==null){return new JoCardinalities();}if(oNode.childNodes.length==0){return new JoCardinalities();}
_cardinalities=new JoCardinalities();for(i=0;i<oNode.childNodes.length;i++){if(oNode.childNodes[i].nodeName==CARD_NODE_NAME){_cardinality=getDomToCardinality(oNode.childNodes[i]);if(_cardinality != null){_cardinalities.add(_cardinality);if(_cardinality.children != null){for(j=0;j<_cardinality.children.length;j++){_cardinalities.add(_cardinality.children[_cardinality.children[j]]);}}}}}return _cardinalities;}
function JoThirds(_serviceId){this.serviceId=_serviceId;this.thirds=new Array();}
JoThirds.prototype.addThird=function(_third){if(_third==null){return;}
var sKey=_third.getKey();if(sKey==null){return;}if(this.thirds[sKey]==null){this.thirds.push(sKey);}this.thirds[sKey]=_third;}
JoThirds.prototype.getThird=function(_thirdKind, _thirdNumber, _thirdSubNumber){if(_thirdKind==null || _thirdNumber==null || _thirdSubNumber==null){return null;}
var sKey='#'+_thirdKind+'#'+_thirdNumber+'#'+_thirdSubNumber+'#';return this.thirds[sKey];}
JoThirds.prototype.getThirdByKey=function(_key){if(_key==null){return null;}return this.thirds[_key];}
JoThirds.prototype.getThirds=function(){return this.thirds;}
JoThirds.prototype.getThirdsByKind=function(_sKind){var lNewThirds=new Array();var oNewThird=null;var sKey=null;var i=0;if(_sKind==null){return lNewThirds;}for(i=0;i < this.thirds.length;i++){oNewThird=this.thirds[this.thirds[i]];sKey=oNewThird.getKey();if(sKey != null){if(oNewThird.getKind()==_sKind){if(lNewThirds[sKey]==null){lNewThirds.push(sKey);}
lNewThirds[sKey]=oNewThird;}}}return lNewThirds;}
var THIRDS_NODE_NAME='thirds';
function getDomToThirds(_serviceId, _oNodeThirds){var i=0;var oThirds=new JoThirds();var oThird=new JoThird();if(_oNodeThirds==null){return null;}try{var lNodeThirds=_oNodeThirds.getElementsByTagName(THIRD_NODE_NAME);for(i=0;i < lNodeThirds.length;i++){oThird=getDomToThird(lNodeThirds[i], _serviceId);oThirds.addThird(oThird);}return oThirds;}catch(e){return null;}}
function JoThird(_serviceId){this.serviceId=_serviceId;this.sKind=null;this.sNumber=null;this.sSubNumber=null;this.sOnline=null;this.sName=null;this.sBookable=null;this.dSoldBegin=null;this.dSoldEnd=null;}
JoThird.prototype.getKind=function(){return this.sKind;}
JoThird.prototype.getNumber=function(){return this.sNumber;}
JoThird.prototype.getSubNumber=function(){return this.sSubNumber;}
JoThird.prototype.isOnline=function(){return this.sOnline=='true';}
JoThird.prototype.isBookable=function(){return this.sBookable=='true';}
JoThird.prototype.getName=function(){return this.sName;}
JoThird.prototype.getSoldBegin=function(){return this.dSoldBegin;}
JoThird.prototype.getSoldEnd=function(){return this.dSoldEnd;}
JoThird.prototype.getKey=function(){if(this.sKind==null
|| this.sNumber==null
|| this.sSubNumber==null){return null;}
var sKey='#'+this.sKind+'#'
+this.sNumber+'#'+this.sSubNumber+'#';return sKey;}
JoThird.prototype.setKind=function(_sKind){this.sKind=_sKind;}
JoThird.prototype.setNumber=function(_sNumber){this.sNumber=_sNumber;}
JoThird.prototype.setSubNumber=function(_sSubNumber){this.sSubNumber=_sSubNumber;}
JoThird.prototype.setName=function(_sName){this.sName=_sName;}
JoThird.prototype.setOnline=function(_sOnline){this.sOnline=_sOnline;}
JoThird.prototype.setBookable=function(_sBookable){this.sBookable=_sBookable;}
JoThird.prototype.setSoldBegin=function(_dSoldBegin){this.dSoldBegin=_dSoldBegin;}
JoThird.prototype.setSoldEnd=function(_dSoldEnd){this.dSoldEnd=_dSoldEnd;}
var THIRD_NODE_NAME="third";var THIRD_ATTR_KIND="kind";var THIRD_ATTR_NUMBER="number";var THIRD_ATTR_SUB_NUMBER="sub-number";var THIRD_ATTR_IS_ONLINE="is-online";var THIRD_ATTR_IS_BOOKABLE="is-bookable";
function getDomToThird(_oNode, _serviceId){var _sKind=null;var _sNumber=null;var _sSubNumber=null;var _sIsOnline=null;var _sIsBookable=null;var _sName=null;var oThird=null;if(_oNode==null){return null;}
_sKind=getAttributeValue(_oNode, THIRD_ATTR_KIND);_sNumber=getAttributeValue(_oNode, THIRD_ATTR_NUMBER);_sSubNumber=getAttributeValue(_oNode, THIRD_ATTR_SUB_NUMBER);_sIsOnline=getAttributeValue(_oNode, THIRD_ATTR_IS_ONLINE);_sIsBookable=getAttributeValue(_oNode, THIRD_ATTR_IS_BOOKABLE);if(_sKind==null || _sNumber==null || _sSubNumber==null){return null;}
var oBeginDate=getDomToDateTime(getChildWithAttribute(_oNode, DATE_NODE_NAME, DATE_ATTR_KIND, SERVICE_CONSTANTS.DATE_KIND_SOLD_BEGIN), _serviceId);var oEndDate=getDomToDateTime(getChildWithAttribute(_oNode, DATE_NODE_NAME, DATE_ATTR_KIND, SERVICE_CONSTANTS.DATE_KIND_SOLD_END), _serviceId);_sName=getNodeValue(_oNode);oThird=new JoThird(_serviceId);oThird.setKind(_sKind);oThird.setNumber(_sNumber);oThird.setSubNumber(_sSubNumber);oThird.setName(_sName);oThird.setOnline(_sIsOnline);oThird.setBookable(_sIsBookable);oThird.setSoldBegin(oBeginDate);oThird.setSoldEnd(oEndDate);return oThird;}
function JoSwitches(_serviceId){this.serviceId=_serviceId;this.switches=new Array();}
JoSwitches.prototype.addSwitch=function(_switch){if(_switch==null){return;}
var sKey=_switch.getKey();if(sKey==null){return;}if(this.switches[sKey]==null){this.switches.push(sKey);}this.switches[sKey]=_switch;}
JoSwitches.prototype.getSwitch=function(_name, _thirdKind, _thirdNumber, _thirdSubNumber, _language){if(_name==null || _thirdKind==null || _thirdNumber==null || _thirdSubNumber==null){return null;}
var sKey='#'+_name+'#'+_thirdKind+'#'+_thirdNumber+'#'+_thirdSubNumber+'#';if(_language != null){sKey=sKey+_language+'#';}return this.switches[sKey];}
JoSwitches.prototype.getSwitchByKey=function(_key){if(_key==null){return null;}return this.switches[_key];}
JoSwitches.prototype.getSwitches=function(){return this.switches;}
JoSwitches.prototype.isEnabled=function(_name, _thirdKind, _thirdNumber, _thirdSubNumber, _language){var oSwitch=this.getSwitch(_name, _thirdKind, _thirdNumber, _thirdSubNumber, _language);if(oSwitch==null){return null;}return oSwitch.isEnabled();}
var SWITCHES_NODE_NAME='switches';
function getDomToSwitches(_serviceId, _oNodeSwitches){var i=0;var oSwitches=new JoSwitches();var oSwitch=new JoSwitch();if(_oNodeSwitches==null){return null;}try{var lNodeSwitches=_oNodeSwitches.getElementsByTagName(SWITCH_NODE_NAME);for(i=0;i < lNodeSwitches.length;i++){oSwitch=getDomToSwitch(_serviceId, lNodeSwitches[i]);oSwitches.addSwitch(oSwitch);}return oSwitches;}catch(e){return null;}}
function JoSwitch(_serviceId){this.serviceId=_serviceId;this.sName=null;this.sEnabled=null;this.tThird=null;this.sLanguage=null;}
JoSwitch.prototype.getName=function(){return this.sName;}
JoSwitch.prototype.isEnabled=function(){return this.sEnabled=='true';}
JoSwitch.prototype.getThird=function(){return this.tThird;}
JoSwitch.prototype.getLanguage=function(){return this.sLanguage;}
JoSwitch.prototype.getKey=function(){if(this.sName==null || this.tThird==null
|| this.tThird.getKind()==null
|| this.tThird.getNumber()==null
|| this.tThird.getSubNumber()==null){return null;}
var sKey='#'+this.sName+'#'+this.tThird.getKind()+'#'
+this.tThird.getNumber()+'#'+this.tThird.getSubNumber()+'#';if(this.sLanguage != null){sKey=sKey+this.sLanguage+'#';}return sKey;}
JoSwitch.prototype.setName=function(_sName){this.sName=_sName;}
JoSwitch.prototype.setEnabled=function(_sEnabled){this.sEnabled=_sEnabled;}
JoSwitch.prototype.setThird=function(_tThird){this.tThird=_tThird;}
JoSwitch.prototype.setLanguage=function(_sLanguage){this.sLanguage=_sLanguage;}
var SWITCH_NODE_NAME="switch";var SWITCH_ATTR_STATE="state";var SWITCH_ATTR_LANGUAGE="lng";var SWITCH_ATTR_NAME="name";
function getDomToSwitch(_serviceId, _oNode){var _sName=null;var _sEnabled=null;var _sLanguage=null;var oThird=null;var oSwitch=null;if(_oNode==null){return null;}
_sEnabled=getAttributeValue(_oNode, SWITCH_ATTR_STATE);_sLanguage=getAttributeValue(_oNode, SWITCH_ATTR_LANGUAGE);_sName=getAttributeValue(_oNode, SWITCH_ATTR_NAME);if(_sName==null){return null;}
var oThird=getDomToThird(getChild(_oNode, THIRD_NODE_NAME), _serviceId);oSwitch=new JoSwitch(_serviceId);oSwitch.setName(_sName);oSwitch.setEnabled(_sEnabled);oSwitch.setLanguage(_sLanguage);oSwitch.setThird(oThird);return oSwitch;}
function JoDisponibility(_bState, _dispoThird, _dispoItem){this.bState=_bState;this.dispoThird=_dispoThird;this.dispoItem=_dispoItem;}
JoDisponibility.prototype.getState=function(){return this.bState=='enable';}
JoDisponibility.prototype.getThird=function(){return this.dispoThird;}
JoDisponibility.prototype.getMix=function(){return this.dispoItem.getMix();}
JoDisponibility.prototype.getPrices=function(){return this.dispoItem.getPrices();}
JoDisponibility.prototype.getItem=function(){return this.dispoItem;}
var DISPOS_NODE_NAME="service-disponibilities";var DISPOS_ATTR_ITEM_ID="id";var DISPO_NODE_NAME="dispo";var DISPO_ATTR_STATE="state";
function getDomToDisponibility(_serviceId, oNode){var _dispoItem=null;var _dispoThird=null;var _bState=null;var _oChildNode=null;var i=0;if(oNode==null || oNode.childNodes==null || oNode.childNodes.length==0){return new JoDisponibilities();}
_bState=getAttributeValue(oNode, DISPO_ATTR_STATE);if(_bState==null){return null;}for(i=0;i<oNode.childNodes.length;i++){_oChildNode=oNode.childNodes[i];if(_oChildNode.nodeName==ITEM_NODE_NAME){_dispoItem=getDomToItem(_serviceId, _oChildNode);}if(_oChildNode.nodeName==THIRD_NODE_NAME){_dispoThird=getDomToThird(_oChildNode);}}return new JoDisponibility(_bState, _dispoThird, _dispoItem);}
function JoDisponibilities(_sItemId){this.lDisponibilities=new Array();this.sItemId=_sItemId;}
JoDisponibilities.prototype.addDisponibility=function(_joDisponibility){if(_joDisponibility==null){return false;}this.lDisponibilities.push(_joDisponibility);return true;}
JoDisponibilities.prototype.isEmpty=function(){var i=0;var lDispo=this.getDisponibilities();var dispo=null;if(lCard==null){return true;}for(i=0;i < lDispo.length;i++){dispo=lDispo[i];if(dispo.getState()=='true'){return false;}}return true;}
JoDisponibilities.prototype.getItemId=function(){return this.sItemId;}
JoDisponibilities.prototype.getDisponibilities=function(){return this.lDisponibilities;}
JoDisponibilities.prototype.getDisponibilitiesByState=function(_state, _online){var i=0;var lDispo=this.getDisponibilities();var lDispoResult=new Array();var dispo=null;if(lDispo==null){return null;}for(i=0;i < lDispo.length;i++){dispo=lDispo[i];if(dispo.getState()==_state && dispo.getThird().isOnline()==_online){lDispoResult.push(dispo);}}return lDispoResult;}
function getDomToDisponibilities(_serviceId, oNode){var _disponibilities=null;var _disponibility=null;var _oChildNode=null;var i=0;if(oNode==null
|| oNode.childNodes==null
|| oNode.childNodes.length==0){return null;}
_sItemId=getAttributeValue(oNode, DISPOS_ATTR_ITEM_ID);if(_sItemId==null){return null;}
_disponibilities=new JoDisponibilities(_sItemId);for(i=0;i<oNode.childNodes.length;i++){_oChildNode=oNode.childNodes[i];if(_oChildNode.nodeName==DISPO_NODE_NAME){_disponibility=getDomToDisponibility(_serviceId, _oChildNode);if(_disponibility != null){_disponibilities.addDisponibility(_disponibility);}}}return _disponibilities;}
function JoServiceContext(_rootUrl, _language, _siteId, _centralId, _storeId){this.rootUrl=_rootUrl;this.client='ITOOL_INDEX';this.name=null;this.iSiteId=_siteId;this.iCentralId=_centralId;this.iStoreId=_storeId;this.sLanguage=_language;this.iDepartmentId=null;this.iFamilyId=null;this.lModels=new Array();this.sModelId=null;this.sArticleId=null;this.sThirdKind=null;this.sThirdNumber=null;this.sThirdSubNumber=null;this.sThirdKind2=null;this.sThirdNumber2=null;this.sThirdSubNumber2=null;this.bDataFilter=false;this.lDataFilter=new Array();this.lHomoFilter=new Array();this.lStepFilter=new Array();this.sBrand=null;this.sPriceKind=null;this.sModelKind=null;this.dMinPrice=null;this.dMaxPrice=null;this.iNumPage=null;this.iNumModelForAPage=null;}
JoServiceContext.prototype.getName=function(){return this.name;}
JoServiceContext.prototype.getDepartmentId=function(){return this.iDepartmentId;}
JoServiceContext.prototype.getFamilyId=function(){return this.iFamilyId;}
JoServiceContext.prototype.getModelsId =function(){return this.lModels;}
JoServiceContext.prototype.getModelId=function(){return this.sModelId;}
JoServiceContext.prototype.getArticleId=function(){return this.sArticleId;}
JoServiceContext.prototype.getThirdKind=function(){return this.sThirdKind;}
JoServiceContext.prototype.getThirdNumber=function(){return this.sThirdNumber;}
JoServiceContext.prototype.getThirdSubNumber=function(){return this.sThirdSubNumber;}
JoServiceContext.prototype.getThirdKind2=function(){return this.sThirdKind2;}
JoServiceContext.prototype.getThirdNumber2=function(){return this.sThirdNumber2;}
JoServiceContext.prototype.getThirdSubNumber2=function(){return this.sThirdSubNumber2;}
JoServiceContext.prototype.addStoreId=function(sThirdToAppend){if(this.iStoreId != null && this.iStoreId.length > 0){this.iStoreId+= ","+sThirdToAppend;}else{this.iStoreId=sThirdToAppend;}}
JoServiceContext.prototype.getStoreIdList=function(){return this.iStoreId.split(',');}
JoServiceContext.prototype.getRawStoreData=function(){return this.iStoreId;}
JoServiceContext.prototype.getUrl=function(){with(this){if(isSwitchService(name)){return getSwitchUrl();}else if(isThirdService(name)){return getThirdUrl();}else if(isProductService(name)){return getProductUrl();}}return null;}
JoServiceContext.prototype.getSwitchUrl=function(){var _attrCtx=null;var url='';with(this){if(rootUrl==null){return null;}if(name==null){return null;}if(sThirdKind==null){return null;}if(sThirdNumber==null){return null;}if(sThirdSubNumber==null){return null;}if(name==SERVICE_CONSTANTS.SERVICE_SWITCH){_attrCtx='&thk='+sThirdKind+'&thn='+sThirdNumber+'&ths='+sThirdSubNumber;if(sThirdKind2 != null && sThirdNumber2 != null && sThirdSubNumber2 != null){_attrCtx=_attrCtx+'&tk2='+sThirdKind2+'&tn2='+sThirdNumber2+'&ts2='+sThirdSubNumber2;}}else{return null;}
url=rootUrl+'/service/getSwitchData.do'+'?cli='+client+'&srv='+name+_attrCtx;}return url;}
JoServiceContext.prototype.getThirdUrl=function(){var _attrCtx=null;var url='';with(this){if(rootUrl==null){return null;}if(name==null){return null;}if(sThirdKind==null){return null;}if(sThirdNumber==null){return null;}if(sThirdSubNumber==null){return null;}if(name==SERVICE_CONSTANTS.SERVICE_THIRD_SINGLE
|| name==SERVICE_CONSTANTS.SERVICE_THIRD_CHILDREN
|| name==SERVICE_CONSTANTS.SERVICE_THIRD_PARENTS){_attrCtx='&thk='+sThirdKind+'&thn='+sThirdNumber+'&ths='+sThirdSubNumber;}else{return null;}
url=rootUrl+'/service/getThirdData.do'+'?cli='+client+'&srv='+name+_attrCtx;}return url;}
JoServiceContext.prototype.getProductUrl=function(){var _attrThp=null;var _attrCtx=null;var _attrStp=null;var _attrHom=null;var _attrDat=null;var url='';var i=0;with(this){if(rootUrl==null){return null;}if(name==null){return null;}if(sLanguage==null){return null;}if(iSiteId==null){return null;}if(iCentralId==null){return null;}if(iStoreId==null){_attrThp=iSiteId+'-'+iCentralId;}else{_attrThp=iSiteId+'-'+iCentralId+'-'+iStoreId;}if(name==SERVICE_CONSTANTS.SERVICE_ARTICLE_IDX || name==SERVICE_CONSTANTS.SERVICE_DISPONIBILITIES_IDX){if(sArticleId==null){return null;}_attrCtx='&art='+sArticleId;}else if(name==SERVICE_CONSTANTS.SERVICE_MODEL_IDX){if(sModelId==null){return null;}_attrCtx='&mod='+sModelId;}else if(name==SERVICE_CONSTANTS.SERVICE_MODELS_IDX){if(lModels==null){return null;}if(lModels.length==0){return null;}
_attrCtx='';for(i=0;i < lModels.length;i++){_attrCtx=_attrCtx+'&mod'+i+'='+lModels[lModels[i]];}}else if(name==SERVICE_CONSTANTS.SERVICE_FAMILY_IDX){if(iFamilyId==null){return null;}_attrCtx='&fam='+iFamilyId;}else if(name==SERVICE_CONSTANTS.SERVICE_FAMILIES_IDX){if(iDepartmentId==null){return null;}_attrCtx='&dpt='+iDepartmentId;}else if(name==SERVICE_CONSTANTS.SERVICE_DEPT_IDX){if(iDepartmentId==null){return null;}_attrCtx='&dpt='+iDepartmentId;}else if(name==SERVICE_CONSTANTS.SERVICE_DEPTS_IDX){_attrCtx='';}else{return null;}
url=rootUrl+'/service/getProductData.do'+'?cli='+client+'&srv='+name+'&lng='+sLanguage+'&thp='+_attrThp+_attrCtx;var bFilter=false;if(bDataFilter){url=url+'&dtf=';_attrDat='';if(lDataFilter != null && lDataFilter.length > 0){if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_PRICE] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_PRICE;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_HOT_DATA] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_HOT_DATA;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_SUBSTITUTE] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_SUBSTITUTE;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_MARKETING] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_MARKETING;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_AVAILABLE] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_AVAILABLE;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_MIX] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_MIX;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_CHILDREN] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_CHILDREN;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_VARIATIONS] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_VARIATIONS;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_BDFR] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_BDFR;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_MRK_AVAILABILITY] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_MRK_AVAILABILITY;}if(lDataFilter[SERVICE_CONSTANTS.DATA_FILTER_CARDINALITY] != null){bFilter=true;_attrDat=_attrDat+SERVICE_CONSTANTS.DATA_FILTER_CARDINALITY;}if(bFilter){url=url+_attrDat;}}}
bFilter=false;if(lHomoFilter != null && lHomoFilter.length > 0){_attrHom='&hom=';if(lHomoFilter[SERVICE_CONSTANTS.HOMO_FILTER_BEGIN] != null){bFilter=true;_attrHom=_attrHom+SERVICE_CONSTANTS.HOMO_FILTER_BEGIN;}if(lHomoFilter[SERVICE_CONSTANTS.HOMO_FILTER_END] != null){bFilter=true;_attrHom=_attrHom+SERVICE_CONSTANTS.HOMO_FILTER_END;}if(lHomoFilter[SERVICE_CONSTANTS.HOMO_FILTER_KIND] != null){bFilter=true;_attrHom=_attrHom+SERVICE_CONSTANTS.HOMO_FILTER_KIND;}if(lHomoFilter[SERVICE_CONSTANTS.HOMO_FILTER_VALUE] != null){bFilter=true;_attrHom=_attrHom+SERVICE_CONSTANTS.HOMO_FILTER_VALUE;}if(bFilter){url=url+_attrHom;}}
bFilter=false;if(lStepFilter != null && lStepFilter.length > 0){_attrStp='&stf=';if(isStepFilterEnable(SERVICE_CONSTANTS.STEP_MIXTE)){bFilter=true;_attrStp=_attrStp+SERVICE_CONSTANTS.STEP_MIXTE;}if(isStepFilterEnable(SERVICE_CONSTANTS.STEP_1)){bFilter=true;_attrStp=_attrStp+SERVICE_CONSTANTS.STEP_1;}if(isStepFilterEnable(SERVICE_CONSTANTS.STEP_2)){bFilter=true;_attrStp=_attrStp+SERVICE_CONSTANTS.STEP_2;}if(isStepFilterEnable(SERVICE_CONSTANTS.STEP_3)){bFilter=true;_attrStp=_attrStp+SERVICE_CONSTANTS.STEP_3;}if(isStepFilterEnable(SERVICE_CONSTANTS.STEP_7)){bFilter=true;_attrStp=_attrStp+SERVICE_CONSTANTS.STEP_7;}if(isStepFilterEnable(SERVICE_CONSTANTS.STEP_8)){bFilter=true;_attrStp=_attrStp+SERVICE_CONSTANTS.STEP_8;}if(bFilter){url=url+_attrStp;}}if(sBrand != null){url=url+'&brd='+sBrand;}if(sPriceKind==SERVICE_CONSTANTS.PRICE_KIND_ALL || sPriceKind==SERVICE_CONSTANTS.PRICE_KIND_SOLD || sPriceKind==SERVICE_CONSTANTS.PRICE_KIND_PROMO){url=url+'&pkf='+sPriceKind;}if(sModelKind==SERVICE_CONSTANTS.MODEL_KIND_BLUE || sModelKind==SERVICE_CONSTANTS.MODEL_KIND_ALL){url=url+'&mkf='+sModelKind;}if(dMinPrice != null){url=url+'&mip='+dMinPrice;}if(dMaxPrice != null){url=url+'&map='+dMaxPrice;}if(iNumPage != null){url=url+'&pgn='+iNumPage;}if(iNumModelForAPage != null){url=url+'&nmp='+iNumModelForAPage;}}return url;}
JoServiceContext.prototype.setDepartments=function(){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_DEPTS_IDX;}
JoServiceContext.prototype.setDepartment=function(_iDepartmentId){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_DEPT_IDX;this.iDepartmentId=_iDepartmentId;}
JoServiceContext.prototype.setFamilies=function(_iDepartmentId){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_FAMILIES_IDX;this.iDepartmentId=_iDepartmentId;}
JoServiceContext.prototype.setFamily=function(_iFamilyId){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_FAMILY_IDX;this.iFamilyId=_iFamilyId;}
JoServiceContext.prototype.setThirdSingle=function(_sThirdKind, _sThirdNumber, _sThirdSubNumber){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_THIRD_SINGLE;this.sThirdKind=_sThirdKind;this.sThirdNumber=_sThirdNumber;this.sThirdSubNumber=_sThirdSubNumber;}
JoServiceContext.prototype.setThirdParents=function(_sThirdKind, _sThirdNumber, _sThirdSubNumber){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_THIRD_PARENTS;this.sThirdKind=_sThirdKind;this.sThirdNumber=_sThirdNumber;this.sThirdSubNumber=_sThirdSubNumber;}
JoServiceContext.prototype.setThirdChildren=function(_sThirdKind, _sThirdNumber, _sThirdSubNumber){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_THIRD_CHILDREN;this.sThirdKind=_sThirdKind;this.sThirdNumber=_sThirdNumber;this.sThirdSubNumber=_sThirdSubNumber;}
JoServiceContext.prototype.setSwitches=function(_sThirdKind, _sThirdNumber, _sThirdSubNumber, _sThirdKind2, _sThirdNumber2, _sThirdSubNumber2){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_SWITCH;;this.sThirdKind=_sThirdKind;;this.sThirdNumber=_sThirdNumber;this.sThirdSubNumber=_sThirdSubNumber;this.sThirdKind2=_sThirdKind2;this.sThirdNumber2=_sThirdNumber2;this.sThirdSubNumber2=_sThirdSubNumber2;}
JoServiceContext.prototype.setModels=function(){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_MODELS_IDX;}
JoServiceContext.prototype.addModels=function(_sModelId){if(this.lModels['#'+_sModelId+'#']==null){this.lModels.push('#'+_sModelId+'#');}this.lModels['#'+_sModelId+'#']=_sModelId;}
JoServiceContext.prototype.setModel=function(_sModelId){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_MODEL_IDX;this.sModelId=_sModelId;}
JoServiceContext.prototype.setArticle=function(_sArticleId){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_ARTICLE_IDX;this.sArticleId=_sArticleId;}
JoServiceContext.prototype.setDisponibility=function(_sArticleId){this.clearServices();this.name=SERVICE_CONSTANTS.SERVICE_DISPONIBILITIES_IDX;this.sArticleId=_sArticleId;}
JoServiceContext.prototype.clearServices=function(){this.name=null;this.iDepartmentId=null;this.iFamilyId=null;this.iModelId=null;this.lModels=new Array();this.iArticleId=null;this.sThirdKind=null;this.sThirdNumber=null;this.sThirdSubNumber=null;this.sThirdKind2=null;this.sThirdNumber2=null;this.sThirdSubNumber2=null;}
JoServiceContext.prototype.activateDataFilter=function(){this.bDataFilter=true;}
JoServiceContext.prototype.desactivateDataFilter=function(){this.bDataFilter=false;}
JoServiceContext.prototype.enableDataFilter=function(_dataFilterName){if(_dataFilterName==null){return;}if(this.lDataFilter[_dataFilterName]==null){this.lDataFilter.push(_dataFilterName);}this.lDataFilter[_dataFilterName]=true;}
JoServiceContext.prototype.disableDataFilter=function(_dataFilterName){if(_dataFilterName==null){return;}if(this.lDataFilter[_dataFilterName] != null){this.lDataFilter.pop(_dataFilterName);}}
JoServiceContext.prototype.isDataFilterEnable=function(_dataFilterName){return(this.lDataFilter[_dataFilterName] != null);}
JoServiceContext.prototype.enableHomoFilter=function(_homoFilterName){if(_homoFilterName==null){return;}if(this.lHomoFilter[_homoFilterName]==null){this.lHomoFilter.push(_homoFilterName);}this.lHomoFilter[_homoFilterName]=true;}
JoServiceContext.prototype.disableHomoFilter=function(_homoFilterName){if(_homoFilterName==null){return;}if(this.lHomoFilter[_homoFilterName] != null){this.lHomoFilter.pop(_homoFilterName);}}
JoServiceContext.prototype.isHomoFilterEnable=function(_homoFilterName){return(this.lHomoFilter[_homoFilterName] != null);}
JoServiceContext.prototype.enableStepFilter=function(_stepFilterName){if(_stepFilterName==null){return;}if(this.lStepFilter['#'+_stepFilterName+'#']==null){this.lStepFilter.push('#'+_stepFilterName+'#');}this.lStepFilter['#'+_stepFilterName+'#']=true;}
JoServiceContext.prototype.disableStepFilter=function(_stepFilterName){if(_stepFilterName==null){return;}if(this.lStepFilter['#'+_stepFilterName+'#'] != null){this.lStepFilter.pop('#'+_stepFilterName+'#');}}
JoServiceContext.prototype.isStepFilterEnable=function(_stepFilterName){if(_stepFilterName==null){return;}if(this.lStepFilter['#'+_stepFilterName+'#']==null){return false;}return this.lStepFilter['#'+_stepFilterName+'#'];}
JoServiceContext.prototype.setBrandFilter=function(_brandName){this.sBrand=_brandName;}
JoServiceContext.prototype.clearBrandFilter=function(){this.sBrand=null;}
JoServiceContext.prototype.getBrandFilter=function(){return this.sBrand;}
JoServiceContext.prototype.setPriceKindFilter=function(_priceKindFilter){this.sPriceKind=_priceKindFilter;}
JoServiceContext.prototype.clearPriceKindFilter=function(){this.sPriceKind=null;}
JoServiceContext.prototype.getPriceKindFilter=function(){return this.sPriceKind;}
JoServiceContext.prototype.setModelKindFilter=function(_modelKindFilter){this.sModelKind=_modelKindFilter;}
JoServiceContext.prototype.clearModelKindFilter=function(){this.sModelKind=null;}
JoServiceContext.prototype.getModelKindFilter=function(){return this.sModelKind;}
JoServiceContext.prototype.setPriceRangeFilter=function(_minPrice, _maxPrice){this.dMinPrice=_minPrice;this.dMaxPrice=_maxPrice;}
JoServiceContext.prototype.clearPriceRangeFilter=function(){this.dMinPrice=null;this.dMaxPrice=null;}
JoServiceContext.prototype.getMinPriceRangeFilter=function(){return this.dMinPrice;}
JoServiceContext.prototype.getMaxPriceRangeFilter=function(){return this.dMaxPrice;}
JoServiceContext.prototype.setNumPage=function(_numPage){this.iNumPage=_numPage;}
JoServiceContext.prototype.setNumModelForAPage=function(_numModel){this.iNumModelForAPage=_numModel;}
JoServiceContext.prototype.clearPagination=function(){this.iNumModelForAPage=null;this.iNumModelForAPage=null;}
function JoService(_serviceContext){this.cardinalities=null;this.header=null;this.content=null;this.error=null;this.context=_serviceContext;this.progressFunction=null;}
JoService.prototype.getId=function(){if(this.getContext()==null){return null;}return this.getContext().getUrl();}
JoService.prototype.getCardinality=function(){return this.cardinalities;}
JoService.prototype.getHeader=function(){return this.header;}
JoService.prototype.getContent=function(){return this.content;}
JoService.prototype.getError=function(){return this.error;}
JoService.prototype.getContext=function(){return this.context;}
JoService.prototype.getProgressFunction=function(){return this.progressFunction;}
JoService.prototype.setCardinality=function(_joCardinalities){this.cardinalities=_joCardinalities;}
JoService.prototype.setHeader=function(_joServiceHeader){this.header=_joServiceHeader;}
JoService.prototype.setContent=function(_joServiceContent){this.content=_joServiceContent;}
JoService.prototype.setError=function(_joServiceError){this.error=_joServiceError;}
JoService.prototype.setProgessFunction=function(_function){this.progressFunction=_function;}
JoService.prototype.notifyProgess=function(_progress){try{if(this.progressFunction != null){this.progressFunction(_progress);}}catch(e){return;}}
JoService.prototype.execute=function(_localFunc){if(this.getContext()==null){return false;}
var sUrl=this.getContext().getUrl();if(sUrl==null){return false;}
var func=function(oService, xmlHttp, httpStatus){if(httpStatus=="200"){oGlobalXml=xmlHttp.responseXML;if(oGlobalXml!=null || oGlobalXml != ""){oService.notifyProgess(0);var oRoot=getChild(oGlobalXml, 'root');if(oRoot==null){oService.notifyProgess(100);httpStatus="500";}else{oService=getDomToService(oService, oRoot);addToServiceCollector(oService);oGlobalXml=null;}}}if(_localFunc != null){try{_localFunc(httpStatus, oService);}catch(e){oService.notifyProgess(100);return false;}}
oService.notifyProgess(100);return true;};var oProcess=new IAjaxServiceProcess(sUrl, func, this);oProcess.run();return true;}
function getDomToService(oService, oServiceNode){var _header=null;var _error=null;var _cardinalities=null;var _content=null;try{_error=getDomToServiceError(getChild(oServiceNode, SERVICE_ERROR_NODE_NAME), oService.getId());if(_error != null){oService.setError(_error);oService.notifyProgess(5);}
_header=getDomToServiceHeader(getChild(oServiceNode, SERVICE_HEADER_NODE_NAME), oService.getId());oService.notifyProgess(20);_cardinalities=getDomToCardinalities(getChild(oServiceNode, CARDS_NODE_NAME));oService.notifyProgess(30);_content=getDomToServiceContent(oService.getId(), getChild(oServiceNode, SERVICE_CONTENT_NODE_NAME));oService.notifyProgess(90);oService.setCardinality(_cardinalities);oService.setHeader(_header);oService.setContent(_content);return oService;}catch(e){return oService;}}
function JoServices(){this.lServices=new Array();}
JoServices.prototype.addService=function(_Service){if(_Service==null){return;}if(_Service.getId()==null){return;}if(this.lServices[_Service.getId()]==null){this.lServices.push(_Service.getId());}this.lServices[_Service.getId()]=_Service;}
JoServices.prototype.getService=function(_serviceId){return this.lServices[_serviceId];}
var MAIN_SERVICE_COLLECTOR=new JoServices();
function getServiceCollector(){return MAIN_SERVICE_COLLECTOR;}
function addToServiceCollector(_service){MAIN_SERVICE_COLLECTOR.addService(_service);}
function getService(_serviceId){if(getServiceCollector()==null){return null;}return getServiceCollector().getService(_serviceId);}
function getServiceContent(_serviceId){if(getService(_serviceId)==null){return null;}return getService(_serviceId).getContent();}
function clearServices(){gcObject(MAIN_SERVICE_COLLECTOR);MAIN_SERVICE_COLLECTOR=new JoServices();}
function isProductService(_serviceName){return(SERVICE_CONSTANTS.SERVICE_ARTICLE_IDX==_serviceName
|| SERVICE_CONSTANTS.SERVICE_MODEL_IDX==_serviceName
|| SERVICE_CONSTANTS.SERVICE_MODELS_IDX==_serviceName
|| SERVICE_CONSTANTS.SERVICE_FAMILY_IDX==_serviceName
|| SERVICE_CONSTANTS.SERVICE_DEPT_IDX==_serviceName
|| SERVICE_CONSTANTS.SERVICE_FAMILIES_IDX==_serviceName
|| SERVICE_CONSTANTS.SERVICE_DEPTS_IDX==_serviceName
|| SERVICE_CONSTANTS.SERVICE_DISPONIBILITIES_IDX==_serviceName);}
function isThirdService(_serviceName){return(SERVICE_CONSTANTS.SERVICE_THIRD_SINGLE==_serviceName
|| SERVICE_CONSTANTS.SERVICE_THIRD_PARENTS==_serviceName
|| SERVICE_CONSTANTS.SERVICE_THIRD_CHILDREN==_serviceName);}
function isSwitchService(_serviceName){return(SERVICE_CONSTANTS.SERVICE_SWITCH==_serviceName);}
var SERVICE_CONSTANTS=new JO_SERVICE_CONSTANTS();
function JO_SERVICE_CONSTANTS(){this.SERVICE_ARTICLE_IDX="ART";this.SERVICE_MODEL_IDX="MOD";this.SERVICE_MODELS_IDX="MDS";this.SERVICE_FAMILY_IDX="FAM";this.SERVICE_DEPT_IDX="DPT";this.SERVICE_FAMILIES_IDX="FAS";this.SERVICE_DEPTS_IDX="DPS";this.SERVICE_SWITCH="SWT";this.SERVICE_THIRD_SINGLE="THS";this.SERVICE_THIRD_PARENTS="THP";this.SERVICE_THIRD_CHILDREN="THC";this.SERVICE_DISPONIBILITIES_IDX="DISPO";this.DATE_KIND_PRICE_BEGIN='beg';this.DATE_KIND_PRICE_END='end';this.DATE_KIND_SERVER='service-time';this.DATE_KIND_SOLD_BEGIN='sld-beg';this.DATE_KIND_SOLD_END='sld-end';this.DATE_FORMAT_DD_MM_YYYY='dd/MM/yyyy';this.DATE_FORMAT_MM_DD_YYYY='MM/dd/yyyy';this.DATE_FORMAT_YYYY_MM_DD='yyyy/MM/dd';this.DATE_FORMAT_DD_MM_YY='dd/MM/yy';this.DATE_FORMAT_MM_DD_YY='MM/dd/yy';this.DATE_FORMAT_YY_MM_DD='yy/MM/dd';this.DATE_FORMAT_DD_MM_YYYY_HH_MI_SS='dd/MM/yyyy HH:mm:ss';this.DATE_FORMAT_MM_DD_YYYY_HH_MI_SS='MM/dd/yyyy HH:mm:ss';this.DATE_FORMAT_YYYY_MM_DD_HH_MI_SS='yyyy/MM/dd HH:mm:ss';this.DATE_FORMAT_DD_MM_YY_HH_MI_SS='dd/MM/yy HH:mm:ss';this.DATE_FORMAT_MM_DD_YY_HH_MI_SS='MM/dd/yy HH:mm:ss';this.DATE_FORMAT_YY_MM_DD_HH_MI_SS='yy/MM/dd HH:mm:ss';this.END_DATE_DAY='31';this.END_DATE_MONTH='12';this.END_DATE_YEAR='9999';this.END_DATE_HOUR='23';this.END_DATE_MINUTE='59';this.END_DATE_SECONDE='59';this.PRICE_SOLD=10;this.PRICE_PROMO=11;this.PRICE_PERMANENT=12;this.PRICE_SOLD_B=-10;this.PRICE_PROMO_B=-11;this.PRICE_WEEE=5;this.AVAILABLE=1;this.UNAVAILABLE=2;this.PARTIALLY_AVAILABLE=3;this.IN_RANGE=1;this.NOT_IN_RANGE=2;this.PARTIALLY_IN_RANGE=3;this.ITEM_KIND_MODEL='MOD';this.ITEM_KIND_ARTICLE='ART';this.CENTRAL_SOURCE='CTL';this.STORE_SOURCE='STR';this.CENTRAL_RULE='C';this.STORE_RULE='S';this.DISPLAY_START_DATE="DISPLAY_START_DATE";this.DISPLAY_END_DATE="DISPLAY_END_DATE";this.DISPLAY_STRIKE_AMI="DISPLAY_STRIKE_AMI";this.DISPLAY_STRIKE_PASSION="DISPLAY_STRIKE_PASSION";this.DISPLAY_DEMARK_PRICE="DISPLAY_DEMARK_PRICE";this.DISPLAY_DEMARK_PURCENT="DISPLAY_DEMARK_PURCENT";this.DISPLAY_DEMARK_LT_PERMANENT="DISPLAY_DEMARK_LT_PERMANENT";this.STEP_MIXTE="M";this.STEP_1="1";this.STEP_2="2";this.STEP_3="3";this.STEP_7="7";this.STEP_8="8";this.HOMO_FILTER_BEGIN="B";this.HOMO_FILTER_END="E";this.HOMO_FILTER_KIND="K";this.HOMO_FILTER_VALUE="V";this.PRICE_KIND_ALL="A";this.PRICE_KIND_SOLD="S";this.PRICE_KIND_PROMO="P";this.MODEL_KIND_BLUE="B";this.MODEL_KIND_ALL="A";this.DATA_FILTER_PRICE="P";this.DATA_FILTER_MARKETING="M";this.DATA_FILTER_MIX ="X";this.DATA_FILTER_HOT_DATA="H";this.DATA_FILTER_SUBSTITUTE="S";this.DATA_FILTER_AVAILABLE="A";this.DATA_FILTER_CHILDREN="C";this.DATA_FILTER_VARIATIONS="V";this.DATA_FILTER_BDFR="L";this.DATA_FILTER_CARDINALITY="D";this.DATA_FILTER_MRK_AVAILABILITY="K";this.CARD_KIND_STEP="STEP";this.CARD_KIND_BRAND="BRAND";this.CARD_KIND_MODEL_KIND="MOD-KND";this.CARD_KIND_PRICE_KIND="PRC-KND";this.CARD_KIND_DEPT="DEPT";this.CARD_KIND_FAM="FAM";this.CARD_STEP_MIXTE="-1";this.CARD_MODEL_KIND_BLUE="BLUE";this.CARD_MODEL_KIND_OTHER="OTHER";this.BRAND_KIND_PASSION="P";this.BRAND_KIND_AMI="A";this.THIRD_KIND_STORE="7";this.THIRD_KIND_COUNTRY="15";this.THIRD_KIND_SITE="-1";this.DATE_FORMAT_KIND_PRICE='prc';this.DATE_FORMAT_KIND_SERVER='srv';this.DATE_FORMAT_KIND_SOLD='sld';}
