function showonlyonev2search(thechosenone2) {
      var newboxes2 = document.getElementsByTagName("div");
      for(var x=0; x<newboxes2.length; x++) {
            name = newboxes2[x].getAttribute("name");
            if (name == 'searchboxdiv') {
                  if (newboxes2[x].id == thechosenone2) {
                        if (newboxes2[x].style.display == 'block') {
                        	
                        }
                        else {
                              	newboxes2[x].style.display = 'block';
                              	//alert(thechosenone2);
                              	document.getElementById("search_tab1").setAttribute("class", "search_tab_inactive1"); 
				document.getElementById("search_tab1").setAttribute("className", "search_tab_inactive1"); 
				document.getElementById("search_tab2").setAttribute("class", "search_tab_active2"); 
				document.getElementById("search_tab2").setAttribute("className", "search_tab_active2"); 
                        }
                  }else {
                        newboxes2[x].style.display = 'none';
                        //alert(thechosenone2);
                        if (newboxes2[x].id == 'searchboxadv') {
                        	document.getElementById("search_tab1").setAttribute("class", "search_tab_active1"); 
				document.getElementById("search_tab1").setAttribute("className", "search_tab_active1"); 
				document.getElementById("search_tab2").setAttribute("class", "search_tab_inactive2"); 
				document.getElementById("search_tab2").setAttribute("className", "search_tab_inactive2"); 
                        }
                        //var currTabElem = document.getElementById(thechosenone2); 
                        //alert(currTabElem);
			//currTabElem.setAttribute("class", "residence_tab_active"); 
			//currTabElem.setAttribute("className", "residence_tab_active"); 
			
                        
                  }
            }
      }
} 


function currencyconverter() { window.open("cc.asp","currencyconverter","width=420,height=200,left=140,top=275,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no"); }

function PrinterFriendlyContent() 
{ 
var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
sOption+="scrollbars=yes,resizable=yes"; 

var sWinHTML = document.getElementById('mainpropertycontent').innerHTML; 

var winprint=window.open("","",sOption); 
winprint.document.open(); 
winprint.document.write('<html><link href=css/print.css rel=Stylesheet><body onload=window.print()>');
winprint.document.write(sWinHTML);
winprint.document.write('</body></html>'); 
winprint.document.close(); 
winprint.focus(); 
}

function showonlyonev2(thechosenone) {
      var newboxes = document.getElementsByTagName("div");
      for(var x=0; x<newboxes.length; x++) {
            name = newboxes[x].getAttribute("name");
            if (name == 'newboxes-2') {
                  if (newboxes[x].id == thechosenone) {
                        if (newboxes[x].style.display == 'block') {
                              //newboxes[x].style.display = 'none';
                        }
                        else {
                              newboxes[x].style.display = 'block';
                        }
                  }else {
                        newboxes[x].style.display = 'none';
                  }
            }
      }
} 


function setActiveTab(tabID) { 
	document.getElementById("prop_tab1").setAttribute("class", "residence_tab"); 
	document.getElementById("prop_tab1").setAttribute("className", "residence_tab"); 
	document.getElementById("prop_tab2").setAttribute("class", "residence_tab"); 
	document.getElementById("prop_tab2").setAttribute("className", "residence_tab"); 
	document.getElementById("prop_tab3").setAttribute("class", "residence_tab"); 
	document.getElementById("prop_tab3").setAttribute("className", "residence_tab"); 
	document.getElementById("prop_tab4").setAttribute("class", "residence_tab"); 
	document.getElementById("prop_tab4").setAttribute("className", "residence_tab"); 
	document.getElementById("prop_tab5").setAttribute("class", "residence_tab"); 
	document.getElementById("prop_tab5").setAttribute("className", "residence_tab"); 
	document.getElementById("prop_tab6").setAttribute("class", "residence_tab"); 
	document.getElementById("prop_tab6").setAttribute("className", "residence_tab"); 
	document.getElementById("prop_tab7").setAttribute("class", "residence_tab"); 
	document.getElementById("prop_tab7").setAttribute("className", "residence_tab"); 
	var currTabElem = document.getElementById(tabID); 
	currTabElem.setAttribute("class", "residence_tab_active"); 
	currTabElem.setAttribute("className", "residence_tab_active"); 
return; 
} 


