/* ****************************************************************************
 * IEEE Communications Society "Marketing Split Test"
 * 
 *	See salesforce case #1352:
 * https://ssl.salesforce.com/cases/casedetail.jsp?id=500000000004SQk
 *
 *	Requires functions in library /v20/js/cookieLib.js
 *
 * Include inside the html <head></head> as :
 *	<script language="JavaScript" src="http://www.register123.com/event/js/cookieLib.js"></script>
 *	<script language="JavaScript" src="http://www.register123.com/event/accounts/register123/aashto/events/ieeemay03/ieeeComSocSplitTest.js"></script>
 *
 *	Modification List:
 * 02/24/03 RWB - Fixed url for cross-domain links
 *					 - Added source and pkregid to link
 *	02/20/03 RWB - Created
 *****************************************************************************/
 
/* ****************************************************************************
1) Initialize object with url name-value pairs
	See http://members.evolt.org/jeff/code/js_url_variables/index.cfm?foo=bar&far=bo
	Access the object in one of 2 ways:
		url['foo']: bar
		url['far']: bo
		
		url.foo: bar
		url.far: bo
 *****************************************************************************/
var qs = location.search.substring(1);
var nv = qs.split('&');
var url = new Object();
for(i = 0; i < nv.length; i++)
{
	eq = nv[i].indexOf('=');
	url[nv[i].substring(0,eq).toLowerCase()] = unescape(nv[i].substring(eq + 1));
}

/* ****************************************************************************
2) Set a cookie with the reg_code, if it was passed in the url. (expires in 90 days)
 *****************************************************************************/
if(url['pkregid'] != null) temp = setCookie('pkregid', url['pkregid'], 90, '/');
if(url['reg_code'] != null) temp = setCookie('reg_code', url['reg_code'], 90, '/');
/* ****************************************************************************
3) Set a cookie with the "source", if passed in url, otherwise use the 
	hostname (e.g., www.icc2003d.com)  (expires in 90 days)
 *****************************************************************************/
var existingSource = getCookie('source');
// Don't write cookie.source if it already exists
if(existingSource == '')
{
	if(url['source'] != null) 
		temp = setCookie('source', url['source'], 90, '/');
	else
		temp = setCookie('source', location.hostname, 90, '/');
}
/* ****************************************************************************
4) David - Javascript to be used on IEEE Com Soc's web site when linking to our
	reg form (since we cannot read cookies written by other domains)
	
	This will is a problem since they are using multiple domains, i.e. 
	www.icc2003a.com will not be able to read nor pass cookies written by
	www.icc2003b.com.
 *****************************************************************************/
/*
<a href="javascript:window.location='http://www.register123.com/event/profile/form/index.evt?PKformID=0x6803684e&source='+getCookie('source')+'&pkregid='+getCookie('pkregid');">Register Now</a>
*/
 
/* 
5) Susie - Add the following script to the Register123 form-profile instructions,
	in case the pre-populated information is not that of the current user:
	
<div id="prePopIsNotMe" class="fine"></div>
*/

/*
6) Susie - Add the following script to the Register123 form-category instructions,
	so that the profile section has rendered before the form elements are checked.
	
<script language="javascript">
if(document.formProfileForm.pro_fname.value != '' && document.formProfileForm.pro_lname.value != '')
{
	document.getElementById("prePopIsNotMe").innerHTML = 'Hello, <b>' + document.formProfileForm.pro_fname.value + ' ' + document.formProfileForm.pro_lname.value + '</b>.  If the information below is not yours, please <a href="javascript:window.location=\'http://www.register123.com/event/profile/form/index.evt?PKformID=0x6803684e&pkregid=0&source=\'+getCookie(\'source\');"><font face=verdana size=2>click here to create a new registration</font></a>.';
}
</script>

*/

