var operation = "";

// obtain the parameter from the browser - or from a URL given as inputStr
function getURLParam(strParamName, inputStr) {
	var strReturn = "";

	if(inputStr == undefined) {
		var strHref = window.location.href;
	}
	else {
		var strHref = inputStr;
	}

	if ( strHref.indexOf("?") > -1 ){
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ) {
			if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}

	return strReturn;
}

function get_operation() {
	return operation;
}

function getChildNodesRec(parentElement) {
	var childs = new Array();
	if(parentElement.childNodes) {
		for(var i=0; i<parentElement.childNodes.length; i++) {
			childs[childs.length] = parentElement.childNodes[i];
			childs.concat(getChildNodesRec(parentElement.childNodes[i]));
		}
	}

	return childs;
}

function getElementsByClass(className) {
	var all = document.all ? document.all : document.getElementsByTagName('*');
	var elements = new Array();

	for(var e = 0; e < all.length; e ++) {
		if(all[e].className == className) {
			elements[elements.length] = all[e];
		}
	}

	return elements;
}

function new_window_standard(url, title, width, height) {
	if(title == undefined) {
		title = "Aplica";
	}
	if(width == undefined) {
		width = 600;
	}
	if(height == undefined) {
		height = 500;
	}

	child = window.open(url, title, 'width=' + width +', height=' + height + ',scrollbars=yes,resizable=yes');
	child.opener = window;
	return false;
}

function new_window_standard2(url, title, width, height) {
	if(title == undefined) {
		title = "Aplica";
	}
	if(width == undefined) {
		width = 600;
	}
	if(height == undefined) {
		height = 500;
	}

	child = window.open(url, title, 'width=' + width +', height=' + height + ',scrollbars=yes,resizable=yes');
	child.opener = window;
}

