function OfferPriceObj(id,sid,x,y) {
// id - current index of OfferArr
// sid - special id
// x - index of the column
// y - index of the date

var MAXIMUM_PEOPLE_PER_COLUMN = 20

/**/this.id = id;       //array id of this offer object
/**/this.sid = sid;     //special ID
    
    for (i=0; i<app.viewArr.length; i++)
        if (app.viewArr[i].Id == sid) break;
    id = i;
    
/**/this.said = id;     //array id of the view array of specials
    //alert(app.DebugObjDump(app.viewArr[i].prices,""))
    
/**/this.Title = app.viewArr[id].details.title;             //title of the special (string)
/**/this.subTitle = app.viewArr[id].details.stitle;

/**/this.FlightDesc = app.viewArr[id].prices.flight[y];     //description of the flight (string)
/**/this.StartDate = app.viewArr[id].prices.date_from[y];   //special begin date (string)
/**/this.EndDate = app.viewArr[id].prices.date_to[y];       //special end date (string)

if (this.StartDate=="" || this.EndDate=="") {
    this.Dates = this.FlightDesc;
} else {
    df = new Array()
    dt = new Array()
    df[0] = this.StartDate.slice(0,2)   //from
    df[1] = this.StartDate.slice(2,4)
    df[2] = this.StartDate.slice(4,8)
    dt[0] = this.EndDate.slice(0,2)   //to
    dt[1] = this.EndDate.slice(2,4)
    dt[2] = this.EndDate.slice(4,8)
    if (parseInt(dt[0])!=parseInt(df[0])) {
        if (parseInt(dt[1])!=parseInt(df[1])) {
            this.Dates = "מ " + df[0]+"/"+df[1] + " עד " + dt[0]+"/"+dt[1] + ", " + (df[2]==dt[2]?df[2]:df[2]+"-"+dt[2])
        } else {
            this.Dates = df[0]+"-"+dt[0] + "/" + df[1] + "/" + df[2]
        }
    }
}

/**/this.Dates = this.Dates;            //date to show (string)
/**/this.Columns = new Array()          //array of descriptions of specific price at a date (string)
/**/this.Prices = new Array()           //array of prices of specific date (float)
/**/this.People = new Array()           //array of minimum people to complete this column
/**/this.SelectedPeople = new Array()   //array of selected people by user of each column at the specific date
    
    for (i=0; i<app.viewArr[id].prices.ppl.length; i++) {
        this.Columns[i] = app.viewArr[id].prices.desc[i]
        this.Prices[i] = parseFloat(app.viewArr[id].prices.price[y][i]==""?-1:app.viewArr[id].prices.price[y][i])
        
        numarr = new Array(
            /^( )*(ל-|ל|)( )*(אפס|0)( )*$/,
            /^( )*(ל-|ל|)( )*(אח(ת|ד)|יחיד|1)( )*$/,
            /^( )*(ל-|ל|)( )*(ש(ת|נ)יים|זוג(י|)|2)( )*$/,
            /^( )*(ל-|ל|)( )*(שלוש(ה|)|תלת|3)( )*$/,
            /^( )*(ל-|ל|)( )*(ארבע(ה|)|4)( )*$/,
            /^( )*(ל-|ל|)( )*(חמ(י|)ש(ה|)|5)( )*$/,
            /^( )*(ל-|ל|)( )*(ש(י|)ש(ה|)|6)( )*$/,
            /^( )*(ל-|ל|)( )*(ש(י|)בע(ה|)|7)( )*$/,
            /^( )*(ל-|ל|)( )*(שמונה|8)( )*$/,
            /^( )*(ל-|ל|)( )*(ת(י|)שע(ה|)|9)( )*$/,
            /^( )*(ל-|ל|)( )*(עשר(ה|)|10).*/,
            /^( )*(ל-|ל|)( )*(אח(ת|ד)( |-|)עשר(ה|)|11)( )*$/,
            /^( )*(ל-|ל|)( )*(ש(נ|ת)י(י|)ם( |-|)עשר(ה|)|12)( )*$/,
            /^( )*(ל-|ל|)( )*(שלוש(ה|)( |-|)עשר(ה|)|13)( )*$/,
            /^( )*(ל-|ל|)( )*(ארבע(ה|)( |-|)עשר(ה|)|14)( )*$/,
            /^( )*(ל-|ל|)( )*(חמ(י|)ש(ה|)( |-|)עשר(ה|)|15)( )*$/,
            /^( )*(ל-|ל|)( )*(ש(י|)ש(ה|)( |-|)עשר(ה|)|16)( )*$/,
            /^( )*(ל-|ל|)( )*(ש(י|)בע(ה|)( |-|)עשר(ה|)|17)( )*$/,
            /^( )*(ל-|ל|)( )*(שמונה( |-|)עשר(ה|)|18)( )*$/,
            /^( )*(ל-|ל|)( )*(ת(י|)שע(ה|)( |-|)עשר(ה|)|19)( )*$/,
            /^( )*(ל-|ל|)( )*(עשרים|20)( )*$/
        )
    
        //numarr = new Array(
        //    /^( )*(ל-|ל|)( )*(אפס|0).*/,
        //    /^( )*(ל-|ל|)( )*(אח(ת|ד)|יחיד|1).*/,
        //    /^( )*(ל-|ל|)( )*(ש(ת|נ)יים|זוג(י|)|2).*/,
        //    /^( )*(ל-|ל|)( )*(שלוש(ה|)|תלת|3).*/,
        //    /^( )*(ל-|ל|)( )*(ארבע(ה|)|4).*/,
        //    /^( )*(ל-|ל|)( )*(חמ(י|)ש(ה|)|5).*/,
        //    /^( )*(ל-|ל|)( )*(ש(י|)ש(ה|)|6).*/,
        //    /^( )*(ל-|ל|)( )*(ש(י|)בע(ה|)|7).*/,
        //    /^( )*(ל-|ל|)( )*(שמונה|8).*/,
        //    /^( )*(ל-|ל|)( )*(ת(י|)שע(ה|)|9).*/,
        //    /^( )*(ל-|ל|)( )*(עשר(ה|)|10).*/,
        //    /^( )*(ל-|ל|)( )*(אח(ת|ד)( |-|)עשר(ה|)|11).*/,
        //    /^( )*(ל-|ל|)( )*(ש(נ|ת)י(י|)ם( |-|)עשר(ה|)|12).*/,
        //    /^( )*(ל-|ל|)( )*(שלוש(ה|)( |-|)עשר(ה|)|13).*/,
        //    /^( )*(ל-|ל|)( )*(ארבע(ה|)( |-|)עשר(ה|)|14).*/,
        //    /^( )*(ל-|ל|)( )*(חמ(י|)ש(ה|)( |-|)עשר(ה|)|15).*/,
        //    /^( )*(ל-|ל|)( )*(ש(י|)ש(ה|)( |-|)עשר(ה|)|16).*/,
        //    /^( )*(ל-|ל|)( )*(ש(י|)בע(ה|)( |-|)עשר(ה|)|17).*/,
        //    /^( )*(ל-|ל|)( )*(שמונה( |-|)עשר(ה|)|18).*/,
        //    /^( )*(ל-|ל|)( )*(ת(י|)שע(ה|)( |-|)עשר(ה|)|19).*/,
        //    /^( )*(ל-|ל|)( )*(עשרים|20).*/
        //)
        
        // extract numbers from the column description
        tempp = this.Columns[i].split(/אדם בתפוסה של|אדם בדירה|אדם בחדר|אדם בוילה|אדם בסירה|גולט|אדם מתוך|תפוסת|אדם בתא|אדם בדירת סטודיו/)[1]
        if (typeof tempp == 'string') {
            for (j=numarr.length-1; j>=0; j--) {
                tempp1 = tempp.replace(numarr[j],j);
                if (tempp != tempp1) {
                    tempp = tempp1;
                    break;
                }
            }
            tempp = isNaN(tempp)?1:parseInt(tempp);
        } else tempp=1;
        
//////////////////////////////////////////////////////////////////////////////////////////////////////
// WHEN NUMBER PEOPLE AT COLUMN WILL BE UPDATED CORRECTLY IN ALL XML FILES, MAKE THE CHANGES BELOW: //
// UNCOMMENT THIS LINE:
        
        //tempp = (tempp==1)?parseInt(app.viewArr[id].prices.ppl[i]):tempp;
        
//                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////
        
        this.People[i] = tempp
        this.SelectedPeople[i] = i==x?this.People[i]:0;
        
/*      if (i==x) {
            this.SinglePriceDesc = app.viewArr[id].prices.desc[i];  //desciption of the price for the single person at the 'this.PeopleAtRoom' (string)
            this.SinglePricePrice = parseFloat(app.viewArr[id].prices.price[y][i]);  //price for the single person at the 'this.PeopleAtRoom' (float)
        }*/
    }
    
/*this.PeopleAtRoom = nppl;   //room for ## people (int)*/
/**/this.Currency = app.viewArr[id].CSign;                  //currency sign of the prices (string)
/**/this.TotalPeople = this.People[x];                      //number of people that have been chosen by the user (int)
/**/this.Included = app.viewArr[id].prices.included;        //the price include ... (string)
/**/this.NotIncluded = app.viewArr[id].prices.notincluded;  //the price not include ... (string)
/**/this.Terms = app.viewArr[id].prices.terms;              //terms (string)
/**/this.TotalPrice = this.TotalPeople*this.Prices[x]//the total price for all persons (int)
    
/**/this.HTML = function() {
        htm = '<table width="100%" cellpadding="0" cellspacing="2" border="0">\n'
            +'<tr>\n'
            +'    <td style="background-image: url(images/white-bg-50.png);">\n'
            +'        <table width="100%" cellpadding="0" cellspacing="5" border="0">\n'
            +'        <tr>\n'
            +'            <td class="op_td_border"><div class="op_spec-title"><b><span style="color:#FFFFFF">המבצע:</span><br><span style="font-size:14px;">'+this.Title+'</span></b></div></td>\n'
            +'        </tr>\n'
            +'        <tr>\n'
            +'            <td class="op_td_border"><div class="op_caption">'+(this.Dates==this.FlightDesc?'פרטים נוספים':'בתאריכים')+'</div><div class="op_caption-content">'+this.Dates+'</div></td>\n'
            +'        </tr>\n'
            +'        <tr>\n'
            +'            <td class="op_td_border">\n'
            +'                <table cellpadding="0" cellspacing="1" border="0" width="100%">\n'
        for (i=0; i<this.Columns.length; i++) {
            if (this.Prices[i] != -1) {
                htm+='                <tr>\n'
                    +'                    <td class="op_caption-content">\n'
                    +'                        <div style="font-weight:bold;">'+this.Columns[i]+'</div>\n'
                    +'                        <div dir="ltr" style="font-size:10px;">\n'
                    +'                            '+this.Currency+'<b>'+this.Prices[i]+'</b> x '
                    +'                            <span id="ppl_'+i+'_'+this.id+'">'+this.SelectedPeople[i]+'</span>'
                    +'                             = '+this.Currency+'<b><span id="tot_'+i+'_'+this.id+'">'+(this.SelectedPeople[i]*this.Prices[i])+'</span></b>\n'
                    +'                        </div>\n'
                    +'                    </td>\n'
                    +'                    <td class="op_caption-content" valign="top">\n'
                    +'                        <select id="num_'+i+'_'+this.id+'" onchange="app.OPpplchg('+this.id+')">\n'
                for (k=0; k<=MAXIMUM_PEOPLE_PER_COLUMN; k+=this.People[i]) {
                    htm+='                            <option value="'+k+'"'
                    if (k == this.SelectedPeople[i]) htm+=' selected'
                    htm+='>'+k+'</option>\n'
                }
                htm+='                        </select>\n'
                    +'                    </td>\n'
                    +'                </tr>\n'
            }
        }
        htm+='                <tr>\n'
            +'                    <td class="op_caption-content"><div style="font-weight:bold;">סה"כ נפשות</div></td>\n'
            +'                    <td class="op_caption-content" valign="top"><b><div id="total_ppl_'+this.id+'">'+this.TotalPeople+'</div></b>\n'
            +'                    </td>\n'
            +'                </tr>\n'
            +'                </table>\n'
            +'            </td>\n'
            +'        </tr>\n'
            +'        <tr>\n'
            +'            <td class="op_td_border">\n'
            +'                <div class="op_caption">סה"כ מחיר</div>\n'
            +'                <div class="op_caption-content" style="font-weight:bold; font-size:16px; color:#090">'+this.Currency+'<span id="total_price_'+this.id+'">'+this.TotalPrice+'</span></div>\n'
            +'            </td>\n'
            +'        </tr>\n'
            +'<tr>\n'
            +'    <td>\n'
            +'        <table cellpadding="0" cellspacing="3" border="0" width="100%">\n'
            +'        <tr id="OP_order_but">\n'
            +'            <td width="70%"><div class="op_button" style="height:30px;text-align:center;font-size:20px;color:#090;" onclick="app.OPClick(\'order\','+this.id+');"'
            +'            onmouseover="this.style.backgroundColor=\'#0F0\';this.style.border=\'2px solid #090\'"'
            +'            onmouseout="this.style.backgroundColor=\'transparent\';this.style.border=\'2px solid #a2a2a2\'">&nbsp;הזמן&nbsp;</div></td>'
            +'            <td><div class="op_button" style="height:30px;text-align:center;color:#F00;" onclick="app.OPClick(\'cancel\','+this.id+');"'
            +'            onmouseover="this.style.backgroundColor=\'#F66\';this.style.border=\'2px solid #F00\'"'
            +'            onmouseout="this.style.backgroundColor=\'transparent\';this.style.border=\'2px solid #a2a2a2\'"><span style="font-size:6px;"><br></span>בטל</div></td>\n'
            +'        </tr>\n'
            +'        <tr>\n'
            +'            <td colspan=2><div class="op_button" onclick="app.OPClick(\'email\','+this.id+');"'
            +'            onmouseover="this.style.backgroundColor=\'#15F\';this.style.border=\'2px solid #009\'"'
            +'            onmouseout="this.style.backgroundColor=\'transparent\';this.style.border=\'2px solid #a2a2a2\'">&nbsp;שלח הצעה באימייל&nbsp;</div></td>\n'
            +'        </tr>\n'
            +'        <tr>\n'
            +'            <td colspan=2><div class="op_button" onclick="app.OPClick(\'print\','+this.id+');"'
            +'            onmouseover="this.style.backgroundColor=\'#15F\';this.style.border=\'2px solid #009\'"'
            +'            onmouseout="this.style.backgroundColor=\'transparent\';this.style.border=\'2px solid #a2a2a2\'">&nbsp;הדפס הצעה&nbsp;</div></td>\n'
            +'        </tr>\n'
            +'        </table>\n'
            +'    </td>\n'
            +'</tr>\n'
        if (this.FlightDesc != "") {
            htm+='        <tr>\n'
                +'            <td class="op_td_border"><div class="op_caption">פרטי טיסה</div><div class="op_caption-content">'+this.FlightDesc+'</div></td>\n'
                +'        </tr>\n';
        }
        if (this.Included != "") {
            htm+='        <tr>\n'
                +'            <td class="op_td_border"><div class="op_caption">המחיר כולל</div><div class="op_caption-content">'+this.Included+'</div></td>\n'
                +'        </tr>\n';
        }
        if (this.NotIncluded != "") {
            htm+='        <tr>\n'
                +'            <td class="op_td_border"><div class="op_caption">המחיר אינו כולל</div><div class="op_caption-content">'+this.NotIncluded+'</div></td>\n'
                +'        </tr>\n';
        }
        if (this.Terms != "") {
            htm+='        <tr>\n'
                +'            <td class="op_td_border"><div class="op_caption">תנאים נוספים</div><div class="op_caption-content">'+this.Terms+'</div></td>\n'
                +'        </tr>\n';
        }
            +'        </table>\n'
            +'    </td>\n'
            +'</tr>\n'
            +'</table>\n';
        return htm;
    }
}
