RJS problem for redirect from controller

I have one RJS file in which i am updating multiple multiple divs.if
user loged in then i am render one page.if user not loged in i am
rendering siginin form page.

MY RJS file:step5.rjs

if session[:username]!=nil and session[:username]!=""

if @type=='compare'
  page << "$('step1_image').src =

‘/images/subpages/steps/step1_off.gif’";
page << “$(‘step2_image’).src =
‘/images/subpages/steps/step2_off.gif’”;
page << “$(‘step3_image’).src =
‘/images/subpages/steps/step3_off.gif’”;
page.replace_html “step4”, :partial=>“step5”
page[‘step1’].hide
page[‘step2’].hide
page[‘step3’].hide
page[‘step4’].show
page[‘step_details’].hide
page[‘step_rest’].hide
else
page.replace_html “company_page”, :partial=>“step5”
end
else
if @type==‘compare’
page << “$(‘step1_image’).src =
‘/images/subpages/steps/step1_off.gif’”;
page << “$(‘step2_image’).src =
‘/images/subpages/steps/step2_off.gif’”;
page << “$(‘step3_image’).src =
‘/images/subpages/steps/step3_off.gif’”;

  page.replace_html "step4", :partial=>"compare_signin"
  page['step1'].hide
  page['step2'].hide
  page['step3'].hide
  page['step4'].show
  page['step_details'].hide
  page['step_rest'].hide
  else
  page.replace_html "company_page", :partial=>"compare_signin"
  end
end

here if user not loged in then the signin page will render.then if user
enter his user name and password.then i have to show the step5 partial
page again in the step4 place.but i couldn’t update the partial step5
page.because i am redirecting action to step5 from contoller which is
signin validation.so it goes to new page.but i need to update the step5
page in the step4 div as i mentioned in the RJS.if user already loged in
means it working perfectly.but in sigin only it giving problem there
also problem is due to redirection.is there any other way to redirect.

my step5 action in controller is:

def step5
render :action=>‘step5’
end

how i am calling the RJS is:

<%=form_remote_tag(:complete=>“eval(request.responseText);”,:url=>{:controller=>‘my_controller’,:action=>‘step5’})%>

how can i do this if anybody know the solutions please let it me know.