var ProfileClass = Class.create();
ProfileClass.prototype = {
	oModal: null,

	initialize: function() {
		return this;
  	},
  	close: function() {
  		this.oModal.Close();
  	},
	fbConnect: function(paAssociations, noIvw) {
  		noIvw = typeof noIvw != 'undefined' ? noIvw : false;    
  		sIVWCode = typeof sIVWCode != 'undefined' ? sIVWCode : null;
  		oIVW = typeof oIVW != 'undefined' ? oIVW : null;
  
  		if(sIVWCode && oIVW && noIvw == false){
  			oIVW.Change(sIVWCode);
  		}else if(typeof IVWCODE != 'undefined' && IVWCODE && noIvw == false){ 
  			oIVW.Change(IVWCODE); 
  		}
  		
  		StdAjax('/__modules__/login/fbconnectmsg',{
  			onSuccess: (function(result){
  				var _this = this;
  				this.oModal = new Modal(1,550);
  				this.oModal.Show('Facebook Connect', result.contents);
  				this.oModal.AddButton('senden', function() { $('fbconnect').submit(); });
  			}).bind(this),
  				onError: function(result, errors){}
  		});  
  	},
	login: function(paAssociations, noIvw, sRedirectUrl) {  		
		noIvw = typeof noIvw != 'undefined' ? noIvw : false;    
		sIVWCode = typeof sIVWCode != 'undefined' ? sIVWCode : null;
		oIVW = typeof oIVW != 'undefined' ? oIVW : null;

		if(sIVWCode && oIVW && noIvw == false){
			oIVW.Change(sIVWCode);
		}else if(typeof IVWCODE != 'undefined' && IVWCODE && noIvw == false){ 
			oIVW.Change(IVWCODE); 
		}
		
		StdAjax('/__modules__/login/loginmodal',{
			onSuccess: (function(result){
				var _this = this;
				this.oModal = new Modal(1,230);
				this.oModal.Show('Login', result.contents);
				$('redirect-url').setValue(sRedirectUrl);
				this.oModal.AddButton('senden', function() { $('login-modal').submit(); });
			}).bind(this),
				onError: function(result, errors){}
		});  
  	}
}

Profile = new ProfileClass();
