function doHover() {
    var elem = $(this);
	var current = elem.attr('src');
	var hover = elem.attr('rev');
	elem.attr('src', hover);
	elem.attr('rev', current);
}

function init(bodyclass) {
    //form submition
	$('input.form_trigger').click(function(){
	    $(this).parents('form').submit();
	});
    //submenu items
    $('a.menuItem img').each(function(){
        $(this).not('.off').addClass('on');
	});
	//images mouseover
	$('img.doHover').hover(doHover, doHover);
	//scroll to
    $('a.slideTo').click(function(){
        var elem = $('#' + $(this).attr('rev') );
        $('html,body').animate({scrollTop: elem.offset().top}, 500);
        return false;
	});
	//adds class to body
    $('body').addClass(bodyclass);
    //rollover twitter
    $('a.thumb-twitter').hover(function(){
        $('img.hover', this).show();
        $('img.normal', this).hide();
	}, function(){
        $('img.normal', this).show();
        $('img.hover', this).hide();
	});
    
	//template functions(try/catch)
    try { initTemplate(); } catch(err) { }
}
