function ajax_load_indicator()
{
$(document.body).ajaxStart(function() {
	$(document.body).append('<div id="loading">Loading...</div>');
	}).ajaxStop(function() {
		$('#loading').remove();
	});
}
ajax_load_indicator();


var on_ready_func_arr = new Array;
var on_ready_func_index = 0;


$(document).ready(function () {
	for(var i=0; i< on_ready_func_arr.length; i++){
		if(on_ready_func_arr[i]) setTimeout(on_ready_func_arr[i]+"()", 1);
	}
});

var cancel_bubble = false;
function CreateCategoryMenu(){
	$("#categories li[id^='cli']").each(function(i){
		if($(this).hasClass("open") || $(this).hasClass("close") ){
			$(this).click(function (e) {
				if(!cancel_bubble){
					$(this).toggleClass("open");
					$(this).toggleClass("close");
				}
				cancel_bubble = false;
			});

		}
	});
	$("#categories li[id^='cli'] a").each(function(i){
		$(this).click(function(e){
			cancel_bubble = true;
		});
	});
}

var $cache;

function doPrint(path){

/*
//	$cache = $('<div></div>'); // this is where we'll put the real content

//	$("head script").each(function(){
//		var temp_src = $(this).attr('src');
//		if(!temp_src){
//			$cache.append('<script type="text/javascript"> '+$(this).html()+' </script>');
//		}else{
///			if(temp_src.substring(0, site_url.length) == site_url){
//				$cache.append('<script type="text/javascript" src="'+$(this).attr('src')+'"></script>');
//			}
//		}
//	});
//	$cache.append('<link type="text/css" rel="stylesheet" href="'+path+'style_print.css">');
//	$cache.append('<div class="printline"><input type="button" name="print" value=" Print " onclick="javascript: window.print();"></div>');
//	$cache.append($("body").html());
*/

	var win = window.open('about:blank', '_blank');

	$(win.document).ready(function(){
		if(jQuery.support.browser == 'IE') win.document.open("text/html", '_blank');
		win.document.write('<html>')
		win.document.write('<head>')
		$("head script").each(function(){
			var temp_src = $(this).attr('src');
			if(!temp_src){
				win.document.write('<script type="text/javascript"> '+$(this).html()+' </script>');
			}else{
				if(temp_src.substring(0, site_url.length) == site_url){
					win.document.write('<script type="text/javascript" src="'+$(this).attr('src')+'"></script>');
				}
			}
		});
		win.document.write('<link type="text/css" rel="stylesheet" href="'+path+'style_print.css">');
		win.document.write('</head>')
		win.document.write('<body>')
		win.document.write('<div class="printline"><input type="button" name="print" value=" Print " onclick="javascript: window.print();"></div>');
		win.document.write($("body").html());
		win.document.write('</body>')
		win.document.write('</html>')

		if(jQuery.support.browser == 'IE') win.document.close();
//		$cache.empty();
	});
	return false;
}

function showFullField(obj, text){
	$("#show-full-text").remove();
	var link = $(obj).attr('href');
	var obj_x = $(obj).offset().left-2;
	var obj_y = $(obj).offset().top-2;

	if(link){
		$('body').append('<div id="show-full-text" class="overflow-content"><a href="'+link+'">'+text+'</a></div>');
	}else{
		$('body').append('<div id="show-full-text" class="overflow-content">'+text+'</div>');
	}
	$("#show-full-text").css('left', obj_x+'px');
	$("#show-full-text").css('top', obj_y+'px');
	$("#show-full-text").show();

	$("#show-full-text").bind('mouseleave', function(){
		$("#show-full-text").remove();
	});
	
}
