<!--

/*	Used to open links in a new window
	Instead of setting the anchor tag attribute target="_blank", set the anchor tag attribute rel="external"
	The attribute "target" fails validation in XHTML1.0 Strict
	This script loops through all anchor tags, finds the ones specified, and sets their target="_blank"
	on the client side, so the page still validates.
	Script should run at window.onload
*/

function externalLinks() {
	if (!document.getElementsByTagName) {
		return;
	}
	var anchors = document.getElementsByTagName("a");
	
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
		 	anchor.target = "_blank";
		}
	}
}


// use a popup instead of a full size window for the ctt button form
function cttPopup() {
	// get existing link
	var url = document.getElementById("CTTButtonWrapper").firstChild.href;
	//var url = this.href;
	
	//alert(url);
	// open in popup window
	// this is the onclick event function
	window.open(url,'','WIDTH=550,height=440,resizable=yes,scrollbars=yes,menubar=1,toolbar=no');
	return false;
	
}


//var clear="/resources/images/spt/spacer.gif" //path to clear.gif

/*
pngfix = function() {
	var els=document.getElementsByTagName('*');
	var ip=/\.png/i;
	var i=els.length;
	
	while(i-- >0){
		var el=els[i];
		var es=el.style;
		if(el.src&&el.src.match(ip)&&!es.filter){
			es.height=el.height;
			es.width=el.width;
			es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";
			el.src=clear;
		}
		else{
			var elb=el.currentStyle.backgroundImage;
			if(elb.match(ip)){
				var path=elb.split('"');
				var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';
				es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";
				es.height=el.clientHeight+'px';
				es.backgroundImage='none';
				var elkids=el.getElementsByTagName('*');
				if (elkids){
					var j=elkids.length;
					if(el.currentStyle.position!="absolute")es.position='static';
					while (j-- >0)
						if(!elkids[j].style.position)elkids[j].style.position="relative";
				}
			}
		}
	}
}
*/
/*
function pngfix() {
	if (document.getElementById('CTTButtonWrapper')) {
		ctt_btn = document.getElementById('CTTButtonWrapper').getElementsByTagName('img')[0];
		ctt_btn.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + ctt_btn.src + "', sizingMethod='scale')";
		ctt_btn.style.width = ctt_btn.style.width;
		ctt_btn.style.height = ctt_btn.style.height;
		//alert(ctt_btn.style.width);
		//ctt_btn.style.height = '40px';
		ctt_btn.src = clear;
	}
}

//window.attachEvent('onload',pngfix);
*/






// global var used to store the page height
//var PageHeight;

// all onload functions go here
window.onload = function() {
	// set value of page height
	//PageHeight = $('PageWrapper').getHeight();
	
	externalLinks();
	
	//pngfix();
	
	// attach event handler to ctt button (if it exists)
	var cttBtnWrapper = document.getElementById("CTTButtonWrapper");
	if (cttBtnWrapper) {
		var cttBtn = cttBtnWrapper.firstChild;
		cttBtn.onclick = function() { cttPopup(); return false;};
	}
	
	// turn on mask and set its height to match page height
	//$('PageMask').setStyle({
	//	height:	PageHeight+'px',
	//	display: ''
	//});
	
}
// -->






