function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function switchSite() {
  var newHref = document.form1.language.value;
  document.location.href = newHref;
}

//An array of possible form field names and their client side translations
var form_translation = new Array(24);
form_translation['FIRST_NAME'] = 'first name';
form_translation['LAST_NAME'] = 'last name';
form_translation['BRIDE_NAME'] = 'bride\'s name';
form_translation['GROOM_NAME'] = 'groom\'s name';
form_translation['BRIDE_FIRST_NAME'] = 'bride\'s first name';
form_translation['GROOM_FIRST_NAME'] = 'groom\'s first name';
form_translation['BRIDE_LAST_NAME'] = 'bride\'s last name';
form_translation['GROOM_LAST_NAME'] = 'groom\'s last name';
form_translation['HOME_EMAIL'] = 'home email address';
form_translation['GROOM_RELIGION'] = 'groom\'s religion';
form_translation['BRIDE_RELIGION'] = 'bride\'s religion';
form_translation['GROOM_NATIONALITY'] = 'groom\'s nationality';
form_translation['BRIDE_NATIONALITY'] = 'bride\'s nationality';
form_translation['WEDDING_MONTH'] = 'month for the wedding';
form_translation['WEDDING_DATE'] = 'day (date) for the wedding';
form_translation['WEDDING_YEAR'] = 'year for the wedding';
form_translation['WEDDING_LOCATION'] = 'location for the wedding';
form_translation['NUMBER_OF_GUESTS'] = 'value for the number of guests';
form_translation['BUDGET_FOR_WEDDING_DAY'] = 'a bugdet for the entire wedding day';
form_translation['HONEYMOON_BUDGET'] = 'a honeymoon budget (excluding airfare)';
form_translation['DAY_PHONE'] = 'a daytime phone number';

//Copied from Mike Spainhower's form validation scripts

// A utility function that returns true if a string contains only whitespace characters.
function isBlank(s) {
  for(var i = 0; i < s.length; i++) {
    var c = s.charAt(i);
    if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
  }
  return true;
}

