﻿function loadPBL()
{
  var prid=document.getElementById("HiddenField_pid").value;
  new Ajax.Updater('pbl', 'get_pbl.aspx?pid='+prid+'', {
  
  //parameters: { pid: 'PR188563' }
   onLoading: function x(){
                             document.getElementById("loading_pbl").innerHTML="<center><span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                document.getElementById('loading_pbl').innerHTML="";
    }
  });
}

function loadSprintvelocity(sprid,loadhere,loading)
{
  
  new Ajax.Updater(''+loadhere+'', 'get_sprintvelocity.aspx?spid='+sprid+'', {
  
  
    onLoading: function x(){
                             document.getElementById(loading).innerHTML="<center><span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });
}

function loadTasks(uid,pblid,loadhere,loading){

 
  new Ajax.Updater(''+loadhere+'', 'get_sprinttasks.aspx?uid='+uid+'&pblid='+pblid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loading).innerHTML="<center><span class='loading1'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });


}

function updateTask(pblid,tskid,value,type)
{

   new Ajax.Request('get_updatetask.aspx?tskid='+tskid+'&&v='+value+'&&t='+type+'', {
   
   onLoading: function x(){
                             document.getElementById('loading_'+pblid).innerHTML="<center><span class='loading1'>Loading ...</span></center>";
                          },
  
    onComplete: function load() {
                                   loadTasks(document.getElementById('HiddenField_uid').value,pblid,'tasks_'+pblid,'loading_'+pblid);
    
                              }
}); 


}

function take(tskid,pblid,type)
{
var uid=document.getElementById('HiddenField_uid').value;
/*alert(uid);
alert(tskid);
alert(pblid);
alert(type);*/
 new Ajax.Request('get_taketask.aspx?tskid='+tskid+'&&type='+type+'&&uid='+uid+'', {
   
   onLoading: function x(){
                             document.getElementById('loading_'+pblid).innerHTML="<center><span class='loading1'>Loading ...</span></center>";
                          },
  
    onComplete: function load() {
                                   loadTasks(document.getElementById('HiddenField_uid').value,pblid,'tasks_'+pblid,'loading_'+pblid);
    
                              }
}); 
}

function loadburndown(sprid,loadto)
{


 new Ajax.Updater(''+loadto+'', 'get_burndown.aspx?sprid='+sprid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadto).innerHTML="<span class='loading1'>Loading ...</span>";
                          },
                          
    onComplete: function x(){
                             document.getElementById('loading_'+loadto).innerHTML="";
                          }
  });



}



function loadSprintWall(sprid,loadhere,loading){

 
 new Ajax.Updater(''+loadhere+'', 'get_sprintwall.aspx?sprid='+sprid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loading).innerHTML="<center><span class='loading'>Loading ...</center></span>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });
}

/******* Project Permissions ****************/

function updatePermission(user,prjid,loadhere,loading)
{

     
     
     var SP1= document.getElementById(user+'_SP1').checked;
     var SP2= document.getElementById(user+'_SP2').checked;
     
     var BL1= document.getElementById(user+'_BL1').checked;
     var BL2= document.getElementById(user+'_BL2').checked;
     
     var permissions="";
     if(SP1==true)
     {
        permissions=permissions+'SP1,';     
     }
     if(SP2==true)
     {
        permissions=permissions+'SP2,';     
     }
      if(BL1==true)
     {
        permissions=permissions+'BL1,';     
     }
     if(BL2==true)
     {
        permissions=permissions+'BL2,';     
     }
    // alert(permissions);
     
     
     
     new Ajax.Request('get_permissionadd.aspx?uid='+user+'&pid='+prjid+'&rights='+permissions+'', {
  
  
         onLoading: function x(){
         
                            
                              document.getElementById(loading).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
         onComplete: function x(){
         
                           //  document.getElementById(loading).innerHTML="";
                           // new Effect.Highlight($('cell_'+user), { startcolor: '#ffff99', endcolor: '#ffffff' });
                          // Effect.Pulsate($('cell_'+user));
                            loadPermission(prjid,user,loadhere,loading)
                          }
        });
     
     
}


function loadPermission(pid,uid,loadhere,loading){

 
 new Ajax.Updater(''+loadhere+'', 'get_loadpermissions.aspx?pid='+pid+'&uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loading).innerHTML="<span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });
}

function light()
{

new Effect.Highlight($(x), { startcolor: '#ffff99', endcolor: '#ffffff' });


}

function sendfeedback(name,email,tel,comment,loadhere,loading)
{
	
	
	new Ajax.Updater(''+loadhere+'', 'get_feedback.aspx?name='+name+'&email='+email+'&tel='+tel+'&comment='+comment+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<center><span class='loading'>Please wait ...</center></span>";
                          }
  });
	
	
}

