Hi there,

Need some help with a calender script, that will refuse to work because the html in the javascript is being parsed.

Error:
Code:
Active Server Pages error 'ASP 0138' 

Nested Script Block 

/guestbook/default.asp, line 284 

A script block cannot be placed inside another script block.
Page:
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<%
Dim Connect : Set Connect = Server.CreateObject("ADODB.Connection")

' Guestbook View

		Connect.Open "markbutler"
	Dim RsGuestbook
	Set RsGuestbook = Server.CreateObject("ADODB.Recordset")
		RsGuestbook.Open "SELECT * From Guestbook", Connect, 2, 2
		
%><head>
<title>31DunstanView.co.uk - A small cottage.. with a large view..</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../Includes/css.asp" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function YY_checkform() { //v4.65
//copyright (c)1998,2002 Yaromat.com
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      if (myReq&&myObj.value.length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        var myMa=args[i+1].split('_');if(isNaN(parseInt(myV))||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==2)){
          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
      } else if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      } else if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      } else if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    } else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    } else if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
}
//Javascript name: My Date Time Picker
//Date created: 16-Nov-2003 23:19
//Scripter: TengYong Ng
//Website: http://www.rainforestnet.com
//Copyright (c) 2003 TengYong Ng
//FileName: DateTimePicker.js
//Version: 1.8.2
//Contact: contact@rainforestnet.com
// Note: Permission given to use and modify this script in ANY kind of applications if
//       header lines are left unchanged.

//Global variables
var winCal;
var dtToday=new Date();
var Cal;
var MonthName=["January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November", "December"];
var WeekDayName1=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var WeekDayName2=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
var exDateTime;//Existing Date and Time
var selDate;//selected date. version 1.7


//Configurable parameters
var cnTop="200";//top coordinate of calendar window.
var cnLeft="500";//left coordinate of calendar window
var WindowTitle ="DateTime Picker";//Date Time Picker title.
var WeekChar=2;//number of character for week day. if 2 then Mo,Tu,We. if 3 then Mon,Tue,Wed.
var CellWidth=20;//Width of day cell.
var DateSeparator="/";//Date Separator, you can change it to "/" if you want.
var TimeMode=24;//default TimeMode value. 12 or 24

var ShowLongMonth=true;//Show long month name in Calendar header. example: "January".
var ShowMonthYear=true;//Show Month and Year in Calendar header.
var MonthYearColor="#cc0033";//Font Color of Month and Year in Calendar header.
var WeekHeadColor="#0099CC";//Background Color in Week header.
var SundayColor="#6699FF";//Background color of Sunday.
var SaturdayColor="#CCCCFF";//Background color of Saturday.
var WeekDayColor="white";//Background color of weekdays.
var FontColor="blue";//color of font in Calendar day cell.
var TodayColor="#FFFF33";//Background color of today.
var SelDateColor="FFFF99";//Backgrond color of selected date in textbox.
var YrSelColor="#cc0033";//color of font of Year selector.
var MthSelColor="#cc0033";//color of font of Month selector if "MonthSelector" is "arrow".
var ThemeBg="";//Background image of Calendar window.
var PrecedeZero=true;//Preceding zero [true|false]
var MondayFirstDay=true;//true:Use Monday as first day; false:Sunday as first day. [true|false]  //added in version 1.7
//end Configurable parameters
//end Global variable

