﻿/* jQuery gMap 1.0.3 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(t($){$.w.x=t(a){8(!Y.H||!H()){y z}A b=$.Z({},$.w.x.I,a);y z.10(t(){$h=5 11(z);8(!b.k&&!b.l){8(c(b.m)&&b.m.o>=1){b.k=b.m[0].k;b.l=b.m[0].l}B{b.k=u.12;b.l=9.13;b.C=2}}$h.14(5 15(b.k,b.l),b.C);$h.16(b.J);8(b.p.o==0){$h.17()}B{K(A i=0;i<b.p.o;i++){18("$h.19(5 "+b.p[i]+"());")}}8(b.L==D&&b.p.o!=0){$h.1a()}K(A j=0;j<b.m.o;j++){4=b.m[j];7=5 1b();7.q=b.3.q;7.r=b.3.r;7.M=(c(b.3.d))?5 v(b.3.d[0],b.3.d[1]):b.3.d;7.N=(c(b.3.e))?5 v(b.3.e[0],b.3.e[1]):b.3.e;7.O=(c(b.3.f))?5 s(b.3.f[0],b.3.f[1]):b.3.f;7.P=(c(b.3.g))?5 s(b.3.g[0],b.3.g[1]):b.3.g;8(4.3){7.q=4.3.q;7.r=4.3.r;7.M=(c(4.3.d))?5 v(4.3.d[0],4.3.d[1]):4.3.d;7.N=(c(4.3.e))?5 v(4.3.e[0],4.3.e[1]):4.3.e;7.O=(c(4.3.f))?5 s(4.3.f[0],4.3.f[1]):4.3.f;7.P=(c(4.3.g))?5 s(4.3.g[0],4.3.g[1]):4.3.g}n=5 1c(5 s(4.l,4.k),7);8(4.E){n.1d(b.F+4.E+b.G);8(n){$h.Q(n)}8(4.1e==D){n.1f(b.F+4.E+b.G)}}B{8(n){$h.Q(n)}}}})};t c(a){y 1g(a)=="1h"&&(a 1i 1j)}$.w.x.I={k:0,l:0,C:6,m:[],p:[],L:D,J:1k,F:\'<R 1l="1m">\',G:"</R>",3:{q:"S://T.U.V/W/4.X",r:"S://T.U.V/W/1n.X",d:[1o,u],e:[1p,u],f:[9,u],g:[9,2]}}})(1q);',62,89,'|||icon|marker|new||gicon|if||||is_array|iconsize|shadowsize|iconanchor|infowindowanchor|gmap|||latitude|longitude|markers|gmarker|length|controls|image|shadow|GPoint|function|34|GSize|fn|gMap|return|this|var|else|zoom|true|html|html_prepend|html_append|GBrowserIsCompatible|defaults|maptype|for|scrollwheel|iconSize|shadowSize|iconAnchor|infoWindowAnchor|addOverlay|div|http|www|google|com|mapfiles|png|window|extend|each|GMap2|885931|84375|setCenter|GLatLng|setMapType|setUIToDefault|eval|addControl|enableScrollWheelZoom|GIcon|GMarker|bindInfoWindowHtml|popup|openInfoWindowHtml|typeof|object|instanceof|Array|G_NORMAL_MAP|class|gmap_marker|shadow50|20|37|jQuery'.split('|'),0,{}))


$(document).ready(function() {
	$('.titleWidget a').hover(function() {
		$(this).animate({'padding-top': '42px'});
	},
	function() {
		$(this).animate({'padding-top': '72px'});
	});
	
	/* COLORBOX */
	$(".contact-form-link").colorbox({
		inline:true,
		innerWidth:573,
		innerHeight:402,
		title:false,
		scrolling:true
	});
	
	/* ACCORDIONS */
	$('.accordions').each(function(){
		var sections = $(this).find('.accordion');

		if (sections.length === 0) {
			return;
		}

		sections.find('h3').click(function(e){
			if($(this).parent().hasClass('accordion-active')) {
				sections.filter('.accordion-active').find('.accordion-wrapper').slideUp(500, function(){
					$(this).parent().removeClass('accordion-active');
				});
				return;
			}

			sections.filter('.accordion-active').find('.accordion-wrapper').slideUp(500, function(){
				$(this).parent().removeClass('accordion-active');
			});

			$(this).parent().find('.accordion-wrapper').slideDown(500, function(){
				$(this).parent().addClass('accordion-active');
			});
		});					
	});
			
	/* SLIDERS */
	$('#business-btn a').click(function(){
		$('#slideshow').animate({ 'margin-top': 405 }, 600);
		$('#business-slider').animate({ 'margin-top': 0 }, 600);
		$('#health-slider').animate({ 'margin-top': 405 }, 600);
		$('#personal-slider').animate({ 'margin-top': 405 }, 600);
		$('#three-sixty-slider').animate({ 'margin-top': 405 }, 600);
		return false;
	});
	
	$('#health-btn a').click(function(){
		$('#slideshow').animate({ 'margin-top': 405 }, 600);
		$('#business-slider').animate({ 'margin-top': 405 }, 600);
		$('#health-slider').animate({ 'margin-top': 0 }, 600);
		$('#personal-slider').animate({ 'margin-top': 405 }, 600);
		$('#three-sixty-slider').animate({ 'margin-top': 405 }, 600);
		return false;
	});
	
	$('#personal-btn a').click(function(){
		$('#slideshow').animate({ 'margin-top': 405 }, 600);
		$('#business-slider').animate({ 'margin-top': 405 }, 600);
		$('#health-slider').animate({ 'margin-top': 405 }, 600);
		$('#personal-slider').animate({ 'margin-top': 0 }, 600);
		$('#three-sixty-slider').animate({ 'margin-top': 405 }, 600);
		return false;
	});
	
	$('#three-sixty-btn a').click(function(){
		$('#slideshow').animate({ 'margin-top': 405 }, 600);
		$('#business-slider').animate({ 'margin-top': 405 }, 600);
		$('#health-slider').animate({ 'margin-top': 405 }, 600);
		$('#personal-slider').animate({ 'margin-top': 405 }, 600);
		$('#three-sixty-slider').animate({ 'margin-top': 0 }, 600);
		return false;
	});
	
	$('.slider-hide-btn').click(function(){
		$('#slideshow').animate({ 'margin-top': 0 }, 600);
		$('#business-slider').animate({ 'margin-top': 405 }, 600);
		$('#health-slider').animate({ 'margin-top': 405 }, 600);
		$('#personal-slider').animate({ 'margin-top': 405 }, 600);
		return false;
	});
	
	$('#home-quote-form select').change(function() {
		var str = $('#home-quote-form select option:selected').val();
		$('#home-quote-form').attr('action', str);
	});
	$('#home-claim-form select').change(function() {
		var str = $('#home-claim-form select option:selected').val();
		$('#home-claim-form').attr('action', str);
	});
	
	
	/* GOOGLE MAPS */
	$("#map-1").gMap({ markers: [{ latitude: 32.317955,
								  longitude: -102.548651,
								  icon: { image: "http://72.48.228.24/public/images/map-icon.png",
								  		  iconsize: [30, 32],
										  iconanchor: [7,20],
										  infowindowanchor: [30, 0] },
								  html:"<strong>Weatherby-Eisenrich Insurance</strong><br />211 West Broadway<br />Andrews, TX 79714<br /><a href='http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=211+West+Broadway+Andrews,+TX+79714&sll=37.0625,-95.677068&sspn=56.243791,135.263672&ie=UTF8&hq=&hnear=211+W+Broadway+St,+Andrews,+Texas+79714&z=17&iwloc=A' target='_blank'>Get Directions</a>",
								  popup: false }],
					   zoom: 15 });
	
	$("#map-2").gMap({ markers: [{ latitude: 32.451363,
								   longitude: -97.738253,
								   icon: { image: "http://72.48.228.24/public/images/map-icon.png",
								  		  iconsize: [30, 32],
										  iconanchor: [7,6],
										  infowindowanchor: [30, 0] },
								   html:"<strong>Weatherby-Eisenrich Insurance</strong><br />3100 E. Hwy 377<br />Granbury, TX 76049<br /><a href='http://maps.google.com/maps?q=3100+E.+Hwy+377++Granbury,+TX+76049&hl=en&ll=32.451363,-97.738253&spn=0.00122,0.002642&sll=37.0625,-95.677068&sspn=37.462243,86.572266&hnear=3100+E+Hwy+377,+Granbury,+Texas+76049&t=m&z=17' target='_blank'>Get Directions</a>",
								   popup: false }],
					   zoom: 15 });
	
	$("#map-3").gMap({ markers: [{ latitude: 31.88055,
								   longitude: -102.323687,
								   icon: { image: "http://72.48.228.24/public/images/map-icon.png",
								  		  iconsize: [30, 32],
										  iconanchor: [12,24],
										  infowindowanchor: [30, 0] },
								   html:"<strong>Edgmon-Eisenrich Insurance</strong><br />4800 E. University Blvd., Ste B<br />Odessa, TX 79761<br /><a href='http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=4800+E+University+Blvd,+Odessa,+TX+79761&sll=37.0625,-95.677068&sspn=32.252269,79.013672&ie=UTF8&hq=&hnear=4800+E+University+Blvd,+Odessa,+Ector,+Texas+79761&z=16&iwloc=r1' target='_blank'>Get Directions</a>",
								   popup: false }],
					   zoom: 15 });
	
});

/* SLIDESHOW */
function slideSwitch() {
    var $active = $('#slideshow span.active');

    if ( $active.length == 0 ) $active = $('#slideshow span:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow span:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