function loadPBLsts(pid,loadhere,loading){

 
 new Ajax.Updater(''+loadhere+'', 'get_pblsts.aspx?pid='+pid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loading).innerHTML="<span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });


}

function loadPBLstsbug(pid,loadhere,loading){

 
 new Ajax.Updater(''+loadhere+'', 'get_pblstsbug.aspx?pid='+pid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loading).innerHTML="<span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });


}


function contact(subject,name,email,tel,comment,loadhere,loading)
{
	
	
	new Ajax.Updater(''+loadhere+'', 'get_contact.aspx?subject='+subject+'&name='+name+'&email='+email+'&tel='+tel+'&comment='+comment+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<center><span class='loading'>Please wait ...</center></span>";
                          }
  });
	
	
}


/***************|||||||||| ClassTube ||||||||************************/

function loadModules(cid,loadhere,loading,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_modules.aspx?cid='+cid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loading).innerHTML="<span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });


}
/****** Loading groups for the student home *****/

function loadGroups(type,loadhere,loading){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_groups.aspx?type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loading).innerHTML="<span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });


}


function loadCourses(gid,loadhere,loading){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_courses.aspx?gid='+gid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loading).innerHTML="<span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
                             document.getElementById(loading).innerHTML="";
                          }
  });


}

function loadCourseinfo(cid,loadhere,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_courseinfo.aspx?cid='+cid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span></center>";
                          }
  });


}

function loadModuleinfo(mid,loadhere,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_moduleinfo.aspx?mid='+mid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span></center>";
                          },
                          
    onComplete: function x(){
    
                               /** Setting selected modules highlight color ****/
                             /*   var x=document.getElementsByName('modules')
                                for(var i=0;i<x.length;i++)
                                {
                                    $(x[i]).className="modulelist"
                                }
                                
                                
                              

                                
    
                                $('M_'+mid+'').className="moduleliston"*/
                          }
  });


}
function loadTests(mid,loadhere,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_moduletests.aspx?mid='+mid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span></center>";
                          }
  });

}

function loadAssignment(mid,loadhere,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_moduleassignments.aspx?mid='+mid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span></center>";
                          }
  });

}

function loadVideo(mid,loadhere,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_modulevideos.aspx?mid='+mid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span></center>";
                          }
  });

}

function loadDocument(mid,loadhere,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_moduledocument.aspx?mid='+mid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span></center>";
                          }
  });

}



function loadModuleContents(mid,type)
{
 
 $('moduleid').value=mid;
  
 
  loadModuleinfo(mid,"moduleinfo",type)
  loadTests(mid,"test",type)
  loadAssignment(mid,"assignment",type)
  loadVideo(mid,"video",type)
  loadDocument(mid,"document",type)
  
  
 
    
}


function getSubscribeButton(cid,uid,loadhere,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_subscribebutton.aspx?cid='+cid+'&uid='+uid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span></center>";
                          }
  });

}

function getSubscriptions(uid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_subscriptions.aspx?uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="Loading...";
                          },
                          
    onComplete: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}

function subscribezero(uid,cid,loadhere){


 new Ajax.Updater(''+loadhere+'', 'ajax/subscribezero.aspx?uid='+uid+'&cid='+cid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'><center><h3>Please wait...</h3></center</span>";
                          },
                          
    onComplete: function x(){
                             location.href="subscribe_complete.aspx";
                          }
  });


}


function sendEvalRequest(cid,mid,uid,loadhere){


 new Ajax.Updater(''+loadhere+'', 'ajax/send_eveluation_request.aspx?cid='+cid+'&mid='+mid+'&uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Please wait...</span>";
                          },
                          
    onComplete: function x(){
                             alert("Evaluation request sent");
                          }
  });


}


function loadTestinfo(tid,loadhere,type){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_testinfo.aspx?tid='+tid+'&type='+type+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span></center>";
                          }
  });


}

