function initFormhandling() {
	jQuery('.error').change(function(){
		jQuery(this).removeClass('error');
	});
	jQuery('.cleardefault').each(function(){
		if(jQuery(this).val() == '') jQuery(this).val(jQuery(this).attr('rel'));
	});
	jQuery('.cleardefault').focus(function(){
		if(jQuery(this).val() == jQuery(this).attr('rel')) jQuery(this).val('');
	});
	jQuery('.cleardefault').blur(function(){
		if(jQuery(this).val() == '') jQuery(this).val(jQuery(this).attr('rel'));
	});
	jQuery('form').submit(function(){
		jQuery('.cleardefault').each(function(){
			if(jQuery(this).val() == jQuery(this).attr('rel')) jQuery(this).val('');
		});
	});
}

function isIE() {
    return (navigator.userAgent.match(/MSIE \d\.\d+/));
}

function zIndexWorkaround() {
    // If the browser is IE,
    if(isIE()) {
        /*
        ** For each div with class menu (i.e.,
        ** the thing we want to be on top),
        */
        jQuery(".submenu").parents().each(function() {
            var obj = jQuery(this);
            var pos = obj.css("position");
 
            // If it's positioned,
            if(pos == "relative" ||
               pos == "absolute" ||
               pos == "fixed") {
                /*
                ** Add the "on-top" class name when the
                ** mouse is hovering over it, and remove
                ** it when the mouse leaves.
                */
                jQuery(this).addClass("on-top");
                
                obj.hover(
	            	function() {
	                    jQuery(this).addClass("on-top");
	                },
	                function() {
	                    jQuery(this).removeClass("on-top");
	                }
                );
            }
        });
    }
}

jQuery(window).load(function(){
	zIndexWorkaround();
});
