jQuery.noConflict();
(function($)
{
	$.fn.blink = function(options)
	{
		var defaults = { delay:500 };
		var options = $.extend(defaults, options);
		
		return this.each(function()
		{
			var obj = $(this);
			setInterval(function()
			{
				if($(obj).css("visibility") == "visible")
				{
					$(obj).css('visibility','hidden');
				}
				else
				{
					$(obj).css('visibility','visible');
				}
			}, options.delay);
		});
	}
}(jQuery))
jQuery(document).ready(function(){
	jQuery("#menu dd").hide();
	if (jQuery.cookie('CKMENU')) {
		jQuery("#menu dt[menu_id="+jQuery.cookie('CKMENU')+"]").addClass('selected');
		jQuery("#menu dt[menu_id="+jQuery.cookie('CKMENU')+"]").next('dd').show();
	}
	jQuery("#menu dt a").click(function(){
		jQuery("#menu dl dt.selected").removeClass('selected');
		jQuery("#menu dd:visible").slideUp("slow");
		jQuery(this).parent().addClass('selected');
		jQuery(this).parent().next().slideDown("slow");
		jQuery.cookie('CKMENU', jQuery(this).parent().attr('menu_id'), { expires: 365, path: '/' });
		return false;
	});
	jQuery("div.searching div.top").click(function(){
		jQuery(this).next('div.content').slideToggle(100);
	});
//	jQuery("#content div.tabs ul").corner('bottom');
//	jQuery("input[type='text'].Vinteger").bind('keypress', function(e){
//		var charCode = (e.which) ? e.which : e.keyCode;
//		if (charCode > 31 && (charCode < 48 || charCode > 57)) {
//			return false;
//		}
//		return true;
//	});
//	jQuery("body").css("background-color", "#045c97");
	jQuery('.blink').blink();
});
Event.observe(window, 'load', function(){
});
function Redirect(url) {
	window.location.href = url;
	return true;
}
function openWindow(file, window, w, h) {
	var msgWindow = open(file, window, 'directories=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,copyhistory=no,resizable=no,width=' + w + ',height='  + h);
	msgWindow.focus();
}
function openWindowScrollable(file, window, w, h) {
    var msgWindow = open(file, window, 'directories=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,width=' + w + ',height='  + h);
    msgWindow.focus();
}
jQuery.fn.focusNextInputField = function() {
    return this.each(function() {
        var fields = jQuery(this).parents('form:eq(0),body').find('button:visible,input:visible,textarea:visible,select:visible');
        var index = fields.index( this );
        if ( index > -1 && ( index + 1 ) < fields.length ) {
            fields.eq( index + 1 ).focus();
        }
        return false;
    });
};
function onKeyPress(o, e) {
	switch (o.type) {
	case 'text':
	case 'textarea':
		var charCode = (e.which) ? e.which : e.keyCode;
		if ((o.selectionEnd - o.selectionStart) < 1) {
			if (jQuery(o).attr('maxlength') > 0 && jQuery(o).attr('value').length >= jQuery(o).attr('maxlength')) {
				if (charCode != 118 && charCode != 9 && charCode != 97 && charCode != 99 && charCode != 38 && charCode != 40 && charCode != 8 && charCode != 13 && charCode != 37 && charCode != 39) {
					return false;
				}
			}
		}
		if (jQuery(o).attr('class').match(/Vinteger/g)) {
			if (charCode != 97 && charCode != 38 && charCode != 40 && charCode != 99 && charCode != 118 && charCode != 13 && charCode != 37 && charCode != 39 && charCode > 31 && (charCode < 48 || charCode > 57)) {
				return false;
			}
		} else if (jQuery(o).attr('class').match(/Vfloat/g)) {
			if (charCode != 45 && charCode != 97 && charCode != 38 && charCode != 40 && charCode != 99 && charCode != 118 && charCode != 44 && charCode != 46 && charCode != 13 && charCode != 37 && charCode != 39 && charCode > 31 && (charCode < 48 || charCode > 57)) {
				return false;
			}
		}
		return true;
		break;
	}
}
function onKeyUp(o, e) {
	switch (o.type) {
		case 'text':
		case 'textarea':
			if (jQuery(o).attr('class').match(/Vinteger/g)) {
				o.value = o.value.replace(/[^0-9]/g, "");
			} else if (jQuery(o).attr('class').match(/Vfloat/g)) {
				o.value = o.value.replace(/[^0-9\,\.\-]/g, "");
			}
			if(!jQuery(o).hasClass('mask')){
				if (jQuery(o).attr('maxlength') > 0 && jQuery(o).attr('value').length >= jQuery(o).attr('maxlength')) {
					jQuery(o).focusNextInputField();
				}
			}
			break;
	}
	return true;
}
function taboverlap(o, page, name, tab) {
	var n = jQuery(o).parent('li').attr('id');
	var nc = n + 'c';
	var ul = jQuery(o).parent('li').parent('ul');
	var ulc = jQuery(o).parent('li').parent('ul').parent('div').next('div[class=taboverlapcontents]');
	jQuery.cookie('CKTABOVERLAP_' + page + '_' + name, tab, { expires: 365, path: '/' });
	ul.children('li').removeClass('selected');
	ulc.children('div').removeClass('selected');
	ul.children('li[id=' + n + ']').addClass('selected');
	ulc.children('div[id=' + nc + ']').addClass('selected');
	return false;
}
function GB_floatDiv(id, disable) {
	if ($(id)) {
		if (disable) {
			$(id).hide();
			return true;
		}
		var offsetcache = Element.cumulativeScrollOffset($(id));
		var top = offsetcache[1] + 10;
//		top = top + 'px';
		var left = offsetcache[0] + 10;
//		left = left + 'px';
		$(id).setStyle({'display': 'block', 'position': 'absolute', 'top': top, 'left': left, 'border': '5px solid #dedede', 'text-align': 'left', 'zIndex': '10000', 'backgroundColor': '#fff'});
	}
}