function popup()
{
	mywindow = window.open("http://www.dublinpubcrawl.com/images/start_map.jpg", "Tour_Start_Location","location=1,status=1,scrollbars=1, width=375,height=419");
	mywindow.moveTo(0,0);
} 

function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt + " is a required Field");return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}

function match_field(field_1, field_2, alerttxt)
{
  if (field_1.value != field_2.value)
    {alert(alerttxt);return false;}
  else {return true;}
}

function validate_checkbox(field, alerttxt)
{
  if (field.checked == false)
    {alert(alerttxt);return false;}
  else {return true;}
}

function validate_pt_form(thisform)
{
	with (thisform)
	{
		if(validate_required(first_name,"First Name")==false){first_name.focus();return false;}
		if(validate_required(last_name,"Last Name")==false){last_name.focus();return false;}
		if(validate_required(email_1,"Email Address")==false){email_1.focus();return false;}
		if(validate_email(email_1,"This is not a valid email address")==false){email_1.focus();return false;}
		if(validate_required(email_2,"Confirm Email Address")==false){email_2.focus();return false;}
		if(match_field(email_1, email_2, "Email addresses dont match")==false){email_1.focus();return false;}
		if(validate_required(telephone,"Contact Telephone number")==false){telephone.focus();return false;}
	}
}

function validate_cp_form(thisform)
{
	with(thisform)
	{
		if(validate_checkbox(terms,"Please read Terms and Conditions and check the box before proceeding to payment")==false){terms.focus();return false;}	
	}
}

function validate_jp_form(thisform)
{
	with (thisform)
	{
		if(adults.value==0 && students.value==0 &&postire.value==0 && postabr.value==0)
		{
			alert("Please select an amount of books and/or tour tickets to purchase");
			return false;
		}
	}
}