function checkreferral() {

var ck = readCookie("SADREF");
if (ck == 'NULL')
{
var qs = new Querystring()
var q1 = qs.get("awc", "NOREFER");


if (q1 != "NOREFER")
{
// Referral Querystring detected. Create cookie.
createCookie("SADREF", "TRUE", 30);
}
else
{
createCookie("SADREF", "FALSE", 30);
}
}
}

function processcookiehome() {
var ck = readCookie("SADREF");
if (ck == 'FALSE')
{
document.getElementById('phonediv').style.display = 'block';
document.getElementById('phonedivmain').style.display = 'block';
}
}

function processcookie() {
var ck = readCookie("SADREF");
if (ck == 'FALSE')
{
document.getElementById('phonediv').style.display = 'block';
}
}

function Querystring(qs) { // optionally pass a querystring to parse
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}


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';
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


//-->