function changeSittning(x, b, e, i) { i=1; while (i<=10){ e = _id('sittning_'+i+''); if(e) { e.style.color = '#000000'; e.style.fontWeight = 'normal'; } i++; } e = _id('sittning_'+x+''); e.style.color = '#b2001f'; e.style.fontWeight = 'bold'; _id('sittningImg').style.background = 'url(' + b + ') no-repeat'; } 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 changeAmount(e){ if(e==1){ _hideId('BAntal2'); _showId('BAntal1'); VU = 1; } else { _hideId('BAntal1'); _showId('BAntal2'); VU = 2; } } var VU = 1; var DBSYS = '7022A56C-FA08-4F88-8AB3-3DC5CFB114F9'; 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)); } Vuxna = _id('BAntal'+VU+'').value; if(VU == 1){ window.location = 'http://motesbokning.skepparholmen.se/byosweb/redirfromsearchform.aspx?categoryID='+ DBSYS +'&dateFrom='+ Datum +'&dateTo='+ Datum2 +'&numAdults='+ Vuxna +''; } else { window.location = 'http://www.skepparholmen.se/byosweb/redirfromsearchform.aspx?categoryID='+ DBSYS +'&dateFrom='+ Datum +'&dateTo='+ Datum2 +'&numAdults='+ Vuxna +''; } } 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'); } } }