//window.open('','_self');window.close()

if (!window.console) console = {}; 
console.log = console.log || function(){};
console.warn = console.warn || function(){};
console.error = console.error || function(){};
console.info = console.info || function(){};

var ns = (navigator.appName.indexOf('Netscape')>-1);
var ie = (navigator.appName.indexOf('Microsoft Internet Explorer')>-1);

var prettyName = ""     // see readCookie()

var localhost = 1

if(location.href.indexOf("file:") == -1 && location.href.indexOf("localhost") == -1) { localhost = 0; }

var host = false;

if ( localhost ) { // works for local host or server host
	if( !host && location.href.indexOf("B2A") > 0 ){
		var hostAt = "http://localhost/tc/B2A";
		host = true;
	}
	if( !host && location.href.indexOf("testing") > 0 ){
		var hostAt = "http://localhost/2007testing";
		host = true;
	}
	if( !host ){
		var hostAt = "http://localhost/tc";
		host = true;
	}
}else{
	var hostAt = ".."
}

xbDetectBrowser();

function dateNotPast( x ){ 			// requires exact mm/dd/yyyy
	if( x.length != 10 ) return false;
	var today = new Date();
	var monthToday = 1 * today.getMonth() + 1;
	var dayToday =   1 * today.getDate();
	var yearToday =  1 * today.getFullYear();
	var y = x.split("/");
	if( y.length != 3 ) return false;
	if( 1*y[2] > yearToday ) return true;
	if( 1*y[0] > monthToday ) return true;
	if( 1*y[1] >= dayToday ) return true;
	return false;
}
function printEmail(e){
    MyWindow = window.open("","MyWindow",
       "toolbar=yes,location=no,directories=no,status=no," +
       "menubar=yes,scrollbars=yes,resizable=yes,dependent=yes," +
       "width=600,height=400,hotkeys=no");
	var t = " e-mail";
    var str = "<html><head>" +
    "<title>" + t + "</title><style type='text/css'>" +
    "body{margin:5%} .dnp{display:none}@media print{input{display:none}}</style>" +
    "</head><body><input type='button' value=' Print ' style='margin-top:-12px' onClick='window.print();' /><br /><br />" + e + "<br clear='all' /><br /><input type='button' value=' Close ' style='margin-top:-16px' onClick='self.close();' />&nbsp;&nbsp;</body></html>"
    self.MyWindow.document.open()
    self.MyWindow.document.write(str)
    self.MyWindow.document.close()
    MyWindow.focus()
}
function openPrivacyPolicy( ){
	var x;
	window.open('../corp/mx035.html', x, 'height=500,width=800, top=200,screenY=200,left=200,screenX=200,resizable=yes,scrollbars=yes');
}
function whatPage(){  // returns name of page running
	var x = location.href;
	var a = x.split("/");
	var n = a.length;
	return a[n-1];
}
function queryStringArray(href) {

	// send: www.x.com?a=12&b=13, return: vars['a']=12, vars['b']=13

	var loc = href.indexOf("?")+1;
	qs = href.substring(loc,href.length);
	var a = qs.split("&");
	var vars= new Array();
	for(i=0;i<a.length;i++){
		var v = a[i].split("=");
		vars[v[0]] = v[1];
	}
	return vars;  // return associative array
}
function queryStringBuild() {

	// send: 'a',12,'b',13; return: '?a=12&b=13'

	var ret = "?";
	for(i=0;i<arguments.length;i++)
	ret = ret + arguments[i];
	return ret
}
// +++++++ interpretive/relationship report functions below +++++++++++++
function fullReport( section ){
	var loc = location.href;
	if( loc.indexOf("?") == -1 ) loc = loc + "?for=full";
	//if( loc.indexOf("for=preview") == -1 ) loc = loc + "&for=preview";
	if( section ){
		loc = linkReport( loc, section )
	}
	location.href=replaceAll("for=preview","for=full",loc);
}
function previewReport(){
	var loc = location.href;
	if( loc.indexOf("for=full") == -1 ) loc = loc + "&for=full";
	location.href=replaceAll("for=full","for=preview",loc);
}
function sources(n,txt){
	document.write("<div id='sources' style='width:auto;margin:14px auto'>"+ txt +"</div>");
}
function prettyDate(dat){
    var m = new Array(12);
    m[0]='Jan' ;     m[1]='Feb' ;     m[2]='Mar' ;     m[3]='Apr' ;     m[4]='May'
    m[5]='Jun' ;     m[6]='Jul' ;     m[7]='Aug' ;     m[8]='Sept' ;    m[9]='Oct'
    m[10]='Nov' ;     m[11]='Dec'
    var lm_year=dat.getFullYear();
    var lm_month=dat.getMonth()+1;
    var lm_day=dat.getDate();
	return m[lm_month-1]+' '+lm_day+', '+lm_year;
}
function printFoot(format,version){
	var a=new Date();
	report_date = prettyDate(a);
	var page = whatPage();  // the names of the free report generators are freePG.php & freeRG.php
	var freeBee = (page.indexOf("free")==-1)?false:true;
	//alert("freeBEE="+freeBee)
	document.write("<div style='float:left'>" + report_date + "</div><div style='float:right'>Version " + version + "</div>")
	document.write("<div id='footOS' style='text-align:center'>www.OppositeStrengths.com</div>")
	document.write("<div class='dnp1' style='text-align:center;margin-top:16px'>")
	if( format=='preview' ){
		if( freeBee ){
			document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freePGerrs.php' \" value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the full report ' onclick=\"location.href='freePG.php?for=full' \" value= ' Full Report ' />&nbsp;&nbsp;")
		}else{
			document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the full report ' onclick=\"location.href='./ix216.php?for=full' \" value= ' Full Report ' />&nbsp;&nbsp;")
		}
	}else{
		if( freeBee ){
			document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freePGerrs.php' \" value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the preview report ' onclick=\"location.href='freePG.php?for=preview' \" value= ' Preview Report ' />&nbsp;&nbsp;")
		}else{
			document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the preview report ' onclick=\"location.href='./ix216.php?for=preview' \" value= ' Preview Report ' />&nbsp;&nbsp;")
		}
	}
	document.write("<input type='button' class='submit' title=' print the report ' onclick='window.print()' value=' Print ' /></div>")

	document.write("<div class='dnp1' id='headRX' >")
	var h = new Array;
	if( format=='preview' ){
		h[0]="<a href='#p_char'"
		h[1]="<a href='#p_tend'"
		h[2]="<a href='#p_grow'"
		h[3]="<a href='#p_polar'"
		h[4]="<a href='#p_work'"
		h[5]="<a href='#p_relat'"
	}else{
		h[0]="<a href='#characteristics'"
		h[1]="<a href='#keytendencies'"
		h[2]="<a href='#growth'"
		h[3]="<a href='#polarization'"
		h[4]="<a href='#atwork'"
		h[5]="<a href='#relations'"
	}
	document.write(h[0] + "title='  Characteristics ' >Characteristics</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[1] + "title='  Key Tendencies ' >Tendencies</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[2] + "title='  Growth ' >Growth</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[3] + "title='  Polarization ' >Polarization</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[4] + "title='  At work ' >Work</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[5] + "title='  Relationships '  >Relationships</a></div>")
}
function printHead(format,version){
	document.write("<div class='dnp1' id='headRX' >")
	var h = new Array;
	var page = whatPage();  // the names of the free report generators are freePG.php & freeRG.php
	var freeBee = (page.indexOf("free")==-1)?false:true;
	//alert("freeBEE="+freeBee)
	if( format=='preview' ){
		h[0]="<a href='#p_char'"
		h[1]="<a href='#p_tend'"
		h[2]="<a href='#p_grow'"
		h[3]="<a href='#p_polar'"
		h[4]="<a href='#p_work'"
		h[5]="<a href='#p_relat'"
	}else{
		h[0]="<a href='#characteristics'"
		h[1]="<a href='#keytendencies'"
		h[2]="<a href='#growth'"
		h[3]="<a href='#polarization'"
		h[4]="<a href='#atwork'"
		h[5]="<a href='#relations'"
	}
	document.write(h[0] + "title='  Characteristics ' >Characteristics</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[1] + "title='  Key Tendencies ' >Tendencies</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[2] + "title='  Growth ' >Growth</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[3] + "title='  Polarization ' >Polarization</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[4] + "title='  At work ' >Work</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[5] + "title='  Relationships '  >Relationships</a></div>")

	document.write("<div class='dnp1' style='text-align:center;margin-top:16px'>")
	if( format=='preview' ){
		if( freeBee ){
			document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freePGerrs.php' \" value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the full report ' onclick=\"location.href='./freePG.php?for=full' \" value= ' Full Report ' />&nbsp;&nbsp;")
		}else{
			document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the full report ' onclick=\"location.href='./ix216.php?for=full' \" value= ' Full Report ' />&nbsp;&nbsp;")
		}
	}else{
		if( freeBee ){
			document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freePGerrs.php' \" value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the preview report ' onclick=\"location.href='./freePG.php?for=preview' \" value= ' Preview Report ' />&nbsp;&nbsp;")
		}else{
			document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the preview report ' onclick=\"location.href='./ix216.php?for=preview' \" value= ' Preview Report ' />&nbsp;&nbsp;")
		}
	}
	document.write("<input type='button' class='submit' title=' print the report ' onclick='window.print()' value=' Print ' /></div>")
}
function printHeadPG2(format,version){
	document.write("<div class='dnp1' id='headRX' >")
	var h = new Array;
	var page = whatPage();  // the names of the free report generators are freePG.php & freeRG.php
	var freeBee = (page.indexOf("free")==-1)?false:true;
	//alert("freeBEE="+freeBee)
	if( format=='preview' ){
		h[0]="<a href='#p_tend'"
		h[1]="<a href='#p_grow'"
		h[2]="<a href='#p_relat'"
	}else{
		h[0]="<a href='#keytendencies'"
		h[1]="<a href='#growth'"
		h[2]="<a href='#relations'"
	}
	document.write(h[0] + "title='  Natural Way ' >Natural Way</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[1] + "title=' Personal Growth ' >Personal Growth</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[2] + "title='  Relationships '  >Relationships</a></div>")

	document.write("<div class='dnp1' style='text-align:center;margin-top:16px'>")
	if( format=='preview' ){
		if( freeBee ){
			document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freePGerrs.php' \" value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the full report ' onclick=\"location.href='./freePG.php?for=full' \" value= ' Full Report ' />&nbsp;&nbsp;")
		}else{
			document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the full report ' onclick=\"location.href='./ix216.php?for=full' \" value= ' Full Report ' />&nbsp;&nbsp;")
		}
	}else{
		if( freeBee ){
			document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freePGerrs.php' \" value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the preview report ' onclick=\"location.href='./freePG.php?for=preview' \" value= ' Preview Report ' />&nbsp;&nbsp;")
		}else{
			document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the preview report ' onclick=\"location.href='./ix216.php?for=preview' \" value= ' Preview Report ' />&nbsp;&nbsp;")
		}
	}
	document.write("<input type='button' class='submit' title=' print the report ' onclick='window.print()' value=' Print ' /></div>")
}
function printFootPG2(format,version){
	var a=new Date();
	report_date = prettyDate(a);
	var page = whatPage();  // the names of the free report generators are freePG.php & freeRG.php
	var freeBee = (page.indexOf("free")==-1)?false:true;
	//alert("freeBEE="+freeBee)
	document.write("<div style='float:left'>" + report_date + "</div><div style='float:right'>Version " + version + "</div>")
	document.write("<div id='footOS' style='text-align:center'>www.OppositeStrengths.com</div>")
	document.write("<div class='dnp1' style='text-align:center;margin-top:16px'>")
	if( format=='preview' ){
		if( freeBee ){
			document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freePGerrs.php' \" value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the full report ' onclick=\"location.href='freePG.php?for=full' \" value= ' Full Report ' />&nbsp;&nbsp;")
		}else{
			document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the full report ' onclick=\"location.href='./ix216.php?for=full' \" value= ' Full Report ' />&nbsp;&nbsp;")
		}
	}else{
		if( freeBee ){
			document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freePGerrs.php' \" value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the preview report ' onclick=\"location.href='freePG.php?for=preview' \" value= ' Preview Report ' />&nbsp;&nbsp;")
		}else{
			document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
			document.write("<input type='button' class='submit' title=' read the preview report ' onclick=\"location.href='./ix216.php?for=preview' \" value= ' Preview Report ' />&nbsp;&nbsp;")
		}
	}
	document.write("<input type='button' class='submit' title=' print the report ' onclick='window.print()' value=' Print ' /></div>")

	document.write("<div class='dnp1' id='headRX' >")
	var h = new Array;
	if( format=='preview' ){

		h[0]="<a href='#p_tend'"
		h[1]="<a href='#p_grow'"
		h[2]="<a href='#p_relat'"
	}else{
		h[0]="<a href='#keytendencies'"
		h[1]="<a href='#growth'"
		h[2]="<a href='#relations'"
	}

	document.write(h[0] + "title='  Natural Way ' >Natural Way</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[1] + "title='  Personal Growth ' >Personal Growth</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[2] + "title='  Relationships '  >Relationships</a></div>")
}

