// JavaScript Document

//These functions make the user's browser information slightly more accessible to the developer

//create an object that stores practical browser settings
function browser() {
	var intPos;
	var strBrowser = navigator.userAgent;
	if(strBrowser.indexOf('MSIE')>-1){
		intPos = strBrowser.indexOf('MSIE')
		this.software = 'IE';
		this.major = strBrowser.charAt(intPos+5)
		this.minor = strBrowser.charAt(intPos+7)
	} else if(strBrowser.indexOf('Netscape')>-1) {
		intPos = strBrowser.indexOf('Netscape')
		this.software = 'Netscape';
		this.major = strBrowser.charAt(intPos+9)
		this.minor = strBrowser.charAt(intPos+11)
	} else if(strBrowser.indexOf('Mozilla')>-1) {
		intPos = strBrowser.indexOf('Mozilla')
		this.software = 'Mozilla';
		this.major = strBrowser.charAt(intPos+8)
		this.minor = strBrowser.charAt(intPos+10)
	} else {
		this.software = 'other';
		this.major = 0
		this.minor = 0
	}
}

//Get practical browser settings
function getBrowser() {
	Browser = new browser();
	return Browser.software + ' ' + Browser.major + '.' + Browser.minor
}

//Validate Browser
function validateBrowser(name,version) {
	var validated = false
	Browser = new browser();
	if(Browser.software == name) {
		if(parseInt(Browser.major+'.'+Browser.minor)>=parseInt(version)){
			validated = true;
		}
	}
	return validated;
}