<!--
//Javascript Functions File

/***********************************************
* Open a window to show a specific file
/***********************************************/
function showFile(theFile, theWidth, theHeight){
	window.open("/fileview.php?theFile="+theFile+"&theWidth="+theWidth+"&theHeight="+theHeight,"filePreview","scrollbars=yes,width="+(theWidth+20)+",height="+theHeight+",top=0,left=0");
}
function sendConfirm(form, field, idBase, desItem, tipItem, tipRel){
	updForm = eval("document."+form);
	updField = eval("document."+form+"."+field);
	MsgConfirm = "Confirma exclusão do(a) "+tipItem+" "+desItem +" ?";
	if (tipRel != ""){
		MsgConfirm = MsgConfirm + "\nIsso inclui apagar tudo o que se relaciona a este(a) "+tipItem+" ("+tipRel+")!";
	}
	MsgConfirm = MsgConfirm + "\nAviso: esse procedimento não tem volta!!"; 
if (confirm(MsgConfirm)){
		updField.value = idBase;
		updForm.submit();
	}
}
function sendRequest(form, field, idBase, field2, idBase2){
	updForm = eval("document."+form);
	updField = eval("document."+form+"."+field);
	updField.value = idBase;
	if (field2 != ""){
		updForm2 = eval("document."+form);
		updField2 = eval("document."+form+"."+field2);
		updField2.value = idBase2;
	}
	updForm.submit();
} 
function openWindow(thePage, theParameters, theName, theWidth, theHeight) {
    window.open(thePage+theParameters, theName, "width="+theWidth+",height="+theHeight+",status=yes,scrollbars=yes,resizable=no");
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, '');
}

String.prototype.ltrim = function() {
	return this.replace(/^\s+/, '');
}

String.prototype.rtrim = function() {
	return this.replace(/\s+$/, '');
}

function sortResult(sortOrder, sortKey){
	document.getElementById('sortOrder').value=sortOrder;
	document.getElementById('sortKey').value=sortKey;
	document.forms[0].submit();
}
//-->

