function popup(url,windowname,width,height) {
	width=(width)?width:screen.width/3;
	height=(height)?height:screen.height/3;
	var screenX = (screen.width/2 - width/2);
	var screenY = (screen.height/2 - height/2);
	var features= "width=" + width + ",height=" + height;
	features += ",screenX=" + screenX + ",left=" + screenX;
	features += ",screenY=" + screenY  +",top=" + screenY +",status=1";
	var mywin=window.open(url, windowname, features);
	if (mywin) 
		mywin.focus();
	return mywin;
}
function popupmax(url,windowname,width,height) {
	width=(width)?width:screen.width/3;
	height=(height)?height:screen.height/3;
	var screenX = (screen.width/2 - width/2);
	var screenY = (screen.height/2 - height/2);
	var features= "width=" + width + ",height=" + height;
	features += ",screenX=" + screenX + ",left=" + screenX;
	features += ",screenY=" + screenY +",top=20, scrollbars=yes, menubar=yes, resizable=yes,toolbar=yes, location=yes,status=1";
	var mywin=window.open(url, windowname, features);
	if (mywin) 
		mywin.focus();
	return mywin;
}
function popleft(url,windowname,width,height) {
	width=(width)?width:screen.width/3;
	height=(height)?height:screen.height/3;
	var screenX = (screen.width/2 - width/2);
	var screenY = (screen.height/2 - height/2);
	var features= "width=" + width + ",height=" + height;
	features += ",screenX=" + screenX + ",left=0";
	features += ",screenY=" + screenY  +",top=" + screenY +",status=1,scrollbars=yes";
	var mywin=window.open(url, windowname, features);
	if (mywin) 
		mywin.focus();
	return mywin;
}
//onclick="popup('member_Alias.asp?memid=<%=contactid%>&fid=<%=fid%>&sess=<%= sess %>&domid=<%= domid %>','win6',400,240);return false"

<!-- Hide from older browsers
function SwitchImg()
{ //start
  var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
    for (rem=0; rem < (SwitchImg.arguments.length-2); rem+=3) {
    	store = SwitchImg.arguments[(navigator.appName == 'Netscape')?rem:rem+1];
    if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
        (store.indexOf('document.all[')==0 && document.all==null))
         store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
         obj = eval(store);
    if (obj != null) {
   	   switcher[keep++] = obj;
      switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
      obj.src = SwitchImg.arguments[rem+2];
  } }
  document.Data = switcher;
} //end

function RestoreImg()
{ //start
  if (document.Data != null)
    for (var rem=0; rem<(document.Data.length-1); rem+=2)
      document.Data[rem].src=document.Data[rem+1];
} //end

// end hiding contents -->
function mousedown(el) {
  el.className = "pressed";
}
function mouseup(el) {
  el.className = "raised";
}





function bookdate(xdate, allcount, freecount, weekcost, daycost) {
	
 if (document.report.TempDate.value !="Please Choose"){
   var startDate = new Date(document.report.TempDate.value);
 var endDate = new Date(xdate);

var ecurr_date = endDate.getDate();
var ecurr_month = endDate.getMonth();
ecurr_month++;
var ecurr_year = endDate.getFullYear();
var ukenddate = ecurr_date + "/" + ecurr_month + "/" + ecurr_year;

var allref = parseFloat(allcount) - parseFloat(document.report.TempAll.value) ;
var freeref = parseFloat(freecount) - parseFloat(document.report.TempFree.value);
 
 
 //alert("startdate= " + startDate + " enddate= " + endDate);
 
  if (endDate < startDate){
		alert("Please enter a valid date");
		return false;
	}	
  if (allref > freeref){
		alert("One or more of your days are already booked. Please select a different date range.");
		return false;
	}	
  document.report.EndDate.value=ukenddate;
  
  //Set the two dates
//today=new Date()
//var christmas=new Date(today.getFullYear(), 11, 25) //Month is 0-11 in JavaScript
//if (today.getMonth()==11 && today.getDate()>25) //if Christmas has passed already
//christmas.setFullYear(christmas.getFullYear()+1) //calculate next year's Christmas
//Set 1 day in milliseconds
var one_day=1000*60*60*24
var staynights = Math.ceil((endDate-startDate)/(one_day)) + 1
//Calculate difference btw the two dates, and convert to days
//document.write
var noweeks = parseInt(staynights/7)
var remdays = staynights - (noweeks * 7)
var basecost = noweeks * weekcost
//if (remdays == 6){remdays = 5 }
var surcharge = remdays * daycost
var totcost = Math.round(basecost + surcharge)
//alert("remdays ="+ remdays)
//
document.report.staynights.value=staynights;
document.report.holcost.value=totcost;
document.getElementById('partyshow').style.visibility='visible';
  }
 else
  {
var startDate = new Date(xdate);  
var curr_date = startDate.getDate();
var curr_month = startDate.getMonth();
curr_month++;
var curr_year = startDate.getFullYear();
var ukstartdate = curr_date + "/" + curr_month + "/" + curr_year; 
	  document.report.TempAll.value=allcount;
	  document.report.TempFree.value=freecount;
	  document.report.TempDate.value=xdate;
	  document.report.StartDate.value=ukstartdate;
  }
}
function warnme(){
	alert("hello");
}

function tot(npep, snights, scost)
	{
var subcost = parseFloat(scost);
var staynights = parseFloat(snights);
var peps = parseFloat(npep)-2;
var pepscost = peps * 2.5;
var pepsnights = staynights * pepscost;
var cost = subcost + pepsnights;

//alert("cost="+scost)
document.report.holcosttext.value="The cost of your "+staynights+" night stay is £"+ cost;
document.report.holcost.value=cost;
document.report.holdep.value=cost/5;
document.getElementById('proceed').style.visibility='visible';

	}

function calendar(formname,currentdate)
	{
	self.name = 'opener';
	remote = open('calendar.asp?name=' + formname + '&sdate=' + currentdate, 'remote', 'width=160,height=165,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes,fullscreen=no');
 	remote.focus();
	}
function actiontext(item1, item2, item3)
	{
alert(item1, item2, item3);	
item1.value = "Please Choose";
item2.value = "Please Choose";
item3.value = "Please Choose";
	}
	function ConfirmContent() {
	 if (document.editor.Email.value.length<3){
		alert("Please enter an Email Address");
		return false;
	}	
   if (document.editor.login.value.length<3){
		alert("Please enter a password");
		return false;
	}	
 if (document.editor.login.value!=document.editor.login2.value){
		alert("Passwords do not match, please re-enter");
		return false;
	}
	 
	//if ( (document.editor.gender[0].checked != true) && 
    // (document.editor.gender[1].checked != true) && 
    // (document.editor.gender[2].checked != true) && 
    // (document.editor.gender[3].checked != true) ) 
//{
 	 //alert("Please select - What are you?");
	// return false;
	 //}
	  document.editor.submit();
}
	function SubmitLogin() {
	//if (document.editor.loginemail.value.length==0){
		//alert("Please enter an Email Address");
		//return false;
	//}	
  	//if (document.editor.loginpassword.value.length==0){
		//alert("Please enter a valid Password");
		//return false;
	//}	
	document.editor.action2.value="none";
	document.editor.submit();
}	
	
		function SubmitPayment() {
	
	
	document.myHoliday.submit();
}	
	
	