/*  test initialse */
function testStart(tid,loadhere,uid){


 
 new Ajax.Request( 'ajax/test_initialise.aspx?tid='+tid+'&uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Please wait...</span></center>";
                          },
                          
    onComplete: function x(transport){
                             $(loadhere).innerHTML="";
                             //alert(transport.responseText);
                             location.href=transport.responseText;
                          }
  });


}

function testRun(attid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/test_getquestion.aspx?attid='+attid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="Loading...";
                          }
  });


}
function testscore(attid,loadhere)
{
 new Ajax.Updater(''+loadhere+'', 'ajax/get_testscore.aspx?attid='+attid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="Loading...";
                          },
                          
    onComplete: function x(transport){
                             document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });
}

function updateAnswer(attid,qid,loadhere)
{
    var option=document.getElementsByName('ans');

    counter=0;
    optid="";

   for (var i=0; i < option.length; i++)
   {
     if (option[i].checked==true)
      {
       counter=1;
       optid=option[i].value;
      }
   }
   
   if(counter==0)
   {
   alert("Please select your answer");
   }
   
   else{
   
   
       new Ajax.Request( 'ajax/test_updateanswer.aspx?attid='+attid+'&qid='+qid+'&optid='+optid+'', {
  
  
       onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="Loading...";
                          },
                          
       onComplete: function x(transport){
                             var sts=transport.responseText;
                             if(sts=='0')
                             {
                             testreview_instantshow(attid,qid,optid,loadhere)
                             }
                             else
                             {
                                testRun(attid,loadhere);
                                
                              }
                              testscore(attid,'score');
                          }
  });
   
   }
   
   
  
}
function testreview_instantshow(attid,qid,optionselected,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/test_instantreview.aspx?qid='+qid+'&optid='+optionselected+'&attid='+attid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          }
  });


}

function gotoTestReview()
{
TID=$('HiddenField_tid').value;
ATTID=$('HiddenField_attid').value

location.href="test_review.aspx?tid="+TID+"&attid="+ATTID+"";
}

function saveTest()
{
CID=$('H_CID').value;
MID=$('H_MID').value;

var x=confirm("Are you sure you want to save and exit this test?");
if(x==true)
{
location.href="course_room.aspx?cid="+CID+"&mid="+MID+"&sid=SID";
}

}

function backtoclassroom()
{
CID=$('H_CID').value;
MID=$('H_MID').value;


location.href="course_room.aspx?cid="+CID+"&mid="+MID+"&sid=SID";


}



function testreview_questions(attid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/test_reviewquestions.aspx?attid='+attid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          }
  });


}

function testreview_show(qid,optionselected,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/test_getreview.aspx?qid='+qid+'&optid='+optionselected+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          }
  });


}

function get_paybutton(cid,uid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/subscribe_paybutton.aspx?cid='+cid+'&uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          }
  });


}

function login(uname,password,loadhere)
{

     new Ajax.Request( 'ajax/login.aspx?uname='+uname+'&password='+password+'', {
  
  
       onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="Loading...";
                          },
                          
       onComplete: function x(transport){
       
                             document.getElementById(loadhere).innerHTML="";
                             
                             var sts=transport.responseText;
                             
                             if(sts=="S")
                             {
                             location.href="student_home.aspx";
                             }
                             else if(sts=="I")
                             {
                             location.href="instructor_home.aspx";
                             }
                             else{
                             alert("Check your username and password");
                             }
                             
                          }
   });
}

function get_homecount(loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_counts.aspx', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          }
  });


}

function get_homeregistrants(loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_registrants.aspx', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ClassTube users...</span>";
                          }
  });


}

function get_savedtests(mid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/test_savedtests.aspx?mid='+mid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          }
  });


}

function get_testresult(mid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/test_results.aspx?mid='+mid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          }
  });


}

function test(loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/test.aspx', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          }
  });


}

function get_scraps(cid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_scraps.aspx?cid='+cid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}

function scrap_send(cid,uid,scrap,refresh,loadhere){

// alert(cid+','+uid+','+scrap);
 new Ajax.Request('ajax/put_scraps.aspx?cid='+cid+'&uid='+uid+'&scrap='+scrap+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<center><h4>Please wait ...</h4></center>";
                          },
                          
       onComplete: function x(){
                             
                             Lightbox.hideBox();
                             if(refresh=="yes")
                             {
                               get_scraps(cid,"scraps")
                             }
                          }
  });


}

