// JavaScript Document
function SetRatingToSubmit(RatingNumber)
	{var i;
	document.getElementById('PostCommentForm_ReviewStars').value=RatingNumber;
	for (i=1; i<=5; i++)
		document.getElementById('RatingStar_'+i).style.backgroundImage="url(/Images/Star.Unselected.png)";
	for (i=1; i<=RatingNumber; i++)
		document.getElementById('RatingStar_'+i).style.backgroundImage="url(/Images/Star.Selected.png)";}
function SetRatingOnMouseOver(RatingNumber)
	{var i;
	for (i=5; i>=1; i--)
		if (i>RatingNumber)
			document.getElementById('RatingStar_'+i).style.backgroundImage="url(/Images/Star.Unselected.png)";
		else
			document.getElementById('RatingStar_'+i).style.backgroundImage="url(/Images/Star.Selected.png)";}
function SetRatingOnMouseOut()
	{var i;
	for (i=5; i>=1; i--)
		if (i>document.getElementById('PostCommentForm_ReviewStars').value)
			document.getElementById('RatingStar_'+i).style.backgroundImage="url(/Images/Star.Unselected.png)";
		else
			document.getElementById('RatingStar_'+i).style.backgroundImage="url(/Images/Star.Selected.png)";}
function VoteForComment(FieldId,CommentId,IsPositive)
	{XmlHttp=GetXmlHttpObject();
	if (XmlHttp==null)
		{alert ("Browser does not support HTTP Request");
		return;} 			
	var Parameters='CommentId='+CommentId;
	Parameters+='&IsPositive='+IsPositive;
	Parameters+='&SID='+Math.random();
	XmlHttp.open('POST','/Requests/VoteForComment.cfm',true);
	XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
	XmlHttp.onreadystatechange=function()
		{if (XmlHttp.readyState==4 || XmlHttp.readyState=="complete")
			{if (XmlHttp.status==200)
				document.getElementById(FieldId).innerHTML=XmlHttp.responseText
			else
				alert('Problem retrieving the xml data');};};
	XmlHttp.send(Parameters);}
function SubmitComment(FieldId)
	{var Continue=true;
	if (Continue==true && document.getElementById('PostCommentForm_ReviewTitle').value=='')
		{alert('You need to include a review title');
		Continue=false;}
	if (Continue==true && document.getElementById('PostCommentForm_ReviewStars').value==0)
		{alert('You need to include a review rating');
		Continue=false;}
	if (Continue==true && document.getElementById('PostCommentForm_ReviewComment').value=='')
		{alert('You need to include a review comment');
		Continue=false;}
	if (Continue==true && document.getElementById('PostCommentForm_ReviewFirstName').value=='')
		{alert('You need to include a review first name');
		Continue=false;}
	if (Continue==true && document.getElementById('PostCommentForm_ReviewLastName').value=='')
		{alert('You need to include a review last name');
		Continue=false;}
	if (Continue==true && document.getElementById('PostCommentForm_ReviewEmail').value=='')
		{alert('You need to include a review email');
		Continue=false;}
	if (Continue==true && CheckEmail(document.getElementById('PostCommentForm_ReviewEmail').value)==false)
		{alert('You need to enter a valid email');
		Continue=false;}
	if (Continue==true && document.getElementById('PostCommentForm_ReviewLocation').value=='')
		{alert('You need to include a reviewer location');
		Continue=false;}
	if (Continue)
		{XmlHttp=GetXmlHttpObject();
		if (XmlHttp==null)
			{alert ("Browser does not support HTTP Request");
			return;} 			
		var Parameters='SessionIdentifier='+document.getElementById('PostCommentForm_SessionIdentifier').value;
		Parameters+='&CompanyId='+document.getElementById('PostCommentForm_CompanyId').value;
		Parameters+='&ReviewStars='+document.getElementById('PostCommentForm_ReviewStars').value;
		Parameters+='&ReviewTitle='+document.getElementById('PostCommentForm_ReviewTitle').value.replace(/&/gi,'%26').replace(/%/gi,'\%');
		Parameters+='&ReviewComment='+document.getElementById('PostCommentForm_ReviewComment').value.replace(/&/gi,'%26').replace(/%/gi,'\%');
		Parameters+='&ReviewFirstName='+document.getElementById('PostCommentForm_ReviewFirstName').value.replace(/&/gi,'%26');
		Parameters+='&ReviewLastName='+document.getElementById('PostCommentForm_ReviewLastName').value.replace(/&/gi,'%26');
		Parameters+='&ReviewEmail='+document.getElementById('PostCommentForm_ReviewEmail').value.replace(/&/gi,'%26');
		Parameters+='&ReviewLocation='+document.getElementById('PostCommentForm_ReviewLocation').value.replace(/&/gi,'%26');
		Parameters+='&SID='+Math.random();
		XmlHttp.open('POST','/Requests/PostComment.cfm',true);
		XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
		XmlHttp.onreadystatechange=function()
			{if (XmlHttp.readyState==4 || XmlHttp.readyState=="complete")
				{if (XmlHttp.status==200)
					document.getElementById(FieldId).innerHTML=XmlHttp.responseText
				else
					alert('Problem retrieving the xml data');};};
		XmlHttp.send(Parameters);};}
