/*roll-over and swapping images */
/*---------------------------------------------------------------------------------------*/

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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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];}
}

/*fix phone number*/
/*---------------------------------------------------------------------------------------*/
function fixPhone(arg01, arg02, arg03, id) {
	var fixedNumber = (arg01.toString() + "-" + arg02.toString() + "-" + arg03.toString());
	var formElement = document.getElementById(id);
	formElement.value = fixedNumber;
	}


/*
Auto tabbing script- By JavaScriptKit.com
http://www.javascriptkit.com
*/
/*---------------------------------------------------------------------------------------*/
function autotab(original,destination){
if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
destination.focus()
}
function changeImageInfo(imageURL,title)
		{
		document.big_image.src = imageURL;
		document.image_form.image_title.value = title;
}
function expandcollapse (faqid) { 
   whichfaq = document.getElementById(faqid); 
   
   if (whichfaq.className=="shown") { 
      whichfaq.className="hidden"; 
   } 
   else { 
      whichfaq.className="shown"; 
   } 
} 
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
  // this function is needed to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   
 /* Stripte Rows */
/*---------------------------------------------------------------------------------------*/
 function stripe(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
	var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    // obtain a reference to the desired table
    // if no such table exists, abort
    var table = document.getElementById(id);
    if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

        // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
 		  
          // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
        
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }

/* Validation */
/*---------------------------------------------------------------------------------------*/
  function validEmail(email) {
			invalidChars = " /:,;"
	
			if (email == "") {
				return false
			}
			for (i=0; i<invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1)
			if (atPos == -1) {
				return false
			}
			if (email.indexOf("@",atPos+1) > -1) {
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {
				return false
			}
			if (periodPos+3 > email.length)	{
				return false
			}
			return true
		}

function formValidate_publish_listings_form01(anyForm) {
	fixPhone(document.form1.phone01.value, document.form1.phone02.value, document.form1.phone03.value, 'realphone');
	for (z=0; z<anyForm.length;z++) {
		//alert(anyForm.length);
		var e = anyForm.elements[z];
		
		if ((e.value == null) || (e.value == "") || isBlank(e.value)) {
					e.focus();
					alert("Please enter a valid value for this field");
					return false;
		}
	}
	if (!validEmail(document.form1.email.value)) {
				alert("Invalid email address value. Example: name@server.com");
				document.form1.email.focus();
				document.form1.email.select();
				return false;
			}
	var arElements02 = new Array(anyForm.phone01, anyForm.phone02, anyForm.phone03);
	for(j=0;j<arElements02.length;j++) {
		arElements02[j].focus();
		//alert(j + " arElements.length = " + arElements.length);
		if(!isNum(arElements02[j].value)) {
			alert("Please enter a valid number for this field");
			return false
		}
	arElements02[j].focus();
	}
	//alert("out of for loop");
	document.form1.realphone.value = (anyForm.phone01.value.toString() + "-" + anyForm.phone02.value.toString() + "-" + anyForm.phone03.value.toString()); 
	return true
}
//Check all code

 function checkAll(checkWhat) {
  // Find all the checkboxes...
  var inputs = document.getElementsByTagName("input");

  // Loop through all form elements (input tags)
  for(index = 0; index < inputs.length; index++)
  {
    // ...if it's the type of checkbox we're looking for, toggle its checked status
    if(inputs[index].id == checkWhat)
      if(inputs[index].checked == 0)
      {
        inputs[index].checked = 1;
      }
      else if(inputs[index].checked == 1)
      {
        inputs[index].checked = 0;
      }
  }
}
 function uncheckAll() {
	 
  // Find all the checkboxes...
  var inputs = document.getElementsByTagName("input");

  // Loop through all form elements (input tags)

      if(inputs[index].checked == 0)
      {
        inputs[index].checked = 0;
      }
      else if(inputs[index].checked == 1)
      {
        inputs[index].checked = 0;
      }
  
}
// Begin Flash Javascript communication

function myAlert(alertText) {
	alert("alert: " + alertText);	
}
function mapmovie_DoFSCommand(command) {
alert("in fscommmand: ");
	switch(command) {
	case 'checkbox_uw':
		if (document.adv_search_form.checkbox_uw[0].checked == false) {
		document.adv_search_form.checkbox_uw[0].checked = true ;
		}
		else {
		document.adv_search_form.checkbox_uw[0].checked = false ;
		}
		document.adv_search_form.checkbox_uw[0].value=check(document.adv_search_form.checkbox_uw);
		break;
	case 'checkbox_ue':
		if (document.adv_search_form.checkbox_ue[0].checked == false) {
		document.adv_search_form.checkbox_ue[0].checked = true ;
		}
		else {
		document.adv_search_form.checkbox_ue[0].checked = false ;
		}
		document.adv_search_form.checkbox_ue[0].value=check(document.adv_search_form.checkbox_ue);
		break;
	case 'checkbox_mw':
		if (document.adv_search_form.checkbox_mw[0].checked == false) {
		document.adv_search_form.checkbox_mw[0].checked = true ;
		}
		else {
		document.adv_search_form.checkbox_mw[0].checked = false ;
		}
		document.adv_search_form.checkbox_mw[0].value=check(document.adv_search_form.checkbox_mw);
		break;
	case 'checkbox_me':
		if (document.adv_search_form.checkbox_me[0].checked == false) {
		document.adv_search_form.checkbox_me[0].checked = true ;
		}
		else {
		document.adv_search_form.checkbox_me[0].checked = false ;
		}
		document.adv_search_form.checkbox_me[0].value=check(document.adv_search_form.checkbox_me);
		break;
	case 'checkbox_ws':
		if (document.adv_search_form.checkbox_ws[0].checked == false) {
		document.adv_search_form.checkbox_ws[0].checked = true ;
		}
		else {
		document.adv_search_form.checkbox_ws[0].checked = false ;
		}
		document.adv_search_form.checkbox_ws[0].value=check(document.adv_search_form.checkbox_ws);
		break;
	case 'checkbox_lm':
		if (document.adv_search_form.checkbox_lm[0].checked == false) {
		document.adv_search_form.checkbox_lm[0].checked = true ;
		}
		else {
		document.adv_search_form.checkbox_lm[0].checked = false ;
		}
		document.adv_search_form.checkbox_lm[0].value=check(document.adv_search_form.checkbox_lm);
		break;
	case 'checkbox_fd':
		if (document.adv_search_form.checkbox_fd[0].checked == false) {
		document.adv_search_form.checkbox_fd[0].checked = true ;
		}
		else {
		document.adv_search_form.checkbox_fd[0].checked = false ;
		}
		document.adv_search_form.checkbox_fd[0].value=check(document.adv_search_form.checkbox_fd);
		break;
	
	default:
		//alert("in default");
		break;
	}
	//alert("in DoFsCommand");
	//document.adv_search_form.checkboxName.value=check(document.adv_search_form.checkboxName);

}

<!-- Original:  -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
} 
/*
function mapmovie_DoFSCommand(command, args) { 
  if ( command == "init" ) { 
    var buttons = parent.InternetExplorer ? window.navmovie : window.document.navmovie; 
    if (buttons != null ) { 
      buttons.GotoFrame(parent.targetFrame);
       // This function ensures that thenavigation bar movie is set to the proper 
       // keyframe when it initially loads . The argument init is the name you use 
       // as the command paramter for the action attached to the first keyframe 
       // in the navigation bar  movie. 
    } 
  } 
 */