//*******************************************************************************************
//		GENERAL FUNCTIONS
//*******************************************************************************************

// Dropdown enabler for older browsers not supporting :hover on arbitrary elements
// http://htmldog.com/articles/suckerfish/dropdowns/

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


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

// Function to swap two classes
$.fn.swapClass = function(c1, c2){
    return this.each(function(){
        var t = $(this);
        (!t.is('.'+c1)) ? 
            t.addClass(c1).removeClass(c2) : t.addClass(c2).removeClass(c1);
    });
}

// Fix IE not responding to change events on radio buttons:
// http://norman.walsh.name/2009/03/24/jQueryIE
$(function() {
    if ($.browser.msie) {
        $('input:radio').click(function () {
            this.blur();
            this.focus();
        });
    }
});
	
// New Windows
$('a.newwindow').bind('click',function(){
    window.open(this.href);
    return false;
});

// Close jQuery object
});

//*******************************************************************************************
//		Validate Contact Form
//*******************************************************************************************

$(document).ready(function() {
	$("#contact_form").validate();		
});

 
//*******************************************************************************************
//		TABS
//*******************************************************************************************
$(document).ready(function(){
	$(".tabs").accessibleTabs({
		tabhead:'h2',
		fx:'show',
		fxspeed:null,
		position:'bottom',
		syncheights:true
	});
});

//*******************************************************************************************
//		Google Map
//*******************************************************************************************

window.onload = function(){
	var mymap = new MeOnTheMap({
		container: "map",
		html: "Robinett Bookkeeping Ltd<br />27a Bridge Road,<br /> Hampton Court<br />East Molesey,<br /> Surrey KT8 9EU",
		address: "27a Bridge Road Hampton Court East Molesey Surrey KT8 9EU ",
		zoomLevel: 13
	});

	mymap.adjustMapCenter({
		x: 0,
		y: -80
	});
}

//*******************************************************************************************
//		CUFON REPLACEMENTS
//*******************************************************************************************

Cufon.replace('#intro h1,#content h2,#content h3,#content h4');
Cufon.replace('#sidebar h2,#sidebar h3,#sidebar h4');

/*
Cufon.replace('#nav a,#footnav a,.entry-title a',{hover:true});
Cufon.replace('h1,h2,h3,h4,h5,h6,#logo,.entry-utility a,.entry-utility b,.button,blockquote');
Cufon.replace('.quote blockquote p', { fontFamily: 'Vegur Regular' });
*/
