// get form buttons on page (excluding action bar) & generate html for left & right caps	
function formButtonBg(customSelector) {	
	var formButtons = null;
	if(customSelector) {
		formButtons = customSelector;
	} else if ($('page-content')) {
		formButtons = $('page-content').select('input.lw-form-button','input.lw-form-button-delete');
	}
	if (formButtons != null) {
	    var btnLeft = "<img src=\"/images/svc-button-left.gif\" class=\"svc-btn-left\" \/>";
	    var btnRight = "<img src=\"/images/svc-button-right.gif\" class=\"svc-btn-right\" \/>";

	    formButtons.each(function(fb) {
		fb.insert({before:btnLeft});
		fb.insert({after:btnRight});	
		});	
	}
}
	
/*
  addButtonPipes() draws the pipes between <li> buttons
*/
function addButtonPipes() {
    var msgButtons = jQuery('.lw-js-pipes li.button');
    if (msgButtons) {
    	msgButtons.each(function(){
        drawPipes(this);
      });
    }
}
	
var drawPipes = function(theButton) {

    // clean leading/trailing spaces & text nodes from <li>
    theButton.innerHTML.strip();
  $(theButton).cleanWhitespace();
    // add pipe to all <li>'s except the first <li>
    if($(theButton).previous()) {
    if (navigator.userAgent.indexOf('MSIE') !=-1  ) {
   			theButton.innerHTML = '<span class="lw-pipe">&nbsp;&#124;&nbsp;</span>' + theButton.innerHTML;
   		} else {
			theButton.innerHTML = "&nbsp;|&nbsp;" + theButton.innerHTML;
   		}
    } else {
	// if this is the first <li> in the <ul>, get the parent ul & strip text nodes
	$(theButton).up().cleanWhitespace();
    }
}

