var doMacCheck = {
    init: function() {
        if ($.client.os == 'Mac') {
            $('body').addClass('mac');
        }
        if ($.client.browser == 'Safari') {
            $('body').addClass('safari');
        }
    }
}

$(document).ready(function() {

    doMacCheck.init();						   

	$("body.home div.box:not(:first)").hide(); 
	$("body.home div#sidebar h4:first").toggleClass('opened');
	$("body.home div#sidebar h4").click(function()
	{
		$(this).siblings("body.home div#sidebar h4").removeClass("opened");	
		$(this).toggleClass('opened').next("div.box").slideToggle("fast").siblings("div.box").slideUp("fast");	
	});	
	
	$("div.toggle:not(:first)").hide(); 
	$("div.toggle:first").toggleClass('opened');
	$("h4").click(function()
	{
		$(this).toggleClass('opened').next("div.toggle").slideToggle("fast").siblings("div.toggle").slideUp("fast");	
	});		

    $('#features').cycle({
        fx:     'fade',
        speed:  'slow',
        timeout: 10000,
		pause:1, 
        pager:  '#featuresnav',
        pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#featuresnav li:eq(' + (idx) + ') a';
        }
    });
	
    $('#customer-cycle').cycle({
        fx:     'fade',
        speed:  'slow',
        timeout: 5000,
		pause:1
    });
		
	
	$("a[rel='lightbox']").colorbox();
	
    $('li.menu-item-type-custom a').click(function(){
        window.open(this.href);
        return false;
    });
    $('li.pdf a').click(function(){
        window.open(this.href);
        return false;
    });

	$("div#tml-page p.error a").hide(); 
	$("div#tml-page p.error").each(function(){
		$(this).html($(this).text().replace(/Lost your password\?/, "Please try again. Need help? <a href='/services/password'>Contact us to reset your password</a>"));     
	});	

});