function NewCal(pCtrl,pFormat,pShowTime,pTimeMode,pScroller,pHideSeconds)
{
	Cal=new Calendar(dtToday);
	if ((pShowTime!=null) && (pShowTime))
	{
		Cal.ShowTime=true;
		if ((pTimeMode!=null) &&((pTimeMode=='12')||(pTimeMode=='24')))
		{
			TimeMode=pTimeMode;
		}
		if ((pHideSeconds!=null)&&(pHideSeconds))
		{
			Cal.ShowSeconds=false;
		}		
	}	
	if (pCtrl!=null)
		Cal.Ctrl=pCtrl;
	if (pFormat!=null)
		Cal.Format=pFormat.toUpperCase();
	if (pScroller!=null)
	{
		if (pScroller.toUpperCase()=="ARROW")
			Cal.Scroller="ARROW";
		else
			Cal.Scroller="DROPDOWN";
    }		
	
	exDateTime=document.getElementById(pCtrl).value;
	if (exDateTime!="")//Parse existing Date String
	{
		var Sp1;//Index of Date Separator 1
		var Sp2;//Index of Date Separator 2 
		var tSp1;//Index of Time Separator 1
		var tSp1;//Index of Time Separator 2
		var strMonth;
		var strDate;
		var strYear;
		var intMonth;
		var YearPattern;
		var strHour;
		var strMinute;
		var strSecond;
		var winHeight;
		//parse month
		Sp1=exDateTime.indexOf(DateSeparator,0)
		Sp2=exDateTime.indexOf(DateSeparator,(parseInt(Sp1)+1));
		
		var offset=parseInt(Cal.Format.toUpperCase().lastIndexOf("M"))-parseInt(Cal.Format.toUpperCase().indexOf("M"))-1;
		if ((Cal.Format.toUpperCase()=="DDMMYYYY") || (Cal.Format.toUpperCase()=="DDMMMYYYY"))
		{
			if (DateSeparator=="")
			{
				strMonth=exDateTime.substring(2,4+offset);
				strDate=exDateTime.substring(0,2);
				strYear=exDateTime.substring(4+offset,8+offset);
			}
			else
			{
				strMonth=exDateTime.substring(Sp1+1,Sp2);
				strDate=exDateTime.substring(0,Sp1);
				strYear=exDateTime.substring(Sp2+1,Sp2+5);
			}
		}
		else if ((Cal.Format.toUpperCase()=="MMDDYYYY") || (Cal.Format.toUpperCase()=="MMMDDYYYY"))
		{
			if (DateSeparator=="")
			{
				strMonth=exDateTime.substring(0,2+offset);
				strDate=exDateTime.substring(2+offset,4+offset);
				strYear=exDateTime.substring(4+offset,8+offset);
			}
			else
			{
				strMonth=exDateTime.substring(0,Sp1);
				strDate=exDateTime.substring(Sp1+1,Sp2);
				strYear=exDateTime.substring(Sp2+1,Sp2+5);
			}

		}
		else if ((Cal.Format.toUpperCase()=="YYYYMMDD") || (Cal.Format.toUpperCase()=="YYYYMMMDD"))
		{
			if (DateSeparator=="")
			{
				strMonth=exDateTime.substring(4,6+offset);
				strDate=exDateTime.substring(6+offset,8+offset);
				strYear=exDateTime.substring(0,4);
			}
			else
			{
				strMonth=exDateTime.substring(Sp1+1,Sp2);
				strDate=exDateTime.substring(Sp2+1,Sp2+3);
				strYear=exDateTime.substring(0,Sp1);
			}
		}

		if (isNaN(strMonth))
			intMonth=Cal.GetMonthIndex(strMonth);
		else
			intMonth=parseInt(strMonth,10)-1;	
		if ((parseInt(intMonth,10)>=0) && (parseInt(intMonth,10)<12))
			Cal.Month=intMonth;
		//end parse month
		//parse Date
		if ((parseInt(strDate,10)<=Cal.GetMonDays()) && (parseInt(strDate,10)>=1))
			Cal.Date=strDate;
		//end parse Date
		//parse year
		YearPattern=/^\d{4}$/;
		if (YearPattern.test(strYear))
			Cal.Year=parseInt(strYear,10);
		//end parse year
		//parse time
		if (Cal.ShowTime==true)
		{
			//parse AM or PM
			if (TimeMode==12)
			{
				strAMPM=exDateTime.substring(exDateTime.length-2,exDateTime.length)
				Cal.AMorPM=strAMPM;
			}
			tSp1=exDateTime.indexOf(":",0)
			tSp2=exDateTime.indexOf(":",(parseInt(tSp1)+1));
			if (tSp1>0)
			{
				strHour=exDateTime.substring(tSp1,(tSp1)-2);
				Cal.SetHour(strHour);
				strMinute=exDateTime.substring(tSp1+1,tSp1+3);
				Cal.SetMinute(strMinute);
				strSecond=exDateTime.substring(tSp2+1,tSp2+3);
				Cal.SetSecond(strSecond);
			}
			//window.status=strHour+":"+strMinute+":"+strSecond;
		}	
	}
	selDate=new Date(Cal.Year,Cal.Month,Cal.Date);//version 1.7
	winCal=window.open("","DateTimePicker","toolbar=0,status=0,menubar=0,fullscreen=no,width=200,height=245,resizable=0,top="+cnTop+",left="+cnLeft);
	RenderCal();
	winCal.focus();
}

