function gareferrer(default_value, organic_value, adwords_value) {
	try {
		// Value to return.
		var return_value = default_value;
		
		// Position of the Google Analytics "current session referal cookie" within the string containing all cookies.
		var utmz_start = document.cookie.indexOf('__utmz');
  
		// Continue if the cookie is present.
		if (utmz_start != -1) {
			// Position of the end of the cookie.
			var utmz_end = document.cookie.indexOf(';', utmz_start);
			
			// Get the cookie string containing all name-value pairs.
			if (utmz_end != -1) {
				var utmz = document.cookie.substring(utmz_start, utmz_end - 1);
			}
			else {
				var utmz = document.cookie.substring(utmz_start);
			}
			
			// Is the referrer organic?
			if (utmz.indexOf('utmcmd=organic') != -1) {
				return_value = organic_value;
			} 
			else {
				// Is the referrer Adwords?
				if (utmz.indexOf('utmglcid=') != -1) {
					return_value = adwords_value;
				}
			}
		}
		
		// Return the appropiate value.
		return return_value;
	}
	catch(err) {
		alert(err.name + "\n" + err.message)
	}
}
