function minimum(dz,ss) { ss = ss/1000; if (lang == "english") {lang = "eng";} if (lang == "spanish") {lang = "span";} overlap_zz(ss,dz,1585108800,1585713600) if (hold_zz > 0 && (dz < 4)) { texteng = "On these dates there is a minimum booking requirement of 4 nights."; textspan = "En estas fechas el minimo de noches es 4"; if (lang == "eng") {text = texteng} if (lang == "span") {text = textspan} error_code = "minstay_error"; window.alert(text) return false; } function overlap_zz(ss,dz,hsdate,hedate) { //window.alert(+ss+'ss'+dz+'ss'+hsdate+'ss'+hedate) durms = dz*86400; se = ss + durms; hs = hsdate; he = hedate; //holiday end is midnight of last holiday day, i.e. beginning of next day; so, add a day //he = he + 86400; holms = 0; if (ss < hs && se > hs && se < he ) {holms = se - hs ;} if (ss > hs && se > he && ss < he ) {holms = he - ss ;} if (ss >= hs && se <= he ) {holms = durms ;} if (ss <= hs && se >= he ) {holms = he - hs ;} //hold is holidaydays hold_zz = 0; hold_zz = Math.round(holms/86400); return hold_zz } }