function MM_jumpMenu(targ,selObj,restore)
{
	var op = selObj.options[selObj.selectedIndex];

	if ( (op.text.toLowerCase() == 'view bbfsa member benefits') || (op.text.toLowerCase() == 'view bbfa member benefits') || (op.text.toLowerCase() == 'update your calendar') )
	{
		//location = op.value;
		window.open(op.value, '', '');
	}
	
	else location = op.value;

	if (restore) selObj.selectedIndex = 0;
}


/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

function noSpam(user,domain) {
		locationstring = "mailto:" + user + "@" + domain;
		window.location = locationstring;
	}
	
	

function validateminisearch() {

var theMessage = "Please select the following: \n-----------------------------------\n";
var noErrors = theMessage

if (document.minisearch.optone.value=="") {
theMessage = theMessage + "\n --> State";
}
// If no errors, submit the form
if (theMessage == noErrors) {

	
return true;
} else {
// If errors were found, show alert message
alert(theMessage);
return false;
}
}


function validatesearch() {

var theMessage2 = "Please select the following: \n-----------------------------------\n";
var noErrors2 = theMessage2

//if (document.accom1.StateID.value=="0") {
//theMessage2 = theMessage2 + "\n --> State";
//}

if (document.accom1.search.value=="Keyword Search") {
document.accom1.search.value=="";
}

if (document.accom1.search.value=="Keyword Search") {
//theMessage2 = theMessage2 + "\n --> Keyword(s)";
}

if (document.accom1.nearesttown.value=="Town") {
document.accom1.nearesttown.value=="";
}

if (document.accom1.arrival_date_site.value=="Arrival Date") {
document.accom1.arrival_date_site.value=="";
}

// If no errors, submit the form
if (theMessage2 == noErrors2) {

return true;
} else {
// If errors were found, show alert message
alert(theMessage2);
return false;
}
}

function validatesearchadv() {

var theMessage1 = "Please select the following: \n-----------------------------------\n";
var noErrors1 = theMessage1

if (document.accom2.search.value=="Keyword Search") {
document.accom2.search.value=="";
}

if (document.accom2.nearesttown.value=="Town") {
document.accom2.nearesttown.value=="";
}

if (document.accom2.arrival_date_site2.value=="Arrival Date") {
document.accom2.arrival_date_site2.value=="";
}

if (document.accom2.region.value=="") {
theMessage1 = theMessage1 + "\n --> Region";
}

// If no errors, submit the form
if (theMessage1 == noErrors1) {

return true;
} else {
// If errors were found, show alert message
alert(theMessage1);
return false;
}
}


function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}


function validatebooking() {

var theMessage = "Please complete the following: \n-----------------------------------\n";
var noErrors = theMessage

if (document.booking2.Name.value=="") {
theMessage = theMessage + "\n --> Your name";
}
if (document.booking2.Name.value=="Name") {
theMessage = theMessage + "\n --> Your name";
}

if (document.booking2.Email.value=="") {
theMessage = theMessage + "\n --> Your e-mail";
}
if (document.booking2.Email.value=="Email") {
theMessage = theMessage + "\n --> Your e-mail";
}

if ( !isEmail(document.booking2.Email.value) ) {
theMessage = theMessage + "\n --> A valid e-mail Address";
}

if (document.booking2.Telephone.value=="") {
theMessage = theMessage + "\n --> Your telephone number";
}
if (document.booking2.Telephone.value=="Telephone") {
theMessage = theMessage + "\n --> Your telephone number";
}

if (document.booking2.arrival_date.value=="") {
theMessage = theMessage + "\n --> The arrival date";
}
if (document.booking2.arrival_date.value=="Arrival Date") {
theMessage = theMessage + "\n --> Arrival date";
}

if (document.booking2.txtCaptcha.value=="Security Code") {
theMessage = theMessage + "\n --> Security Code";
}
if (document.booking2.txtCaptcha.value=="") {
theMessage = theMessage + "\n --> Security Code";
}

// If no errors, submit the form
if (theMessage == noErrors) {
return true;

} else {

// If errors were found, show alert message
alert(theMessage);
return false;
}
}

function RefreshImage(valImageId) {
            var objImage = document.getElementById(valImageId)
            if (objImage == undefined) {
                return;
            }
            var now = new Date();
            objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}