function duplicate(qid,loadhere){


var x=confirm(qid+" : Are you sure you want ot add this question")
if(x==true)
{
 new Ajax.Request('ajax/zduplicatequestion.aspx?qid='+qid+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="Please wait ...";
                          },
                          
       onComplete: function x(transport){
                             
                              document.getElementById(loadhere).innerHTML=transport.responseText;
                             
                          }
  });
  }


}

function scrapdelete(id,refresh,loadhere){



 new Ajax.Request('ajax/get_scraps_delete.aspx?id='+id+'', {
  
  onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                            
       onComplete: function x(transport){
                             
                            if(refresh=="yes")
                                {
                                  get_scraps($('HiddenField_cid').value,loadhere)
                                }
                             
                          }
  });
 


}

function get_subscribers(cid,start,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/subscribers_get.aspx?cid='+cid+'&start='+start+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}




function coupenCheck()
{
activateCoupen($('COUPID').value,$('HiddenField_cid').value,'coupen')
}

function activateCoupen(COUPID,COURSEID,loadhere){



 new Ajax.Request('ajax/coupen_activate.aspx?coupid='+COUPID+'&&cid='+COURSEID+'', {
  
  onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Please wait ...</span>";
                          },
                            
       onComplete: function x(transport){
                             
                            document.getElementById(loadhere).innerHTML="";
                            
                          var value=  transport.responseText;
                         
                          if(value=='done')
                          {
                          location.href="subscribe_complete.aspx";
                          }
                          
                          
                          else if(value=='0')
                          {
                            alert("Invalid coupen number");
                          }
                          else if(value=='used')
                          {
                            alert("This coupen is already used");
                          }
                          else if(value=='invalidcourse')
                          {
                            alert("This coupen cannot be used with this course");
                          }
                          else if(value=='expired')
                          {
                            alert("The validity of this coupen has expired");
                          }
                          
                             
                          }
  });
 


}


function createCoupen(cid,expdate,loadhere){



 new Ajax.Request('ajax/coupen_create.aspx?cid='+cid+'&exp='+expdate+'', {
  
  onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                            
       onComplete: function x(transport){
                              document.getElementById(loadhere).innerHTML="";
                          loadCoupens(cid,'coupens')
                             
                          }
  });
 


}


function loadCoupens(cid,loadhere){


 new Ajax.Updater(''+loadhere+'', 'ajax/coupen_load.aspx?cid='+cid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}

/************** Personal scraps ***************************/

function showPersonalScrapBox(to,refresh)
{
      Lightbox.showBoxByAJAX('scrap_personal_send.aspx?to='+to+'&refresh='+refresh+'', 420, 300);return false;
}


function scrapSendPersonal(to,scrap,refresh,loadhere){

 new Ajax.Request('ajax/scraps_send.aspx?to='+to+'&scrap='+scrap+'', {
  
  onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<center><h4>Sending scrap. Please wait ...</h4></center>";
                          },
                            
       onComplete: function x(transport){
       
                            Lightbox.hideBox();
                            if(refresh=="yes")
                                {
                                 PersonalScraps_load(to,'no','Pscraps')
                                }
                             
                          }
  });

}

function PersonalScraps_load(uid,refresh,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/scraps_load.aspx?uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}
function PersonalScraps_delete(id,refresh,loadhere,whosscrapbook){



 new Ajax.Request('ajax/scraps_delete.aspx?id='+id+'', {
  
  onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                            
       onComplete: function x(transport){
                             
                            if(refresh=="yes")
                                {
                                  PersonalScraps_load(whosscrapbook,'no','Pscraps')
                                }
                             
                          }
  });
 
}

/************ End *************************/

function getProfile(uid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_profile.aspx?uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}

