var strDays = 31; function Left(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else return String(str).substring(0,n); } function Right(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else { var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } function sendBokning() { Datum = _id('BManad').value + '-' + _id('BDag').value; if ((parseInt(_id('BDag').value) + parseInt(_id('BNatter').value) >= strDays)) { overday = strDays - (parseInt(_id('BDag').value) + parseInt(_id('BNatter').value)); overday = Math.abs(overday); if(parseInt(Right(_id('BManad').value, 2)) == 12) { Datum2 = (parseInt(Left(_id('BManad').value, 4)) + 1) + '-01-' + overday; } else { theMonth = (parseInt(Right(_id('BManad').value, 2)) + 1) if(theMonth <= 9){theMonth = '0'+theMonth+''} Datum2 = Left(_id('BManad').value, 4) + '-' + theMonth + '-' + overday; } //alert(overday); } else { Datum2 = _id('BManad').value + '-' + (parseInt(_id('BDag').value) + parseInt(_id('BNatter').value)); } DBSYS = '89CE9CE2EDB44870B5D27679EE7312D3'; Vuxna = _id('BVuxna').value; Ung = _id('BUngdomar').value; Barn = _id('BBarn').value; window.location = 'http://www.storhogna.se/byosweb/redirfromsearchform.aspx?categoryID='+ DBSYS +'&dateFrom='+ Datum +'&dateTo='+ Datum2 +'&numAdults='+ Vuxna +'&numChildren='+ Ung +'&numInfants='+ Barn +''; } function getDays(strMonth,strYear) { strYear = parseInt(Left(strMonth, 4)); strMonth = parseInt(Right(strMonth, 2)); //alert(strYear); //alert(strMonth); if(strMonth == 1 || strMonth == 3 || strMonth == 5 || strMonth == 7 || strMonth == 8 || strMonth == 10 || strMonth == 12) { strDays = 31; _showId('BDay29'); _showId('BDay30'); _showId('BDay31'); } if(strMonth == 4 || strMonth == 6 || strMonth == 9 || strMonth == 11) { strDays = 30; _showId('BDay29'); _showId('BDay30'); _hideId('BDay31'); } if(strMonth == 2) { if((parseInt(strYear) % 4 == 0 && !(parseInt(strYear) % 100 == 0)) || (parseInt(strYear) % 400 == 0)) { strDays = 29; _showId('BDay29'); _hideId('BDay30'); _hideId('BDay31'); } else { strDays = 28; _hideId('BDay29'); _hideId('BDay30'); _hideId('BDay31'); } } }