// ===========================================================================
//
//	Filename:  cnjjbbf.js
//
//	Description: CNJJBBF site - JavaScript methods and members
//
//	Version : 1.0	Date : 21/03/05
//	Version : 2.0	Date : 03/08/05 - Added mm rollover functions
//	Version : 3.0	Date : 29/10/05 - Removed mm rollover and other unecessary functions; added adjustFonts()
//	Version : 4.0	Date : 01/11/05 - Fixed bug for rollover in Opera; removed more unecessary functions
//
// ===========================================================================
//
//	Useful constants
//
var	minWidth = 980 ;
var	eleven100width = 1100 ;
var	twelve100width = 1200 ;

function rollOvr(dis)	{
	var brdrCol0 = "" ;
	var bgCol0 = "" ;
	var brdrCol1 = "" ;
	var bgCol1 = "" ;
	if ( (is_ie) || (is_opera) )	{
//		brdrCol1 = "#ff6666" ;
		bgCol1 = "#efefef" ;
//		brdrCol1 = "#ff6666" ;
		bgCol0 = "#ffdddd" ;
	}	else	{
//		brdrCol1 = "rgb(255, 102, 102)" ;
		bgCol1 = "rgb(239, 239, 239)" ;
//		brdrCol0 = "rgb(255, 102, 102)" ;
		bgCol0 = "rgb(255, 221, 221)" ;
	}
	if (dis.style.backgroundColor == bgCol0)	{
		dis.style.backgroundColor = bgCol1 ;
//		dis.style.borderColor = brdrCol1;
	}	else 	{	
		dis.style.backgroundColor = bgCol0 ;
//		dis.style.borderColor = brdrCol0;
	}
}
function adjustNavImg(pathPrefix) {
	var wd = (screen.availWidth < minWidth) ? '160' : '146' ;
	var ht = (screen.availWidth < minWidth) ? '40' : '60' ;
	var src = (screen.availWidth < minWidth) ? 'redninja_ca_sm.jpg' : 'redninja_ca.jpg' ;
	var pPre = (arguments.length >= 1)	? pathPrefix + 'images/crests/' : 'images/crests/' ;
		
	document.write("<img src='./" + pPre + src + "' width='" + wd + "' height='" + ht + "' border='0' alt=''>");
}
function adjustAfont(sSheet, ruleno) {
	var aryFontSizes = new Array( "9pt", "10pt", "11pt" ) ;
	if (screen.availWidth > minWidth)	{
		if (screen.availWidth < eleven100width)	{
 			if (is_ie) sSheet.rules[ruleno].style.fontSize = aryFontSizes[0] ;
 			else if (is_moz || is_fx || is_nav6up || is_chrome)  sSheet.cssRules[ruleno].style.fontSize = aryFontSizes[0];
		}	else if (screen.availWidth < twelve100width)	{
 			if (is_ie) sSheet.rules[ruleno].style.fontSize = aryFontSizes[1];
 			else if (is_moz || is_fx || is_nav6up || is_chrome)  sSheet.cssRules[ruleno].style.fontSize = aryFontSizes[1];
		}	else	{
 			if (is_ie) sSheet.rules[ruleno].style.fontSize = aryFontSizes[2];
 			else if (is_moz || is_fx || is_nav6up || is_chrome)  sSheet.cssRules[ruleno].style.fontSize = aryFontSizes[2];
		}
	}
}
function adjustFonts() {
	 if (screen.availWidth < minWidth)	{
		if (is_ie)	{
			document.styleSheets[0].rules[1].style.fontSize  = '9pt' ;
			document.styleSheets[0].rules[2].style.fontSize  = '9pt' ;
			document.styleSheets[0].rules[3].style.fontSize  = '9pt' ;
			document.styleSheets[0].rules[4].style.fontSize  = '9pt' ;
			document.styleSheets[0].rules[5].style.fontSize  ='14pt' ;
			document.styleSheets[0].rules[6].style.fontSize  ='12pt' ;
			document.styleSheets[0].rules[7].style.fontSize  = '9pt' ;
			document.styleSheets[0].rules[8].style.fontSize  ='10pt' ;
			document.styleSheets[0].rules[9].style.fontSize  = '9pt' ;
			document.styleSheets[0].rules[10].style.fontSize = '9pt' ;
		}	else if (is_moz || is_fx || is_nav6up || is_chrome)	{
			document.styleSheets[0].cssRules[1].style.fontSize  = '9pt' ;
			document.styleSheets[0].cssRules[2].style.fontSize  = '9pt' ;
			document.styleSheets[0].cssRules[3].style.fontSize  = '9pt' ;
			document.styleSheets[0].cssRules[4].style.fontSize  = '9pt' ;
			document.styleSheets[0].cssRules[5].style.fontSize  ='14pt' ;
			document.styleSheets[0].cssRules[6].style.fontSize  ='12pt' ;
			document.styleSheets[0].cssRules[7].style.fontSize  = '9pt' ;
			document.styleSheets[0].cssRules[8].style.fontSize  ='10pt' ;
			document.styleSheets[0].cssRules[9].style.fontSize  = '9pt' ;
			document.styleSheets[0].cssRules[10].style.fontSize = '9pt' ;
		}  
	 }
}
function adjustImgSize(measurement, ratio) {
	return new String(parseInt(parseInt(measurement) * ratio + 0.5))
}

	$(function() {

		$('img').attr('title', function() { 
			return  this.alt; 
		});
		$('hr').attr('background-color', function() { 
			return  this.color; 
		});
		
		$('table').attr('border', '0');
		
		$("a").focus(function(){
		  $(this).blur();
		});

	});



