function Ginit() {
	Gcheck();
}

function GgetArgs() {
	var Gargs = new Object();
	var Gquery = location.search.substring(1);
	var Gpairs = Gquery.split("&");
	for(var i=0; i<Gpairs.length; i++){
		var pos = Gpairs[i].indexOf("=");
		if (pos == -1) continue;
		var Gargname = Gpairs[i].substring(0,pos);
		var Gvalue = Gpairs[i].substring(pos+1);
		Gargs[Gargname] = unescape(Gvalue);
	}
	return Gargs;
};
var Gargs = GgetArgs();
var GtheCookie = document.cookie;
var GtID = Gargs.lsg;

function Gcheck() {
	if ((GtID == null) || (GtID == 'undefined')) {
		if (GtheCookie.indexOf('lsg')>-1) {
			Gstart = GtheCookie.indexOf('lsg') + 4;
			Gend = GtheCookie.indexOf(';', Gstart);
			if (Gend == -1) Gend = GtheCookie.length;
			GtID = GtheCookie.substring(Gstart, Gend);
			GsendValues();
		}
		else {
			GtID = -1;
//			GsendValues();
		}
	}
	else {
		GwriteCookie();
		GsendValues();
	}
}

function GwriteCookie() { 
	expireDate = new Date;
	expireDate.setMonth(expireDate.getMonth()+1); 
	expireDate = expireDate.toGMTString();
	if (GtID != -1) {
		document.cookie = 'lsg='+GtID+';expires='+expireDate;
	}
	else {
	}
}

function GsendValues() {
	p1value = GtID;
	p2value = document.URL;
	sPos = p2value.lastIndexOf('/')+1;
	p2value = p2value.substring(sPos,p2value.length);
	p2value = p2value.replace(/\x3F/g,'_');
	p2value = p2value.replace(/&/g,'_');
	p2value = p2value.replace(/=/g,'-');
	p3value = document.title;
	p3value = p3value.replace(/ /g,'_');
	theValues = "http://www.campcon.com/r/rh.t?";
	theValues += 'p1='+p1value+'&p2='+p2value+'&p3='+p3value;

	var IE = false;

	IE = (navigator.appName.indexOf('Microsoft')>-1) ? true : false;

	if (IE) {
		document.write('<script src="'+theValues+'"><\/script>');
	}
	else {
		document.write('<script src="'+theValues+'&p4=NotIE"><\/script>');
	}	

}

Mac = (navigator.platform.indexOf('Mac')>-1) ? true : false;
Ginit();
