function loadDays(FRM)
{
        listBox_s = FRM.day_s;
        listBox_e = FRM.day_e;
        for(i = 1; i <= 31; i++)
        {
                Caption = i+"";
                Value = i+""; // ((Caption.length == 1)?"0"+i:i);

                newOpt = new Option(Caption, Value)
                l = listBox_s.length;
                listBox_s.options[l++] = newOpt
                listBox_s.value = Caption;

                newOpt = new Option(Caption, Value)
                l = listBox_e.length;
                listBox_e.options[l++] = newOpt
                listBox_e.value = Caption;
        }
}

function loadMonths(FRM)
{
        listBox_s = FRM.month_s;
        listBox_e = FRM.month_e;
        var Months = new Array('','January', 'February', 'March', 'April', 'May', 'June', 'Jule', 'August', 'September', 'October', 'November', 'December');

        for(i = 0; i <= 12; i++)
        {
                if(i == 0) continue;

                Caption = Months[i];
                Value = i; // ((i+"".length == 1)?"0"+i:i);

                newOpt = new Option(Caption, Value)
                l = listBox_s.length;
                listBox_s.options[l++] = newOpt
                listBox_s.value = Caption;

                newOpt = new Option(Caption, Value)
                l = listBox_e.length;
                listBox_e.options[l++] = newOpt
                listBox_e.value = Caption;

                try
                {
                        newOpt = new Option(Caption, Value)
                        l = document.resForm.expMonth.length;
                        document.resForm.expMonth.options[l++] = newOpt
                        document.resForm.expMonth.value = i;
                }
                catch(e){}
        }
}

function loadYears(FRM)
{
        listBox_s = FRM.year_s;
        listBox_e = FRM.year_e;
        for(i = 2007; i <= 2009; i++)
        {
                newOpt = new Option(i, i)
                l = listBox_s.length;
                listBox_s.options[l++] = newOpt
                listBox_s.value = i;

                newOpt = new Option(i, i)
                l = listBox_e.length;
                listBox_e.options[l++] = newOpt
                listBox_e.value = i;

                try
                {
                        newOpt = new Option(i, i)
                        l = document.resForm.expYear.length;
                        document.resForm.expYear.options[l++] = newOpt
                        document.resForm.expYear.value = i;
                }
                catch(e){}
        }
}

function loadGuests(FRM)
{
        listBox_s = FRM.adult;
        listBox_e = FRM.child;
        for(i = 0; i <= 5; i++)
        {
                newOpt = new Option(i, i)
                l = listBox_s.length;
                listBox_s.options[l++] = newOpt
                listBox_s.value = i;

                newOpt = new Option(i, i)
                l = listBox_e.length;
                listBox_e.options[l++] = newOpt
                listBox_e.value = i;
        }

        listBox_s.value = "1";
        listBox_e.value = "1";
}

function setNow(FRM)
{
        var Now = new Date();
        FRM.day_s.value = Now.getDate();
        FRM.day_e.value = Now.getDate() + 1;
        FRM.month_s.value = FRM.month_e.value = Now.getMonth()+1;
        FRM.year_s.value = FRM.year_e.value = Now.getYear();

        try
        {
                document.resForm.expMonth.value = FRM.month_s.value;
                document.resForm.expYear.value = FRM.year_s.value;
        }
        catch(e){}
}

function calculateNight(FRM)
{
        sDate = new Date(FRM.month_s.value+"/"+FRM.day_s.value+"/"+FRM.year_s.value);
        eDate = new Date(FRM.month_e.value+"/"+FRM.day_e.value+"/"+FRM.year_e.value);
        diffSeconds = eDate - sDate;
        noNights = diffSeconds / 86400000;

        if(FRM.name == "calendar")
                document.getElementById("nights").innerHTML = noNights;
		try
		{
        	if(FRM.send.value == "true")
                document.getElementById("nights1").innerHTML = noNights;
		} catch(e){}
}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function sendReservation(Message)
{
        f = document.resForm;
        if(f.name.value.trim() == "" || f.lastname.value.trim() == "" || f.email.value.trim() == "" || f.cardno.value.trim() == "")
        {
                alert(Message);
        }
        else
        {
                f.submit();
        }
}

function setValue(Field,Value)
{
        try
        {
                document.resForm[Field].value = Value;
        }
        catch(e){ }
}

function showBigImage(File)
{
        myWin= open("", "displayWindow", "width=100,height=100,status=yes,toolbar=0,menubar=0,location=0,scrollbars=0");

         myWin.document.open();

         myWin.document.write("<html><head><title>&#1055;&#1088;&#1086;&#1089;&#1084;&#1086;&#1090;&#1088; &#1080;&#1079;&#1086;&#1073;&#1088;&#1072;&#1078;&#1077;&#1085;&#1080;&#1103;"); //Просмотр изображения
         myWin.document.write("</title><meta http-equiv='content-type' content='text/html; charset=windows-1251'></head><body style='margin:0;'>");
         myWin.document.write("<img src='/images/upload/" + File + "' onload='self.resizeTo(this.width,this.height+50);focus();'>");
         myWin.document.write("</body></html>");
         myWin.document.close();
}

function showPicture(File)
{
        myWin= open("", "displayWindow", "width=1000,height=800,status=yes,toolbar=0,menubar=0,location=0,scrollbars=1");

         myWin.document.open();

         myWin.document.write("<html><head><title>&#1055;&#1088;&#1086;&#1089;&#1084;&#1086;&#1090;&#1088; &#1080;&#1079;&#1086;&#1073;&#1088;&#1072;&#1078;&#1077;&#1085;&#1080;&#1103;"); //Просмотр изображения
         myWin.document.write("</title><meta http-equiv='content-type' content='text/html; charset=windows-1251'></head><body style='margin:0;'>");
         myWin.document.write('<table width="90%" style="border:solid 1px #E4E4E4; " border="0" align="center" cellpadding="0" cellspacing="0">  <tr>    <td width="300" height="123" align="right" valign="middle" bgcolor="#FFF3E2"><img src="http://www.snrhotels.com/hotels/ledpet/PPLogo.gif" width="300" height="233" /></td>    <td valign="middle" bgcolor="#FFF3E2"><img src="http://www.snrhotels.com/hotels/ledpet/PPalace.gif" width="478" height="233" /></td>  </tr>  <tr>    <td height="27" colspan="2" bgcolor="#FAD7A7"></td>  </tr>  <tr bgcolor="#FFF3E2">    <td height="300" colspan="2" align=center><form action="" method="post" name="f1" id="f1">');
         myWin.document.write("<img src='/images/upload/" + File + "' onload='focus();'>");
        myWin.document.write('    </form></td>  </tr>  <tr bgcolor="#B38413">    <td height="1" colspan="2"></td>  </tr>  <tr bgcolor="#FFFFFF">    <td height="20" colspan="2"></td>  </tr>  <tr bgcolor="#B38413">    <td height="1" colspan="2"></td>  </tr>  <tr>    <td colspan="2" bgcolor="#FFFFFF"><img src="http://www.snrhotels.com//comfiles/images/general/Slogos.gif" width="60" height="34" /></td>  </tr></table></body></html>');
         myWin.document.close();
}
