function ChangePos($proj_id, $direction, $pro = 0, $portf_id = 0)
{
    session_start();
    $objResponse = new xajaxResponse();
    /*
    	$proj_id2 = portfolio::ChangePos($_SESSION['uid'], intval($proj_id), intval($direction));
    
    	$s = "
    	
    	if (document.getElementById('w_select_".$portf_id."_".$proj_id."').checked)
    	{
    		alert('ok-".$proj_id."');
    	}
    	else
    	{
    		alert ('nope-".$proj_id."');
    	}
    	
    	
    	if (document.getElementById('w_select_".$portf_id."_".$proj_id2."').checked)
    	{
    		alert('ok-".$proj_id2."');
    	}
    	else
    	{
    		alert ('nope-".$proj_id2."');
    	}
    	
    	";
    	$objResponse->script($s);
    //	$objResponse->alert($objResponse->script($s));
    */
    if ($proj_id2 = portfolio::ChangePos($_SESSION['uid'], intval($proj_id), intval($direction))) {
        $script = "can_move = 1;\n        var td = \$('num{$proj_id}');        \n        var position    =  parseInt(td.innerHTML);\n        var td = \$('num{$proj_id2}');        \n        var position2    =  parseInt(td.innerHTML);\n\t\t\$('num{$proj_id}').set('html', position2 + '.');\n\t\t\$('num{$proj_id2}').set('html', position + '.');\n\t\tif (document.getElementById('w_select_" . $portf_id . '_' . $proj_id . "').checked){checked1 = true;} else {checked1 = false;}\n\t\tif (document.getElementById('w_select_" . $portf_id . '_' . $proj_id2 . "').checked){checked2 = true;} else {checked2 = false;}\n\t\ticoup1 = document.getElementById('icoupw" . $proj_id . "');\n\t\ticoup2 = document.getElementById('icoupw" . $proj_id2 . "');\n\t\ticodn1 = document.getElementById('icodnw" . $proj_id . "');\n\t\ticodn2 = document.getElementById('icodnw" . $proj_id2 . "');\n\t\ttmp = icoup1.src;\n\t\ticoup1.src = icoup2.src;\n\t\ticoup2.src = tmp;\n\t\ttmp = icodn1.src;\n\t\ticodn1.src = icodn2.src;\n\t\ticodn2.src = tmp;\n\t\twall = document.getElementById('sproj" . $proj_id . "a');\n\t\twall2 = document.getElementById('sproj" . $proj_id2 . "a');\n\t\t\ttmp3 = wall.innerHTML;\n\t\t\twall.innerHTML = wall2.innerHTML;\n\t\t\twall2.innerHTML = tmp3;\n\t\t\twall.id = 'sproj" . $proj_id2 . "a';\n\t\t\twall2.id = 'sproj" . $proj_id . "a';";
        if ($pro) {
            $script .= "\n\t\twall = document.getElementById('sproj" . $proj_id . "d');\n\t\twall2 = document.getElementById('sproj" . $proj_id2 . "d');\n\t\t\ttmp3 = wall.innerHTML;\n\t\t\twall.innerHTML = wall2.innerHTML;\n\t\t\twall2.innerHTML = tmp3;\n\t\t\twall.id = 'sproj" . $proj_id2 . "d';\n\t\t\twall2.id = 'sproj" . $proj_id . "d';\n\t\twall = document.getElementById('sproj" . $proj_id . "e');\n\t\twall2 = document.getElementById('sproj" . $proj_id2 . "e');\n\t\t\ttmp3 = wall.innerHTML;\n\t\t\twall.innerHTML = wall2.innerHTML;\n\t\t\twall2.innerHTML = tmp3;\n\t\t\twall.id = 'sproj" . $proj_id2 . "e';\n\t\t\twall2.id = 'sproj" . $proj_id . "e';\n\t\tdocument.getElementById('w_select_" . $portf_id . '_' . $proj_id . "').checked = checked1;\n\t\tdocument.getElementById('w_select_" . $portf_id . '_' . $proj_id2 . "').checked = checked2;";
        }
        $objResponse->assign("prj_msg_{$proj_id}", 'innerHTML', '');
        $objResponse->assign("prj_msg_{$proj_id2}", 'innerHTML', '');
    } else {
        $script = 'can_move = 1;';
    }
    $objResponse->script($script);
    return $objResponse;
}