

//====================================================================
//	Browser Functions
//====================================================================

//	[ Cookies ]

	function setCookie(object, value, days)
		{
//		alert('value: ' + value);
		if(days)
			{
			time = new Date();
			time.setTime(time.getTime()+days*24*60*60*1000);
			var exp = '; expires='+time.toGMTString();
			}
		else
			{
			var exp='';
			}
//		alert(object + "=" + value + exp);
		document.cookie = object + "=" + value + exp + ";path=/";
//		alert(document.cookie);
		}


	function setGroupCookie(object, value, days)
		{

		//Calculate the expiration date for the cookie
		if(days)
			{
			time = new Date();
			time.setTime(time.getTime()+days*24*60*60*1000);
			var exp = '; expires='+time.toGMTString();
			}
		else
			{
			var exp='';
			}
		
		//Get the current group ID to use as the key for the cookie record
		var group;
		if(typeof GroupId === 'undefined'){
			group = '';
		}else{
			group = GroupId;
		}
		

		var cookies = document.cookie.split(';');
		var testObject = '';
		
		
		//Get the current value for the object
		var currVal = '';
		for(i = 0;i<cookies.length;i++){
			//Get a list of object names, trimming any whitespace
			testObject = cookies[i].substring(0, cookies[i].indexOf('=')).replace(/^\s+|\s+$/,"");
			//Get the current value of the object matching the object argument of this function
			if(testObject == object){
				currVal = cookies[i].substring(cookies[i].indexOf('=')+1, cookies[i].length);
			}
		}
		
		
		//Save new value to the object
		var newVal = '';
		if(currVal != ''){
			//Find whether a value is already stored for the group
			var groupFound = 0;
			var valArray = currVal.split('&');
			
			for(i=0;i<valArray.length;i++){
				keyValPair = valArray[i].split('=');
				if(keyValPair[0] == group){
					//group found, save new value to existing group
					groupFound = 1;
					keyValPair[1] = value;
					valArray[i] = keyValPair.join('=');
				}
			}
			if(groupFound == 0){
				//We have not yet stored a value for the current group
				var keyVal = group + '=' + value;
				valArray.push(keyVal);
			}
			newVal = valArray.join('&');
		} else {
			//First time a value has been saved for this object in any group.
			newVal = group + '=' + value;
		}
		
		//alert(object + ' (' + group + ') [' + currVal + '] <- [' + newVal + ']');
		
		//Save cookie
		document.cookie = object + "=" + newVal + exp + ";path=/";
		
		}
		


	function getCookie(object)
		{
		var SearchString = object + "=";
		var ReturnValue = "";
		if (document.cookie.length > 0)
			{
			offset = document.cookie.indexOf(SearchString);
			if (offset != -1)
				{
				offset += SearchString.length;
				end = document.cookie.indexOf(";", offset);
				if (end == -1) end = document.cookie.length;
				ReturnValue=unescape(document.cookie.substring(offset, end));
				}
			}
		return ReturnValue;
		}



	function getGroupCookie(object){
	
		var retval = '';
	
		var cookies = document.cookie.split(';');
		var testObject = '';
		
		
		//Get the current group ID to use as the key for the cookie record
		var group;
		if(typeof GroupId === 'undefined'){
			group = '';
		}else{
			group = GroupId;
		}		
		
		
		//Get the current value for the object
		var currVal = '';
		for(i = 0;i<cookies.length;i++){
			//Get a list of object names, trimming any whitespace
			testObject = cookies[i].substring(0, cookies[i].indexOf('=')).replace(/^\s+|\s+$/,"");
			//Get the current value of the object matching the object argument of this function
			if(testObject == object){
				currVal = cookies[i].substring(cookies[i].indexOf('=')+1, cookies[i].length);
			}
		}
		
		var valArray = currVal.split('&');
		//find the value in the value array that matches the group
		for(i=0;i<valArray.length;i++){
			keyValPair = valArray[i].split('=');
			if(keyValPair[0] == group){
				retval = keyValPair[1];
			}
		}
		
		return retval;
		
	}


	function BolWin(wintype)
		{
		BolWindow=window.open(wintype,"BolWindow","toolbar=1,resizable=1,directories=0,status=1,scrollbars=1, menubar=1, location=1, width=820,height=900,top=20,left=30, fullscreen=0"); BolWindow.window.focus()
		}

	function DetailWin(wintype)
		{
		DetailWindow=window.open(wintype,"DetailWindow","toolbar=0,resizable=1,directories=0,status=1,scrollbars=1,menubar=0,width=760,height=400,top=20,left=30"); DetailWindow.window.focus()
		}


//====================================================================
//	General Functions
//====================================================================

//	[ start mOver / mOut ]
		function mOverRow(Item)
			{
			Item.style.backgroundColor="#E4DECD";
			Item.style.color="#3C3C3C";
			if (navigator.appName == "Microsoft Internet Explorer")
				{
				Item.style.cursor="hand";
				}
			else
				{
				Item.style.cursor="pointer";
				}
			}

		function mOutRow(Item)
			{
			Item.style.backgroundColor="";
			Item.style.color="#3C3C3C";
			}

		function mOverBol(Item)
			{
			Item.style.backgroundColor="#FFCC99";
			Item.style.color="#000080";
			if (navigator.appName == "Microsoft Internet Explorer")
				{
				Item.style.cursor="hand";
				}
			else
				{
				Item.style.cursor="pointer";
				}
			}

		function mOutBol(Item)
			{
			Item.style.backgroundColor="";
			Item.style.color="";
			return true;
			}

//	[ end mOver / mOut ]


//====================================================================
//	Misc Functions
//====================================================================

