window.gf_items_table = function(){

	
	var main_chb = jQuery(".gf-items-table input.chbm");
	var tabl = main_chb.parents(".gf-items-table");
	main_chb.bind('click', (function(tabl){return function(event){
		var checked = jQuery(this).attr("checked");
		if (checked) {
			jQuery(".chb", tabl).attr("checked", "checked");
			jQuery("tbody tr", tabl).addClass("sel");
		} else {
			jQuery(".chb", tabl).attr("checked", null);
			jQuery("tbody tr", tabl).removeClass("sel");
		}
	}})(tabl));

	var tr = jQuery(".gf-items-table tbody tr");
	tr.bind('click', (function(){return function(event){
		if (jQuery(this).hasClass("sel")){
			jQuery(this).removeClass("sel");
			jQuery(".chb", this).attr("checked", null);
		} else {
			jQuery(this).addClass("sel");
			jQuery(".chb", this).attr("checked", "checked");
		}
	}})());
	

}

window.gf_open_window_center = function(url, name, widthP, heightP){
	if (!widthP) widthP = 70;
	if (!heightP) heightP = 70;
	if (!name) name = "_blank";

	var w = jQuery(window).width();
	var h = jQuery(window).height();

	var new_w = parseInt(w*widthP/100);
	var new_h = parseInt(h*heightP/100);

	var l = parseInt((w - new_w) / 2);
	var t = parseInt((h - new_h) / 2);
	

	window.open(url, name, "width="+new_w+",height="+new_h+",left="+l+",top="+t+"");

}


