function ShowPopup(block, wind) {
	
	var objFloatFormAlphaBg = $(block);
	var objFloatForm = $(wind);
	
	if($type(objFloatForm)!="element" || $type(objFloatFormAlphaBg)!="element") return false;
		
	if(!objFloatForm.hasClass("visible")) {	
		
		var windowSize = window.getSize();
		var X = window.getScrollLeft() + Math.round(ff_clientWidth_Compl()/2)-160;
		var Y = window.getScrollTop() + Math.round(ff_clientHeight_Compl()/2)-120;
				
		objFloatForm.setStyle('left', X + 'px');
		objFloatForm.setStyle('top', Y + 'px');

		
		objFloatFormAlphaBg.setStyle('width', window.getScrollWidth() + 'px');
		objFloatFormAlphaBg.setStyle('height', window.getScrollHeight() + 'px');
  	
		ChangeLayerVisibility(block, true, false);
		objFloatForm.style.display ='block';
		showHideFlash(false);
	}else {
		closePopupTop(block, wind);
	}
	return false;
}
/**
	Close float form action
*/
function closePopupTop(block, wind) {

	showHideFlash(true);
	ChangeLayerVisibility(wind, false, true);
	ChangeLayerVisibility(block, false, true);
	
	var reg=/_(\d+)/ 
	var blockIDStr=reg.exec(block) 
		
	ChangeLayerVisibility('firstFrom'+blockIDStr[0], true, false);
	ChangeLayerVisibility('compReady'+blockIDStr[0], false, true);
	
}

function ff_clientWidth_Compl() {
	return ff_filterResults_Compl (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function ff_clientHeight_Compl() {
	return ff_filterResults_Compl (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}

function ff_filterResults_Compl(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


function complaintAdd(proj, item, path, hideLink) {
	
	imgObj = $('ComplMainImgLoader');
	
	var windowSize = window.getSize();
	var X = window.getScrollLeft() + Math.round(ff_clientWidth_Compl()/2)-160;
	var Y = window.getScrollTop() + Math.round(ff_clientHeight_Compl()/2)-120;
			
	imgObj.setStyle('left', X + 'px');
	imgObj.setStyle('top', Y + 'px');
	
	imgObj.style.display='block';
	
	$('startpagewindow').style.display='none';
			
	new Requester('/'+path, 
					   {method    : 'post',
							data      : 'complaintAdd=1&projID='+proj+'&itemID='+item+'&linkHide='+hideLink+'&path='+path,
							onComplete: function() {imgObj.style.display='none';
								$('compReady_'+item).style.display='block';
								$('complaintWin_'+item).style.display='block';
								$('firstFrom_'+item).style.display='none';
								$('complaintLink_'+item).style.display = hideLink=='false' ? 'block' : 'none';
								}})

}