/**
 * base javascript functionality for IBF website
 * 
 */ 

jQuery(document).ready(function() {
    if (!$('#title_empty').length) {
    	$('#footer').show();
    }
    jQuery("#top-menu ul li").hover(
        function () {
            jQuery(this).children("ul").show();            
        },
        function () {
            jQuery(this).children("ul").hide();
        }
    );
    
    $('#top-menu ul li ul li').hover(function() {
        $(this).stop().animate({ fontSize : '20px', fontWeight: 'bold'});
    },
    function() {
        $(this).stop().animate({ fontSize : '14px' });
    });
});

/**
 * String trimming functionality used for in-input-field hints treatment
 */
var trim_whitespace = {};
var trim_ww = [
      0x0009,0x000a,0x000b,0x000c,0x000d,0x0020,0x0085,0x00a0,0x1680,0x180e,0x2000,0x2001,0x2002,0x2003,
      0x2004,0x2005,0x2006,0x2007,0x2008,0x2009,0x200a,0x200b,0x2028,0x2029,0x202f,0x205f,0x3000
];
for (var i = 0; i < trim_ww.length; i++) {
      trim_whitespace[trim_ww[i]] = true;
}
function trim(str) {
    var len = str.length;
    if (len) {
            while (trim_whitespace[str.charCodeAt(--len)]);
            if (++len) {
                    var i = 0;
                    while (trim_whitespace[str.charCodeAt(i)]) {
                            ++i;
                    }
            }
            return str.substring(i, len);
    }
    return str;
}

var validateEmailSoft = function(emailAddress){
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	return reg.test(emailAddress);	
}
