<!---

/**********************************************************************************   
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	// this.opera5=this.agent.indexOf("Opera 5")>-1
	this.opera5=(this.agent.indexOf("Opera 5")>-1)||(this.agent.indexOf("Opera 6")>-1) // audrey (opera6) 08.16.02
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;

	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	
	this.safari=(this.agent.indexOf("Safari")>-1); // audrey (safari -- mac) 04.30.04

	this.bw=( this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 )
	return this
}
var bw=new lib_bwcheck()



/*
* Resize fixes: executed on page load
* coutsey of: Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*/
if(document.layers){ //NS4 resize fix...
	scrX= innerWidth; scrY= innerHeight;
	onresize= function(){if(scrX!= innerWidth || scrY!= innerHeight){history.go(0)} }
}
if(navigator.userAgent.indexOf('Opera')>-1 && document.getElementById){ //Opera 5 (+6) resize fix.
	scrX= innerWidth; scrY= innerHeight;
	document.onmousemove= function(){
		if(scrX<innerWidth-10 || scrY<innerHeight-10 || scrX>innerWidth+10 || scrY>innerHeight+10){
			scrX = innerWidth;
			scrY = innerHeight;
			foldInit();
		}
	};
}


/* 
*	Executed on Pageload : Load the correct stylesheet file (a. strauss 08.19.02)
*/
var cssFilename = "HREF='styles/ua_dhtml.css'";

// special sheet for ns4
if ( bw.ns4 ) { cssFilename = "HREF='styles/ua_dhtml_ns4.css'"; } 

// Write out the stylesheet information to the document
var stylesheet = "<LINK REL='stylesheet' TYPE='text/css'" + cssFilename + ">";
document.write(stylesheet);


// Write Nonselectable style sheet needed for Netscape 6.0 and higher... (astrauss 02.02.04)
// executed b4 load (should be OK)
if ( bw.ns6 ) { 
	cssFilename = "HREF='styles/ns_unselectable.css'"; 
	stylesheet = "<LINK REL='stylesheet' TYPE='text/css'" + cssFilename + ">";
	document.write(stylesheet);
} 



/* 
 * audrey strauss :: get obj :  IE5.X or NS6/Opera
 */
function ua_getObj (divIDstr) {
	if ( bw.ns6 ) { 
		return document.getElementById( divIDstr ) // NS6	
	}
	else { 
		return document.all( divIDstr ); 			// IE or Opera
	}
}



// Executed ONload -- for IE. NS done in stylesheet (see above) (astrauss 02.02.04)
// stop events that are select events
//	ONSELECTSTART	="Document_OnSelectStart();"
//	ONSELECT		="Document_OnSelect();"
//	ONDRAGSTART	= "Document_OnDragStart();"

// IE
// onselectstart = "cancelSelectText(event);" 
// ondragstart = "cancelSelectText(event);"

// NS
// onDragDrop

// both
// onselect = "cancelSelectText(event);" 
function onLoad_AddSelectCancelEvents() {

	// for netscape/mozilla disabling the select event is done with a CSS stylesheet call
	// no events are trapped and disabled, they simply won't happen
	if ( bw.ns6 ) {
	/*
		// inline tbis in the document
		//	document.write("<link href='css/ns_unselectable.css' rel='stylesheet' type='text/css'>");

		// body {-moz-user-select: none} - not sure of the syntax...for the style element
		var obj = ua_getObj( "body" );
		if ( obj ) { obj.style.mozUserSelect = "none"; }

		// div {-moz-user-select: none}		
		obj = ua_getObj( "div" );
		if ( obj ) { obj.style.mozUserSelect = "none"; }

		// img {-moz-user-select: none}		
		obj = ua_getObj( "img" );
		if ( obj ) { obj.style.mozUserSelect = "none"; }

//	    document.addEventListener("onselect",	cancelSelectText,	true);			
//    	document.addEventListener("onDragDrop",	cancelSelectText,	true);
//    	window.addEventListener("onDragDrop",	cancelSelectText,	true);*/
	}
	else {
    	document.attachEvent("onselect", 		cancelSelectText);
	    document.attachEvent("onselectstart",   cancelSelectText);
	    document.attachEvent("ondragstart",   	cancelSelectText);
	}
}

function cancelSelectText(e) {
	if ( bw.ns6 ) {
//		e.preventDefault();		
//		e.cancelBubble = true; 	// false = usual default
	}
	else {
		document.selection.empty();	
		e.cancelBubble	= true; 
		e.returnValue	= false;
	}
	return false;
}
//-->
