﻿$(document).ready(function() {
	$('#navigation ul.superfish').superfish({ 
		hoverClass:   'active' 
		,delay:        800
		,animation:    {opacity:'show',height:'show'}
		,speed:        'normal'
		,autoArrows:   false
		,dropShadows:  false
		,onShow:       function(){ $(this).parent('li').children('a').addClass('active'); }
	        ,onHide:       function(){ $(this).parent('li').children('a').removeClass('active'); }
	});
	
	(function($) {
		var obj1 = new Object();
		var obj2 = new Object();
		obj1.text = '262-671-0717';
		obj1.text = 'Call Us at 262-671-0717';
		$('.utmz-switch').utmzSwitch(obj1);
		$('.utmz-switch-side').utmzSwitch(obj2);
	})(jQuery);
	
	$('#photo-gallery').beforeaftergallery({speed:350, width:470});
	
	$('#office-gallery').beforeaftergallery({speed:350, width:470});
	
	$('#lightbox a').click(function(event) {
		
		event.preventDefault();
		
		if ($(this).attr("class").indexOf("close") == -1 && $(this).attr("class").indexOf("prev") == -1) {
			
			window.top.location = $(this).attr('href');		
		}
	});

	$('#lightbox .close').click(function() {
		self.parent.tb_remove();
	});
	
	$('.next-steps ul a').hover(function(event) {
		$(this).parent('li').css('background-position', '-1525px -88px');
	}, function(event) {
		$(this).parent('li').css('background-position', '-1525px -63px');
	});
});
	
window.hasVideoCookie = function() {
	
	if ($.cookie('video-played')) {
		return true;
	}
	// set a method to run in 30 seconds to remove the flash piece after it is done
	window.setTimeout(function() {
		$('#video-overlay').remove();
	}, 30000);
	
	$.cookie('video-played', 'true', { expires: 0, path: '/'});
	return false;
};
	
window.hasHomeVideoCookie = function() {
	
	if ($.cookie('home-video-played')) {
		return true;
	}
	
	$.cookie('home-video-played', 'true', { expires: 0, path: '/'});
	return false;
};
