function changeLanguage( strParams )
{	
	if ( !Sarissa || !document.getElementById ) return ;
	
	/* Set up the request */
	var xmlhttp =  new XMLHttpRequest() ;
	xmlhttp.open( 'POST', '../langSwitch', true ) ;

	/* The callback function */
	xmlhttp.onreadystatechange = function() 
	{
		if ( xmlhttp.readyState == 4 ) 
		{
			if ( xmlhttp.status == 200 ) 
			{
				newLangId   = xmlhttp.responseXML.getElementsByTagName( 'langId' )[0].firstChild.data;				
				newLocation = xmlhttp.responseXML.getElementsByTagName( 'location' )[0].firstChild.data;

	            newLocation=newLocation.replace(/\+/g," ");
	            newLocation=unescape(newLocation);
	            newLocation = '../' + newLocation;
				
				setCookie('langId', newLangId, '30', '/', '', '') ;
	  			self.location.replace( newLocation );
			}
			else 
			{
				alert( xmlhttp.status + " ao tentar trocar a linguagem." ) ;
			}
		}
	}

	/* Send the POST request */
	xmlhttp.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ) ;	
	xmlhttp.send( strParams ) ;

}

function setCookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date() ;
	today.setTime( today.getTime() ) ;

	if ( expires )
		expires = expires * 1000 * 60 * 60 * 24 ;

	var expires_date = new Date( today.getTime() + (expires) ) ;

	document.cookie = name + "=" + escape( value )
					+ ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) 
					+ ( ( path ) ? ";path=" + path : "" )
					+ ( ( domain ) ? ";domain=" + domain : "" ) 
					+ ( ( secure ) ? ";secure" : "" ) ;
}