jQuery.noConflict();
var $j = jQuery;
var isIE6 = false; var isIE7 = false; var isSafari = false;
$j(document).ready(function() {
	/* Checks for IE6/IE7 apply background flicker bug fix */
	if( ($j.browser.msie) && (parseInt($j.browser.version) == "6" )) { isIE6 = true; try { document.execCommand('BackgroundImageCache', false, true); } catch(e) { } }
	if( ($j.browser.msie) && (parseInt($j.browser.version) == "7" )) { isIE7 = true; }
	/* Checks for Safari */
	if($j.browser.safari) { isSafari = true; }
	if (typeof initPage == "function"){
		initPage();
	}
	var wobbler = new wobblerObject('#ApplyNowAnimate');
	wobbler.play();
	roundedNavigation();
	newsSignUp();
});
function roundedNavigation() { 
	var $first = $j('#NavigationPrimary ul li.first');
	var $last = $j('#NavigationPrimary ul li.last');
	$first.append('<span class=\"lc\"></span>');
	$last.append('<span class=\"rc\"></span>');
	if($first.hasClass('active')) { $j('span.lc').css('background-position',' 0 -30px'); };
	if($last.hasClass('active')) { $j('span.rc').css('background-position',' 0 -90px'); };
}
function newsSignUp() {
	var $signUpField = $j('#GetTheNews .frow-text input');
	$signUpField.focus(function() {
		$j(this).parents().filter('.frow').removeClass('frow-error');
		$j(this).parent().removeClass('field-error');
		$j(this).parent().addClass('field-focus');
		$j(this).blur(function()	{ $j(this).parent().removeClass('field-focus');  });
	});	
}
function wobblerObject(e){
	//Object properties
	this.id = e;
	this.interval = 9000;
	this.setInterval = function(s) { this.interval = (s * 1000); }
	this.live = false;
	this.play = function() {
		window.setTimeout(function() { wobble(); }, 1000);
		this.player = window.setInterval(function() { wobble(); }, this.interval);
	}
	this.stop = function() { clearInterval(this.player); }
	//Private variables
	var $element = $j(this.id);
	//Private functions
	function wobble() {
		$element.animate({left: '15px'},80)
		.animate({left: '-15px'},80)
		.animate({left: '10px'},80)
		.animate({left: '-10px'},80)
		.animate({left: '5px'},80)
		.animate({left: '-5px'},80)
		.animate({left: '2px'},80)
		.animate({left: '-2px'},80)
		.animate({left: '0px'},80)
		;
	}
}

