function trim(str)
{
	   return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/\s\s*/,' ');
}
$(document).ready(function(){
	$('.dl_ctrl dt').click(function()
	{
		$(this).next().toggle();
	})
	
}
);
$(document).ready(function(){
	$(".bv_form_languagepanel").each(
			function() {
				tabsElement =$(this).tabs()
				fn=function(event) {
					
					el=$("a[href='#"+ $(this).parent().attr('id') +"']");
					if (trim($(this).val()))
					{	
						el.addClass('bv_tab_withContent');
					}
					else
					{
						el.removeClass('bv_tab_withContent');
					}
				}
				fn2=function (event)
				{
					label=$("a[href='#"+ $(this).parent().attr('id') +"']");
					original = $(this).parent().find(".bv_form_original_data");
					if (trim($(this).val()) != trim(original.val()))
					{
						
						label.addClass('bv_tab_modified');
					}
					else
					{
						
						label.removeClass('bv_tab_modified');
					}
				}
				fn3=function()
				{
					$(this).parent().find(".bv_form_original_data").text($(this).val())
				}
				tabsElement.find("textarea,input[type='text']").each(fn3).each(fn).keyup(fn).keyup(fn2);
			}
		);
	}
);
$(document).ready(function(){
	$(".dhtml_pagination>ul").tabs();
}
);
$(document).ready(function() {
	$(".bv_form_date_ctrl").datepicker({dateFormat:'dd/mm/yy',minDate:new Date(2008,1-1,1),maxDate:new Date(2018,12-1,31)});
}
);

$(document).ready(function(){
	var hovertipConfig = {'attribute':'hovertip',
            'showDelay': 300,
            'hideDelay': 700};
	$(".bv_tooltip").hovertipActivate(hovertipConfig,
			targetSelectById,
            hovertipPrepare,
            hovertipTargetPrepare);
});