/*! Crusaders General v1 <http://nvinteractive.co.nz>
	Copyright (c) NV Interactive
	
	References:
		jquery-1.2.6.js
		
	Release Notes:

		
*/

ui = function(){
	
	document.write('<style type="text/css">');
	document.write("body {visibility: hidden;} ");
	document.write('</style>');
	
	var init = function(){
		$("body").css( {visibility: "visible"} );
	}	
	
	return {
	/* Public API
	*/
	init: init
	}
		
}();

$(ui.init);


/* ============================================================= */
/* [ Form default button actions ] */
function searchSubmit(clicked, e) {
    var search = false;
    var q = document.getElementById ? document.getElementById('query').value : query.value;
    search = submitForm(e);
    if (search || clicked) {
        window.location = "/net/search/?q=" + escape(q);
        return true;
    }
    return false;
}

function submitForm(e) {
    var toSubmit = false;
    var evt;

    // IE
    if (document.all) {
        evt = window.event;
        // Other
    } else {
        evt = e;
    }

    var key = evt.keyCode ? evt.keyCode : (evt.which ? evt.which : evt.charCode);

    if (key == 13) {
        // Cancel postback
        toSubmit = true;

        if (document.all) {
            if (window.opera) {
                evt.preventDefault();  // opera, currently this does not work.
            } else {
                evt.returnValue = false; //ie
                evt.cancel = true;
            }

        } else {
            evt.preventDefault(); //geko
        }
    }

    return toSubmit;

}
