// Load jQuery & swfobject
google.load("jquery", "1.4.2");
google.load("swfobject", "2.2");

// set onload
google.setOnLoadCallback(function() {

	// remove no_JS class from body tag
	$('body').removeClass('no_JS');

	(function() {
		var flash_version = "8.0.0",
				eiswfurl = "",
				flashvars = {},
				params = {
					wmode: "transparent"
				},
				attributes = {};
		if (swfobject.hasFlashPlayerVersion(flash_version)){
			// has Flash
			swfobject.embedSWF("/includes/swfs/OPCC2.swf", "hpflash", "639", "330", flash_version, eiswfurl, flashvars, params, attributes);
		}
		else{
			// doesn't have Flash
			$('body').addClass('no_JS');
		}
	})();

	$("#ads div").hover(
		function () {
			$(this).addClass("adshover");
		},
		function () {
			$(this).removeClass("adshover");
		}
	);

	$("#ads div").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});

	$("#info div").hover(
		function () {
			$(this).addClass("infohover");
		},
		function () {
			$(this).removeClass("infohover");
		}
	);

	$("#info div").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});

});

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16419786-1']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
(function() {
	var thisurl = document.location.href;
	if(thisurl.indexOf('opccag.org') > -1){
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	}
})();
