
/* jat 6/26/08 - adding code to allow anchor links (#) */
function visitargs(PageURL,args,SURL,anchor)
{
	var storeIdClause='?';
	var argsLowerCase=args.toLowerCase();
	var i=0;
	var trailingAmpersandCount=0;
	
	anchor = (anchor == undefined)? "" : anchor;	// jat 1/29/08 - make sure anchor is not null before apending below

	//if s_id isn't in the args, prepare it for addition
	//gets us "?s_id=nnn" for use as the first URL arg
	if(argsLowerCase.indexOf('s_id')<0 && argsLowerCase.indexOf('s%5fid')<0)
		storeIdClause += 's_id='+i_jscript_uu_sid;

	//gets use "example.asp?" or "example.asp?sid=nnn"
	PageURL += storeIdClause;
	if (args.length>0)
	{
		//at this point, PageURL will end a "?" or a "s_id=nnn" so...
		//if PageURL doesn't end in a "?" and args doesn't start with one
		//we need an initial amp
		var initialamp = (('?' == PageURL[PageURL.length-1]) && ('@' == args[0]))? '' : '&';
		PageURL += initialamp + args;
	}
	//watch out for alots of amps at the end of PageURL
	for(i=PageURL.length-1;i>=0;i--)
	{
		if (PageURL.charAt(i)=='&')
		{
			trailingAmpersandCount++;
		}
		else
		{
			break;
		}
	}
	//wipe out any trailing amps in PageURL
	PageURL=PageURL.substring(0,PageURL.length-trailingAmpersandCount)
    
	if (user_guid !=' ')
		PageURL =PageURL + '&mscssid='+ user_guid;

	if (SURL=='SURL')
		location = i_jscript_uu_rootSURL+PageURL+anchor;	// added 4th argument in function for anchor
	else
		location = i_jscript_uu_rootURL+PageURL+anchor;		// added 4th argument in function for anchor

	return(false);	
}