/*
v 5.xx
13 nov 2010
scripts/BIM.js
*/

function toggle_Edit(myObj,myEditObj) {  // show/hide edit layer, pass content obj, edit obj
	if (myObj.style) { 
		if ( myObj.style.display == 'none' ) { // || obj.style.visibility == 'hidden' 
			state = '';
			sv = 'visible';
			editstate = 'none';
			ev = 'hidden';
		} else {
			state = 'none';
			sv = 'hidden';
			editstate = '';
			ev = 'visible';
		}
		myObj.style.display = state;
		if ( myEditObj.style ) {
			myEditObj.style.display = editstate;
		}
	}
} // end func

function disSubmitButts( inTxt ) {
	var i;
	var j;
	var myTxt = inTxt;
	if ( myTxt == '' || myTxt == null || myTxt == "" ) {
		myTxt = 'Submitting: wait...'; /* <?php echo $msgtxt['submitplswait']; ?> */
	}
	if ( myTxt == '' || myTxt == null || myTxt == "" ) {
		myTxt = 'Submitting: wait...';
	}
	for ( i = 0; i < document.forms.length; i ++ ) {
		for ( j = 0; j < document.forms[i].elements.length; j++ ) {
			if ( document.forms[i].elements[j].type == "submit" ) {
				// document.forms[i].elements[j].disabled = true;
				document.forms[i].elements[j].value = myTxt;
			}
		}
	}
	return true;
}

function conf_screen(gotrue,gofalse,msg) {
	var message = msg;
	if ( message == "" ) {
		message = "Do you really want to do that?!?";
	}
	var where_to= confirm(message);
	if ( where_to== true ) {
		window.location=gotrue;
	} else if ( gofalse != "" ) {
		window.location=gofalse;
	}
}

function open_edit_form(myUrl,msg) {  // url, conf message
	var message = msg;
	if ( message == "" ) {
		message = "Open this item for editing? If you have not submitted other changes, your edits will be lost!";
	}
	// conf_screen(myUrl,"",message);
	window.location.href=myUrl;
}

function close_edit_form(myUrl,msg) {  // url, conf message
	var message = msg;
	if ( message == "" ) {
		message = "Close this form? If you have not submitted your changes, your edits will be lost!";
	}
	conf_screen(myUrl,"",message);
}

