﻿$(document).ready
(
	function()
	{

			/*
		==============================================
			Rotating banners
		==============================================
	

		if($("#promotional_banner.rotating").length > 0)
		{
			$('#promotional_banner.rotating a:first').css("display","block");
			$('#promotional_banner').cycle (
				{
					fx: 'fade',
					pause: 14,
					pager: '#banner_pagination'
				} );
		};

$("#main_content table tr:even").addClass('SF_even');

		$('#practitioners').hover(function() {
        DD_belatedPNG.fix('#promotional_banner .practitioners-hover');
        $(this).addClass('practitioners-hover');
      }, function() {
        $(this).removeClass('practitioners-hover');
      });
      $('#practitioners').focus(function() {
        $(this).addClass('practitioners-hover');
      }, function() {
        $(this).removeClass('practitioners-hover');
      });
      $('#practitioners').blur(function() {
        $(this).addClass('practitioners-hover');
      }, function() {
        $(this).removeClass('practitioners-hover');
      });

	/*
	==============================================
		Fix the height in doormats
	==============================================
	*/	
	if ($('.home').length ) {
		var max_height = 0;
		$(".g-1col .column-content").each
		(
			function (i)
			{
				if ($(this).height() > max_height) 
					max_height = $(this).height();
						
			}
		);
		$(".g-1col .column-content").height(max_height);
	}
	if ( ('.faq-answer').length ) {
		$('.faq-answer').hide();
		$('.faq-title a').click (function () {
			$(this).toggleClass('minus').parent().next('.faq-answer').slideToggle();
			return false;
		});
	}

/*
====================================
  Style switcher
====================================
*/
 $('.styleswitch').click(function()
	{
	relattrib = this.getAttribute("rel");
	switchStylestyle(this.getAttribute("rel"));
	return false;
	}
	);
	var style = readCookie('style');
	if(style) {
	switchStylestyle(style);
	}

	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);
	}

	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 index = 0; index < ca.length; index++)
		{
			var c = ca[index];
			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);
	}
	
	
	
	}
);

