﻿/* Author: Antony Benito(tonybenito@gmail.com) +91 9745003819 */



function addUserReference(fname,lname,password,email,ref)
{

new Ajax.Request('ajax/USER_add_reference.aspx?password='+password+'&email='+email+'&fname='+fname+'&lname='+lname+'&ref='+ref+'', {
  
   onLoading: function x(){
                            $('useradd').disabled=true;
                            $('useradd').value='Please wait...';
                          },
                          
       onComplete: function x(transport){
                              
                             
                              sts=transport.responseText;
                              if(sts!="done")
                              {
                                 $('useradd').disabled=false;
                                 $('useradd').value='Create my account';
                                 alert(sts)
                                 
                              }
                              else{
                          
                              location.href='sprint_board.aspx'
                             
                              }
                           
                          }
  });
}

function SendRequest(email,loadhere)
{
 new Ajax.Request('ajax/CONTACT_SendRequest.aspx?email='+email+'', {
          
         
         onLoading: function x(){
                                   
                                     $(loadhere+'_loading').innerHTML="Searching..."

                                },
                                  
               onComplete: function x(transport){
               
                                  $('searchtext').value="";
                                  $(loadhere+'_loading').innerHTML="";
                                  sts=transport.responseText;   
                                  
                                  
                                                             
                                  alert(sts);
                                  ListMycontact($('HiddenField_uid').value,'ContactsCurrent')
                                  
                                      }
                                   
                                
          });
}


function contactFormLoad(uid)
{
    $('holderRight').innerHTML="";
    $('holder2').innerHTML="";
      $('BacklogBoxSprintBoard').innerHTML="";

     new Ajax.Updater('holder', 'forms/contacts.aspx', {
          
          method:'get',
         onLoading: function x(){
                                    $('holder').innerHTML="<div class='taskLoading'>Loading...</div>";
                                },
                                  
               onComplete: function x(transport){
                                  
                                   ListMycontact(uid,'ContactsCurrent')
                                  
                                     
                                      }
                                   
                                
          });
} 

function ContactAddFind(search,loadhere)
{
 new Ajax.Updater(loadhere, 'ajax/CONTACT_add_find.aspx?search='+search+'', {
          
         
         onLoading: function x(){
                                   
                                     $(loadhere+'_loading').innerHTML="Searching..."

                                },
                                  
               onComplete: function x(transport){
               
                                  $(loadhere+'_loading').innerHTML="";
                                  
                                      }
                                   
                                
          });
}

function ListMycontact(uid,loadhere)
{
 new Ajax.Updater(loadhere, 'ajax/CONTACT_current.aspx?uid='+uid+'', {
          
         
         onLoading: function x(){
                                   
                                     $(loadhere+'_loading').innerHTML="Loading..."

                                },
                                  
               onComplete: function x(transport){
               
                                  $(loadhere+'_loading').innerHTML="";
                                  
                                      }
                                   
                                
          });
}

function ListMycontactPending(uid,loadhere)
{
 new Ajax.Updater(loadhere, 'ajax/CONTACT_pending.aspx?uid='+uid+'', {
          
         
         onLoading: function x(){
                                   
                                     $(loadhere+'_loading').innerHTML="Loading..."

                                },
                                  
               onComplete: function x(transport){
               
                                  $(loadhere+'_loading').innerHTML="";
                                  
                                      }
                                   
                                
          });
}

function SendRequestExisting(to,loading)
{
 new Ajax.Request('ajax/CONTACT_sendrequestExisting.aspx?touid='+to+'', {
  
   onLoading: function x(){   
                            $(loading).innerHTML="Please wait...";
                          },
                          
       onComplete: function x(transport){
       
                              $(loading).innerHTML="";
                              
                              sts=transport.responseText;                              
                              alert(sts);
                              
                          }
  });
}

function DeleteRequest(from,loadhere)
{
 new Ajax.Request('ajax/CONTACT_deleterequest.aspx?fromuid='+from+'', {
  
   onLoading: function x(){   
                            $(loadhere+'_loading').innerHTML="Please wait...";
                          },
                          
       onComplete: function x(transport){
       
                              $(loadhere+'_loading').innerHTML="";
                              
                              sts=transport.responseText;                              
                              
                              if(sts!='done')
                              {
                                alert(sts);
                              }
                              else
                              {
                              
                                ListMycontactPending($('HiddenField_uid').value,loadhere)
                              }
                              
                          }
  });
}

function RequestAproveExisting(friendId,loadhere)
{
 new Ajax.Request('ajax/CONTACT_approve_existing.aspx?friendid='+friendId+'', {
  
   onLoading: function x(){   
                            $(loadhere+'_loading').innerHTML="Please wait...";
                          },
                          
       onComplete: function x(transport){
       
                              $(loadhere+'_loading').innerHTML="";
                              
                              sts=transport.responseText;                              
                              
                              if(sts!='done')
                              {
                                alert(sts);
                              }
                              else
                              {
                                 alert("Added to your contact list.");
                                ListMycontactPending($('HiddenField_uid').value,loadhere)
                              }
                              
                          }
  });
}
   