$(document).ready(function() {
    Cufon.replace('h1'); // repalce H1 with GE Inspira font

    //active tab
    var loc = window.location;

    if (loc.href.indexOf('waterproblems') != -1) {
        $('#n1 a').addClass('selected');
    } else if (loc.href.indexOf('product') != -1) {
        $('#n2 a').addClass('selected');
    } else if (loc.href.indexOf('resource') != -1) {
        $('#n3 a').addClass('selected');
    } else if (loc.href.indexOf('wheretobuy') != -1) {
        $('#n4 a').addClass('selected');
    }

    var i = 4;
    var subs = null;
    while (subs == null && i > 0) {
        subs = $.url.segment(i);
        i--;
    }
    var main = $.url.segment(0);
    $('#local a.' + main).addClass('current');
    $('#local a.' + subs).addClass('current');

    // submit button hover
    $('#submit').hover(
		function() { // Change the input image's source when we "roll on"
		    $(this).attr({ src: '/images/bttn_submit-over.gif' });
		},
		function() { // Change the input image's source back to the default on "roll off"
		    $(this).attr({ src: '/images/bttn_submit.gif' });
		}
	);
});
