var isChecking8 = true;
var eightBitMsg = 'The settings of your monitor/display do not allow the images to be displayed in their best quality, please change your color settings to millions of colors, also called true colors or 32 bit. You will find the settings in your computers preferences/control panels.';
var eightBitLocation = 'alert_8bit.html';

var isChecking16 = true;
var sixteenBitMsg = 'The settings of your monitor/display do not allow the images to be displayed in their best quality, please change your color settings to millions of colors, also called true colors or 32 bit. You will find the settings in your computers preferences/control panels.';
var sixteenBitLocation = 'alert_16bit.html';

var isChecking24 = false;
var twentyfourBitMsg = '24bit';
var twentyfourBitLocation = 'alert_24bit.html';

var colorDepth = window.screen.colorDepth;

var isCheckingUnknown = false;
var unknownBitMsg = 'Unknown ColorDepth!'+colorDepth;
var unknownBitLocation = 'alert_Unknownbit.html';

function analyzeColorDepth(method) {
	switch(colorDepth) {
		case 8:
			if(isChecking8){
				if(method=='alert'){
					alert(eightBitMsg)
				}else{
					location.href=eightBitLocation
				}
			}
			break
			
		case 16:
			if(isChecking16){
				if(method=='alert'){
					alert(sixteenBitMsg)
				}else{
					location.href=sixteenBitLocation
				}
			}
			break
		
		case 18: //Netscape 4.0 reads 8 bit as 18 for whatever reason
			if(isChecking8){
				if(method=='alert'){
					alert(eightBitMsg)
				}else{
					location.href=eightBitLocation
				}
			}
			break
			
		case 24:
			if(isChecking24){
				if(method=='alert'){
					alert(twentyfourBitMsg)
				}else{
					location.href=twentyfourBitLocation
				}
			}
			break
		
		case 32:
			break
		
		default:
			if(isCheckingUknown){
				if(method=='alert'){
					alert(unknownBitMsg)
				}else{
					location.href=unknownBitLocation
				}
			}
	}
}

analyzeColorDepth('alert');


