function get_cred_source()
{
	// Create a global array that will hold the value of each variable,
	// keyed by the name of the variable.
	var GETDATA = new Array();

	// Get the string that follows the "?" in the window's location.
	var sGet = window.location.search;
	if (sGet) // if has a value...
	{
		// Drop the leading "?"
		sGet = sGet.substr(1);
		
		// Generate a string array of the name value pairs.
		// Each array element will have the form "foo=bar"
		var sNVPairs = sGet.split("&");
		
		// Now, for each name-value pair, we need to extract
		// the name and value.
		for (var i = 0; i < sNVPairs.length; i++)
		{
			// So, sNVPairs[i] contains the current element...
			// Split it at the equals sign.
			var sNV = sNVPairs[i].split("=");
			
			// Assign the pair to the GETDATA array.
			var sName = sNV[0];
			var sValue = sNV[1];
			GETDATA[sName] = sValue;
		}

		if(GETDATA['source'])
			createCookie("cred_source", GETDATA['source']);

		if(GETDATA['zanpid'])
			createCookie("zanpid", GETDATA['zanpid']);

	}
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}