function RenderCal()
{
	var vCalHeader;
	var vCalData;
	var vCalTime;
	var i;
	var j;
	var SelectStr;
	var vDayCount=0;
	var vFirstDay;

	winCal.document.open();
	winCal.document.writeln("<html><head><title>"+WindowTitle+"</title>");
	winCal.document.writeln("<script>var winMain=window.opener;</script>");//winMain is window that open calendar window. 
	winCal.document.writeln("</head><body background='"+ThemeBg+"' link="+FontColor+" vlink=" +FontColor+ "><form name='Calendar'>");

	vCalHeader="<table border=1 cellpadding=1 cellspacing=1 width='100%' align=\"center\" valign=\"top\">\n";
	//Table for Month & Year Selector
	vCalHeader+="<tr>\n<td colspan='7'><table border=0 width='100%' cellpadding=0 cellspacing=0><tr>\n";

	//******************Month selector in dropdown list************************
	if (Cal.Scroller=="DROPDOWN")
	{
		vCalHeader+="<td align='left'><select name=\"MonthSelector\" onChange=\"javascript:winMain.Cal.SwitchMth(this.selectedIndex);winMain.RenderCal();\">\n";
		for (i=0;i<12;i++)
		{
			if (i==Cal.Month)
				SelectStr="Selected";
			else
				SelectStr="";	
			vCalHeader+="<option "+SelectStr+" value >"+MonthName[i]+"\n";
		}
		vCalHeader+="</select></td>";
		//Year selector
		vCalHeader+="\n<td align='right'><a href=\"javascript:winMain.Cal.DecYear();winMain.RenderCal()\"><b><font color=\""+YrSelColor+"\"><</font></b></a><font face=\"Verdana\" color=\""+YrSelColor+"\" size=2><b> "+Cal.Year+" </b></font><a href=\"javascript:winMain.Cal.IncYear();winMain.RenderCal()\"><b><font color=\""+YrSelColor+"\">></font></b></a></td></tr></table></td>\n";	
		vCalHeader+="</tr>";
	}
	//******************End Month selector in dropdown list*********************
	//******************Month selector in arrow*********************************
	else if (Cal.Scroller=="ARROW")
	{
		vCalHeader+="<td align='center'><a href='javascript:winMain.Cal.DecYear();winMain.RenderCal();'>- </a></td>";//Year scroller (decrease 1 year)
		vCalHeader+="<td align='center'><a href='javascript:winMain.Cal.DecMonth();winMain.RenderCal();'>&lt;</a></td>";//Month scroller (decrease 1 month)
		vCalHeader+="<td align='center' width='70%'><font face='Verdana' size='2' color='"+YrSelColor+"'><b>"+Cal.GetMonthName(ShowLongMonth)+" "+Cal.Year+"</b></font></td>"//Month and Year
		vCalHeader+="<td align='center'><a href='javascript:winMain.Cal.IncMonth();winMain.RenderCal();'>&gt;</a></td>";//Month scroller (increase 1 month)
		vCalHeader+="<td align='center'><a href='javascript:winMain.Cal.IncYear();winMain.RenderCal();'>+</a></td>";//Year scroller (increase 1 year)
		vCalHeader+="</tr></table></td></tr>"
	}
    //******************End Month selector in arrow******************************
	//Calendar header shows Month and Year
	if ((ShowMonthYear)&&(Cal.Scroller=="DROPDOWN"))
		vCalHeader+="<tr><td colspan='7'><font face='Verdana' size='2' align='center' color='"+MonthYearColor+"'><b>"+Cal.GetMonthName(ShowLongMonth)+" "+Cal.Year+"</b></font></td></tr>\n";
	//Week day header
	vCalHeader+="<tr bgcolor="+WeekHeadColor+">";
	var WeekDayName=new Array();//Added version 1.7
	if (MondayFirstDay==true)
		WeekDayName=WeekDayName2;
	else
		WeekDayName=WeekDayName1;
	for (i=0;i<7;i++)
	{
		vCalHeader+="<td align='center'><font face='Verdana' size='2'>"+WeekDayName[i].substr(0,WeekChar)+"</font></td>";
	}
	
	vCalHeader+="</tr>";	
	winCal.document.write(vCalHeader);
	//Calendar detail
	CalDate=new Date(Cal.Year,Cal.Month);
	CalDate.setDate(1);
	vFirstDay=CalDate.getDay();
	//Added version 1.7
	if (MondayFirstDay==true)
	{
		vFirstDay-=1;
		if (vFirstDay==-1)
			vFirstDay=6;
	}
	//Added version 1.7
	vCalData="<tr>";
	for (i=0;i < vFirstDay;i++)
	{
		vCalData=vCalData+GenCell();
		vDayCount=vDayCount+1;
	}
	//Added version 1.7
	for (j=1;j=Cal.GetMonDays();j++)
	{
		var strCell;
		vDayCount=vDayCount+1;
		if ((j==dtToday.getDate())&&(Cal.Month==dtToday.getMonth())&&(Cal.Year==dtToday.getFullYear()))
			strCell=GenCell(j,true,TodayColor);//Highlight today's date
		else
		{
			if ((j==selDate.getDate())&&(Cal.Month==selDate.getMonth())&&(Cal.Year==selDate.getFullYear()))//modified version 1.7
			{
				strCell=GenCell(j,true,SelDateColor);
			}
			else
			{	
				if (MondayFirstDay==true)
				{
					if (vDayCount%7==0)
						strCell=GenCell(j,false,SundayColor);
					else if ((vDayCount+1)%7==0)
						strCell=GenCell(j,false,SaturdayColor);
					else
						strCell=GenCell(j,null,WeekDayColor);					
				} 
				else
				{
					if (vDayCount%7==0)
						strCell=GenCell(j,false,SaturdayColor);
					else if ((vDayCount+6)%7==0)
						strCell=GenCell(j,false,SundayColor);
					else
						strCell=GenCell(j,null,WeekDayColor);
				}
			}		
		}						
		vCalData=vCalData+strCell;

		if((vDayCount%7==0)&&(jCal.GetMonDays()))
		{
			vCalData=vCalData+"/tr>\n<tr>";
		}
	}
	winCal.document.writeln(vCalData);	
	//Time picker
	if (Cal.ShowTime)
	{
		var showHour;
		showHour=Cal.getShowHour();	
		vCalTime="<tr>\n<td colspan='7' align='center'>";
		vCalTime+="<input type='text' name='hour' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+showHour+" onchange=\"javascript:winMain.Cal.SetHour(this.value)\">";
		vCalTime+=" : ";
		vCalTime+="<input type='text' name='minute' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+Cal.Minutes+" onchange=\"javascript:winMain.Cal.SetMinute(this.value)\">";
		if (Cal.ShowSeconds)
		{
			vCalTime+=" : ";
			vCalTime+="<input type='text' name='second' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+Cal.Seconds+" onchange=\"javascript:winMain.Cal.SetSecond(this.value)\">";
		}
		if (TimeMode==12)
		{
			var SelectAm =(Cal.AMorPM=="AM")? "Selected":"";
			var SelectPm =(Cal.AMorPM=="PM")? "Selected":"";

			vCalTime+="<select name=\"ampm\" onchange=\"javascript:winMain.Cal.SetAmPm(this.options[this.selectedIndex].value);\">";
			vCalTime+="<option "+SelectAm+" value=\"AM\">AM</option>";
			vCalTime+="<option "+SelectPm+" value=\"PM\">PM<option>";
			vCalTime+="</select>";
		}	
		vCalTime+="\n</td>\n</tr>";
		winCal.document.write(vCalTime);
	}	
	//end time picker
	winCal.document.writeln("\n</table>");
	winCal.document.writeln("</form></body></html>");
	winCal.document.close();
}

