/*!
	Site:		
	File:		/assets/scripts/global.js
	Author:		
	Version:	isoD
	Plugin:		Simplest jQuery Slideshow Plugin - http://github.com/mathiasbynens/Simplest-jQuery-Slideshow
----------------------------------------------- */




/*	Global Configuration
----------------------------------------------- */
var $j = jQuery;
var isIE = false;
var isIE6 = false;
var isSafari = false;

/*	Plugins
----------------------------------------------- */

/*	Global Literal Object: Site-wide functions
----------------------------------------------- */
var SGlobal = {

	/* Configuration, Flags and Messages */

	/* jQuery Object References  */
	jEOBody: null,
	jEOPrintPage: null,
	jEOPrintPageLoc: null,
	jEONavPrimary: null,

	/* Utility: Browser Tests / Specific Fixes/Hooks */
	utilBrowserTests : function() {

		if ($j.browser.msie) { isIE = true; }

		/* Detect if User Agent is IE6 using object detection, apply fix for background flicker bug */
		if (typeof document.body.style.maxHeight == 'undefined') { isIE6 = true; try { document.execCommand('BackgroundImageCache', false, true); } catch(e) { } }

		/* Detect if User Agent is Safari, add class '.safari' to div#Container */
		if ($j.browser.safari) { isSafari = true; $j('div#Wrapper').addClass('safari'); }

	},

	/* Utility: Print Page */
	utilPrintPage : function() {

		var cc = this;

		cc.jEOPrintPage = $j('<li><a href="#PrintPage" title="Print this page">Print Page</a></li>');
		cc.jEOPrintPageLoc = $j('#Footer ul li.first');

		/* Insert cc.jEOPrintPage to cc.jEOPrintPageLoc */
		cc.jEOPrintPageLoc.before(cc.jEOPrintPage);
		$j('a', cc.jEOPrintPage).click(function() {
			window.print();
			return false;
		});

	},

	/* NavPrimary Events: Workaround for li:hover IE */
	eventsNavPrimary : function() {

		var cc = this

		$j('li', cc.jEONavPrimary).hover(function() {
			$j(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});

	},

	init : function() {

		var cc = this;

		/* ADD class to body so we can apply CSS only for when jQuery is available, different to hasJS */
		cc.jEOBody = $j('body');
		cc.jEOBody.addClass('hasjQ')

		cc.jEONavPrimary = $j('#NavPrimary');

		cc.utilBrowserTests()
		
		if (cc.jEONavPrimary.length) {
			cc.eventsNavPrimary();
		}

		/* If print support is available, initialise utilPrintPage */
		if (window.print) { cc.utilPrintPage(); }

	}

};


/*	DOM Ready events
----------------------------------------------- */
$j(function () {

    SGlobal.init();

    
});

$j(document).ready(function () {
    $j(function () {
        $j(".tweet").tweet({
            join_text: "AssocPoliceAuth APA:",
            username: "AssocPoliceAuth",
            count: 3,
            loading_text: "loading tweets...",
            template: "{join}{text}{time}"
        });
    });
});
