var siteurl = 'http://www.combenz.com';
jQuery.fn.ajaxdata = function(){
	return this.serialize()+'&ajax=1';
}
jQuery.fn.visible = function(){
	if ($(this).css('display') == 'none') {
		return false;
	}else {
		return true;
	}
}
jQuery.fn.jump = function(){
	document.location.href = $(this).attr('link');
}
jQuery.fn.p2nl = function(){
	var content = [];
	$(this).each(function(i){
		content.push($(this).text());
	});
	return content.length?content.join("\n"):$(this).text();
};
jQuery.fn.nl2p = function(){
	var content = $(this).val().split(/\r\n|\n/);
	$.each(content, function(i,n){
		content[i] = n ? "<p>"+n+"</p>" : null;
	});
	return content.join("");
};	
jQuery.extend({
	redirect: function(url, delay){
		if (delay) {
			setTimeout(function(){document.location.href = url;}, delay*1000);
		}
		else
		{
			document.location.href = url;
		}
	},
	reload: function(){
		document.location.reload();
	},
	popMsg: function(info, style, delay){
		var win = $("<div id='popMsg'>"+info+"</div>");
		var _top = $(window).height()/2-win.innerHeight()/2+document.documentElement.scrollTop-80;
		var _left = $(window).width()/2 - 110;
		win.css({position:'absolute', width:'200px', border:'#7FCAE2 1px solid', backgroundColor:'#F1F5FA', padding:'10px', top:_top, left:_left});
		style?win.css('color', '#222222'):win.css('color', 'red');
		win.appendTo(document.body);
		delay?setTimeout(function(){ win.fadeOut('slow', function(){ win.remove();}); }, 2000):'';
	},
	boxy: function(title){
		$('.boxy-wrapper').remove();
		var win = new Boxy("<div id='boxy'><h3 id='boxy-title'>"+title+"</h3><div id='boxy-body'></div><div id='boxy-footer'><span class='low-blue little-pd'><button id='operate'>确认</button></span></div></div>", {title:'主题管理'});
		return win;
	}
});

$(document).ready(function() {
	
	Boxy.DEFAULTS.closeText = '[关闭]';
	Boxy.DEFAULTS.title = '提示信息';
	$.ajaxSetup({'dataType':"json"});
}); 