

// don't they mean var psFolder?  - Jason
psFolder = 'account';
psModule = '';


function login() {
//	if(!isIE()){
	//	$.blockUI({ message: '<div style="height: 100px;"><table style="width:100%; height:100%;"><tr><td style="align:center; vertical-align:middle; width:30%;"><img src=\'/images/pleaseWait.gif\' /></td><td style="align:center; vertical-align:middle; width:70%;"><h1>Logging you in...</h1></td></tr></table></div>' });
	//}
  myAction = 'login';
  setMessage( myAction, 'Logging in...' );

	this.handler = this.defaultHandler;

  sendJasonIsAwesome(myAction,'',undefined,'','account');
}
function checkAvailableSurvey(){
  sendJasonIsAwesome('checkSurvey','',undefined, '','account');
}

function loginSmall() {
	//if(!isIE()){
	//	$.blockUI({ message: '<div style="height: 100px;"><table style="width:100%; height:100%;"><tr><td style="align:center; vertical-align:middle; width:30%;"><img src=\'/images/pleaseWait.gif\' /></td><td style="align:center; vertical-align:middle; width:70%;"><h1>Logging you in...</h1></td></tr></table></div>' });
//	}
  myAction = 'loginSmall';
  setMessage( myAction, 'Logging in...' );

  this.handler = function(text, status, xml) 
  {
		this.defaultHandler(text, status, xml);
  }  

  sendJasonIsAwesome(myAction,'',undefined,'','account');
}

function closePopUp() {
		myAction='closePopUp';
		this.handler=this.defaultHandler;
		sendJasonIsAwesome(myAction,'',undefined, '','account');
}


function currencyConverter() {
	myAction='currencyConverter';
	message = 'Processing';
	setMessage( myAction, message );
	this.handler = function(text, status, xml) {
		cursorBusy(false);
		var message = xml.getElementsByTagName('message')[0].firstChild.nodeValue;
		var success = xml.getElementsByTagName('success')[0].firstChild.nodeValue;
		if (success == 'true') {
			if( xml.getElementsByTagName('exchange')[0] )
			{
				document.getElementById('c_exchange').value = (xml.getElementsByTagName('exchange')[0].firstChild.nodeValue);
				document.getElementById('c_exchange_div').innerHTML = (xml.getElementsByTagName('exchange')[0].firstChild.nodeValue);
			}
		} else {
			alert("There was a problem!" + "\n\n" + message);
		}
	}

	sendJasonIsAwesome(myAction,'',undefined, '','account');

}


function logout()
{
	//if(!isIE()){
	//	$.blockUI({ message: '<div style="height: 100px;"><table style="width:100%; height:100%;"><tr><td style="align:center; vertical-align:middle; width:30%;"><img src=\'/images/pleaseWait.gif\' /></td><td style="align:center; vertical-align:middle; width:70%;"><h1>Logging you out... Goodbye</h1></td></tr></table></div>' });
//	}
  myAction = 'loginSmall';
  setMessage( myAction, 'Logging out...' );
  this.handler = function(text, status, xml) {
    var success = xml.getElementsByTagName('success')[0].firstChild.nodeValue;
    var message = xml.getElementsByTagName('message')[0].firstChild.nodeValue;
    if (success == 'true') {
			if( xml.getElementsByTagName('redirect')[0] )
			{
				location.href = xml.getElementsByTagName('redirect')[0].firstChild.nodeValue;
				return;
			}
			
      var fixurl = location.href.replace( /(.*)#.*/, "$1");
      location.href = fixurl;
    } else {
      alert("There was a prolem logging you out!" + "\n\n" + message);
    }
  }  
  var xhr = new XHRObject('/account/?action=ajax&ajaxAction=logout', this.handler);
  xhr.request(null, 'POST');
}