function addLoadEvent(func) {var oldonload = window.onload;if (typeof window.onload != 'function') {window.onload = func;} else {window.onload = function() {if (oldonload) { oldonload();  }func();}}}
function cbPopFlash(aEl, movieID){stopFlash(movieID);var url = aEl.href;$.fn.colorbox({href:url,width:'80%', height:'80%',onCleanup:function(){ stopFlash('flashMovie'); }    });return (false);}
function cbPopURL(aEl){var url = aEl.href;$.fn.colorbox({href:url,width:'80%', height:'80%' });return (false);}
function getInternetExplorerVersion() {    var rv = -1;  if (navigator.appName == 'Microsoft Internet Explorer') {  var ua = navigator.userAgent;        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");        if (re.exec(ua) != null)            rv = parseFloat(RegExp.$1);    }    return rv;}
function stopFlash(movieName){	if (navigator.userAgent.indexOf('Safari') != -1) return; var movie = false;	if (window.document[movieName]) movie = window.document[movieName];	else if (navigator.appName.indexOf("Microsoft Internet")==-1){		if (document.embeds && document.embeds[movieName])	movie = document.embeds[movieName]; 	}	else if (navigator.appName.indexOf("Microsoft Internet")!=-1){		movie =  document.getElementById(movieName);	} 	if (movie && movie.IsPlaying() ) movie.StopPlay();	return;}
function loaded(){ 	if (getQSParam('pf')==1) self.setTimeout('pagePrint()', 500);}
function getQSParam(name){var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("=");if (pair[0] == name) {return pair[1];}}}
function openMailer(address){	window.location="mailto:" + address; }
function pagePrint(){if ( window.print ){if (window.event) window.event.cancelBubble = true;window.focus();window.print( );}else alert("Sorry! Your browser doesn't support this function.");}

function openPrintWindow(url, openDlg ){var arRes = viewportSize();var scW = arRes.w ;var scH = arRes.h ;winW=Math.round(scW * .8);winH=Math.round(scH * .8);var winL=Math.round(scW-winW)/2;var winT=Math.round(scH-winH)/2;strOptions= 'height=' + winH +  ',width=' + winW + ',left='+winL+',top='+winT;strOptions += "toolbar=no,"; strOptions += "location=no,"; strOptions += "directories=no,";strOptions += "status=no,"; strOptions += "menubar=yes,"; strOptions += "scrollbars=yes,"; strOptions += "resizable=no";winName='Print';if (!window.winPrint){try{ winPrint = window.open(url,winName,strOptions);}catch(e){return(false);};} else {if (winPrint.closed){try{ winPrint.close(); winPrint = window.open(url,winName,strOptions);}catch(e){return(false);};} else {try{ winPrint = window.open(url,winName,strOptions);}catch(e){window.alert("Popup window blocked " + e.number); }}}if (winPrint && openDlg ){if ( winPrint.print ){if (winPrint.event) winPrint.event.cancelBubble = true;winPrint.focus();winPrint.print( );}}return(winPrint);}
function newWin(elOrUrl){
    if ( typeof elOrUrl=== 'object') var url = elOrUrl.href;
    else var url = elOrUrl ;
    return(openWindow(url));
}
function printWin(aEl){  	var url = aEl.href; openPrintWindow(url);return(false); ;}
function popWin(aEl){var url = aEl.href;var arRes = viewportSize();var scW = arRes.w ;var scH = arRes.h ;var winW= scW *.9;var winH= scH *.85;var winL=Math.round(scW-winW)/2;var winT=Math.round(scH-winH)/2;var strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=yes,scrollbars=yes,resizable=no,left='+winL+',top='+winT;var winName='winDoc';return (openWindow(url,winName,strOptions));}
function openPano(url ){var arRes = viewportSize();var scW = arRes.w ;var scH = arRes.h ;var winW=800;var winH=640;var winL=Math.round(scW-winW)/2;var winT=Math.round(scH-winH)/2;var strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=no,scrollbars=yes,resizable=no,left='+winL+',top='+winT;var winName='panoViewer';return (openWindow(url,winName,strOptions));}
function openDoc(url ){var arRes = viewportSize();var scW = arRes.w ;var scH = arRes.h ;var winW= scW *.9;var winH= scH *.9;var winL=Math.round(scW-winW)/2;var winT=Math.round(scH-winH)/2;var strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=yes,scrollbars=yes,resizable=no,left='+winL+',top='+winT;var winName='winDoc';return (openWindow(url,winName,strOptions));}
function openPopup(url, winName,winW, winH){var scW = screen.availWidth ? screen.availWidth : screen.width;var scH = screen.availHeight ? screen.availHeight : screen.height;if (! winW ) var winW=800; if (! winH ) var winH=640; var winL=Math.round(scW-winW)/2;var winT=Math.round(scH-winH)/2;strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=yes,scrollbars=yes,resizable=no,left='+winL+',top='+winT;if (!winName) winName='winInfo';return (openWindow(url,winName,strOptions));}
function openDownload(url ){var arRes = viewportSize();var scW = arRes.w ;var scH = arRes.h ;var winW=640;var winH=480;var winL=Math.round(scW-winW)/2;var winT=Math.round(scH-winH)/2;strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=no,scrollbars=yes,resizable=no,left='+winL+',top='+winT;winName='winDownload';return (openWindow(url,winName,strOptions));}
function openFlash(url, winW, winH){var arRes = viewportSize();var scW = arRes.w ;var scH = arRes.h ;if (! winW) winW=650;if (! winH) winH=480;var winL=Math.round(scW-winW)/2;var winT=Math.round(scH-winH)/2;var strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=no,scrollbars=no,resizable=0,left='+winL+',top='+winT;return(openWindow(url,'flash',strOptions, winW, winH) );}
function openWindow(url, winName, strOptions, winW, winH){
var winName='winPop';
var arRes = viewportSize();
var scW = arRes.w ;
var scH = arRes.h ;
if (! winW ) winW=Math.round(scW * .9);
if (! winH) winH=Math.round(scH * .9);
var winL=Math.round(scW-winW)/2;
var winT=Math.round(scH-winH)/2;
if (! strOptions) strOptions= 'height=' + winH +  ',width=' + winW + ',location=yes,toolbar=yes,directories=yes,status=yes,' + 'menubar=yes,scrollbars=yes,resizable=yes,left='+winL+',top='+winT;
if (!window.winName){

try{ winName =  window.open(url,winName,strOptions);}
catch(e){return(false);};//window.alert("Popup window blocked " + e.number);}
} else {
if (!winName.closed){
try{ winName.close(); winName = window.open(url,winName,strOptions);}
catch(e){return(false);};//window.alert("Popup window blocked " + e.number);}
} else {
try{ winName = window.open(url,winName,strOptions);}
catch(e){return(false);};//window.alert("Popup window blocked " + e.number); }
}
}
if (winName ) winName.focus();
return (false);
}
function viewportSize(){
var viewportwidth;
var viewportheight;
    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
    if (typeof window.innerWidth != 'undefined'){
        viewportwidth = window.innerWidth;
        viewportheight = window.innerHeight
    }
    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
    else if (typeof document.documentElement != 'undefined'
        && typeof document.documentElement.clientWidth !=
        'undefined' && document.documentElement.clientWidth != 0){
        viewportwidth = document.documentElement.clientWidth;
        viewportheight = document.documentElement.clientHeight;
    }
    // older versions of IE
    else {
        viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
        viewportheight = document.getElementsByTagName('body')[0].clientHeight;
    }
return {w : viewportwidth, h : viewportheight};}
function setFormFocus(){var frm = document.forms[0];var done = false; if (document.forms.length == 0) return; for (f = 0; f < frm.elements.length; f++){if (! done){if (frm.elements[f].type){if ( frm.elements[f].type.substr(0,5) != "selec" && frm.elements[f].type != "hidden" && frm.elements[f].type != "reset" && frm.elements[f].type != "submit" && ! frm.elements[f].disabled && ! frm.elements[f].readOnly){ frm.elements[f].focus();done = true;}}}}}
function openPlayer(filedesc,filepath, vWidth, vHeight ) {
var winID = 'winMedia'
var newWinOffset = 0 // Position of first pop-up
	// From: http://digitalmedia.oreilly.com/2005/02/23/mp3_embed.html
	winWidth=vWidth+20; winHeight=vHeight+120;
var arRes = viewportSize();
var scW = arRes.w ;
var scH = arRes.h ;
	var winL=Math.round(scW-winWidth)/2;
	var winT=Math.round(scH-winHeight)/2;
	PlayWin = window.open('',winID,'width='+winWidth+',height='+winHeight+',top=' + winT +',left=' + winL + ',resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.focus();

    var winContent = "<HTML>\n<HEAD>\n<TITLE>\n" + filedesc + "</TITLE>\n</HEAD>\n<BODY bgcolor='#FF9900'>\n";
    winContent += "<B style='font-size:14px;font-family:Verdana,sans-serif;line-height:1.5'>" + filedesc + "</B>\n";
	// For IE
    winContent += "<OBJECT width='"+vWidth+"' height='"+vHeight+"'>\n";
    winContent += "<param name='SRC' value='" + filepath + "'>\n";
    winContent += "<param name='AUTOPLAY' VALUE='true'>\n";
    winContent += "<param name='CONTROLLER' VALUE='true'>\n";
    winContent += "<param name='BGCOLOR' VALUE='#FF9900'>\n";
    // For NS & Moz
    if (is_ie ) vHeight += 15; // or we loose teh controller?
    else  vHeight += 60; // or we loose teh controller?
    winContent += "<EMBED SRC='" + filepath + "' AUTOPLAY='TRUE' TARGET='MYSELF' LOOP='FALSE' WIDTH='"+vWidth+"' HEIGHT='"+vHeight+"' CONTROLLER='TRUE' BGCOLOR='#FF9900'></EMBED>";
    winContent += "</OBJECT>\n";

    //winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'><a href='" + filepath +"'>Download this file</a> <SPAN style='font-size:10px'>(right-click or Option-click)</SPAN></p\n";
    winContent += "<FORM><DIV align='center'><INPUT type='button' value='Close this window' onclick='javascript:window.close();'></DIV></FORM>\n";
    winContent += "</BODY>\n</HTML>\n";

    PlayWin.document.write(winContent);
    PlayWin.document.close(); // "Finalizes" new window
    //UniqueID = UniqueID + 1 // newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels lower
}

function contextMenuOff(){	if (navigator.appName.indexOf("Microsoft")!=-1) { document.oncontextmenu = function(){return false};if(document.layers) {window.captureEvents(Event.MOUSEDOWN);window.onmousedown = function(e){if(e.target==document)return false;}}}else document.onmousedown = function(){return false}; window.oncontextmenu = function(){return false};}
function createCookie(name, value, days) {	if (days) {		var date = new Date();		date.setTime(date.getTime()+(days*24*60*60*1000));		var expires = "; expires="+date.toGMTString();	}	else var expires = "";	 document.cookie = name+"="+value+expires+"; path=/";}
function readCookie(name){	var ca = document.cookie.split(';');	var nameEQ = name + "=";	for(var i=0; i < ca.length; i++) {		var c = ca[i];		while (c.charAt(0)==' ') c = c.substring(1, c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);	}	return null;}
function flashFix(){theObjects = document.getElementsByTagName("object");for (var i = 0; i < theObjects.length; i++) {	theObjects[i].outerHTML = theObjects[i].outerHTML;	}}7
function elVisible(blockID){var state;     el = xbGetElement(window,blockID);     if (document.layers) state = el.visibility ;     else state = el.style.visibility;	return( (state=='visible')? true: false);}

function Banner_start(){
	if ( (is_win && (is_ie5up || is_gecko || is_opera5up || is_safari )) || is_safari || is_ff) {
		elTest = xbGetElement(window,this.textID)
		if ( this.firstCall == 1 ) this.firstCall = 0;
		else if ( elTest != null  ){
			xbSetInnerHTML(window,this.titleID,this.titles[this.banIndex]);
			xbSetInnerHTML(window,this.textID,this.text[this.banIndex]);
			this.banIndex++;
			if ( this.banIndex >= this.text.length ) this.banIndex = 0;
		}
		// Set callback
		var pThis = this;
		var f = function(){pThis.start();}
	this.timerID = window.setTimeout(f, this.banDuration * 1000);
	}
}
// ==============================
function Banner() {
	this.banIndex = 1;
	this.titleID='bannerTitle';
	this.textID='bannerText';
	this.titles = new Array();
	this.text = new Array();
	this.banCount=0;
	this.banDuration=5;
	this.firstCall=1;
	this.start = Banner_start;
}
// ==============================
function xbGetElement(win,strID){

	if (document.getElementById) return(win.document.getElementById(strID));
	else if (document.all) return( win.document.all[strID]);
}
// ==============================
function xbSetInnerHTML(win,strID,strHTML){
var el = xbGetElement( win, strID )
if ( el && ! win.document.layers ){
	if (win.document.getElementById)  el.innerHTML = strHTML;
	else if (win.document.all)  el.innerHTML  = strHTML;
}
}
// ==============================
function xbElHide(el){
if (document.getElementById || document.all) el.style.visibility = 'hidden';
else if (document.layers)  el.visibility = 'hidden';
}
// ==============================
function xbElShow(el){
if (document.getElementById || document.all) {
	el.style.visibility = 'visible';
	el.style.display = 'block';
}
else if (document.layers)  el.visibility = 'visible';
}
// ==============================
function xbSetElClass(el,strClass){
if (el != null){
	if (document.layers ) ; //unsupported in document.layers.X
	else if (document.getElementById) el.className = strClass;
	else if (document.all ) el.className = strClass;
}
}
var agt=navigator.userAgent.toLowerCase();var is_major = parseInt(navigator.appVersion);var is_minor = parseFloat(navigator.appVersion);var is_gecko = (agt.indexOf('gecko') != -1);var is_moz = (agt.indexOf('mozilla') != -1);var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav6up = (is_nav && (is_major >= 5));var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));var is_ie3    = (is_ie && (is_major < 4));var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);var is_opera = (agt.indexOf("opera") != -1);var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);var is_safari = (agt.indexOf("safari")!=-1);var is_ff = (agt.indexOf("firefox")!=-1);	var is_win = (agt.indexOf("win")!=-1);var is_mac = (agt.indexOf("mac")!=-1);
window.onload=loaded;
/* Fixes IE Hourglass on mous-over */
try { document.execCommand("BackgroundImageCache", false, true);} 
catch(err) {}

