// Function to encode the URL
function urlencode(decodedString) {
	var output = '';
	var x = 0;
	
	// Convert to string
	decodedString = decodedString.toString();
	
	// Define Regular Expressions used in Encoded URL's
	var regex = /(^[a-zA-Z0-9_.]*)/;

	while (x < decodedString.length) {
		
		var match = regex.exec(decodedString.substr(x));
		
		if (match != null && match.length > 1 && match[1] != '') {

			output += match[1];
			x += match[1].length;

		} else {

			if (decodedString[x] == ' ') {
				
				output += '+';
			
			} else {
				
				var charCode = decodedString.charCodeAt(x);
				var hexVal = charCode.toString(16);
				
				output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
			}

			x++;
		}
	}
return output;
}

// Set the URL
var url   = urlencode(document.location.href);

// Set the page title, has a fall back if there is no document title.
function page_title() {
	
	if (document.title == "") {
		// Fall back title
		var title = "Replace with a more descriptive title";
	} else { 
		// get the document title
		var title = document.title;
	}
	
	return title
}