<?
function getPopupFieldsJsCode($module,$id)
{
	require_once("modules/".$module."/popup_fields.php");
	$js='';
	if($popup_field[$module])
	{
		$js.='<script language="javascript">;
';
		foreach($popup_field[$module] as $field)
		{
			$exp=explode("||",$field['to_insert']);
			$value="";
			$values=array();
			foreach($exp as $e)
			{
				if($_REQUEST[$e]!="" && $e=="id")$values[]=$id;
				elseif($_REQUEST[$e]!="")$values[]=$_REQUEST[$e];
			}
			$value=implode(" ",$values);
			if($field['if_empty']==true)$js.='if(parent.opener.document.getElementById("'.$field['field'].'")=="")';
			$js.='parent.opener.document.getElementById("'.$field['field'].'").value="'.$value.'";
			';
		}
		$js.='window.close();</script>';
	}
	return $js;
}
?>