

function form_validate_search() {

	$("#error_query").hide();
	
	var q = $("#input_search").val();
	if (jQuery.trim(q)  == "") {
		
		$("#error_query").show();
		return false;
	}
	else {
		
		$("#cse-search-box").submit();
		return true;
	}
}


hp = {};

hp.dialog_open = function(d_id, level) {
		
	w_width = document.documentElement.clientWidth;
	w_height = document.documentElement.clientHeight;
	
	var dialog_screen = $("#dialog_screen");
	dialog_screen.css({"z-index":level});
	dialog_screen.show();
		
	var dialog = $(d_id);
	
	var d_width = dialog.attr("d_width");
	var d_height = dialog.attr("d_height");
	if (d_height == "e") {
		d_height = w_height - 140;
	}
	else {
	
		if (d_height >= (w_height - 90))
			d_height = w_height - 90;
	}
	
	var d_left = Math.round((w_width / 2) - (d_width / 2));
	var d_top = Math.round((w_height / 2) - (d_height / 2)) - 40;
	if (d_top < 10)
		d_top = 10;
	
	var z_index = level + 1;
	dialog.css({
		"background-color":"#ffffff",
		"top": d_top,
		"left": d_left,
		"position": "fixed",
		"_position": "absolute",
		"width": d_width + "px",
		"height": d_height + "px",
		"z-index":z_index
	});
		
	dialog.show();
} 

hp.dialog_close = function(d_id, level) {

	var dialog = $(d_id);	
	dialog.hide();
	
	if (level == 2)
		$("#dialog_screen").hide();
 	else 
		$("#dialog_screen").css({"z-index": (level - 1)});
}

hp.dialog_close_all = function() {
	$("[dialog]").hide();	
}



