   function selectall() {
   	var iIndex;
   	var iMaxItems;
	
	if (!window.document.frmDomains.domain) return (false);
					
   	iMaxItems = window.document.frmDomains.domain.length;

   	for (iIndex =0;iIndex<iMaxItems;iIndex++) {
   		window.document.frmDomains.domain[iIndex].checked = true;
   	}
	if (typeof iMaxItems=="undefined"){window.document.frmDomains.domain.checked = true;}
	return (false);
   }
   function unselectall () {
   	var iIndex;
   	var iMaxItems;
					
	if (!window.document.frmDomains.domain) return (false);
	
   	iMaxItems = window.document.frmDomains.domain.length;
					
   	for (iIndex =0;iIndex<iMaxItems;iIndex++) {
   		window.document.frmDomains.domain[iIndex].checked = false;
   	}
	if (typeof iMaxItems=="undefined"){window.document.frmDomains.domain.checked = false;}
	return (false);
   }
   function invertselection () {
   	var iIndex;
   	var iMaxItems;
	
	if (!window.document.frmDomains.domain) return (false);
					
   	iMaxItems = window.document.frmDomains.domain.length;
					
   	for (iIndex =0;iIndex<iMaxItems;iIndex++) {
   		if (window.document.frmDomains.domain[iIndex].checked == true) {
   			window.document.frmDomains.domain[iIndex].checked = false;
   		}
   		else {
   			window.document.frmDomains.domain[iIndex].checked = true;
   		}
   	}
	if (typeof iMaxItems=="undefined")
	{
		if (window.document.frmDomains.domain.checked == true) 
		{
			window.document.frmDomains.domain.checked = false;
		}
		else
		{
			window.document.frmDomains.domain.checked = true;
		}
	}
	return (false);
   }
   
      // grant access rights pages
   function selectallrights() {
   	var iIndex;
   	var iMaxItems;
	
	if (!window.document.frmGrant.capid) return (false);
					
   	iMaxItems = window.document.frmGrant.capid.length;

	for (iIndex =0;iIndex<iMaxItems;iIndex++) {
		window.document.frmGrant.capid[iIndex].checked = true;
	}
	return (false);
   }
   function unselectallrights () {
   	var iIndex;
   	var iMaxItems;
					
   	iMaxItems = window.document.frmGrant.capid.length;
					
   	for (iIndex =0;iIndex<iMaxItems;iIndex++) {
   		window.document.frmGrant.capid[iIndex].checked = false;
   	}
	return (false);
   }
   function invertrightsselection () {
   	var iIndex;
   	var iMaxItems;
					
   	iMaxItems = window.document.frmGrant.capid.length;
					
   	for (iIndex =0;iIndex<iMaxItems;iIndex++) {
   		if (window.document.frmGrant.capid[iIndex].checked == true) {
   			window.document.frmGrant.capid[iIndex].checked = false;
   		}
   		else {
   			window.document.frmGrant.capid[iIndex].checked = true;
   		}
   	}
	return (false);
   }
   function selectparentrights (chk, parentidvalue) {

	if (chk.checked == true) {
	   	var iIndex;
   		var iMaxItems;
					
	   	iMaxItems = window.document.frmGrant.capid.length;
					
   		for (iIndex =0;iIndex<iMaxItems;iIndex++) {
   			if (window.document.frmGrant.capid[iIndex].value == parentidvalue) {
   				window.document.frmGrant.capid[iIndex].checked = true;
				break;
   			}
	   	}
	}
	return (true);
   }
   function validaterightsselection() {
	var iIndex;
   	var iMaxItems;
	
	if (!window.document.frmGrant.capid) return (false);
					
   	iMaxItems = window.document.frmGrant.capid.length;

	for (iIndex =0;iIndex<iMaxItems;iIndex++) {
		window.document.frmGrant.capid[iIndex].checked = true;
	}
	return (false);
   }


// Cookie Functions : http://www.quirksmode.org/js/cookies.html

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
