﻿// Browser sniffer. Written by PerlScriptsJavaScripts.com
function Is() {
	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));
	this.ie = (agent.indexOf("msie") != -1);
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
	this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
	this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
	
	this.win = ( (agent.indexOf("win")!=-1) || (agent.indexOf("16bit")!=-1) );
}

var is = new Is();

if (is.ie6	&& is.win) { //for IE6 on WINDOWS
	// substitute the stylesheet for printing....
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { // loop through all the "<link>" files
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { // check to see that the "<link>" file is a stylesheet and perform an action on the proper title
			if(a.getAttribute("title") == "print") { 	a.disabled = true; }	// disable the original printing stylesheet
			if(a.getAttribute("title") == "printIE6") { a.disabled = false; }	// enable the printing stylesheet for IE6
		}
	}	
}