function SubmitAccommodationEnquiry(FieldId)
	{var Continue=true;
	if (Continue==true && document.getElementById('AccommodationEnquiryFirstName').value=='')
		{alert('You need to include your first name');
		Continue=false;}
	if (Continue==true && document.getElementById('AccommodationEnquirySurname').value=='')
		{alert('You need to include your surname');
		Continue=false;}
	if (Continue==true && document.getElementById('AccommodationEnquiryEmail').value=='')
		{alert('You need to include your email');
		Continue=false;}
	if (Continue==true && CheckEmail(document.getElementById('AccommodationEnquiryEmail').value)==false)
		{alert('You need to enter a valid email');
		Continue=false;}
	if (Continue==true && document.getElementById('AccommodationEnquiryTelephone').value=='')
		{alert('You need to include your telephone');
		Continue=false;}
	if (Continue)
		{XmlHttp=GetXmlHttpObject();
		if (XmlHttp==null)
			{alert ("Browser does not support HTTP Request");
			return;} 			
		var Parameters='CompanyId='+document.getElementById('AccommodationEnquiryCompanyId').value;
		Parameters+='&EnquiryFirstName='+document.getElementById('AccommodationEnquiryFirstName').value;
		Parameters+='&EnquirySurname='+document.getElementById('AccommodationEnquirySurname').value;
		Parameters+='&EnquiryEmail='+document.getElementById('AccommodationEnquiryEmail').value;
		Parameters+='&EnquiryTelephone='+document.getElementById('AccommodationEnquiryCountryCode').value+'.'+document.getElementById('AccommodationEnquiryTelephone').value;
		Parameters+='&EnquiryArrivalDateMonthYear='+document.getElementById('AccommodationEnquiryArrivalDateMonthYear').value;
		Parameters+='&EnquiryArrivalDateDay='+document.getElementById('AccommodationEnquiryArrivalDateDay').value;
		Parameters+='&EnquiryDepartureDateMonthYear='+document.getElementById('AccommodationEnquiryDepartureDateMonthYear').value;
		Parameters+='&EnquiryDepartureDateDay='+document.getElementById('AccommodationEnquiryDepartureDateDay').value;
		Parameters+='&EnquiryNoPeople='+document.getElementById('AccommodationEnquiryNoPeople').value;
		Parameters+='&EnquiryNotes='+document.getElementById('AccommodationEnquiryNotes').value;
		Parameters+='&SID='+Math.random();
		XmlHttp.open('POST','/Requests/PostAccommodationEnquiry.cfm',true);
		XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
		XmlHttp.onreadystatechange=function()
			{if (XmlHttp.readyState==4 || XmlHttp.readyState=="complete")
				{if (XmlHttp.status==200)
					document.getElementById(FieldId).innerHTML=XmlHttp.responseText
				else
					alert('Problem retrieving the xml data');};};
		XmlHttp.send(Parameters);};}
function SubmitGenericEnquiry(FieldId)
	{var Continue=true;
	if (Continue==true && document.getElementById('GenericEnquiryFirstName').value=='')
		{alert('You need to include your first name');
		Continue=false;}
	if (Continue==true && document.getElementById('GenericEnquirySurname').value=='')
		{alert('You need to include your surname');
		Continue=false;}
	if (Continue==true && document.getElementById('GenericEnquiryEmail').value=='')
		{alert('You need to include your email');
		Continue=false;}
	if (Continue==true && CheckEmail(document.getElementById('GenericEnquiryEmail').value)==false)
		{alert('You need to enter a valid email');
		Continue=false;}
	if (Continue)
		{XmlHttp=GetXmlHttpObject();
		if (XmlHttp==null)
			{alert ("Browser does not support HTTP Request");
			return;} 			
		var Parameters='CompanyId='+document.getElementById('GenericEnquiryCompanyId').value;
		Parameters+='&EnquiryFirstName='+document.getElementById('GenericEnquiryFirstName').value;
		Parameters+='&EnquirySurname='+document.getElementById('GenericEnquirySurname').value;
		Parameters+='&EnquiryEmail='+document.getElementById('GenericEnquiryEmail').value;
		Parameters+='&EnquiryTelephone='+document.getElementById('GenericEnquiryCountryCode').value+'.'+document.getElementById('GenericEnquiryTelephone').value;
		Parameters+='&EnquiryNotes='+document.getElementById('GenericEnquiryNotes').value;
		Parameters+='&SID='+Math.random();
		XmlHttp.open('POST','/Requests/PostGenericEnquiry.cfm',true);
		XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
		XmlHttp.onreadystatechange=function()
			{if (XmlHttp.readyState==4 || XmlHttp.readyState=="complete")
				{if (XmlHttp.status==200)
					document.getElementById(FieldId).innerHTML=XmlHttp.responseText
				else
					alert('Problem retrieving the xml data');};};
		XmlHttp.send(Parameters);};}