//A function to make sure that required fields are filled in on the form.
function verify(f) {

 //Set the errors flag to false. If nothing changes this then the form will submit.
  var errors = false;
	var msg = "";
	var missing = "<table cellpadding=0 cellspacing=0 border=0>\n";
  var filter = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; // valid email format	
  
 //The required field is a hidden element in the form. It will decide which elements need to be checked.
 //So, we divide the single text string that is separated with commas into an array.
  var required_array = f.required.value.split(',');

  var part_num=0;
  while (part_num < required_array.length) {
   //Cycle through the fields
    var current_field = required_array[part_num];
//alert("Current field is: " + current_field);
   //If the selected index is not null, then this is a drop down
    if (f[current_field].selectedIndex != null) {
      if (current_field != 'WEDDING_MONTH' && current_field != 'WEDDING_DATE' && current_field != 'WEDDING_YEAR') {
       //Check to see if the dropdown has been set to a valid value. Values 0 and 1 are not valid
        if (f[current_field].selectedIndex < 2) {
//alert("Please select a " + form_translation[current_field]);
		      missing += "<tr><td class=\"RFBody\">Please select:&nbsp;&nbsp;</td><td class=\"RFPopErrField\">" + form_translation[current_field] + ".</td></tr>\n";
          errors = true;
        }
      }
    } else {
     //Otherwise, it is most likely a text area. If value is not null, it is a text box
      if (f[current_field].value != null) {
       //Run the value of the textbox through Mike's isBlank function to make sure it is
       //not simply full of whitespace characters
        if (isBlank(f[current_field].value)) {
//alert ("Please enter a " + form_translation[current_field]);
		      missing += "<tr><td class=\"RFBody\">Please enter:&nbsp;&nbsp;</td><td class=\"RFPopErrField\">" + form_translation[current_field] + ".</td></tr>\n";
          errors = true;
        }
      } else {
       //If neither of the above are true then the field has neither a value, nor a selected index,
       //This usually means it isn't present in the form.
//alert (current_field + " is a required field, yet it is not present in the form.");
      }
    }
   //Go to the next required item
    part_num+=1;
  }
	missing += "</table>";		
  if (!errors) {
    f.submit();
		return true;
	} 
	var xpos = (screen.width - 400) / 2;
	var ypos = (screen.height - 300) / 2;
	var settings = 'height=400,width=400,toolbar=0,menubar=0,location=0,scrollbars=0,resizable=1,top=' + ypos + ',left=' + xpos;
	var content = '<html>' +
			          '<head>' +
			          '<title>Form Error</title>' +
			          '<meta http-equiv="Content-Type" CONTENT="text/html; charset=iso-8859-1">' +
			          '<style type="text/css">' +
			          '.RFTitle	  		{ font-family: Times; font-size: 18px; color: #990000; font-weight:bold; text-align:center; }' +
			          '.RFSubTitle		{ font-family: Times; font-size: 15px; color: #006600; font-weight:bold; text-align:center; }' +
			          '.RFHeading1		{ font-family: Arial; font-size: 16px; color: #006600; font-weight:bold; text-align:center; }' +
			          '.RFHeading2		{ font-family: Arial; font-size: 16px; color: #990000; font-weight:bold; text-align:center; }' +
			          '.RFBody			{ font-family: Times; font-size: 14px; color: #006600; }' +
			          '.RFBodyBold  	{ font-family: Times; font-size: 14px; color: #006600; font-weight:bold; }' +
			          '.RFBodyCenter	{ font-family: Times; font-size: 14px; color: #006600; text-align:center; }' +
			          '.RFBodyBoldCenter{ font-family: Times; font-size: 14px; color: #006600; font-weight:bold; text-align:center; }' +
			          '.RFPopErrField	{ font-family: Times; color: #990000; font-size: 14px; font-weight: bold; }' +
			          '.RFStar			{ font-size: 14px; color: #993300; font-weight: bold; }' +
			          '.RFStarInvis		{ font-size: 14px; color: #993300; font-weight: bold; visibility:"hidden" }' +
			          'A.RF:link, ' +
			          'A.RF:visited, ' +
			          'A.RF:active      { font-family: Times; color: #006600; font-size: 14px; font-weight: bold; text-align:center; }' +
			          'A.RF:hover		{ font-family: Times; color: #006600; font-size: 14px; font-weight: bold; text-align:center; }' +
			          '</style>' +
			          '<body bgcolor="#FFFFFF">' +
			          '<p class="RFTitle">Form Error</p>' +
			          '<p class="RFBodyBold">The form was not submitted due to the following error(s).<br>' +
			          '<blockquote>' + missing + '</blockquote>' +
			          '<p class="RFBodyBold">Note: <span class="RFStar">*</span> Indicates a required field on the request form.</p>' +
			          '<p class="RFBodyCenter"><a class="RF" href="Javascript:window.close();">Close this window</a>' +
			          '</body>' +
			          '</html>';
   
	NewWindow = window.open("","",settings);
	NewWindow.document.write(content);
	NewWindow.document.close();
	window.scrollTo(0, 0);
	return false;
}

//Script from The JavaScript Source!! http://javascript.internet.com
//Prevents right-click

/*
function right(e) {
  if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
    return false;
  else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
    alert("Sorry, you do not have permission to right click.");
    return false;
  }
  return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
*/

//Copied from Typo3 source to reduce rendered HTML code size

	browserName = navigator.appName;
	browserVer = parseInt(navigator.appVersion);
	var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
	if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror") {version = "n3";} else {version = "n2";}
	function blurLink(theObject)	{
		if (msie4)	{theObject.blur();}
	}

 	function openPic(url,winName,winParams)	{
    var winParams = "titlebar=no,directories=0,location=0,menubar=0,personalbar=0,toolbar=0,scrollbars=0,status=0,resizable=1,width=165,height=150"; 
    var theWindow = window.open(url,winName,winParams);	
    if (theWindow)	{theWindow.focus();}
  }