function l(id) {
	return LANG_RES[id];
}

function isube()
{window.open("https://sube.garanti.com.tr/isube/login","xsube","top=0,left=0,width=790,height=543,status,resize='no'");}

// From http://www.dominopower.com/issues/issue200004/howto002.html

function getRequestParameter(parameterName) {
	// Find the query string
	var queryString = "";
	if ( window.top.location.search != 0 ) {
		queryString = window.top.location.search;
	}

	// Add "=" to the parameter name (i.e. parameterName=value)
	var parameterName = parameterName + "=";

	if ( queryString.length > 0 ) {
		// Find the beginning of the string
		begin = queryString.indexOf ( parameterName );
		// If the parameter name is not found, skip it, otherwise return the value
		if ( begin != -1 ) {
			// Add the length (integer) to the beginning
			begin += parameterName.length;
			// Multiple parameters are separated by the "&" sign
			end = queryString.indexOf ( "&" , begin );
			if ( end == -1 ) {
				end = queryString.length
			}
			// Return the string
			return decodeURIComponent(queryString.substring (begin, end));
		}

	// Return "null" if no parameter has been found
	return null;
	}
}

function addBellsAndWhistlesToSearchBox(divId) {
	// Hint resetter.
	searchBox = $$('#' + divId + ' .searchText')[0];
	if (getRequestParameter('q')) {
		searchBox.value = getRequestParameter('q').split('+').join(' ')
	} else {
		searchBox.value = l("SEARCH_HINT_STRING");
	}

	searchBox.addEvent('click', function() {
		if (this.value == l("SEARCH_HINT_STRING")) {
			this.value = '';
		}
	});

	// Form validator
	searchForm = $$('#' + divId + ' form')[0];
	searchForm.addEvent('submit', function(evt){
		// Stops the submission of the form.
		new Event(evt).stop();
		if (searchBox.value == '' || searchBox.value == l("SEARCH_HINT_STRING")) {
			alert(l("SEARCH_NO_INPUT"));
		}	else {
			searchForm.submit();
		};
	});
}

function refresh(url)
{
	window.document.location = url;
}