function top(){
	document.write("<span class='dnp2'>&nbsp;&nbsp;<img onclick='window.scroll(0,0)' onmouseover='wiggle(this)' onmouseout='unWiggle(this)' src='../images/top-s.gif' alt=' go to the top of this report ' width='35' height='12' border='0' /></span>")
}
function more( where ){
	document.write("&nbsp;<span class='more' onclick='fullReport( \""+ where + "\" )'><img onmouseover='wiggle(this)' onmouseout='unWiggle(this)' src='../images/more-s.gif' alt=' read this section of the full report ' width='48' height='12' border='0' /></span>")
}
function wiggle(obj){
	obj.style.position = 'relative'
	obj.style.top = '-2px'
	obj.style.left = '-2px'
}
function unWiggle(obj){
	obj.style.position = 'relative'
	obj.style.top = '0px'
	obj.style.left = '0px'
}
function printRelationshipHead(format,version){
	var page = whatPage();  // the names of the free report generators are freePG.php & freeRG.php
	var freeBee = (page.indexOf("free")==-1)?false:true;
	document.write("<div class='dnp1' id='headRX' >")
	var h = new Array;
	if( format=='lowerReader' ){
		h[0]="<a href='#lr1' "
		h[1]="<a href='#lr2' "
		h[2]="<a href='#lr3' "
		h[3]="<a href='#lr4' "
		h[4]="<a href='#lr5' "
		h[5]="<a href='#lr6' "
	}
	if( format=='higherReader' ){
		h[0]="<a href='#hr1' "
		h[1]="<a href='#hr2' "
		h[2]="<a href='#hr3' "
		h[3]="<a href='#hr4' "
		h[4]="<a href='#hr5' "
		h[5]="<a href='#hr6' "
	}
	if( format=='otherReader' ){
		h[0]="<a href='#or1' "
		h[1]="<a href='#or2' "
		h[2]="<a href='#or3' "
		h[3]="<a href='#or4' "
		h[4]="<a href='#or5' "
		h[5]="<a href='#or6' "
	}
//	document.write(h[0] + "title=' top of page ' >Top</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[1] + "title=' general tips for relating ' >Tips</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[2] + "title=' overview ' >Overview</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[3] + "title=' typical relationship problems ' >Problems</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[4] + "title=' strengthening the relationship ' >Strengthening</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[5] + "title=' characteristics for your Patterns '  >Characteristics</a></div>")
	document.write("<div class='dnp1' style='text-align:center;margin-top:16px'>")
	if( freeBee ){
		document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freeRGinfo.php' \" value= ' Close ' />&nbsp;&nbsp;")
		document.write("<input type='button' class='submit' title=' print the report ' onclick='window.print()' value=' Print ' /></div>")
	}else{
		document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
		document.write("<input type='button' class='submit' title=' print the report ' onclick='window.print()' value=' Print ' /></div>")
	}

}
function printRelationshipFoot(format,version){
	var page = whatPage();  // the names of the free report generators are freePG.php & freeRG.php
	var freeBee = (page.indexOf("free")==-1)?false:true;
	var a=new Date();
	report_date = prettyDate(a);
	document.write("<div style='float:left'>" + report_date + "</div><div style='float:right'>Version " + version + "</div>")
	document.write("<div id='footOS' style='text-align:center'>www.OppositeStrengths.com</div>")
	document.write("<div class='dnp1' style='text-align:center;margin-top:16px'>")
	if( freeBee ){
		document.write("<input type='button' class='submit' title=' link to member home ' onclick=\"location.href='freeRGinfo.php' \" value= ' Close ' />&nbsp;&nbsp;")
		document.write("<input type='button' class='submit' title=' print the report ' onclick='window.print()' value=' Print ' /></div>")
	}else{
		document.write("<input type='button' class='submit' title=' return to member home ' onclick='window.close()' value= ' Close ' />&nbsp;&nbsp;")
		document.write("<input type='button' class='submit' title=' print the report ' onclick='window.print()' value=' Print ' /></div>")
	}
	document.write("<div class='dnp1' id='headRX' >")
	var h = new Array;
	if( format=='lowerReader' ){
		h[0]="<a href='#lr1' "
		h[1]="<a href='#lr2' "
		h[2]="<a href='#lr3' "
		h[3]="<a href='#lr4' "
		h[4]="<a href='#lr5' "
		h[5]="<a href='#lr6' "
	}
	if( format=='higherReader' ){
		h[0]="<a href='#hr1' "
		h[1]="<a href='#hr2' "
		h[2]="<a href='#hr3' "
		h[3]="<a href='#hr4' "
		h[4]="<a href='#hr5' "
		h[5]="<a href='#hr6' "
	}
	if( format=='otherReader' ){
		h[0]="<a href='#or1' "
		h[1]="<a href='#or2' "
		h[2]="<a href='#or3' "
		h[3]="<a href='#or4' "
		h[4]="<a href='#or5' "
		h[5]="<a href='#or6' "
	}
	document.write(h[0] + "title=' top of page ' >Top</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[1] + "title=' general tips ' >Tips</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[2] + "title=' overview ' >Overview</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[3] + "title=' typical relationship problems ' >Problems</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[4] + "title=' strengthening the relationship ' >Strengthening</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
	document.write(h[5] + "title=' characteristics for your Patterns '>Characteristics</a></div><br clear='all' /><br />")
}



// +++++++ interpretive/relationship report functions above +++++++++++++
function localClick(to){
//document.write("<input type='button' value='&nbsp;Start&nbsp;' " + localClick("php/mx025.php") + "class='submit'  />")
    var href = "'" + hostAt + "/" + to
    href = "onclick=\"" + "location.href=" + href + "\'\""
    return href
}
function theoryMenu(page){
    document.write("<dl class='theoryMenu'>")
    if( page != "Introduction" ){
        document.write("<dt><a href='../benefits/introduction.php'>Introduction</a></dt>")
        document.write("<dd>&#183;&nbsp;overview and introduction<br />&nbsp;&nbsp;to our model for success in life</dd>")
    }
    if( page != "Strengths" ){
        document.write("<dt><a href='../benefits/patternofstrengths.php'>Strengths</a></dt>")
        document.write("<dd>&#183;&nbsp;your three pairs of lead strengths<br />&nbsp;&nbsp;and supporting strengths</dd>")
    }
    if( page != "Growth" ){
        document.write("<dt><a href='../benefits/personalgrowth.php'>Sustained Success</a></dt>")
        document.write("<dd>&#183;&nbsp;being yourself; learning to<br />&nbsp;&nbsp;use your supporting strengths</dd>")
    }
    if( page != "Personality" ){
        document.write("<dt><a href='../benefits/fourforces.php'>Personality</a></dt>")
        document.write("<dd>&#183;&nbsp;your capacities, strengths, choices,<br />&nbsp;&nbsp;and environment</dd>")
    }
    if( page != "Relationships" ){
        document.write("<dt><a href='../benefits/relationships.php'>Relationships</a></dt>")
        document.write("<dd>&#183;&nbsp;creatively adjusting<br />&nbsp;&nbsp;the dynamics in relationships</dd>")
    }
    if( page != "Inventory" ){
        document.write("<dt><a href='../benefits/inventory.php'>Opposite Strengths Inventory</a></dt>")
        document.write("<dd>&#183;&nbsp;our 45-item questionnaire</dd>")
    }
    if( page != "Reports" ){
        document.write("<dt><a href='../benefits/reports.php'>Guides</a></dt>")
        document.write("<dd>&#183;&nbsp;Online guides customized&nbsp;<br />&nbsp;&nbsp;  for your strengths</dd>")
    }
    if( page != "Publications" ){
        document.write("<dt><a href='../benefits/publications.php'>Publications</a></dt>")
        document.write("<dd>&#183;&nbsp;recent books that describe our theory&nbsp;<br />&nbsp;&nbsp;and its practice in depth</dd>")
    }
    document.write('</dl>')
}

function localHref(to){
// document.write("<a " + localHref('php/mx025.php?skipintro') + " title=' Join '>Join</a>")
    var href =  hostAt + "/" + to
    href = "href=\'" + href + "\'"
    //alert(href)
    return href
}
function UCtext(obj){
    obj.value = obj.value.toUpperCase();
}
function rowShades(t){
	var x=document.getElementById(t);
    for (var i=1; i < x.rows.length; i++){
        if( ie ){
			x.rows[i].bgColor= ((i % 2) == 0?"#DEE9FF":"#FFFFFF")
        }else{
			x.rows[i].bgColor= ((i % 2) == 0?"#DEE9FF":"#FFFFFF")
		}
	}
}
function printBack(to){
	if( to=='preview' ){ to="window.close()" }else{ to="location.href=\"./ix216.php?for=preview\"" }
	document.write(	"<div class='dnp1'>	<input type='button' id='bak78' disabled='true' value='< Back' onclick='" + to + "' />&nbsp;&nbsp;&nbsp;<input type='button' value=' Print ' id='prt78' onclick='window.print()' /></div>")
}
function back2mx055(){
	document.write("<br clear='all' /><div style='text-align:center'>")
	document.write("<input value='Your home' type='button' class='submit' onclick='location.href=\"../php/mx055.php\"' /></div>")
}
function back2cx005(){
	document.write("<br clear='all' /><div style='text-align:center'>")
	document.write("<input value='Your events' type='button' class='submit' onclick='location.href=\"../php/cx005.php\"'  />")
}
function back2previous(){
	document.write("<input value='< Back' type='button' class='submit' onclick='history.go(-1)'  />")
}
function readCookie(){  // cookie is written in login.php, logout.php; most html pages ONLY read it
    var x = unescape(document.cookie) // +";"
	//alert("cookie read: "+x);
	if( x.indexOf("PHPSESSID=") == -1 || x == "" ) return "";
	var y = x.indexOf("tc=")
	//alert("y="+y)
    if( y == -1 ) { return "" }
	var z = x.indexOf(";",y+3)
	//document.write("y="+y+", z="+z+", cookie="+x)
    if( z > -1 ) { prettyName = mid(x,y+3,z-3) }else{ prettyName = mid(x,y+3,99) }
	//alert("Read: prettyName="+prettyName)
	//if( prettyName.indexOf(";") ) location.replace("../php/logout.php");
    return prettyName;
}
function writeCookie(value){
		//alert('cookie value='+value)
	    var nintyDays = 90 * 24 * 60 * 60 * 1000         // date/time in milliseconds
	    var fifteenMinutes = 1 * 1 *  15 * 60 * 1000     // date/time in milliseconds
	    var today = new Date()                                      // today's date
	    today.setTime(today.getTime() + nintyDays)       // add lifetime to cookie
	    ExpiresWhen = today.toGMTString()                // convert to GMT
	    var x = 'tc=' + escape(value) + '; expires=' + ExpiresWhen + ';path=/;'
	    document.cookie = x
}
function deleteCookie(){
    var threeDays = 3 * 24 * 60 * 60 * 1000      	// date/time in milliseconds
	var fiveMinutes = 1 * 1 *   5 * 60 * 1000      	// date/time in milliseconds
    var today = new Date()                      			 // today's date
    today.setTime(today.getTime() - threeDays)   	// subtract lifetime to cookie
    ExpiresWhen = today.toGMTString()            		// convert to GMT
    document.cookie = "tc=" + escape("") + '; expires=' + ExpiresWhen  + ';path=/;'
	//alert("cookie deleted")
}
function isEmailString(e){
     if(howMany("@",e) != 1 || howMany(".",e) == 0) { return false }else{ return true }
}
function replaceAll(old,newer,haystack){
	while (true) {
		var a = haystack.indexOf(old)
		if ( a == -1 ) return haystack
		haystack = haystack.replace(old,newer)
	}
return haystack
}
function linkTo(w){
	location.href=w
}
function oneWayLinkTo(w){
	location.replace(w)
}
function linkReport( href, to ){   // used by template reports
//alert("href,to="+href+"******"+to)
	var y = href.split( "#" );
	return y[0] + "#" + to;
}
function isDateString(d){
     // validates date strings ( e.g. input text boxes)
     // requires a 4-digit year
	if (howMany("/",d) != 2) return false;
	d = trim(d);
	var s1 = d.indexOf("/");
	var mm = left(d,s1)
	if(mm < 1 || mm > 12) return false // alert("mm="+mm)
	var s2 = d.indexOf("/",s1+1)
	var dd = mid(d,s1+1,s2-s1-1)
	if(dd < 1 || dd > 31) return false //  alert("dd="+dd)
	var yy = mid(d,s2+1)
	if(yy < 1890 || yy > 2050) return false  //alert("yy="+yy)
	return true
}
function checkDateSimple( t ){ // onblur='checkDateSimple(this.value)'
	if( t == null || t == "" ) return
	var b = t
	var a = properDate( b )
	if( b != a ) {
		//alert (t+" - "+a)
		for( var i=0; i<document.forms[0].elements.length; i++){
			if(document.forms[0].elements[i].value == t)document.forms[0].elements[i].value = a;
		}
	}
}
function checkDate( t,frm ){ // onblur='checkDate(this.value,frm.xstart_date)'
	var b = t;
	var a = properDate( b );
	if( b != a ) {
		//alert (a)
		frm.value = a;
	}
}
function properDate( d ){   // checks 1/2/04 - returns 01/02/2004
	var ret = "00/00/0000";
	var y = trim(d).split( "/" );
	if( y.length != 3) return ret;
	y[0] = right("0"+y[0],2);
	y[1] = right("0"+y[1],2);
	if(len(y[2]) !=4 ) y[2] = right("20"+right("0"+y[2],2),4);
	return y[0]+"/"+y[1]+"/"+y[2];
}
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
function goodDate (day,month,year) {
	 // checks if date passed is valid
	 // will accept dates in following format:
	 // goodDate(dd,mm,ccyy), or
	 // goodDate(dd,mm) - which defaults to the current year, or
	 // goodDate(dd) - which defaults to the current month and year.
	 // Note, if passed the month must be between 1 and 12, and the
	 // year in ccyy format.
      var today = new Date();
     year = ((!year) ? y2k(today.getFullYear()):year);
     month = ((!month) ? today.getMonth():month-1);
     if (!day) return false
     var test = new Date(year,month,day);
     if ( (y2k(test.getFullYear()) == year) &&
          (month == test.getMonth()) &&
          (day == test.getDate()) )
         return true;
     else
         return false
}
function howMany(needles, haystack){
    var n = 0
    var loc = 0
    for(var i=0; i < haystack.length; i++){
            loc = haystack.indexOf(needles,loc)
            if ( loc == -1 ) return n;
            n++
            loc++
            }
    return n
}
function illegalpasswordchars( haystack ){
	var needle = new Array(8)
	needle[0]="<"
	needle[1]=">"
	needle[2]="&"
	needle[3]="?"
	needle[4]="'"
	needle[5]='"'
	needle[6]='#'
	needle[7]=" "
    var ret = ""
    n=haystack.length
    for(var i=0; i < haystack.length; i++){
    	var c = haystack.charAt(i)
    	var ok = true
        for(var j=0; j < needle.length; j++){
        	if( needle[j] == c ) ok = false
		}
	if( ok ) ret = ret + "" + c
	}
    return ret
}

function illegalemailchars( haystack ){
	var needle = new Array(6)
	needle[0]="<"
	needle[1]=">"
	needle[2]="&"
	needle[3]="?"
	needle[4]='"'
	needle[5]="'"
	needle[6]=" "
    var ret = ""
    n=haystack.length
    for(var i=0; i < haystack.length; i++){
    	var c = haystack.charAt(i)
    	var ok = true
        for(var j=0; j < needle.length; j++){
        	if( needle[j] == c ) ok = false
		}
	if( ok ) ret = ret + "" + c
	}
    return ret
}
function bg(e) {
    if (ns)  { var obj = e.target } else { var obj = e.srcElement }

    if( obj.tagName=="TABLE") return              //alert(obj.previousSibling.tagName)

    if(obj.nodeType == 3)  obj = obj.parentNode    //  necessary for Netscape, not IE

    if(obj.tagName=="TD"){
        if(obj.id=="menuleft" || obj.id=="menuright") return
    }
    if(e.type=="mouseover" && obj.tagName=="TD"){
        //obj.style.backgroundColor="rgb(240,240,240)"  //"url(images/BGtestLeft.png) repeat-y"
        //obj.style.backgroundImage="url(../images/poenz/buttonbannerinterior.jpg)"
        obj.style.cursor="pointer"
        obj.style.borderColor="silver"
    }
    if(e.type=="mouseout" && obj.tagName=="TD"){
        //obj.style.backgroundColor="white"
        //obj.style.color="rgb(240,240,240)"
        obj.style.borderColor="dimgray"
    }
    if(e.type=="click" && obj.tagName=="TD"){
       location.href= obj.id
    }
}
function mainMenu(mx){  /* also see footing: footerPX()	*/
	var idstyle = new Array(8)
	var mxstyle="style='background-image:url(../images/poenz/menuinterior.jpg)' "
	idstyle[0]="id='../home/index.html'> home </td>";

$topmenu = "community";

	idstyle[1]="id='../corp/hx300.php'>history</td>";
	idstyle[2]="id='../php/hx105.php'> faculty </td>";
	idstyle[3]="id='../php/mx000.php'> community </td>";
	idstyle[4]="id='../benefits/introduction.php' title='&nbsp;overview of Opposite Strengths&nbsp;'> system </td>";
	idstyle[5]="id='../benefits/theory.php' title='&nbsp;a condensed description of Opposite Strengths model&nbsp;' > theory </td>";
	idstyle[6]="id='../corp/hx400.php' title='&nbsp;licensing&nbsp;' >licensing</td>"; 
	idstyle[7]="id='../php/axcc_noshop.php' title='&nbsp;buy personalized reports and more&nbsp;' >shopping cart</td>"; 

	switch (mx){
		case "home":
			idstyle[0] = mxstyle + idstyle[0]; break;
		case "history":
		case "coaching":
		case "events":
			idstyle[1] = mxstyle + idstyle[1]; break;
		case "faculty":
		case "training":
		case "seminars":
			idstyle[2] = mxstyle + idstyle[2]; break;
		case "community":
			idstyle[3] = mxstyle + idstyle[3]; break;
		case "my strengths":
			idstyle[4] = mxstyle + idstyle[4]; break;
		case "theory":
			idstyle[5] = mxstyle + idstyle[5]; break;
		case "licenses":     
	 	case "licensing":
			idstyle[6] = mxstyle + idstyle[6]; break;
		case "shopping":
			idstyle[7] = mxstyle + idstyle[7]; break;
	}
	document.write("<table id='ssmenu' border='0' cellspacing='0' cellpadding='4' width='100%'  onmouseover='bg(event)' onmouseout='bg(event)' onclick='bg(event)'><tr>")

	for(var i=0; i < len(idstyle); i++){
		document.write("<td " + idstyle[i] )
	}
	document.write("</tr></table>")
}
function header(){
	document.write("<div id='headerPX'>")
	var ck = readCookie();
	//alert(ck);
	if( ck == "" || prettyName.indexOf("PHPSESSID=") != -1 )	{
		//document.write("<a "+ localHref('php/mx023.php') + " title='&nbsp;Join our online community&nbsp;'>Join</a>&nbsp;|&nbsp;")
		//document.write("<a href='../db/sitemap.html' title='&nbsp;Major topics, areas, functions of the site&nbsp;'>Site map</a>&nbsp;|&nbsp;")
	}else{
		if(prettyName.indexOf("PHPSESSID=") != -1 ){
			alert("Please log on to OppositeStrengths.com");
			 location.replace('logout.php');
			 //  alert('PHPSESSID found in cookie:'+prettyName); 1/20/2009 solved remaining logged on after computer switched off
		}
		document.write("<a "+ localHref('php/mx055.php') + " title='&nbsp;Your personal home page&nbsp;' style='color:navy; xfont-weight:bold'>"+possessive(prettyName)+"</a>&nbsp;|&nbsp;")
		document.write("<a "+ localHref('php/logout.php') + " title='&nbsp;Log out&nbsp;'>Log out</a>&nbsp;|&nbsp;")
	}
	document.write("<a "+ localHref('php/hx030.php') + " title='&nbsp;Comments by e-mail&nbsp;'>Contact us</a></div>")
}
function possessive(surname){
	if( right(surname,1)=="s" ) {
		return surname+"' home page"
	}else{
		return surname+"'s home page"
	}
}
function footerPX(){
	document.write("<div id='footerPX'>")
	document.write("<a href='../index.html' title='&nbsp;Get back to the starting point of the site&nbsp;'>Home</a>&nbsp;|&nbsp;")
	//document.write("<a href='../php/hx100.php' title='&nbsp;The principals and staff&nbsp;'>Who we are</a>&nbsp;|&nbsp;")
	document.write("<a href='../corp/hx300.php' title='&nbsp;The principals &nbsp;'>History</a>&nbsp;|&nbsp;")
	if ( localhost ){
		//document.write("<a href='../php/hx026.php' title='&nbsp;our locations in USA and Canada &nbsp;'>Where we are</a>&nbsp;|&nbsp;")
		//document.write("<a href='../php/hx060.php' title='&nbsp;A growing list of over 1,300&nbsp;'>Clients</a>&nbsp;|&nbsp;")

		document.write("<a href='../php/hx105.php' title='&nbsp;A list of over 1,000&nbsp;'>Faculty</a>&nbsp;|&nbsp;")
		//document.write("<a href='../corp/hx200.php' title='&nbsp;Consulting;'>Consulting</a>&nbsp;|&nbsp;")
		document.write("<a href='../php/mx000.php' title='&nbsp;Community&nbsp;'>Community</a>&nbsp;|&nbsp;")
		document.write("<a href='../benefits/introduction.php' title='&nbsp;Overview of The Power of Opposite Stengths system&nbsp;'>System</a>&nbsp;|&nbsp;")
		document.write("<a href='../benefits/theory.php' title='&nbsp;Introduction to The Power of Opposite Stengths model&nbsp;'>Theory</a>&nbsp;|&nbsp;")
	}else{
		//document.write("<a href='../php/hx026.php' title='&nbsp;our locations in USA and Canada &nbsp;'>Where we are</a>&nbsp;|&nbsp;")
		//document.write("<a href='../php/hx060.php' title='&nbsp;A growing list of over 1,300&nbsp;'>Clients</a>&nbsp;|&nbsp;")
		document.write("<a href='../php/hx105.php' title='&nbsp;A list of over 1,000&nbsp;'>Faculty</a>&nbsp;|&nbsp;")
		//document.write("<a href='../corp/hx200.php' title='&nbsp;Consulting;'>Consulting</a>&nbsp;|&nbsp;")
		document.write("<a href='../php/mx000.php' title='&nbsp;Community&nbsp;'>Community</a>&nbsp;|&nbsp;")
		document.write("<a href='../benefits/introduction.php' title='&nbsp;Overview of our system of components&nbsp;'>System</a>&nbsp;|&nbsp;")
		document.write("<a href='../benefits/theory.php' title='&nbsp;Overview of The Power of Opposite Stengths&nbsp;'>Theory</a>&nbsp;|&nbsp;")
	}
	document.write("<a href='../corp/mx035.html' title='&nbsp;How information you give us is handled and protected&nbsp;'>Privacy</a>&nbsp;|&nbsp;")

	document.write("<a "+ localHref('php/hx030.php') + " title='&nbsp;Phone, e-mail or send us a comment/suggestion directly from this site'>Contact us</a></div>")
	if ( readCookie() == "" )	{
		//document.write("<a "+ localHref('php/mx023.php') + " title='&nbsp;Join our online community&nbsp;'>Join</a>&nbsp;|&nbsp;")
	}
	//document.write("<a "+ localHref('php/logout.php') + " title='&nbsp;Log out&nbsp;'>Log out</a>&nbsp;|&nbsp;")
	//document.write("<a "+ localHref('php/hx030.php') + " title='&nbsp;Phone, e-mail or send us a comment/suggestion directly from this site'>Contact us</a></div>")
	var a=new Date();
	var y = a.getFullYear();
	document.write("<div id='footCopyRight' >&copy; Opposite Strengths, Inc. 2003-"+ y + "</div>")
}
function showEmail(txtText){
    emailWindow = window.open("","email",
       "toolbar=no,location=no,directories=no,status=no," +
       "menubar=no,scrollbars=yes,resizable=yes,dependent=yes," +
       "width=600,height=400,hotkeys=no")
    str = "<html><head>" +
    "<title>Simulated e-mail</title><style type='text/css'>" +
    "body{margin:5%}</style>" +
    "</head><body>" + txtText + "<br clear='all' /><input type='button' value=' Close ' style='margin-top:1em' onClick='self.close();' /></body></html>"
    self.emailWindow.document.open()
    self.emailWindow.document.write(str)
    self.emailWindow.document.close()
    emailWindow.focus()
}
function validateXHTML(){
        var validCheck = location.href
        var ref = "http://validator.w3.org/"
        if(validCheck.indexOf('file:///')!=-1)
            {validCheck="file-upload.html"}
        else
            {validCheck="check?uri=" + escape(validCheck)}
        location.href= ref + validCheck
}
function validFooting(){
	var x = location.href
	var y = x.indexOf("/tc/")
	y = mid(x,y,99)
	var z = document.lastModified
	document.write("<br clear='all'/><address style='color:silver;text-align:center;margin-top:62px'>")
	document.write("Page= "+ y + " modified on ")
	document.write(left(z, len(z)-9) + "<br />")
	document.write("<a style='color:silver' href='#' onclick='vbscript: validateXHTML()'>Valid XHTML?</a>")
	document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
	document.write("<a style='color:silver' href='http://jigsaw.w3.org/css-validator'>Valid CSS?</a>")
	document.write("</address>")
 }
 function isNumber(x){             // returns true if arg is a number. Both "12" and 12 return true.
     return !isNaN(parseInt(x))
}
// this func was commented out in the pages that used it
function caseStudies(){  // add an arg to drop out one of the studies from the list below
	document.write("<h3 style='margin:9px 0px 5px 38px;text-align:left'>Case studies</h3>")
	document.write("<ul style='margin:0px 0px 0px 38px'><li>&#183;&nbsp;<a href='../benefits/hx115.html'>gain a competitive edge</a></li>")
	document.write("<li>&#183;&nbsp;<a href='../benefits/hx120.html'>build a team of resourceful individuals</a></li>")
	document.write("<li>&#183;&nbsp;<a href='../benefits/hx125.html'>cut production and HR costs</a></li>")
	document.write("<li>&#183;&nbsp;<a href='../benefits/hx130.html'>elevate diversity as a value</a></li>")
	document.write("<li>&#183;&nbsp;<a href='../benefits/hx135.html'>create a common language</a></li>")
	document.write("<li>&#183;&nbsp;<a href='../benefits/hx140.html'>resolve interpersonal conflicts</a></li><ul>")
 }
function onlyNumbers(x){
    x = trim(x);
    z = "";
    for(i=0;i<x.length;i++) {
        y = x.substring(i,i+1);
        if( !isNaN( y ) ) z = z + y;
    }
    return z;
}
function mid(string, loc, many){
	    var l = string.length
	    if(l<=0 || loc<0|| many<=0) return string;
	    return string.substr(loc,many)
}
function len(obj){
		return obj.length
}
// trims leading & trailing spaces
function trim(str){
    var x="", y="";
    for (var i=0; i<str.length; i++){
    	y=str.substring(i,i+1);
    	if( y!=" " && y!="\n" && y!="\t" ){x = x + y}
	}
    return x
}
function rtrim(str){
	var x=""
	for (var i=str.length-1; i >-1; i--){
		var x = str.charAt(i)
		//alert(i+"="+x)
		if( x!=" " && x!="\n" && x!="\t" ) return str.substr(0,i+1)
	}
	return ""
}
function ltrim(str){
    for (var i = 0; i < str.length; i++){
		var x = str.charAt(i)
		//alert(i+"="+x)
		if( x!=" " && x!="\n" && x!="\t" ) return str.substr(i)
    }
return ""
}
function right(string, many){
    var l = string.length
    if(l<=0 || many<=0) return string;
    return string.substr(l-many)
}
function left(string, many){
    var l = string.length
    if(l<=0 || many<=0) return string;
    return string.substr(0,many)
}
function minimum(a,b){
		if(a<b){return a}else{return b}
}
function maximum(a,b){
		if(a<b){return b}else{return a}
}
/*
 * $Log: ua.js,v $
 * Revision 1.7  2002/05/14 16:52:52  bc6ix
 * use CVS Log for revision history
 *
 *
 */

/* ***** BEGIN LICENSE BLOCK *****
 * Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
 * Full Terms at /evangelism/lib/js/license/mpl-tri-license.txt
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Netscape code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2001
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s): Bob Clary <bclary@netscape.com>
 *
 * ***** END LICENSE BLOCK ***** */

 /* **** Basic Example *****

 alert("Browser Sniffing Example" + "\n"+ "navigator.OS=" + navigator.OS + "\n" + "navigator.version=" + navigator.version + "\n" + "navigator.org=" + navigator.org + "\n" + "navigator.family=" + navigator.family)

 navigator.OS
     "win" for all Windows platforms
     "mac" for all Macintosh platforms
     "nix" for all Unix like platforms
     "" if platform is not one of the above

 navigator.org
     "opera" for Opera based browsers
     "netscape" for Netscape browsers
     "microsoft" for Microsoft browsers
     "compuserve" for Compuserve browsers
     "sun" for HotJava
     "" if organization is not one of the above

 navigator.version
     If the browser organization is one of the above, then the version will be reported in navigator.version as a floating point number. Otherwise, the version will be 0. Note that Gecko based browser will report the Release Version from the UserAgent string and not actual version reported by the vendor.

 navigator.family
 navigator.family contains a string that groups browsers into families that can be reasonably treated in a similar fashion. Different versions of a browser within a family can be distinguished by the navigator.version property. Current families that are detected are:
     "hotjava" HotJava browsers from Sun
     "opera" Opera Browsers
     "ie3" Internet Explorer versions before 4
     "ie4" Internet Explorer versions 4 and later
     "gecko" browsers based upon the Mozilla Open Source browser such as Netscape 6
     "nn3" Netscape Navigator 3.x browsers
     "nn4" Netscape Navigator 4.x browsers
     "aol" AOL browsers
******* */
function xbDetectBrowser()
{
  var oldOnError = window.onerror;
  var element = null;

  window.onerror = null;

  // work around bug in xpcdom Mozilla 0.9.1
  window.saveNavigator = window.navigator;

  navigator.OS    = '';
  navigator.version  = parseFloat(navigator.appVersion);
  navigator.org    = '';
  navigator.family  = '';

  var platform;
  if (typeof(window.navigator.platform) != 'undefined')
  {
    platform = window.navigator.platform.toLowerCase();
    if (platform.indexOf('win') != -1)
      navigator.OS = 'win';
    else if (platform.indexOf('mac') != -1)
      navigator.OS = 'mac';
    else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
      navigator.OS = 'nix';
  }

  var i = 0;
  var ua = window.navigator.userAgent.toLowerCase();

  if (ua.indexOf('opera') != -1)
  {
    i = ua.indexOf('opera');
    navigator.family  = 'opera';
    navigator.org    = 'opera';
    navigator.version  = parseFloat('0' + ua.substr(i+6), 10);
  }
  else if ((i = ua.indexOf('msie')) != -1)
  {
    navigator.org    = 'microsoft';
    navigator.version  = parseFloat('0' + ua.substr(i+5), 10);

    if (navigator.version < 4)
      navigator.family = 'ie3';
    else
      navigator.family = 'ie4'
  }
  else if (ua.indexOf('gecko') != -1)
  {
    navigator.family = 'gecko';
    var rvStart = navigator.userAgent.indexOf('rv:') + 3;
    var rvEnd = navigator.userAgent.indexOf(')', rvStart);
    var rv = navigator.userAgent.substring(rvStart, rvEnd);
    var decIndex = rv.indexOf('.');
    if (decIndex != -1)
    {
      rv = rv.replace(/\./g, '')
      rv = rv.substring(0, decIndex) + '.' + rv.substr(decIndex)
    }
    navigator.version = parseFloat(rv);

    if (ua.indexOf('netscape') != -1)
      navigator.org = 'netscape';
    else if (ua.indexOf('compuserve') != -1)
      navigator.org = 'compuserve';
    else
      navigator.org = 'mozilla';
  }
  else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
  {
    var is_major = parseFloat(navigator.appVersion);

    if (is_major < 4)
      navigator.version = is_major;
    else
    {
      i = ua.lastIndexOf('/')
      navigator.version = parseFloat('0' + ua.substr(i+1), 10);
    }
    navigator.org = 'netscape';
    navigator.family = 'nn' + parseInt(navigator.appVersion);
  }
  else if ((i = ua.indexOf('aol')) != -1 )
  {
    // aol
    navigator.family  = 'aol';
    navigator.org    = 'aol';
    navigator.version  = parseFloat('0' + ua.substr(i+4), 10);
  }
  else if ((i = ua.indexOf('hotjava')) != -1 )
  {
    // hotjava
    navigator.family  = 'hotjava';
    navigator.org    = 'sun';
    navigator.version  = parseFloat(navigator.appVersion);
  }

  window.onerror = oldOnError;
}
