/**
 * @author Passaro Azul
 */
HttpGet = {
	length : 0,
	getVars : function() {
		var httpGetVars, eof, indexChar, keyChar, varIndex, varValue, varEnd, tmpVars = [];
		this.length = 0;
		httpGetVars = decodeURI(window.location.search);
		eof = false;
		indexChar = 0;
		if (httpGetVars != "") {
			while (eof == false) {
				if (indexChar == 0) { 
					keyChar = "?"; 
				} 
				else {
					keyChar = "&"; 
				}
				
				varIndex = httpGetVars.substring(httpGetVars.indexOf(keyChar, indexChar) + 1, httpGetVars.indexOf("=", indexChar));
				
				if (httpGetVars.indexOf("&", indexChar + 1) != -1) {
					varEnd = httpGetVars.indexOf("&", indexChar + 1);
				}
				else {
					varEnd = httpGetVars.length;
					eof = true;
				}
				varValue = httpGetVars.substring(httpGetVars.indexOf("=", indexChar) + 1, varEnd);
				indexChar = httpGetVars.indexOf(varValue) + varValue.length;
				tmpVars[varIndex] = varValue;
				this.length++;
			}
			
		return tmpVars;
		}
		
		else {
			return null;
		}
	},
	
	getVar : function(varName) {
		try {
			this.getVars();
			return this.getVars()[varName];
		}
		catch(e) {
			switch (e.name) {
				case "TypeError":
					return null;
					break;
				default:
					alert(e);
					return false;
					break;
			}
		}
	}

}
