function ManageUserEvent (){ if ($('detailbox')){ var requestSenderDetail = new Request({ url: 'http://www.one2one.com/ug/getSenderDetail.php', method: 'get', onSuccess: function (txt, xml){ $('detailbox').set('html', ''); $('detailbox').set('html',txt); window.fireEvent('DetailSync'); } }); function refreshDetails(){ //alert ('Going to refresh'); requestSenderDetail.send('f=pics'); } } if( $('cbutton') ){ // the login button event sync the ajax request $('cbutton').addEvent('click', function (e){ e.stop() connectUser (); manageUboxEvents(); }); $('uconnectf').addEvent('submit', function(e){ e.stop(); connectUser (); manageUboxEvents(); }); $('uconnectf').set('send', { // use url from the form url : 'http://www.one2one.com/ug/uconnect.php', method :'post', onComplete: function (){ //alert('Completed!'); }, onSuccess: function(txt){ $('ubox_container').set('html', ''); $('ubox_container').set('html',txt); if ($('detailbox')){ refreshDetails(); } //modifico la promo de la izquierda if($('promo_login') != null & $('promo_logout') != null){ $('promo_login').setStyle('display','block'); $('promo_logout').setStyle('display','none'); } window.fireEvent('AjaxSync'); }, onFailure: function (){ //alert ('Request failed!'); } } ); // send the ajax request function connectUser (){ $('uconnectf').send(); } } if( $('logoutb')){ var uboxDisconnect = new Request.HTML({ url: 'http://www.one2one.com/ug/uconnect.php', method: 'post', data: 'logout=1', onComplete: function (tree, elements, html, js){ //alert ('uboxDisconnect Request Completed!'); }, onFailure: function (){ //alert ('uboxDisconnect Request failed!'); }, onSuccess: function (html){ //alert ('uboxDisconnect Request success!'); $('ubox_container').set('html', ''); $('ubox_container').adopt('html',html); if ($('detailbox')){ refreshDetails(); } //modifico la promo de la izquierda if($('promo_login') != null & $('promo_logout') != null){ $('promo_logout').setStyle('display','block'); $('promo_login').setStyle('display','none'); } window.fireEvent('AjaxSync'); } }); $('logoutb').addEvent('click', function (e){disconnectUser ();}) function disconnectUser (){ uboxDisconnect.send(); } } if( $('logoutlcb')){ var uboxDisconnect = new Request.HTML({ url: 'http://www.one2one.com/ug/uconnect.php', method: 'post', data: 'logout=1&ubTset=leftcolumn', /* evalResponse: true, */ /* evalScripts: true, */ onComplete: function (tree, elements, html, js){ //alert ('uboxDisconnect Request Completed!'); }, onFailure: function (){ //alert ('uboxDisconnect Request failed!'); }, onSuccess: function (html){ $('ubox_container').set('html', ''); $('ubox_container').adopt('html',html); window.fireEvent('AjaxSync'); } }); $('logoutlcb').addEvent('click', function (e){disconnectUser ();}) function disconnectUser (){ uboxDisconnect.send(); } } if( $('lpbutton') ){ // the login button event sync the ajax request $('lpbutton').addEvent('click', function (e){ e.stop() sendPassword (); }); $('uconnectf').addEvent('submit', function(e){ e.stop(); //alert ('Form Submitted'); sendPassword (); }); $('uconnectf').set('send', { // use url from the form url : 'http://www.one2one.com/ug/uconnect.php', method :'post', onComplete: function (){ //alert('Completed!'); }, onSuccess: function(txt){ $('ubox_container').set('html', ''); $('ubox_container').set('html',txt); window.fireEvent('AjaxSync'); }, onFailure: function (){ //alert ('Request failed!'); } } ); // send the ajax request function sendPassword (){ $('uconnectf').send(); } } if ($('lostpasswordb')){ var requestLostPasswordBox = new Request.HTML({ url: 'http://www.one2one.com/ug/getUserbox.php', method: 'post', data: 'ubox_tid=4', onComplete: function (tree, elements, html, js){ //alert ('uboxDisconnect Request Completed!'); }, onFailure: function (){ //alert ('uboxDisconnect Request failed!'); }, onSuccess: function (html){ //alert ('uboxDisconnect Request success!'); $('ubox_container').set('html', ''); $('ubox_container').adopt('html',html); window.fireEvent('AjaxSync'); } }); $('lostpasswordb').addEvent('click', function (e){showLostPassword ();}) function showLostPassword (){ requestLostPasswordBox.send(); } } // lost password botton left column userbox if ($('lostpasswordlcb')){ var requestLostPasswordBox = new Request.HTML({ url: 'http://www.one2one.com/ug/getUserbox.php', method: 'post', data: 'ubox_tid=4&ubox_tset=leftcolumn', onComplete: function (tree, elements, html, js){ //alert ('uboxDisconnect Request Completed!'); }, onFailure: function (){ //alert ('uboxDisconnect Request failed!'); }, onSuccess: function (html){ //alert ('uboxDisconnect Request success!'); $('ubox_container').set('html', ''); $('ubox_container').adopt('html',html); window.fireEvent('AjaxSync'); } }); $('lostpasswordlcb').addEvent('click', function (e){showLostPassword ();}) function showLostPassword (){ requestLostPasswordBox.send(); } } if ($('loginb')){ var requestDefaultBox = new Request.HTML({ url: 'http://www.one2one.com/ug/getUserbox.php', method: 'post', data: 'ubox_tid=1&', onComplete: function (tree, elements, html, js){ //alert ('uboxDisconnect Request Completed!'); }, onFailure: function (){ //alert ('uboxDisconnect Request failed!'); }, onSuccess: function (html){ //alert ('uboxDisconnect Request success!'); $('ubox_container').set('html', ''); $('ubox_container').adopt('html',html); window.fireEvent('AjaxSync'); } }); $('loginb').addEvent('click', function (e){showDefaultBox ();}) function showDefaultBox (){ requestDefaultBox.send(); } } if ($('loginlcb')){ var requestDefaultBox = new Request.HTML({ url: 'http://www.one2one.com/ug/getUserbox.php', method: 'post', data: 'ubox_tid=1&ubox_tset=leftcolumn', onComplete: function (tree, elements, html, js){ //alert ('uboxDisconnect Request Completed!'); }, onFailure: function (){ //alert ('uboxDisconnect Request failed!'); }, onSuccess: function (html){ //alert ('uboxDisconnect Request success!'); $('ubox_container').set('html', ''); $('ubox_container').adopt('html',html); window.fireEvent('AjaxSync'); } }); $('loginlcb').addEvent('click', function (e){ showDefaultBox (); }) function showDefaultBox (){ requestDefaultBox.send(); } } if ($('checkCancel')){ var cancelBox = new Request.HTML({ url: 'http://www.one2one.com/ug/uCancel.php', method: 'post', data: 'ubox_tid=5&ubTset=leftcolumn&check=1', onComplete: function (tree, elements, html, js){ //alert ('uboxDisconnect Request Completed!'); }, onFailure: function (){ //alert ('uboxDisconnect Request failed!'); }, onSuccess: function (html){ //alert ('uboxDisconnect Request success!'); $('ubox_container').set('html', ''); $('ubox_container').adopt('html',html); window.fireEvent('AjaxSync'); } }); $('checkCancel').addEvent('click', function (e){ showCancelBox (); }) function showCancelBox (){ cancelBox.send(); } } if ($('cancelMember')){ $('cancelMember').addEvent('click', function (e){ showCancelBox (); }) $('delimiter').setStyle('display', 'block'); $('delimiterform').setStyle('display', 'block'); } } function showCancelBox (){ //var reason = $('reason').value.replace(,'"', "'"); var reason = $('reason').value; var cancelBox = new Request.HTML({ url: 'http://www.one2one.com/ug/uCancel.php', method: 'post', data: "ubox_tid=1&ubTset=leftcolumn&cancel=1&reason=" + reason, onComplete: function (tree, elements, html, js){ //alert ('uboxDisconnect Request Completed!'); }, onFailure: function (){ //alert ('uboxDisconnect Request failed!'); }, onSuccess: function (html){ //alert ('uboxDisconnect Request success!'); $('ubox_container').set('html', ''); $('ubox_container').adopt('html',html); window.fireEvent('AjaxSync'); } }); cancelBox.send(); } window.addEvent('domready', function(){ ManageUserEvent(); }); window.addEvent('AjaxSync', function(){ ManageUserEvent(); manageUboxEvents(); window.removeEvent('AjaxSync'); });