function showConfirm (text) {
	return confirm (text + getSignString ());
}

function showAlert (text) {
	alert (text + getSignString ());
}

function getSignString () {
	return "";
}

function proceed(id) {

	var form=null;
	if (!id) {
		id='theForm';
	}

	if (form=document.getElementById(id)) {
		if (!!window.ActiveXObject) {
			var b=document.createElement('<input type="hidden" name="PST_CTRL_Proceed">');
		} else {
			var b=document.createElement('input');
			b.type='hidden';
			b.name='PST_CTRL_Proceed';
		}
		b.value=1;
		b.style.display='none';
		form.appendChild(b);
		submit(id);
	} else {
		showAlert('form '+id+' not found!');
	}
}


function submit(id){
	var form=null;
	if (!id) {
		id='theForm';
	}

	if (form=document.getElementById(id)) {

		// to invoke all onsubmit handlers
		if (!!window.ActiveXObject) {
			var b=document.createElement('<input type="submit">');
		} else {
			var b=document.createElement('input');
			b.type='submit';
		}
		b.style.display='none';
		form.appendChild(b);
		b.click();

//		form.submit();
	} else {
		showAlert('form '+id+' not found!');
	}
}

function redirToSearchableURI(form, config) {
	var parts=[];
	for(var ctrlName in config) {
		if (el = form.elements['PST_CTRL_'+ctrlName]) {
			if (el.value) {
				parts.push(config[ctrlName]+':'+escape(el.value));
			}
		}
	}
	window.location.href=form.action+'&Search='+parts.join('/');
	return false;
}

function showDiv(id){
	document.getElementById(id).style.display='block';
	return false
}

function showSubDiv(divID, icon) {
	var div = document.getElementById(divID)
	var display = div.style.display
	div.style.display = display ? '' : 'none';
	icon.setAttribute("src", display ? icon.src.replace(/plus/, 'minus') : icon.src.replace(/minus/, 'plus'))
}

function showDiv(divID) {
	var div = document.getElementById(divID)
	div.style.display = div.style.display == 'block' ? 'none' : 'block';
	return false;
}

function checkBoxes(formName, elemPrefix) {
	form = document.forms[formName]
	for (var i=0; i<form.elements.length;i++)
		if (form.elements[i].getAttribute('type')=='checkbox' && form.elements[i].getAttribute('name').indexOf(elemPrefix)==0 && !form.elements[i].disabled)
			form.elements[i].checked = form.elements[i].checked ? '' : 'checked';
}
