/*!
	Site:		
	File:		/assxets/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,

	/* 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'); }

	},

	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.utilBrowserTests();

	}

};

/*	Module Object
----------------------------------------------- */
var MAccordion = {

	/* jQuery Object References  */
	jEOAccordion: null,

	mBuild : function() {

		var cc = this;

		$j('div.item:first', cc.jEOAccordion).css('display', 'block');

		cc.jEOAccordion.tabs('div.m-b > div.item', { 
			tabs: 'h2',
			effect: 'slide',
			initialIndex: nlInitialIndex
		});

	},

	init : function() {

		var cc = this;

		cc.jEOAccordion = $j('div#jsAccordion');

		/* If cc.jEOAccordion markup is present and UA is IE enable hover */
		if (cc.jEOAccordion.length && isIE) {

		}

		if (cc.jEOAccordion.length) {
			cc.mBuild();
		}

	}

};

/*	DOM Ready events
----------------------------------------------- */
$j(function() {

	SGlobal.init();

	MAccordion.init();

	$(document).ready(function() {
	    $("a[rel=external]").attr('target', '_blank');
	});
});