function GenCell(pValue,pHighLight,pColor)//Generate table cell with value
{
	var PValue;
	var PCellStr;
	var vColor;
	var vHLstr1;//HighLight string
	var vHlstr2;
	var vTimeStr;
	
	if (pValue==null)
		PValue="";
	else
		PValue=pValue;
	
	if (pColor!=null)
		vColor="bgcolor=\""+pColor+"\"";
	else
		vColor="";	
	if ((pHighLight!=null)&&(pHighLight))
		{vHLstr1="color='red'><b>";vHLstr2="</b>";}
	else
		{vHLstr1=">";vHLstr2="";}	
	
	if (Cal.ShowTime)
	{
		vTimeStr="winMain.document.getElementById('"+Cal.Ctrl+"').value+=' '+"+"winMain.Cal.getShowHour()"+"+':'+"+"winMain.Cal.Minutes";
		if (Cal.ShowSeconds)
			vTimeStr+="+':'+"+"winMain.Cal.Seconds";
		if (TimeMode==12)
			vTimeStr+="+' '+winMain.Cal.AMorPM";
	}	
	else
		vTimeStr="";		
	PCellStr="<td "+vColor+" width="+CellWidth+" align='center'><font face='verdana' size='2'"+vHLstr1+"<a href=\"javascript:winMain.document.getElementById('"+Cal.Ctrl+"').value='"+Cal.FormatDate(PValue)+"';"+vTimeStr+";window.close();\">"+PValue+"</a>"+vHLstr2+"</font></td>";
	return PCellStr;
}

function Calendar(pDate,pCtrl)
{
	//Properties
	this.Date=pDate.getDate();//selected date
	this.Month=pDate.getMonth();//selected month number
	this.Year=pDate.getFullYear();//selected year in 4 digits
	this.Hours=pDate.getHours();	
	
	if (pDate.getMinutes()<10)
		this.Minutes="0"+pDate.getMinutes();
	else
		this.Minutes=pDate.getMinutes();
	
	if (pDate.getSeconds()<10)
		this.Seconds="0"+pDate.getSeconds();
	else		
		this.Seconds=pDate.getSeconds();
		
	this.MyWindow=winCal;
	this.Ctrl=pCtrl;
	this.Format="ddMMyyyy";
	this.Separator=DateSeparator;
	this.ShowTime=false;
	this.Scroller="DROPDOWN";
	if (pDate.getHours()<12)
		this.AMorPM="AM";
	else
		this.AMorPM="PM";
	this.ShowSeconds=true;		
}

function GetMonthIndex(shortMonthName)
{
	for (i=0;i<12;i++)
	{
		if (MonthName[i].substring(0,3).toUpperCase()==shortMonthName.toUpperCase())
		{	return i;}
	}
}
Calendar.prototype.GetMonthIndex=GetMonthIndex;

function IncYear()
{	Cal.Year++;}
Calendar.prototype.IncYear=IncYear;

