// Copyright (c) 2007 PWEBO LLC (http://leaguelogix.com, http://pwebo.com)
//
function toggle_id_with_text(handle,changeTxtHandle,hiddenTxt,visTxt) {
	var element = document.getElementById(handle);
	if(null == element) return 1;
    if(element.style.display=="none"){
    	changeTxtHandle.innerHTML=visTxt;
		element.style.display='';
    }
    else{
    	changeTxtHandle.innerHTML=hiddenTxt;
    	element.style.display='none';
    } 
}

function remove_element(handle){
	parentEle = document.getElementById(handle).parentNode;
	childEle = document.getElementById(handle); 
	
	parentEle.removeChild(childEle);
}
function toggle_div(handle){
	var element = document.getElementById(handle);
	if(null == element) return 1;
	
	if(element.style.display=='none')
		element.style.display='';
	else
		element.style.display='none';
}
function hide_div(handle) {
	var element = document.getElementById(handle);
	if(null == element) return 1;

	element.style.display='none';
}

function show_div(handle) {
	var element = document.getElementById(handle);

	if(null == element) {
		return 1;
	}

	element.style.display='';
}

function disableOnSubmit(submitButtonId,indicatorId,formName) {
	var theIndicator = document.getElementById(indicatorId);
	var submitButton = document.getElementById(submitButtonId);
	
	if(null == submitButton || null == theIndicator) return false;
	
	submitButton.disabled=true;
	submitButton.className='submitButtonDisable';
	theForm = document.forms[formName];
		
	var html = '<input type="hidden" name="'+submitButton.name+'" value="'+submitButton.value+'" id="'+submitButton.id+'" />';

	var newSpan = document.createElement("span");
	newSpan.innerHTML=html;
 	theForm.appendChild(newSpan);
 	
	theForm.submit();
	
	theIndicator.className='workingShow';
	return false;	 
}

function normalizeInt(value){
	var x=parseInt(value); 
	if (isNaN(x)) return 0;
	else return x;
}

function normalizeFloat(value){
	var x=parseFloat(value); 
	if (isNaN(x)) return 0;
	else return x;		
}
