
function reloads ( id, host ) {
	$("#"+id).attr( "src", host+"/engine/antibot.php?rnd="+Math.random());
}

function setHide(id, section){
	if(section && $("#"+id).css('display') == 'none'){
		$("[section='"+section+"']").each(function(){
			if($(this).css('display') != 'none'){
				$(this).animate({height: 'toggle'}, 200);
			}
		});
	}
	if($("#"+id).css('display') != 'none'){
		$("#"+id).animate({height: 'toggle'}, 200);
	}else{
		$("#"+id).animate({height: 'show'}, 500);
	}
}
$(function() {
	$(".dialog_info").click(function(){
		var _this = this;
		if(!$("#dialog_info").is('*')){
			$("body").append('<div id="dialog_info"></div>');
			//$("body").append('<iframe src="'+$(_this).attr("href")+'" id="dialog" onLoad="autoResize(\'iframe1\');></iframe>');
		}
		
		$("#dialog_info").dialog({
			show: 'scale',
			width: $(_this).attr("width") ? $(_this).attr("width") : 640,
			title: $(_this).attr("title"),
			open: function(){
				$('#dialog_info').load($(_this).attr("href"));
				
			},
		});
		return false;
	});
});

$(function() {
	$(".dialog_iframe").click(function(){
		var _this = this;
		if(!$("#dialog").is('*')){
			//$("body").append('<div id="dialog_info"></div>');
			$("body").append('<div id="dialog"><iframe id="dialog_iframe" width="100%" height="100%" src="'+$(_this).attr("href")+'"></iframe></div>');
		}
		
		$("#dialog").dialog({
			show: 'scale',
			width: ($(_this).attr("width") ? $(_this).attr("width") : 640),
			height: ($(_this).attr("height") ? $(_this).attr("height") : 480),
			title: $(_this).attr("title"),
			open: function(){
				$("#dialog_iframe").attr("src", $(_this).attr("href"));
			},
		});
		return false;
	});
});

function getSelText(){
	var txt = '';
	if (window.getSelection){
		txt = window.getSelection();
	}else if (document.getSelection){
		txt = document.getSelection();
	}else if (document.selection){
		txt = document.selection.createRange().text;
	}
	return txt;
}







jQuery.fn.menu = function(){
	this.hover(
		function() {
			$(this).addClass("active");
			$(this).find('ul').stop(true, true);
			$(this).find('ul:first').slideDown();
		},
		function() {
			$(this).removeClass("active");
			$(this).find('ul').slideUp('fast');
		}
	);
}

