function user_settings()	{
	if(is_BrowserCompatible() && is_VersionCompatible() && is_ScreenCompatible() && is_CookieEnabled())
		return true;
	return false;
}

function is_BrowserCompatible()	{
	if (navigator.appName!=='Microsoft Internet Explorer' )	{
		alert('This application works with Internet Explorer only');
		return false;
	}
	return true;
}
function is_VersionCompatible()	{
	var version=0;
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp=navigator.appVersion.split("MSIE");
		version=parseFloat(temp[1]);
	}
	if (version<5.5)	{
		alert('You are using Internet Explorer version ' + version + '. The recommended minimum version for this application is 5.5.  \n Due to this some functionality might be lost. A browser update is strongly recommended.');
	}
	return true;
}

function is_ScreenCompatible()	{
	if (screen.height==600)	{
		alert('The recommended resolution for viewing this application is 1024*768 or higher. \n Please adjust your monitor settings if possible.');
	}
	if (screen.height<600)	{
		alert('This application is viewed at 800 * 600 or higher resolution. \n Please adjust your monitor settings.');
		return false
	}
	return true;
}
function is_CookieEnabled()	{
	if(!navigator.cookieEnabled)	{
		alert('This application requires the use of cookies. Please change your Internet Explorer settings to accept cookies.');
		return false;
	}
	return true;
}

//USED IN
	//-Croft_Online.asp
	//Customer Satisfaction Reports
function SetFocus()	{
	if(eval(document.Form)){
		if(document.Form[0].type=='text'){
			document.Form[0].focus();
		}
	}
}
//USED IN
	//-Croft_Online.asp
function SubmitLogin()	{
	var flag=false;
	var message='The following fields are missing : \n';
	if(Form.UserName.value == '' || Form.UserName.value == null )	{
		flag = true;  //an element is empty
		message=message + 'User Name \n';
	}
	if(Form.Password.value == '' || Form.Password.value == null )	{
		flag = true;  //an element is empty
		message=message + 'Password \n';
	}
	if(!flag)	{
		Form.action=Form.action + '?width=' + getScreenWidth() + '&height=' + getScreenHeight();
		return true; //all fields are non-empty so return true;
	}
	else
	{
		alert(message);	 //at least one element is empty so display error message 
		return false; //return false
	}
}
function RedirectPage(targeturl,strArguments,height,width)	{
	var newPage=targeturl + '?' + strArguments;
	var firstseparator='&'
	
	if (strArguments=='')
		firstseparator='';
	if (height=='') {
				newPage=newPage + firstseparator + 'height=' + getScreenHeight();
	}
	if (width=='') {
		newPage=newPage + '&width=' + getScreenWidth();
	}
	if (self != top) { 
		// if the current page is inside frames 
		if (window.replace)	{
			top.location.replace(newPage); 
			//alert('top' + newPage);
		}
	}
	else	{
		//alert('self' + newPage);
		window.location.href=newPage;
	}
	
}
//USED  IN Croft_Online 
//1. On Login the resolution is passed to the Personal Menu page
//2. From the Personal Menu the resolution is passed to every application
//3.It is used through out to control the amount of results shown on pages
function getScreenHeight()	{ 
   return (screen.height);
} 
function getScreenWidth()	{ 
   return (screen.width);
} 

//USED In Change_Password
function SubmitSetPassword()	{
	var flag=false;
	var message='The following fields are missing : \n';
	if(Form.Password1.value == '' || Form.Password1.value == null )	{
		flag = true;  //an element is empty
		message=message + 'Enter password \n';
	}
	if(Form.Password2.value == '' || Form.Password2.value == null )	{
		flag = true;  //an element is empty
		message=message + 'Confirm password \n';
	}
	if(Form.Password1.value != Form.Password2.value)	{
		flag = true;  //an element is empty
		message='Passwords are not matching \n';
	}
	if(!flag)	{
		return true; //all fields are non-empty so return true;
	}
	else
	{
		alert(message);	 //at least one element is empty so display error message 
		return false; //return false
	}
}

//NOT SURE
//function navClassMouseOver(menuObj,strDefaultClass) {
	//document.all.item(menuObj).className = 'NAVITEMON';
//}
//NOT SURE
//function navClassMouseOut(menuObj,strDefaultClass) {
	//document.all.item(menuObj).style.background=strDefaultClass;
//}
//NOT SURE
//function navBGMouseOver(objID,strColor) {
	//document.all.item(objID).style.background=strColor;
