function showPopWin(sUrl, nW, nH, returnFunc, showCloseBox, bTitleBar, sMessage, bFrameScroll, sContingut) {

	bFrameScroll = bFrameScroll?'yes':'no';
	sShadow = '<div id="popwin_bg"><div class="popwin_bg" id="popwin_bg_n"></div><div class="popwin_bg" id="popwin_bg_ne"></div><div class="popwin_bg" id="popwin_bg_e"></div><div class="popwin_bg" id="popwin_bg_se"></div><div class="popwin_bg" id="popwin_bg_s"></div><div class="popwin_bg" id="popwin_bg_sw"></div><div class="popwin_bg" id="popwin_bg_w"></div><div class="popwin_bg" id="popwin_bg_nw"></div></div>';
	sFrame = '<iframe id="popupFrame" src="'+sUrl+'" scrolling="'+bFrameScroll+'" frameborder="0" name="popupFrame" style="width: '+nW+'px; height: '+nH+'px; background-color: #fff;" hspace="0"></iframe>';
	sContent = sUrl?sFrame:'<table border="0" cellspacing="0" cellpadding="0" width="'+nW+'" height="'+nH+'"><tr><td valign="middle" align="center" class="modalMessage">' + sMessage + '</td></tr></table>';
	if (typeof(sContingut) != "undefined" && sContingut!=''){ 
	sContent = sContingut;
	}
	sContent = sShadow+sContent;
	sContent += showCloseBox?'<a class="modalCloseImg" title="'+MODALBOX_CLOSE+'" onclick="hidePopWin(false);">'+MODALBOX_CLOSE+'</a>':'';
	if (sMessage){
		nFadeIn=0;
		$.blockUI.defaults.fadeOut = 200;
	}
	else{		
		nFadeIn=500;
		$.blockUI.defaults.fadeOut = 200;
	}
		
	
	$.blockUI({ 
		message: sContent,
		fadeIn: nFadeIn,
		css: {  
			top:  ($(window).height() - nH) /2 + 'px', 
			left: ($(window).width() - nW) /2 + 'px',
			padding: '0',
			margin: '0',
			width:nW+'px',
			height:nH+'px',
			backgroundColor:"#fff"
		},
		overlayCSS:  { 
				backgroundColor: '#000', 
				opacity:         0.3 
			}

	}); 
}
function hidePopWin(callReturnFunc) {
	$.unblockUI();
	if (callReturnFunc == true && gReturnFunc != null) {
		window.setTimeout('gReturnFunc();');
	}
}


function set_focus(obj)
{

	for (x=0;x<obj.elements.length; x++)
	{
	 if ( (obj.elements[x].type.indexOf('select')!=-1)||(obj.elements[x].type == 'text')||(obj.elements[x].type == 'textarea')||(obj.elements[x].type == 'radio') )
	 {
	 //obj.elements[x].focus();
	break;
	 }
	}	
}