/*
	AjaxStats - session manager js script
	Copyright (C) 2006 Jason LaCouture - antidesigns.com

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

*/

// grab the referer and replace all the & with ~~ 
// this is so we can pass the whole url back to the server 
// using ajax and GET
var rf	= document.referrer.replace(/&/g, "~~");

// the ajax var
var ajax;

// returns the name of the page the user is accessing
function getPageName(rf){
	// get rid of the http://
	var name= rf.substring(8);
	// and then get rid of everything till the first slash
	// so that all thats left is the actual page the user accessed
	name	= name.substring(name.indexOf("/")+1);

	// replace all the '&'s so that we store the entire argument to the page
	name	= name.replace(/&/g, "~~");
	name	= name.replace(/#/g, "XX");
return name;	
}
function loadData(type){
	var page	= getPageName(document.URL);
	var url 	= "ajaxStats/sessions/sessionManager.php?rf="+rf+"&lp="+page+"&pn="+page;
	ajax 	= new Ajax();
	ajax.doGet(url, function foo(){});
}
function handleCustomizerPage(page){
	var url 	= "ajaxStats/sessions/sessionManager.php?rf="+rf+"&lp="+page+"&pn="+page;
	ajax 	= new Ajax();
	ajax.doGet(url, function foo(){});
}
function handlePayPalClick(pid){
	var size	= document.forms.antiCART.size.value;
	var qty		= document.forms.antiCART.quantity.value;
	var url		= "ajaxStats/sessions/paypalManager.php?pid="+pid+"&size="+size+"&qty="+qty;
	ajax		= new Ajax();
	ajax.doGet(url, function foo(){});
}
function handleAntedoteClick(pid,size){
	var qty		= 1;
	var url		= "ajaxStats/sessions/paypalManager.php?pid="+pid+"&size="+size+"&qty="+qty;
	ajax		= new Ajax();
	ajax.doGet(url, function foo(){});
}
loadData("");

