function maxDays(mm, yyyy){
var mDay;
if((mm == 3) || (mm == 5) || (mm == 8) || (mm == 10)){
mDay = 30;
}
else{
mDay = 31
if(mm == 1){
if (yyyy/4 - parseInt(yyyy/4) != 0){
mDay = 28
}
else{
mDay = 29
}
}
}
return mDay;
}
function changeBg(id){
if (eval(id).style.backgroundColor != "yellow"){
eval(id).style.backgroundColor = "yellow"
}
else{
eval(id).style.backgroundColor = "#ffffff"
}
}
var field
function initCalendar(obj, e){
var now = new Date
dow=now.getDate()
mm=now.getMonth()+1
yyyy=now.getFullYear()
field=obj
d=obj.value
ds=d.split(".")
dan=(parseInt(ds[0]))?parseInt(ds[0]):dow
mjesec=(parseInt(ds[1]))?parseInt(ds[1]):mm
godina=(parseInt(ds[2]))?parseInt(ds[2]):yyyy
xmouse=findPosX(obj)-20
ymouse=findPosY(obj)+15
document.getElementById('kalendarChange').style.left=xmouse+"px"
document.getElementById('kalendarChange').style.top=ymouse+"px"
document.getElementById("kalendarChange").style.visibility="visible"
writeCalendar(dan, mjesec, godina, dan, mjesec, godina)
}
function writeCalendar(danNew, mjesecNew, godinaNew, dan, mjesec, godina){
var now = new Date
if (danNew) {
dd=danNew
var dow = now.getDay()
} else {
var dd = now.getDate()
var dow = now.getDay()
}
if (mjesecNew) {
mm=mjesecNew-1
} else {
var mm = now.getMonth()
}
if (godinaNew) {
yyyy=godinaNew
} else {
var yyyy = now.getFullYear()
}
mm1=mm
yyyy1=yyyy
if (mm1==0) {
mm1=12
yyyy1--
}
mm2=mm+2
yyyy2=yyyy
if (mm2==13) {
mm2=1
yyyy2++
}
ref = new Date
refd=now.getDate()
refm=now.getMonth()
refy=now.getFullYear()
var arrM = new Array("January","Fabruary","March","April","May","June","July","August","September","October","November","December")
var arrY = new Array()
for (ii=0;ii<=4;ii++){
arrY[ii] = yyyy - 2 + ii
}
var arrD = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
var text = ""
text += "
"
text += ""
text += ""
text += " | "
text += ""
if ((mm1>refm && yyyy1>=refy) || yyyy1>refy) {
text += " "
}
text += arrM[mm]
text += ", "
text += ""
text += arrY[2]
text += "  | "
text += " | "
text += ""
text += " "
text += " |
"
text += ""
text += ""
text += " | "
for (ii=0;ii<=6;ii++){
text += "| " + arrD[ii] + " | "
}
text += " "
aa = 0
for (kk=0;kk<=5;kk++){
text += ""
for (ii=0;ii<=6;ii++){
text += "| 1 | "
aa += 1
}
text += " | "
}
text += " "
text += " |
"
text += ""
text += "
"
document.getElementById("kalendarInner").innerHTML=text
changeCal(dd, mm, yyyy, dan, mjesec, godina)
}
function submitDate(d, m, y) {
m++
document.searchform.fromDate.value=d+"."+m+"."+y
document.getElementById("kalendarChange").style.visibility="hidden"
n=parseInt(document.searchform.nights.value)
d1=d+n
m1=m-1
var newDate=new Date()
newDate.setFullYear(y,m1,d1)
d2=newDate.getDate()
m2=newDate.getMonth()+1
y2=newDate.getFullYear()
document.searchform.toDate.value=d2+"."+m2+"."+y2
if (document.hotelscalcform) {
document.hotelscalcform.fromDate.value=d+"."+m+"."+y
document.hotelscalcform.toDate.value=d2+"."+m2+"."+y2
calc()
}
if (document.ttcalcform) {
document.ttcalcform.fromDate.value=d+"."+m+"."+y
calcTour(document.ttcalcform.ttIDthis.value)
}
}
function hideCalendar() {
document.getElementById("kalendarChange").style.visibility="hidden"
}
function changeCal(danNew, mjesecNew, godinaNew, dan, mjesec, godina){
var now = new Date
var dd = now.getDate()
var mm = now.getMonth()
var dow = now.getDay()
var yyyy = now.getFullYear()
var currM = mjesecNew
var prevM
if (currM!=0){
prevM = currM - 1
} else {
prevM = 11
}
var currY = godinaNew
var mmyyyy = new Date()
mmyyyy.setFullYear(currY)
mmyyyy.setDate(1)
mmyyyy.setMonth(currM)
var day1 = mmyyyy.getDay()
if (day1 == 0){
day1 = 7
}
var arrN = new Array(41)
var aa
for (ii=0;ii20))||((ii>27)&&(arrN[ii]<20))){
if ((ii<7)&&(arrN[ii]>20)) {
currM1=currM-1
} else {
currM1=currM+1
}
currY1=currY
if (currM1==-1) {
currM1=11
currY1=currY-1
}
if (currM1==12) {
currM1=0
currY1=currY+1
}
//if (((dd<=arrN[ii] && mm==currM1 && yyyy==currY1) || (mm"+arrN[ii]+""
document.getElementById(nnn).className = "calendarInactive"
if ((arrN[ii]==dan)&&(mjesec-1==currM1)&&(godina==currY1)){
document.getElementById(nnn).className= "calendarNow"
}
//} else {
// document.getElementById(nnn).innerHTML = arrN[ii]
// document.getElementById(nnn).className = "calendarBlur"
//}
}
else{
//if (((dd<=arrN[ii] && mm==currM && yyyy==currY) || (mm"+arrN[ii]+""
if ((dCount==0)||(dCount==6)){
document.getElementById(nnn).className = "calendarActive"
} else {
document.getElementById(nnn).className = "calendarActive"
}
if ((arrN[ii]==dan)&&(mjesec-1==currM)&&(godina==currY)){
document.getElementById(nnn).className= "calendarNow"
}
//} else {
// document.getElementById(nnn).innerHTML = arrN[ii]
// document.getElementById(nnn).className = "calendarBlur"
//}
}
dCount += 1
if (dCount>6){
dCount=0
}
}
}