//	Javascript to tag file downloads and external links in Google Analytics
//	To use, place reference to this file should be placed at the bottom of all pages, 
//	just above the Google Analytics tracking code.
//	All outbound links and links to non-html files should now be automatically tracked.
//
//  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//	Created by: 	Colm McBarron, colm.mcbarron@iqcontent.com
//	Last updated: 	12-Feb-2006
//	+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
var moveImg;
var leftPos;


var starterImg;

document.observe('dom:loaded', function () {
	moveImg = $('skyPicture');
	
	var opacMover = .085
	starterImg = function g() {
		var leftPos = -100;
		var opacVar = .1
		var i=0;
		function moveIt(){
		
			leftPos = leftPos + .3;
			opacVar = opacVar + opacMover
// disabling sky background			
// moveImg.style.background = 'url("/img/sky.gif") repeat-x ' + (leftPos + '') + 'px 0';
			moveImg.style.opacity = opacVar / 10;
			moveImg.style.filter = 'alpha(opacity=' + opacVar * 10 + ')';
			i++;
			if (i < 500) {
				if (opacVar > 10) {
					opacMover = -.1
				}
				if (opacVar <= 0 && i != 1 ) {
					opacMover = .1
				}
				setTimeout(moveIt, 70);
			}
		}
		moveIt();
	}
	starterImg();
	moveImg = $('headerEffect');
	var opacVar = 0
	var i=0;
	function opacIt(){
			opacVar = opacVar + .02
			moveImg.style.opacity = opacVar / 10;
			moveImg.style.filter = 'alpha(opacity=' + opacVar * 10 + ')';
			i++;
			if (i < 200) {
				if (opacVar > 10) {
					opacMover = -.1
				}
				setTimeout(moveIt, 100);
			}
		}
		opacIt();
	
	
	
	
	var hrefs = document.getElementsByTagName('a');
	var link_path = "";
	
	for (var l = 0; l < hrefs.length; l++) {
			try {
				var link_path = hrefs[l].pathname;
				
				if (location.host == hrefs[l].hostname) {
					if (link_path.match(/\.(doc|pdf|xls|ppt|zip|txt|vsd|vxd|js|css|rar|exe|wma|mov|avi|wmv|mp3)$/)) {
						addtrackerlistener(hrefs[l]);
					}
				} else {
					addtrackerlistener(hrefs[l]);
				}
			}
			catch(err) { }
	}
	
	
	function addtrackerlistener(obj) {
		if (obj.addEventListener) {
			obj.addEventListener('click', trackfiles, true);
		} else if (obj.attachEvent) {
			obj.attachEvent("on" + 'click', trackfiles);
		}
	}
	
	function trackfiles(array_element) {
		file_path = "";
		if (location.host != this.hostname) {
			file_path = "/exlinks/" + ((array_element.srcElement) ? "/" + array_element.srcElement.hostname : this.hostname);
		}
		file_path = file_path + ((array_element.srcElement) ? "/" + array_element.srcElement.pathname : this.pathname);
		urchinTracker(file_path);
	}
});
/* end tracking code js */
var thistime = new starterImg;
thistime();



//	window.onerror = function(msg, url, linenumber) {
//		alert("Error:" + msg + "\nAt line: " + linenumber + "\nIn file: " + url);
//		return true;
//	};

Playa.onStateChange = function() {
		sTitle = (Playa.playListPosition+1) + "/" + Playa.playlistSize + " ";
		if (Playa.path == "") {
			sTitle += Playa.title;
		} else {
			sTitle += "<"+"a href=\"" + Playa.path + "\" target=\"_blank\" title=\"Click to download\"" + ">" + Playa.title + "<" + "/a" + ">";
		}

		// document.getElementById("songTitle").innerHTML = sTitle;
		document.getElementById("btnPlayStop").innerHTML = Playa.buttonText;
	}

function popup(mylink, windowname)
	{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, windowname, 'width=620,height=425,scrollbars=no');
	return false;
}

function playsong(song) {
var playdiv = document.getElementById(song);
if (playdiv.style.display == 'none') {
	 playdiv.style.display = 'block';
	 } else if (playdiv.style.display == 'block') {
	 playdiv.style.display = 'none';
  	}
}


