// ----- Show News Items (Fading) -----
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function showNews(newsid) {
	for (i=1;i<=5;i++) {
		var lnwindow = document.getElementById('featurednews'+i)
		lnwindow.className='featurednews';
		document.getElementById('lnlistitem'+i).className='newstitle';
		if (isIE) { 
			lnwindow.style.filter = 'alpha(opacity=0)';
		} else {
			lnwindow.style.opacity= '0';
		}
	}
	var lnwindowon = document.getElementById('featurednews'+newsid)
	lnwindowon.className='featurednewson';
	document.getElementById('lnlistitem'+newsid).className='newstitleon';
	Spry.Effect.DoFade(lnwindowon, { from: 0, to: 100 })
}

function showText(txtid) {
	for (i=1;i<=5;i++) {
		var lnwindow = document.getElementById('cstxt'+i)
		lnwindow.className='cstext';
		if (isIE) { 
			lnwindow.style.filter = 'alpha(opacity=0)';
		} else {
			lnwindow.style.opacity= '0';
		}
	}
	var lnwindowon = document.getElementById('cstxt'+txtid)
	lnwindowon.className='cstexton';
	Spry.Effect.DoFade(lnwindowon, { from: 0, to: 100 })
}

// ----- Listener & Functions to defeat Autofill -----
if(window.attachEvent) window.attachEvent("onload",setListeners);

function setListeners(){
	inputList = document.getElementsByTagName("INPUT");
	for(i=0;i<inputList.length;i++){
	  inputList[i].attachEvent("onpropertychange",restoreStyles);
	  inputList[i].style.backgroundColor = "";
	}
	selectList = document.getElementsByTagName("SELECT");
	for(i=0;i<selectList.length;i++){
	  selectList[i].attachEvent("onpropertychange",restoreStyles);
	  selectList[i].style.backgroundColor = "";
	}
}

function restoreStyles(){
	if(event.srcElement.style.backgroundColor != "") event.srcElement.style.backgroundColor = "";
}
  
  
// ----- Debug function -----
function showProps(obj,objName) {
    var result = ""
    for (var i in obj) {
        result += objName + "." + i + " = " + obj[i] + "; " 
    }
    alert(result);
}
  