if (document.images) {
	 img1 = new Image();
	 img2 = new Image();
	 img3 = new Image();
	 img4 = new Image();
	 img5 = new Image();
	 img6 = new Image();
	 
	 img1.src = "s/i/whatrescueit_on.jpg";
	 img2.src = "s/i/whoisrescueit_on.jpg";
	 img3.src = "s/i/whyrescueit_on.jpg";
	 img4.src = "s/i/rescueitremoteaccess_on.jpg";
	 img5.src = "s/i/rescueittuneup_on.jpg";
	 img6.src = "s/i/rescueitvalue_on.jpg";
}

var videos = new Array();
// videos[key]
videos[1] = { title: "What is CenturyLink&trade; RescueIT?", page: "whatisrescueit.html", time: "01:31" }; // whatisrit.flv
videos[2] = { title: "What makes CenturyLink&trade; RescueIT technicians tick?", page: "whoisrescueit.html", time: "01:34" };  // whatmakestechnicianstick.flv
videos[3] = { title: "Is CenturyLink&trade; RescueIT right for you?", page: "whyrescueit.html", time: "00:55" }; // isritrightforyou.flv
videos[4] = { title: "What is remote access from CenturyLink&trade; RescueIT?", page: "remoteaccess.html", time: "01:35" }; // whatisremoteaccess.flv
videos[5] = { title: "What is a PC Tune-up from CenturyLink&trade; RescueIT?", page: "tuneups.html", time: "01:14" }; // whatisapctuneup.flv
videos[6] = { title: "How can CenturyLink&trade; RescueIT save you money?", page: "value.html", time: "01:03" }; // howcanitsaveyoumoney.flv
videos[24] = { title: "What sets CenturyLink&trade; RescueIT apart?", page: "whatsetsitapart.html", time: "01:29" }; // whatsetsitapart.flv

// Returns the requested GET parameter from the URL
function url(param) {
	var regex = '[?&]' + param + '=([^&#]*)';
	var results = (new RegExp(regex)).exec(window.location.href);
	if(results) return results[1];
	return '';
}

// Functions to support the FLV Media Player (http://www.jeroenwijering.com/?item=Javascript_interaction)
function sendEvent(swf,typ,prm) { 
  thisMovie(swf).sendEvent(typ,prm); 
};
function getUpdate(typ,pr1,pr2,swf) {};
function thisMovie(swf) {
  if(navigator.appName.indexOf("Microsoft") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
};
function loadFile(swf,obj) { 
	thisMovie(swf).loadFile(obj); 
};
function writeList () {
	$("#track-list").empty();
	$.ajax({
		type: "GET",
		url: 'http://kountar.levelfivesolutions.com/counters/values/1,2,3,4,5,6,24',
		dataType: "script",
		success: function(){
			$.each( counterValues, function(i, obj) {
				$("<li id='key" + obj.key + "'></li>").click( function () {
					// loadFile('player', {file: videos[obj.key].file}); 
					
					var sUrl = "http://kountar.levelfivesolutions.com/counters/increment/" + obj.key;
					$.ajax({
						type: "GET",
						url: sUrl,
						dataType: "script",
						success: function(){
							window.location = videos[obj.key].page;
					 }
					});

					
					return false;
				}).appendTo("#track-list").html("<h4>" + videos[obj.key].title + "</h4>" + videos[obj.key].time + "<br />Views:  " + obj.count);
			});
		}
	});
};
$(document).ready(function(){ 
	writeList();
});
