//function to trim a string
function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}
//function to toggle all checkboxes
function toggleAll(oElement) 
	{ 
	  oForm = oElement.form; 
	  oElement = oForm.elements[oElement.name]; 
	  if(oElement.length) 
	  { 
	    bChecked = oElement[0].checked; 
	    for(i = 1; i < oElement.length; i++) 
	      oElement[i].checked = bChecked; 
	  } 
	} 
	
//function to toggle individual checkboxes	
function toggle(oElement) 
	{ 
	  oForm = oElement.form; 
	  oElement = oForm.elements[oElement.name]; 
	  if(oElement.length) 
	  { 
	    bIndeterminate = false; 
	    bChecked = true; 
	    nChecked = 0; 
	    for(i = 1; i < oElement.length; i++) 
	      if(oElement[i].checked) 
	        nChecked++; 
	    if(nChecked < oElement.length - 1) 
	    { 
	      if(nChecked) 
	        bIndeterminate = true; 
	      else 
	      { 
	        bIndeterminate = false; 
	        bChecked = false; 
	      } 
	    } 
	    else 
	    { 
	      bIndeterminate = false; 
	    } 
	    oElement[0].indeterminate = bIndeterminate; 
	    oElement[0].checked = bChecked; 
	  } 
	}
	
	/** This set of functions is used on list pages to add/ remove a ad from MyList **/
function ChecklistDelrentals(x,y){
	window.open('add_to_chklist.cfm?id='+x,'checklist','WIDTH=300,HEIGHT=300,scrollbars=yes,resize=yes,left=150,top=100,screenX=150,screenY=100');
}

function ChecklistAddrentals(x){
	window.open('add_to_chklist.cfm?add=1&id='+x,'checklist','WIDTH=300,HEIGHT=300,scrollbars=yes,resize=yes,left=150,top=100,screenX=150,screenY=100');
}


function Checklistrentals(element,st) {

 if (document.images) {

	if (element.type == "checkbox") {

	if (element.checked) 

	ChecklistAddrentals(element.value);

	else

	ChecklistDelrentals(element.value);

  }

 }

}
// end of functions for Mylist 

// functions to disable right click 
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
