function ajaxLoadingImage(status, id_container){
	if (status)
		$("#"+id_container).html('loading!');
	else
		$("#"+id_container).html('');
}

jQuery.fn.center = function () {
	//this.css("position","absolute");
	this.css("top", ( $(window).height() - this.height() ) / 2 + "px");
	this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
	return this;
}

function launchWindow(file, str, width, height, not_use_corner) {

	if(!not_use_corner) {
		var not_use_corner = 0;
	}

	if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
		var maskHeight = $(document).height();
	}else{
		var maskHeight = $(window).height();
	}
	var maskWidth = $(window).width();

	$('#mask').css({'width':maskWidth,'height':maskHeight});
	$('#mask').fadeIn(300);
	$('#mask').fadeTo(300,0.5);

	if ($(window).height() < height) height= $(window).height()-70;
	if ($(window).width() < width) width = $(window).width()-70;

	$('.window').css({'width':width,'height':height});

	ajaxLoadingImage(1, 'content');

	$('.window').center();
	$('.window').fadeIn(300);

	/*if (not_use_corner != 1) {
		$('.window').corner('cc:#313131');
	}*/
	$.get(file, str, function(data){
		$('#content').html(data);
		//$('.window').fadeIn(300);
	});
}

$(document).ready(function() { $('#mask').click(function () { CloseWindow(); }); });
function CloseWindow(){$('#mask').hide();$('.window').hide();$('#content').html('');}