function DecYear()
{	Cal.Year--;}
Calendar.prototype.DecYear=DecYear;

function IncMonth()
{	
	Cal.Month++;
	if (Cal.Month>=12)
	{
		Cal.Month=0;
		Cal.IncYear();
	}
}
Calendar.prototype.IncMonth=IncMonth;

function DecMonth()
{	
	Cal.Month--;
	if (Cal.Month<0)
	{
		Cal.Month=11;
		Cal.DecYear();
	}
}
Calendar.prototype.DecMonth=DecMonth;
	
function SwitchMth(intMth)
{	Cal.Month=intMth;}
Calendar.prototype.SwitchMth=SwitchMth;

function SetHour(intHour)
{	
	var MaxHour;
	var MinHour;
	if (TimeMode==24)
	{	MaxHour=23;MinHour=0}
	else if (TimeMode==12)
	{	MaxHour=12;MinHour=1}
	else
		alert("TimeMode can only be 12 or 24");		
	var HourExp=new RegExp("^\\d\\d");
	var SingleDigit=new RegExp("^\\d");
	if (SingleDigit.test(intHour))
		intHour="0"+intHour;
	if (HourExp.test(intHour) && (parseInt(intHour,10)<=MaxHour) && (parseInt(intHour,10)>=MinHour))
	{	
		if ((TimeMode==12) && (Cal.AMorPM=="PM"))
		{
			if (parseInt(intHour,10)==12)
				Cal.Hours=12;
			else	
				Cal.Hours=parseInt(intHour,10)+12;
		}	
		else if ((TimeMode==12) && (Cal.AMorPM=="AM"))
		{
			if (intHour==12)
				intHour-=12;
			Cal.Hours=parseInt(intHour,10);
		}
		else if (TimeMode==24)
			Cal.Hours=parseInt(intHour,10);	
	}
}
Calendar.prototype.SetHour=SetHour;

function SetMinute(intMin)
{
	var MinExp=new RegExp("^\\d\\d$");
	if (MinExp.test(intMin) && (intMin<60))
		Cal.Minutes=intMin;
}
Calendar.prototype.SetMinute=SetMinute;

function SetSecond(intSec)
{	
	var SecExp=new RegExp("^\\d\\d$");
	if (SecExp.test(intSec) && (intSec<60))
		Cal.Seconds=intSec;

}
Calendar.prototype.SetSecond=SetSecond;

function SetAmPm(pvalue)
{
	this.AMorPM=pvalue;
	if (pvalue=="PM")
	{
		this.Hours=(parseInt(this.Hours,10))+12;
		if (this.Hours==24)
			this.Hours=12;
	}	
	else if (pvalue=="AM")
		this.Hours-=12;	
}
Calendar.prototype.SetAmPm=SetAmPm;

function getShowHour()
{
	var finalHour;
    if (TimeMode==12)
    {
    	if (parseInt(this.Hours,10)==0)
		{
			this.AMorPM="AM";
			finalHour=parseInt(this.Hours,10)+12;	
		}
		else if (parseInt(this.Hours,10)==12)
		{
			this.AMorPM="PM";
			finalHour=12;
		}		
		else if (this.Hours>12)
		{
			this.AMorPM="PM";
			if ((this.Hours-12)<10)
				finalHour="0"+((parseInt(this.Hours,10))-12);
			else
				finalHour=parseInt(this.Hours,10)-12;	
		}
		else
		{
			this.AMorPM="AM";
			if (this.Hours<10)
				finalHour="0"+parseInt(this.Hours,10);
			else
				finalHour=this.Hours;	
		}
	}
	else if (TimeMode==24)
	{
		if (this.Hours<10)
			finalHour="0"+parseInt(this.Hours,10);
		else	
			finalHour=this.Hours;
	}	
	return finalHour;	
}				
Calendar.prototype.getShowHour=getShowHour;		

function GetMonthName(IsLong)
{
	var Month=MonthName[this.Month];
	if (IsLong)
		return Month;
	else
		return Month.substr(0,3);
}
Calendar.prototype.GetMonthName=GetMonthName;

function GetMonDays()//Get number of days in a month
{
	var DaysInMonth=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	if (this.IsLeapYear())
	{
		DaysInMonth[1]=29;
	}	
	return DaysInMonth[this.Month];	
}
Calendar.prototype.GetMonDays=GetMonDays;

function IsLeapYear()
{
	if ((this.Year%4)==0)
	{
		if ((this.Year%100==0) && (this.Year%400)!=0)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		return false;
	}
}
Calendar.prototype.IsLeapYear=IsLeapYear;

