//basic init functions to be performed where ever we use jquery - everywhere
$(function(){

	intializeAll();

});

/******************************************************************************/
// generic functions used globally

function getParameter(paramName) {
    var currentUrl = window.location.search
    var strBegin = currentUrl.indexOf(paramName) + (paramName.length+1)
    var strEnd = currentUrl.indexOf("&",strBegin)
    if (strEnd==-1)
            strEnd = currentUrl.length
    return currentUrl.substring(strBegin,strEnd)
}

function appendSession(page) {
	return(page + (page.indexOf("?") == -1 ? "?" : "&") + "-session=" + getParameter("-session"));

}

function intializeAll() {

	// convert the normal buttons to jq buttons			
	$("input:button, input:submit").button();
	
	// toggle the radio or checkbox when the row is clicked.
	$("input:radio, input:checkbox").parent().click( function(event) { if(event.target.type !== 'radio') $(':radio', this).trigger('click'); });


}

