
function setPopupAction(ctrl,callback){
		
		AllSubWindow = $('.PopUp').parent().find(".SubWin");
		
		$(ctrl).click(function(){
			//call();
				var NFShow = $("#"+$(this).attr("id")+"SubM");
		
		if (!NFShow.hasClass("DBlock")) {
		$(AllSubWindow).removeClass("DBlock");}
		
			
		var leftP = $(this).offset().left;
			topP = $(this).offset().top;
			WidthP = NFShow.outerWidth();
			HeightP = NFShow.outerHeight();
			
		if (document.body.scrollTop+document.body.clientHeight-HeightP-20<topP)
						{topP = topP-NFShow.outerHeight()-$(this).outerHeight()}
			
		if (leftP + NFShow.outerWidth()+10>document.body.clientWidth/2)
			{leftP = $(this).offset().left-WidthP+$(this).outerWidth();}
			
		cssObj = {'top' : topP+$(this).outerHeight(),
			'left':leftP}
		cssObjShad = {'top' : topP+$(this).outerHeight()+3,
			'left':leftP+4,
			'width':WidthP,
			'height':HeightP}
			
		NFShow.css(cssObj).toggleClass("DBlock");
		if (typeof callback== 'function'){
			callback();
		}
		return false;});
}

function setPopupCloseAction(ctrl){
	$(ctrl).click(function(){
		$(this).parents(".SubWin").animate({"height": "toggle", "opacity": "toggle"}, 100);
		tActivSubWin="";
		return false;});
}