function getProfileComplete(uid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_profile_complete.aspx?uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}
function getProfileCompleteEdit(uid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/get_profile_complete_edit.aspx?uid='+uid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}

function getProfileCompleteUpdate(uid,loadhere){

 var u_fname=$('u_fname').value;
 var u_lname=$('u_lname').value;
 var u_email=$('u_email').value;
 var u_tel=$('u_tel').value;
 var u_address=$('u_address').value;
 var u_city=$('u_city').value;
 var u_state=$('u_state').value;
 var u_country=$('u_country').value;
 

 var link='ajax/get_profile_complete_update.aspx?uid='+uid+'&u_fname='+u_fname+'&u_lname='+u_lname+'&u_email='+u_email+'&u_tel='+u_tel+'&u_address='+u_address+'&u_city='+u_city+'&u_state='+u_state+'&u_country='+u_country+'';
 
 
 new Ajax.Request(''+link+'', {
  
  onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                            
       onComplete: function x(transport){
                          // alert(transport.responseText);
                           getProfileComplete(uid,'profile')
                          }
  });
 
}

/*************** End of profile ************/

function classtubers(start,loadhere,search){


 
 new Ajax.Updater(''+loadhere+'', 'ajax/classtubers.aspx?search='+search+'&start='+start+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Searching ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}
function autocomplete(searchstring)
{

 if(searchstring.length >= 3)
 {
 //alert(searchstring.length);
   classtubers('0','classtubers',searchstring)
 }
 
}


function get_wallupdates(cid,loadhere){

 
 new Ajax.Updater(''+loadhere+'', 'ajax/wall_updates.aspx?cid='+cid+'', {
  
  
   onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Loading ...</span>";
                          },
                          
       onComplete: function x(){
                             
                            document.getElementById('loading_'+loadhere).innerHTML="";
                          }
  });


}

/************ Data Entry *******************/

function dataentry_add(id,q,o1,o2,o3,o4,des,correct,loadhere){

var x= confirm("Really want to add ?");

if(x==true)
{

 new Ajax.Request('ajax1/data_questionadd.aspx?tid='+id+'&q='+q+'&o1='+o1+'&o2='+o2+'&o3='+o3+'&o4='+o4+'&des='+des+'&correct='+correct+'', {
  
  onLoading: function x(){
                             document.getElementById('loading_'+loadhere).innerHTML="<span class='loading'>Plsease wait ...</span>";
                          },
                            
       onComplete: function x(transport){
                             
                           document.getElementById('loading_'+loadhere).innerHTML=transport.responseText;
                             
                          }
  });
}
 
}

/*********** feedback **********/
function sendfeedback(name,email,tel,comment,loadhere,loading)
{
	
	
	new Ajax.Updater(''+loadhere+'', 'ajax/get_feedback.aspx?name='+name+'&email='+email+'&tel='+tel+'&comment='+comment+'', {
  
  
   onLoading: function x(){
                             document.getElementById(loadhere).innerHTML="<center><span class='loading'>Please wait ...</center></span>";
                          }
  });
	
	
}

function sendbugreport(qid,comment,loadhere)
{

new Ajax.Request('ajax/reportbug.aspx?qid='+qid+'&comment='+comment+'', {
  
  
   onLoading: function x(){
                               $('comment').disabled=true;
                               $('commentbutton').disabled=true;
                             document.getElementById(loadhere).innerHTML="Please wait ...";
                          },
                          
                          
    onComplete: function x(transport){
                             
                          document.getElementById(loadhere).innerHTML="";
                          sts=transport.responseText;
                             if(sts!="done")
                             {
                              $('comment').disabled=false;
                              $('commentbutton').disabled=false;
                               alert(sts);
                             }
                             else{                             
                               
                                alert("Thank you for your feed back")
                               
                             }
                                                        
                          }
  });


}

function openRecoment(cid)
{
 Lightbox.showBoxByAJAX('course_recoment.aspx?cid='+cid+'', 400, 400);return false;
}

function sendrecomentation(cid,email,msg,loadhere)
{

new Ajax.Request('ajax/recoment_send.aspx?email='+email+'&msg='+msg+'', {
  
  
   onLoading: function x(){
                              
                               $('postbutton').disabled=true;
                             document.getElementById(loadhere).innerHTML="Please wait ...";
                          },
                          
                          
    onComplete: function x(transport){
                             
                          document.getElementById(loadhere).innerHTML="";
                          sts=transport.responseText;
                             if(sts!="done")
                             {
                             
                              $('postbutton').disabled=false;
                               alert(sts);
                             }
                             else{                             
                               
                                Lightbox.hideBox();
                                alert("Mail is sent");
                               
                             }
                                                        
                          }
  });


}

function ON(id,onclass)
{
$(id).setAttribute("class", onclass);
}
function OFF(id,onclass)
{
$(id).setAttribute("class", onclass);
}

