﻿
//////////////////////////////////////////////////////////
// Constants
//////////////////////////////////////////////////////////
var EXIT_HANDLER_URL = '/handlers/SiteExitManager.ashx?m=getparam';
var SITE_EXIT_URL = '/system_pages/SiteExitTest.aspx';

//////////////////////////////////////////////////////////
// Site Exit
// Supports site exit operations.
//////////////////////////////////////////////////////////
var SiteExit = {

	getExitLink: function(strURL, intType, strSignature) {
	
//		alert('strURL: ' + strURL + '\n'
//			+ 'intType: ' + intType + '\n'
//			+ 'strSignature: ' + strSignature + '\n');
	
		if (!strURL || !intType || !strSignature) { return; }
		var strSiteExitUrl = SITE_EXIT_URL;
		var urlEsc = escape(strURL);
		SiteExit.goTo(strSiteExitUrl 
			+ '?url=' 
			+ urlEsc + '&type=' 
			+ intType + '&signature=' 
			+ strSignature);
	} // End getExitLink()
	,

	getExitParam: function() { /* MooTools version */
	
		// Get variable from XHR /Json
		var response = null;
		var xhr = new XHR({
			method: 'get',
			async: false
		}).send(EXIT_HANDLER_URL);
		
		alert(xhr.transport.responseText);
		
		return xhr.transport.responseText;
		//return Json.evaluate(response || xhr.transport.responseText);
	}
	,

//	getExitParam: function() { /* JQUERY version */
//		var strParam = $.ajax({
//		  type: 'GET',
//		  url: EXIT_HANDLER_URL,
//		  async: false //blocks the browser while the request is active.
//		}).responseText;
//		return strParam;
//	} // End getExitParam()
//	,

	//Navigates to a URL
	goTo: function(strURL) {
		window.location.href = strURL;
	} // End goTo()

};



