/*----------------------------------------------------------------------------\
|                            Login Utilities	                              |
|-----------------------------------------------------------------------------|
|                  Copyright (c) 2003 e-travel                                |
\----------------------------------------------------------------------------*/

//returns URL the same as first parameter but with protocol, host name, port
//taken from the second parameter
//if no host is available for any URL current host is used
function changeUrlBase(u1o, u2o) {
	
  var link = document.createElement('a');
  
  var u1 = u1o.toString();
  var u2 = u2o.toString();  

  link.href = u2
  var host2 = link.host
  var protocol2 = link.protocol

  link.href = u1
  link.host = host2
  link.protocol = protocol2

  var url = link.href

 if (browser.isSafari)
  	return u2 // fix for safari (login page loops when accessing it from HTTP)
  else
  	return url	
}

