// JavaScript by Nick Wood - http://n2-tec.com

//checkCompatibility is an adaptation of Code 11.2 Detecting the Browser's Name and Version from the book
//DHTML and CSS by Jason Cranford Teague
function checkCompatibility() {
	m1 = 'This browser\'s designation is: ';
	m2 = navigator.appName + ' ';
	m3 = navigator.appVersion + '\n';
	var m5 = 0;
	var isNS = 0;
	var isIE = 0;
	var isOtherBrowser = 0;
	var good = 0;
	if (navigator.appName.indexOf('Netscape') != -1) {
		isNS = 1;
	} else {
		if (navigator.appName.indexOf('Microsoft Internet Explorer') != -1) {
			isIE = 1;
		} else {
			isOtherBrowser = 1;
		}
	}
	broswerVersion = parseInt(navigator.appVersion);
	if (isNS) { 
		if (broswerVersion > 4) {
				good = 1; //if browser IE 4+ all is good
			}
	} else {
		if (isIE) {
			if (broswerVersion > 3) {
				good = 1; //if browser IE 4+ all is good
			}
		} else {
			if (isOtherBrowser) {
				m5 = '\nYour browser version could not be retrieved or support for this browser has not been tested.\n';
			}
		}
	}
	if (good) {
		m4 = "\nYour Browser should be able to use all features of this website without a problem.";
	} else {
		m4 = "\nYour Browser might not be able to use all features of this website. If problems occur please use a different browser.";
	}
	if (m5) {
		m4 = m5 + m4;	
	}
	alert(m1 + m2 + m3 + m4);
} //END checkCompatibility

function clearBox(sentItem) {
	if (sentItem.value=="Type Search Here") {
		sentItem.value="";
	} else if (sentItem.value=="") {
		sentItem.value="Type Search Here";
	}
}

function toggleLayer(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers) {
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}

function newWindow(ur,row){
	nWindow = window.open(ur+'?rid='+row,'RobinsonEdit','width=450,height=300,resizable=yes,scrollbars=yes,location=no,directories=no,status=yes,menubar=no');
	nWindow.focus();
}

function picWindow(ur,w,h){
	pWindow = window.open(ur,'Image','width='+w+',height='+h+',resizable=yes,scrollbars=yes,location=no,directories=no,status=yes,menubar=no');
	pWindow.focus();
}

function deleteConfirm(row,frm,search,sy,sd,sc,sa,sw) {
	var msg;
	if (frm=='win') {
		msg='winner';
	}
	if (confirm("Are you sure you want to permanently delete this " + msg + "?")) {
		window.location="deletewin.php?wid=" + row + "&sch=" + search + "&sy=" + sy + "&sd=" + sd + "&sc=" + sc + "&sa=" + sa + "&sw=" + sw;
	} else {
		alert("Delete of " + msg + " was canceled.");
	}
}