function FormatDate(pDate)
{
	var MonthDigit=this.Month+1;
	if (PrecedeZero==true)
	{
		if (pDate<10)
			pDate="0"+pDate;
		if (MonthDigit<10)
			MonthDigit="0"+MonthDigit;
	}

	if (this.Format.toUpperCase()=="DDMMYYYY")
		return (pDate+DateSeparator+MonthDigit+DateSeparator+this.Year);
	else if (this.Format.toUpperCase()=="DDMMMYYYY")
		return (pDate+DateSeparator+this.GetMonthName(false)+DateSeparator+this.Year);
	else if (this.Format.toUpperCase()=="MMDDYYYY")
		return (MonthDigit+DateSeparator+pDate+DateSeparator+this.Year);
	else if (this.Format.toUpperCase()=="MMMDDYYYY")
		return (this.GetMonthName(false)+DateSeparator+pDate+DateSeparator+this.Year);
	else if (this.Format.toUpperCase()=="YYYYMMDD")
		return (this.Year+DateSeparator+MonthDigit+DateSeparator+pDate);
	else if (this.Format.toUpperCase()=="YYYYMMMDD")
		return (this.Year+DateSeparator+this.GetMonthName(false)+DateSeparator+pDate);	
	else					
		return (pDate+DateSeparator+(this.Month+1)+DateSeparator+this.Year);
}
Calendar.prototype.FormatDate=FormatDate;		
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="605" border="0" cellpadding="0" cellspacing="0" class="General-Text">
  <tr> 
    <td width="601"><img src="../Images/Top/Save%7BTOP%7D_r1_c1.gif" width="600" height="130" /></td>
    <td width="10" background="../Images/Top/Save{TOP_BORDER}.gif"><img src="../Images/Top/Save%7BTOP_BORDER%7D.gif" width="5" height="5" /></td>
  </tr>
  <tr> 
    <td height="20" align="center" background="../Images/Top/Save%7BTOP%7D_r2_c1.gif"><table width="590" border="0" cellpadding="0" cellspacing="0" class="General-Text">
        <tr> 
          <td width="125">&nbsp;</td>
          <td width="5">&nbsp;</td>
          <td><a href="http://31dunstanview.co.uk/">home</a> | <a href="http://31dunstanview.co.uk/rooms/">view 
            room gallery</a> | <a href="http://31dunstanview.co.uk/prices/">prices</a> 
            | <a href="http://31dunstanview.co.uk/guestbook/">customer 
            comments</a> | <a href="http://31dunstanview.co.uk/contact/">contact 
            us</a></td>
        </tr>
      </table></td>
    <td align="right" background="../Images/Top/Save{TOP_BORDER}.gif">&nbsp;</td>
  </tr>
  <tr> 
    <td background="../Images/Top/Save{BG}.gif"><img src="../Images/Top/spacer.gif" width="600" height="5" /></td>
    <td background="../Images/Top/Save{TOP_BORDER}.gif"><img src="../Images/Top/spacer.gif" width="1" height="1" /></td>
  </tr>
  <tr> 
    <td background="../Images/Top/Save{BG}.gif"><table width="590" border="0" align="center" cellpadding="0" cellspacing="0" class="General-Text">
        <tr valign="top"> 
          <td width="125" height="125"><table width="125" border="0" cellpadding="0" cellspacing="0" class="General-Text">
              <tr> 
                <td width="125"><img src="../Rooms/Kitchen/tn_image026.jpg" width="125" height="125" /></td>
              </tr>
              <tr> 
                <td><img src="../Images/Top/spacer.gif" width="125" height="5" /></td>
              </tr>
              <tr> 
                <td height="20" align="center" background="../Images/Save{LEFT_HEADER}.gif">View 
                  a Room</td>
              </tr>
              <tr> 
                <td background="../Images/Save{LEFT_BG}.gif"><img src="../Images/Top/spacer.gif" width="125" height="5" /></td>
              </tr>
              <tr> 
                <td background="../Images/Save{LEFT_BG}.gif" align="center"><form action=<%=PopFile%> method="POST">
                    <select name="go" onChange="jumppage(this);" size=1>
  <% 
  ShowSub = request("ShowSub")
  ShowPic = request("ShowPic")
  strPathInfo = Request.ServerVariables("PATH_INFO")
  strPhysicalPath = Server.MapPath(strPathInfo)
 
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFSO.GetFile(strPhysicalPath)
  Set objFolder = objFile.ParentFolder
  Set objFolderContents = objFolder.Files
  For each Folder in objFolder.SubFolders
  	If Left(Folder.Name,1)<>"_" Then
	  IF NOT Folder.Name = "Thumbnails" THEN
	  IF NOT Folder.Name = "Main" THEN
	  	Response.write "<option "
	  	If ShowSub=Folder.Name Then
	  		Response.Write "selected "
	  	End if
	  	Response.Write"value='" & CurFile & "?ShowSub="
	  	Response.Write(Replace(Folder.Name, " ", "%20"))
	  	response.write "'>"
	  	Response.Write(Folder.Name & "</option>")
		END IF
		END IF
	  	If ShowSub <= " " Then
	  	  ShowSub = Folder.Name
		End if
  	End if
  Next 
  Set objFSO = Nothing
  %>
  </select>
  </form></td>
              </tr>
              <tr> 
                <td><img src="../Images/Save%7BLEFT_BOTTOM%7D.gif" width="125" height="5" /></td>
              </tr>
            </table>
            <% IF Session("31DunstanView") <> "" THEN %> <table width="115%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td><img src="../Images/Top/spacer.gif" width="125" height="5" /></td>
              </tr>
              <tr> 
                <td class="General-Text"><strong><a href="../includes/engine.asp?action=moderator&status=logout">Logout</a></strong></td>
              </tr>
            </table>
            <% END IF %> </td>
          <td width="5">&nbsp;</td>
          <td><table width="460" border="0" cellpadding="0" cellspacing="0" class="General-Text">
              <tr> 
                <td><strong><font size="2">Guestbook<br />
                  <br />
                  </font></strong><font size="2">Below we have provided a little 
                  guestbook, just for those who have stayed at 31 Dunstan View, 
                  and would like to make a comment. We would like to let you know, 
                  that any posts that would deem inappropriate, will be edited 
                  or removed.<br />
                  <br />
                  We appreciate your time and effort.<br />
                  <br />
                  Thank you</font></td>
              </tr>
              <tr> 
                <td>&nbsp;</td>
              </tr>
              <tr> 
                <td><% IF RsGuestbook.EOF THEN %>
                  <table width="335%" border="0" cellpadding="0" cellspacing="0" class="General-Text">
                    <tr> 
                      <td><strong>There are no current comments made, if you would 
                        like <br />
                        to add a comment, please fill out the form below.</strong></td>
                    </tr>
                    <tr> 
                      <td><hr color="#3A88B1" noshade="noshade" /></td>
                    </tr>
                  </table>
                  <% Else %>
                  <% IF NOT RsGuestbook.BOF THEN
				  						Do UNTIL RsGuestbook.EOF 
									%> <table width="460" border="0" cellpadding="0" cellspacing="0" class="General-Text">
                    <tr> 
                      <td valign="top"><strong>Name:</strong></td>
                      <td width="5">&nbsp;</td>
                      <td width="335"> <table width="335" border="0" cellpadding="0" cellspacing="0" class="General-Text">
                          <tr> 
                            <td valign="top"><%= RsGuestbook("Name") %></td>
                            <td width="5">&nbsp;</td>
                            <td width="165" align="right" valign="top">&nbsp; </td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr> 
                      <td><strong>Location:</strong></td>
                      <td>&nbsp;</td>
                      <td><%= RsGuestbook("Location") %></td>
                    </tr>
                    <tr> 
                      <td><strong>Date of stay:</strong></td>
                      <td>&nbsp;</td>
                      <td><%= RsGuestbook("StayedDate") %></td>
                    </tr>
                    <tr> 
                      <td colspan="3">&nbsp;</td>
                    </tr>
                    <tr> 
                      <td><strong>Rating:</strong></td>
                      <td>&nbsp;</td>
                      <td><%= RsGuestbook("Rating") %></td>
                    </tr>
                    <tr> 
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr> 
                      <td height="20" valign="top"><strong>Comments:</strong></td>
                      <td>&nbsp;</td>
                      <td rowspan="2" valign="top"><%=Replace(RsGuestbook("Comments").Value,Chr(13),"<br>")%> <% IF RsGuestbook("Edited") = "Yes" THEN %>
                        ... <br /> <br /> <strong>This post has been edited due 
                        to inappropriate language, we apologize for the inconvenience.</strong> 
                        <% END IF %></td>
                    </tr>
                    <tr> 
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr> 
                      <td><strong>Date Of Comment:</strong></td>
                      <td>&nbsp;</td>
                      <td><table width="335" border="0" cellpadding="0" cellspacing="0" class="General-Text">
                          <tr> 
                            <td>&nbsp;</td>
                            <td width="5">&nbsp;</td>
                            <td width="165" align="right">&nbsp; </td>
                          </tr>
                          <tr> 
                            <td><%= RsGuestbook("Date") %></td>
                            <td>&nbsp;</td>
                            <td align="right"> <% IF Session("31DunstanView") <> "" THEN %> <a href="moderator_function.asp?Action=Edit&ID=<%= RsGuestbook("ID") %>"><img src="../Images/Save%7BBUTTON_EDIT%7D.gif" width="80" height="20" border="0" /></a> 
                              <a href="moderator_function.asp?Action=Delete&ID=<%= RsGuestbook("ID") %>"><img src="../Images/Save%7BBUTTON_REMOVE%7D.gif" width="80" height="20" border="0" /></a> 
                              <% END IF %> </td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr> 
                      <td colspan="3"><hr color="#3A88B1" noshade /></td>
                    </tr>
                  </table>
                  <%
				  			RsGuestbook.movenext
							     LOOP
							END IF
						   %> <% end if %> <form name="Add" id="Add" method="post" action="../Includes/engine.asp?Action=Add&Status=Guestbook">
                    <table width="460" border="0" cellpadding="0" cellspacing="0" class="General-Text">
                      <tr> 
                        <td width="120">Name:</td>
                        <td width="5">&nbsp;</td>
                        <td><input name="Name" type="text" class="Guestbook-Fields" id="Name" /></td>
                      </tr>
                      <tr> 
                        <td>Location:</td>
                        <td>&nbsp;</td>
                        <td><input name="Location" type="text" class="Guestbook-Fields" id="Location" /></td>
                      </tr>
                      <tr> 
                        <td>Date of stay:</td>
                        <td>&nbsp;</td>
                        <td><table width="335%" border="0" cellpadding="0" cellspacing="0" class="General-Text">
                            <tr> 
                              <td width="100"><input name="text" type="text" class="General-Text" id="demo1" size="25" maxlength="25" /> 
                              </td>
                              <td width="5">&nbsp;</td>
                              <td> <a href="javascript:NewCal('demo1','ddmmmyyyy')"><img src="../Images/cal.gif" width="16" height="16" border="0" alt="Pick a date" /></a> 
                                <span class="descriptions">pick a date..</span> 
                              </td>
                            </tr>
                          </table></td>
                      </tr>
                      <tr> 
                        <td colspan="3">&nbsp;</td>
                      </tr>
                      <tr> 
                        <td>Rating:</td>
                        <td>&nbsp;</td>
                        <td><select name="Rating" class="Guestbook-Fields" id="Rating">
                            <option>How would you rate the cottage...</option>
                            <option value="5-Star">*****&nbsp;&nbsp;5 Stars</option>
                            <option value="4-Star">****&nbsp;&nbsp;&nbsp;&nbsp;4 
                            Stars</option>
                            <option value="3-Star">***&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3 
                            Stars</option>
                            <option value="2-Star">**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 
                            Stars</option>
                            <option value="1-Star">*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 
                            Star</option>
                          </select></td>
                      </tr>
                      <tr> 
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td height="20" valign="top">Comments:</td>
                        <td>&nbsp;</td>
                        <td rowspan="2" valign="top"><textarea name="Comments" rows="10" class="Guestbook-Fields" id="Comments"></textarea></td>
                      </tr>
                      <tr> 
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><input name="Submit" type="submit" class="General-Text" onClick="YY_checkform('Add','Name','#q','0','You need to provide a name, if you wish to remain anonymous, please type in Anonymous.','Location','#q','0','You must provide your Location.','Rating','#q','1','Please rate our cottage, it would help.','Comments','20','1','You must leave a comment. \(Min 20 Char\)');return document.MM_returnValue" value="Add Comment" /> 
                          <input name="Submit2" type="reset" class="General-Text" value="Clear" /></td>
                      </tr>
                    </table>
                  </form></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
    <td background="../Images/Top/Save{TOP_BORDER}.gif">&nbsp;</td>
  </tr>
  <tr> 
    <td background="../Images/Top/Save{BG}.gif"><img src="../Images/Top/spacer.gif" width="600" height="5" /></td>
    <td background="../Images/Top/Save{TOP_BORDER}.gif"><img src="../Images/Top/spacer.gif" width="1" height="1" /></td>
  </tr>
  <tr> 
    <td height="20" align="center" background="../Images/Top/Save{TOP}_r2_c1.gif"><table width="590" border="0" cellpadding="0" cellspacing="0" class="General-Text">
        <tr> 
          <td width="125">&nbsp;</td>
          <td width="5">&nbsp;</td>
          <td>Copyright 2004 &copy; - 31DunstanView.co.uk : All Rights Reserved.</td>
        </tr>
      </table></td>
    <td valign="bottom" background="../Images/Top/Save{TOP_BORDER}.gif">&nbsp;</td>
  </tr>
  <tr> 
    <td align="center" background="../Images/Save{TOP_BORDER_BOTTOM}.gif"><img src="../Images/Top/spacer.gif" width="600" height="5" /></td>
    <td valign="bottom"><img src="../Images/Save%7BTOP_BORDER_CORNER%7D.gif" width="5" height="5" /></td>
  </tr>
  <tr>
    <td align="center"><img src="../Images/Save%7BEYCDBANNER%7D.gif" height="60" /></td>
    <td valign="bottom">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<%

	RsGuestbook.Close
Set RsGuestbook = Nothing
	Connect.Close
Set Connect = Nothing

%>
Its pointing towards:

Code:
	winCal.document.open();
	winCal.document.writeln("<html><head><title>"+WindowTitle+"</title>");
	winCal.document.writeln("<script>var winMain=window.opener;</script>");//winMain is window that open calendar window. 
	winCal.document.writeln("</head><body background='"+ThemeBg+"' link="+FontColor+" vlink=" +FontColor+ "><form name='Calendar'>");
Thanks in advance

Gav