

function performAction(action, id) {
	document.form1.hiddenAction.value=action;
	document.form1.hiddenActionID.value = id;
	document.form1.submit();
	return false;
}


function editRecord(idName, id) {
	var url = window.location.href;
	if (url.indexOf('?') < 0) {
		url += '?';
	} else {
		url += '&';
	}
	url += idName + '=' + id + '&action=edit';
	window.location.href = url;
}

function deleteRecord(what, id) {
	var msg = 'Are you sure you want to delete this ' + what + '?';
	c = confirm(msg);
	if (c) {
		document.form1.hiddenAction.value='delete';
		document.form1.hiddenActionID.value=id;
		document.form1.submit();
	}
}

function saveScrollPosition() {
    var y = 0;
    if( typeof( window.pageYOffset ) == 'number' ) {
        // Netscape
        y = window.pageYOffset;
    } else if( document.body && document.body.scrollTop ) {
        // DOM
        y = document.body.scrollTop;
    } else if( document.documentElement && document.documentElement.scrollTop ) {
        // IE6 standards compliant mode
        y = document.documentElement.scrollTop;
    }
    
	document.form1.hiddenScrollY.value=y;
	
    return y;
}

function keepScroll() {
	document.form1.hiddenKeepScroll.value=1;
}



function setCaretTo(obj, pos) { 
    if(obj.createTextRange) { 
        /* Create a TextRange, set the internal pointer to
           a specified position and show the cursor at this
           position
        */ 
        var range = obj.createTextRange(); 
        range.move("character", pos); 
        range.select(); 
    } else if(obj.selectionStart) { 
        /* Gecko is a little bit shorter on that. Simply
           focus the element and set the selection to a
           specified position
        */ 
        obj.focus(); 
        obj.setSelectionRange(pos, pos); 
    } 
} 