//}
//NOT SURE
//function navBGMouseOut(objID,strColor) {
	//document.all.item(objID).style.background=strColor;
//}


//CURRENTLY NOT USED- NEEDS IMPROVEMENT
function OpenWindow(targetUrl,task)	{
	switch(task)	{
	
	case 'Error':
		//open a popup window window
		//withscrollbars argument determines whether there will be scrollbars on the screen
		window.open(targetUrl,'_blank','width=' + screen.width-10 + ',height=' + screen.height-55 + ',top=0,left=0,resizable=no,toolbar=no,menu=no,scrollbars=no,titlebar=yes,status=no');
	//case 'Login':
		//window.open (targetUrl + '?Screen=' + getScreenRes());
		//CloseWindow();
	}
}
//USED TO EXIT APPLICATION FROM THE ERROR SCREEN
//OR CROFT_ONLINE.asp
function CloseWindow()	{
	//self.Close()
	var parentwin= window.self;			//Make handle for current window named "parentwin"
	parentwin.opener = window.self;    //Tell current window that it opened itself
	//parentwin.close()                 //Close window's parent (e.g. the current window)
 	window.opener.close();
}
	//-Croft_Social.asp
function OpenPopup(targetUrl,height,width){
	//open a popup window window
    window.open(targetUrl,'_blank','width=' + width + ',height=' + height + ',resizable=no,toolbar=no,menu=no,titlebar=no,status=no');
	//window.open targetUrl
}
function OpenPopupModal(targeturl,height,width){
	window.showModalDialog(targeturl,'','dialogHeight:' + height + 'px;dialogWidth:' + width + 'px;center:yes;)');
}
//USED IN ALL MENUS TO EXPAND/CLOSE LINKS/SUBLINKS
function ShowHideMenu(menuName,menuID,intMenuCount) {
var headObj;
var menuObj;
var imgObj;
	for (i=1;i<=intMenuCount;i++)	//intMenuCount represents the number of main nodes
		if (i==menuID)	{
			//open required menu
			menuObj = menuName + menuID;
			//alert(menuObj);
			if (document.all.item(menuObj).LinkType=='SubLink')	{
				if (document.all.item(menuObj).className =='MENULINKSOFF')	{
					//alert('Expand' + (menuName + i));
					document.all.item(menuObj).className = 'MENULINKSON';
				}
				else	{
					//alert('Close Clicked' + (menuName + i));
					document.all.item(menuObj).className = 'MENULINKSOFF';
				}
			}
		}
		else
		{
		//close all open menus
			menuObj=menuName + i;
			if (document.all.item(menuName + i).LinkType=='SubLink')	{
				if (document.all.item(menuObj).className == 'MENULINKSON')	{
					//alert('Close' + (menuName + i));
					document.all.item(menuObj).className = 'MENULINKSOFF';
				}
			}
		}
}
//USED IN WEBSITE SERVICES/DIVISIONS TO SHOW/HIDE DESCRIPTIONS IN
	//-Croft_Divisions.asp
	//-Croft_Services.asp
function ShowHideDesc(menuID,intMenuCount,strDefaultClass)	{
var headObj;
var menuObj;
var imgObj;
	for (i=0;i<=intMenuCount-1;i++)
				if (i==menuID)	{
						menuObj = 'Link' + menuID;
						headObj='Head' + menuID;
						
						//open required menu						
						if (document.all.item(menuObj).className == 'SHOWOFF')	{
							document.all.item(menuObj).className = 'SHOWON';
						}
						else	{
							document.all.item(menuObj).className = 'SHOWOFF';
						}					
						
						//color the required header
						if (document.all.item(headObj).className ==strDefaultClass)	{
							document.all.item(headObj).className = 'HEADHIGHLIGHT';
						}
						else	{
							document.all.item(headObj).className = strDefaultClass;
						}
				}			
				else 	{
					menuObj = 'Link' + i;
					headObj='Head' + i;
					if (document.all.item(menuObj).className =='SHOWON')
						document.all.item(menuObj).className = 'SHOWOFF';
						document.all.item(headObj).className=strDefaultClass;			
					imgObj='Img' + i;
					document.all.item(imgObj).src = '../croft/Images/RightArrow.gif';

				//display the apporopriate image
				imgObj='Img' + menuID;
				document.all.item(imgObj).src = '../Croft/Images/DownArrow.gif';
				}
}
