startList = function() {
	if (document.all && document.getElementById) {
		if (document.getElementById("navEsp")) {
			navRoot = document.getElementById("navEsp");
		} else {
			navRoot = document.getElementById("nav");
		}
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
$(document).ready(function(){
	startList();
	$('#play-kernel-game').click( function(event) {
		GA_Click('Games', 'Link ', 'PlayTheGame');
		event.preventDefault();
		var width = screen.width;
		var height = screen.height;
		var left = ((width - 800) / 2);
		var top = ((height - 650) / 2);
		var var_href = $(this).attr('href');
		window.open('/about-us/' + var_href,'KernelKatch','top='+ top + ',left=' + left + ',width=800,height=600');
		return false;
	});
	$('.png').ifixpng();
	$('#tabs').tabs();
	$('#mycarousel').jcarousel({
        scroll: 1
    });
	$(".play-thesis").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/Thesis_widescreen.flv",
			img: "/images/about-us/our-ads/img-thesis-big.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-science-fair").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/ScienceFair_widescreen.flv",
			img: "/images/about-us/our-ads/img-science-fair-big.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-rv").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/rv_320x180.flv",
			img: "/images/about-us/our-ads/rv_preview.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-stain").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/stain_320x180.flv",
			img: "/images/about-us/our-ads/stain_preview.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-tea-party").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/tea_party_320x180.flv",
			img: "/images/about-us/our-ads/tea_party_preview.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-broken-leg").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/broken_leg_320x180.flv",
			img: "/images/about-us/our-ads/broken_leg_preview.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-difference").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/76_Difference.flv",
			img: "/images/about-us/our-ads/difference.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-popper").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/76_Popper.flv",
			img: "/images/about-us/our-ads/popper.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-ticket").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/78_Ticket.flv",
			img: "/images/about-us/our-ads/ticket.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-cooking-school").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/81_Cooking_School.flv",
			img: "/images/about-us/our-ads/cooking-school.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-40-years").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/83_40_years.flv",
			img: "/images/about-us/our-ads/83-40yrs.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	/*
	$(".play-40-years").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/83_40_Years.flv",
			img: "/images/about-us/our-ads/default_preview.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	*/
	$(".play-real-close").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/87_Real_Close.flv",
			img: "/images/about-us/our-ads/real-close.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-big-news").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/89_Big_News_Light.flv",
			img: "/images/about-us/our-ads/big-news.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-gary-demo").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/91_Gary_Demo.flv",
			img: "/images/about-us/our-ads/gary-demo.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
	$(".play-natural-snacks").click(function(event) {
		event.preventDefault();
		var adsVars = {
			flv: "/flash/videos/04_Natural_Snacks.flv",
			img: "/images/about-us/our-ads/natural-snacks.jpg"
		};
		swfobject.embedSWF("/flash/video-player.swf", "player", "320", "212", "9.0.115", "/flash/expressinstall.swf", adsVars, adsParams);
		return false;
	});
});
function trackInteractionsClickThru(id, url, target) {
	dcsMultiTrack('WT.ti', id);

	if (url.indexOf("http://") >= 0) {
		setTimeout("openWindow('" + url + "')", 300);
	} else {
		setTimeout("changeLocation('" + url + "')", 300);
	}
}

function changeLocation(url) {
	document.location = url;
}

function openWindow(url) {
	window.open(url);
}

//function trackInteractions(id, url, opt_id) { //category, action, label, url :id, url, opt_id
//	if(id != "homepage") {
//		location.href = url;
//	}
//}
//function trackInteractionsPopup(id, url, name, specs, opt_id) {
//	trackInteractions(id);
//}
//function trackInteractionsClickThru(id, url, target, opt_id) {
//	trackInteractions(id, url);
//}


/*function trackInteractions(category, action, label, url) {
       clickTracking(category, action, label);
       if (url != null)
              setTimeout("window.location.href='" + url + "'", 500);
}*/
			
function GA_ClickThru(url, category, action, label){
       _gaq.push(['_trackEvent', category, action, label]);
       setTimeout("window.location.href='" + url + "'",250);
       return false; 
}

function GA_ClickThru_Target(url, category, action, label){
       _gaq.push(['_trackEvent', category, action, label]);
       window.open(url);
       return false; 
}

function GA_Click(category, action, label){
       _gaq.push(['_trackEvent', category, action, label]);
       return true; 
}


