var xml; 


function Schedule()
{
   if(document.frmSch.workout.value==0)//workout
   {
    alert('Please select Workout Type');
    return false;
   }

}

//For checking user has selected workout or not
function checkfrm()
{
    if(document.frmrecord.check.value!=1)
    {
        if(document.frmrecord.workout.value==0)
       {
            alert("Please Select Workout Type");
            return false;
       } 
    }  
    

}

//******************************************************************/
//For checking Cardio frm

function checkCardiofrm()
{
         if(document.frmcard.check.value!=1)
         {
          if(document.frmcard.Cexercise.value=="0")
          {
             return false;
          }
          if(document.frmcard.distance.value=="")
          {
            document.frmcard.distance.value=0;  
           }
          if(isNaN(document.frmcard.distance.value))
            {
              document.frmcard.distance.value=0;  
            }
            
           if(document.frmcard.txttime.value=="")
          {
           document.frmcard.txttime.value=0;  
           }
          if(isNaN(document.frmcard.txttime.value))
            {
              document.frmcard.txttime.value=0;  
            }
        //txtbeat
        if(document.frmcard.txtbeat.value=="")
          {
           document.frmcard.txtbeat.value=0;  
           }
          if(isNaN(document.frmcard.txtbeat.value))
            {
             document.frmcard.txtbeat.value=0;  
             }
         }
}  
//******************************************************************/

//For checking the Yoga Details

function checkYogafrm ()
{

  if(document.frmyoga.txttime.value=="")
  {
   document.frmyoga.timetxt.value=0;  
   }
  if(isNaN(document.frmyoga.timetxt.value))
    {
       document.frmyoga.timetxt.value=0; 
    }
    
}

/******************************************************************/

    function checkDVDfrm()
    {
    
     if(document.dvdworkout.dvd.value=="0")
          {
           alert('Please Select DVD');
           document.dvdworkout.dvd.focus();  
           return false;
          }
          
       if(document.dvdworkout.timetxt.value=="")
      {
       document.frmyoga.timetxt.value=0; 
      }  
      if(isNaN(document.dvdworkout.timetxt.value))
    {
      document.frmyoga.timetxt.value=0; 
    }
   
    }
    // get scheduled workout details
    function fnScheduledWtDetails(val,schid,recid)
    {
        var url="getRec1.php?wid="+val+"&recid="+recid+"&schid="+ schid
        xmlHttp=GetXmlHttpObject(putDetails)
        xmlHttp.open("GET", url , true)
        xmlHttp.send(null)    
    }
    
   //getworkoutdetails                                     
    
    /*function getDetails(val)
     {
        //document.getElementById("eid").innerHTML ="<img src='../images/loading2.gif'>";
        var workout = document.getElementById("workout").value;
         if(workout >= 1)
        {
            var url=DIR+"/getSubRecords.php?wid="+val+"&load=1"; 
            xmlHttp=GetXmlHttpObject(putDetails)
            xmlHttp.open("GET", url , true)
            xmlHttp.send(null)    
        }
        else
        {
           $('loadOnNeed').style.display = 'none'; 
           if($('dlBtn'))
           $('dlBtn').style.display = 'none'; 
        }  
     }*/ 
     
     function getDetails(val,isRotation,index)
     {
     
     var append = (isRotation)?'sidebar_rotation_weight':'sidebar_weight';   
        //document.getElementById("eid").innerHTML ="<img src='../images/loading2.gif'>";
        var workout = document.getElementById("workout").value;
         if(workout >= 1)
        {
            var url=DIR+"/getSubRecords.php?wid="+val+"&load=1&isRotation="+isRotation+"&index="+index; 
             nowLoading('block');      
            new Ajax.Updater('weightExerciseList',url,{
                onComplete:function(req)
                        {
                            var result = req.responseText 
                            res = result.split('~');      
                            $('loadOnNeed').style.display = 'block';  
                             nowLoading('none');      
                            document.getElementById("weightExerciseList").innerHTML =res[0];
                            fnloadExercises('name','sort');    
                            if($('dlBtn') && $('downloadPdf'))
                            {  
                              $('dlBtn').style.display = 'block'; 
                                //$('printBtn').style.display = 'block';              
                            /* if(navigator.appName == 'Netscape')   
                                 $('downloadPdf').setAttribute('onclick',res[1]);
                             else
                                $('downloadPdf').onclick= function() { res[1] };   */ 
                                
                            } 
                           
                            $(append+"_txttime_"+index).value = res[4];
                            $(append+"_METVal_"+index).value = res[5];
                            $(append+"_calVal_"+index).value = res[7];
                            $('itemDescription').value = res[3]; 
                            $('notes').value = res[2]; 
                            $("level").value = res[6];  
                        },
                evalScripts: true   
                });
    
           /* xmlHttp=GetXmlHttpObject(putDetails)
            xmlHttp.open("GET", url , true)
            xmlHttp.send(null)    */
        }
        else
        {
           $('loadOnNeed').style.display = 'none'; 
           if($('dlBtn'))
           $('dlBtn').style.display = 'none'; 
        }  
     }

     function getDetailsForAdd(val,isRotation)
     {
     
        //document.getElementById("eid").innerHTML ="<img src='../images/loading2.gif'>";
        var workout = document.getElementById("workout").value;
        if(workout >= 1)
        {
            var url=DIR+"/getSubRecords.php?wid="+val+"&load=1&isRotation="+isRotation; 
               nowLoading('block');       
            new Ajax.Updater('weightExerciseList',url,{
                onComplete:function(req)
                        {
                            var result = req.responseText 
                            res = result.split('~');      
                            $('loadOnNeed').style.display = 'block';  
                               nowLoading('none');       
                            document.getElementById("exerciseList").innerHTML =res[0];
                            fnloadExercises('name','sort');    
                            if($('dlBtn') && $('downloadPdf'))
                            {  
                              $('dlBtn').style.display = 'block';            
                                //$('printBtn').style.display = 'block';              
                           /*    if(navigator.appName == 'Netscape')   
                                 $('downloadPdf').setAttribute('onclick',res[1]);
                             else  
                                $('downloadPdf').onclick= function() { res[1] };   */   
                            }
                            $("txttime").value = res[4];
                            $("METVal").value = res[5];
                            $("calVal").value = res[7];
                            $('itemDescription').value = res[3]; 
                            $('notes').value = res[2]; 
                            //$("level").value = res[6];  
                        },
                evalScripts: true   
                });
    
           /* xmlHttp=GetXmlHttpObject(putDetails)
            xmlHttp.open("GET", url , true)
            xmlHttp.send(null)    */
        }
        else
        {
           $('loadOnNeed').style.display = 'none'; 
           if($('dlBtn'))
           $('dlBtn').style.display = 'none'; 
        }  
     }
     
      function putDetails()
      {
          
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
        {
              //document.getElementById("eid").innerHTML ="<img src='../images/loading2.gif'>"; 
              var result=xmlHttp.responseText; 
                    result = result.split('~');      
              
              $('loadOnNeed').style.display = 'block';  
               $('dlBtn').style.display = 'block';              
              document.getElementById("weightExerciseList").innerHTML =result[0];   
              $('dlBtn').setAttribute('onclick',result[1]);
        }
     }
   
    function GetXmlHttpObject(handler)
    {
        var objXmlHttp=null

        if (navigator.userAgent.indexOf("Opera")>=0)
        {
            alert("This example doesn't work in Opera")
            return
        }
        if (navigator.userAgent.indexOf("MSIE")>=0)
        {
            var strName="Msxml2.XMLHTTP"
            if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
            {
                strName="Microsoft.XMLHTTP"
            }
            try
            {
                objXmlHttp=new ActiveXObject(strName)
                objXmlHttp.onreadystatechange=handler
                return objXmlHttp
            }
            catch(e)
            {
                alert("Error. Scripting for ActiveX might be disabled")
                return
            }
        }
            if (navigator.userAgent.indexOf("Mozilla")>=0)
            {
                objXmlHttp=new XMLHttpRequest()
                objXmlHttp.onload=handler
                objXmlHttp.onerror=handler
                return objXmlHttp
            }
    }
    
    function fnShoeDetails(Val){
        var mywindow=window.open('exer_details.php?exerid='+Val,'mywindow','status=0,toolbar=0,scrollbars=1,resizable=1,height=500,width=460,top=500,left=300');
        mywindow.moveTo(100,100);
    }
    
    function savsAs()
    {
        if (document.getElementById('WOName').value == "")
        {
            var nam = prompt("Enter New Workout Name","");
            if(nam !=null)
            {
                document.getElementById('WOName').value = nam;
                document.frmrecord.submit;
            }
        }
        
        
    }
  /************************************************************************************************
     @Name : fnGetActList
     @params:  sub-category id
     @return: Replaces list of exercies with new list
     purpose: To send a request to server to get the list of activities for a given sub-category
     Created by: PrasannaKumari B
    ************************************************************************************************/
    
   /* function fnGetActList(Val,actlist,trackId)
    {
        // track id == 1 is for sidebar 
        // track id == 2 is for main 
        
    
       var url=DIR+"/getActList.php?task=List&val="+Val+"&trackId="+trackId;
                alert(url)
     var   xml=GetXmlHttpObject(fnReplaceList(actlist));
        alert(xml)
        xml.open("GET", url , true);
        xml.send(null);
    }     
            
    /***********************************
    function accept the rewponse from server and to replace div tag content
    **************************************
    function fnReplaceList(refreshId)
    {     
        if (xml.readyState==4 || xml.readyState=="complete")
        {            
            var newResult=xml.responseText;
                     alert(newResult)
            var returnStr = newResult.split("~");
                                
            if (returnStr[0] == 1)
            {                                   alert(refreshId)           
//                document.getElementById('ActList').innerHTML=returnStr[1]; 
                document.getElementById(refreshId).innerHTML=returnStr[1]; 
                $(refreshId).innerHTML='change';
                
            }
            if (returnStr[0] == 2)
            {
//              document.getElementById('METVal').value=returnStr[1]; 
              document.getElementById(refreshId).value=returnStr[1];
              
              if(refreshId == 'sidebar_METVal') 
                getCalBurnedForSideBar()
              else  
                getCalBurned()
            }
        }
    
    }        */
    
    
    
    /*function fnGetMET(Val,metVal,trackId)
    {    
    // track id == 1 is for sidebar 
        // track id == 2 is for main                    
       var url=DIR+"/getActList.php?task=MET&val="+Val+"&trackId="+trackId;
       
        xmlHttp=GetXmlHttpObject(fnReplaceList(metVal));
        xmlHttp.open("GET", url , true);
        xmlHttp.send(null);
    }              */

//Function to calculate calories burned    
function getCalBurned(met_id)
{
      
   var metval = document.getElementById(met_id).value
   var bmival = document.getElementById('BMIVal').value
   var utime = document.getElementById('txttime').value
    
   /*if (isNaN(metval) || metval == "")
   {
        alert("Select an activity");
        return false;
   }
   
   if (isNaN(utime) || utime == "")
   {
      document.getElementById('txttime').value=0  
   } */ 
   if (isNaN(utime))
   {
        alert("Text Duration Should be have only Numbers") 
       $("txttime").focus();
       $("txttime").select();  
       return false;
   }
   
   var cals =   Math.round(((metval*bmival* 3.5)/200)*utime,2)
  
     document.getElementById('calVal').value = cals
     
   
}

//Function to calculate calories burned    DVD
function getCalBurnedForSideBar2(isRotation,index)
{    
    var append = (isRotation)?'sidebar_rotation_DVD':'sidebar_DVD';
          
   var metval = document.getElementById(append+'_METVal_'+index).value
   var bmival = document.getElementById(append+'_BMIVal_'+index).value
   var utime = document.getElementById(append+'_txttime_'+index).value
                   
   if (isNaN(utime))
   {
        alert("Text Duration Should be have only Numbers") 
       $(append+"_txttime_"+index).focus();
       $(append+"_txttime_"+index).select();  
       return false;
   }
   
   var cals =   Math.round(((metval*bmival* 3.5)/200)*utime,2)
   
   document.getElementById(append+'_calVal_'+index).value = cals;
//   document.getElementById('sidebar_rotation_DVD_calVal').value = cals
                                    
}


//Function to calculate calories burned    
function getCalBurnedForSideBar(isRotation,index,type)
{                 
    var append;
                                          
    switch(type)
    {
        case 1:
            append = (isRotation)?'sidebar_rotation_yoga':'sidebar_yoga';
            break;
        
        case 2:
            append = (isRotation)?'sidebar_rotation':'sidebar';    
            break;
            
        case 3:
            append = (isRotation)?'sidebar_rotation_weight':'sidebar_weight';    
            break;
            
        case 4:
            append = (isRotation)?'sidebar_rotation_DVD':'sidebar_DVD';    
            break;
        
        case 5:
            append = (isRotation)?'sidebar_rotation_DVD':'sidebar_STS';    
            break;                                                                
            
        case 6:
            append = (isRotation)?'sidebar_rotation_CT':'sidebar_CT';    
            break;  
            
        case 7:
            append = (isRotation)?'sidebar_rotation_Core':'sidebar_Core';    
            break;                                                                
        
        case 8:
            append = (isRotation)?'sidebar_rotation_KB':'sidebar_KB';    
            break;                                                                
    }  
    
          
   var metval = document.getElementById(append+'_METVal_'+index).value
   var bmival = document.getElementById(append+'_BMIVal_'+index).value
   var utime = document.getElementById(append+'_txttime_'+index).value
                   
   if (isNaN(utime))
   {
        alert("Text Duration Should be have only Numbers") 
       $(append+"_txttime_"+index).focus();
       $(append+"_txttime_"+index).select();  
       return false;
   }
   
   var cals =   Math.round(((metval*bmival* 3.5)/200)*utime,2)
   
   document.getElementById(append+'_calVal_'+index).value = cals;
                                    
}
/*function getCalBurnedForSideBar(isRotation,index)
{                                                     
    var append = (isRotation)?'sidebar_rotation':'sidebar';
          
   var metval = document.getElementById(append+'_METVal').value
   var bmival = document.getElementById(append+'_BMIVal').value
   var utime = document.getElementById(append+'_txttime').value
    
   if (isNaN(utime))
   {
        alert("Text Duration Should be have only Numbers") 
       $(append+"_txttime").focus();
       $(append+"_txttime").select();  
       return false;
   }
   
   var cals =   Math.round(((metval*bmival* 3.5)/200)*utime,2)
  
   document.getElementById(append+'_calVal').value = cals
                                    
}*/


//Function to calculate calories burned    
function getCalBurnedForSideBar1(isRotation) //for yoga should be changed
{
    var append = (isRotation)?'sidebar_rotation_yoga':'sidebar_yoga';
          
   var metval = document.getElementById(append+'_METVal').value
   var bmival = document.getElementById(append+'_BMIVal').value
   var utime = document.getElementById(append+'_txttime').value
    
   if (isNaN(utime))
   {
        alert("Text Duration Should have only Numbers") 
       $(append+"_txttime").value='';  
       $(append+"_txttime").focus();
       return false;
   }
   
   var cals =   Math.round(((metval*bmival* 3.5)/200)*utime,2)
//       alert(cals)
   document.getElementById(append+'_calVal').value = cals
                                    
}


 function fnGetYogaMet(val,met)
 {      
    if (val == "" || val==null)
      document.getElementById('METVal').value=0;
    else
    {  
        var url=DIR+"/getYogaMet.php?task=MET&val="+val;
       
       new Ajax.Request(url,
                    {   
                        method: 'get',         
                        
                        onComplete:function(response)
                        
                        {   
                               nowLoading('none');    
                               
                               var result = response.responseText;
                               
                               $(met).value = result;
                               
                        }
                    
    } 
    );
 }
 }
 
 function fnYogaMET()
 {
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      {
            var result=xmlHttp.responseText;
            document.getElementById('sidebar_yoga_METVal').value=result;
      }
 }
 
 function fnGetDVDMET(val,load)
 {   
     if (val == "" || val==null)
     {
        alert("Please Select the DVD");
     } 
     else
     {  
         var url=DIR+"/getDVDMet.php?val="+val+"&load="+load; 
         
         nowLoading('block');   
      
        new Ajax.Request(url,
                    {
                        method: "get",
                        
                        onComplete: function(response)
                        {
                        
                            var result = response.responseText;  
          
                            var res = result.split("~")
                            
                            nowLoading('none');  
                            
                            $('premixTitle').innerHTML = res[3];  
                            
                            $('dvd_premix').innerHTML = res[0];
                            
                            document.getElementById('METVal').value = res[1];
                            
                            document.getElementById('txttime').value = res[2];
                            
                            var cals;
                            
                            var bmival = document.getElementById('BMIVal').value
                            
                            cals = Math.round(((res[1]*bmival*3.5)/200)*res[2],2)
                            
                            document.getElementById('calVal').value = cals;  
                            
                          
                        
                        }
                    }
                    ) 
           
      }
 }
 
 function fnGetDVDMET_Val(val,isRotation,index)
 {   
     if (val == "" || val==null)
     {
        alert("Please Select the DVD");
     } 
     else
     {
        var append = (isRotation)?'sidebar_rotation_DVD':'sidebar_DVD'; 
       
//         var url=DIR+"/getDVDMet.php?val="+val; 
        var url=DIR+"/getDVDMet.php?val="+val+"&load=2&isRotation="+isRotation+"&index="+index;  // 2 indicates sidebar
         
        nowLoading('block');   
      
        new Ajax.Request(url,
                    {
                        method: "get",
                        
                        onComplete: function(response)
                        {
                        
                            var result = response.responseText;  
          
                            var res = result.split("~")
                            
                            nowLoading('none');  
                            
                            $('premixTitle_'+index).innerHTML = res[3];  
                            
                            $('dvd_premix_'+index).innerHTML = res[0];
                            
                            document.getElementById(append+'_METVal_'+index).value = res[1];
                            
                            document.getElementById(append+'_txttime_'+index).value = res[2];
                            
                            var cals;
                            
                            var bmival = document.getElementById(append+'_BMIVal_'+index).value
                            
                            cals = Math.round(((res[1]*bmival*3.5)/200)*res[2],2)
                            
                            document.getElementById(append+'_calVal_'+index).value = cals;  
                            
                        }
                    }
          ) 
           
      }
 }  
 
 
 function fnGetPremixMET(val,isRotation,index)     
 {
     var append = (isRotation)?'sidebar_rotation_DVD':'sidebar_DVD'; 
     
     if (val == 0 || val==null)
     {
       
          newval = $('dvd'+index).value
          
          fnGetDVDMET_Val(newval,isRotation,index);
     } 
     
     else
     {  
        var url=DIR+"/getDVDMet.php?premix_val="+val;
        
        new Ajax.Request(url,
                    {
                        method:'get',
                        
                        onComplete:function(response)
                        {
                            var result = response.responseText;
                            
                            var result1 = result.split("~"); 
                            
                            document.getElementById(append+'_METVal_'+index).value=fntrim(result1[0]);
                
                            document.getElementById(append+'_txttime_'+index).value=fntrim(result1[1]);
                
                            var cals;
                
                            var bmival = document.getElementById(append+'_BMIVal_'+index).value
                            
                            cals = Math.round(((result1[0]*bmival*3.5)/200)*result1[1],2)
                
                            document.getElementById(append+'_calVal_'+index).value= cals;
                            
                        }
                        
                        } 
                    )
     
 }
 
 }
 
 function fnGetPremixMETVal(val)
 {
        
     if (val == 0 || val==null)
     {
          newval = $('dvd0').value
          
          fnGetDVDMET(newval,1);
     } 
     
     else
     {  
        var url=DIR+"/getDVDMet.php?premix_val="+val;
        
        new Ajax.Request(url,
                    {
                        method:'get',
                        
                        onComplete:function(response)
                        {
                            var result = response.responseText;
                            
                            var result1 = result.split("~");
                            
                            document.getElementById('METVal').value=fntrim(result1[0]);
                
                            document.getElementById('txttime').value=fntrim(result1[1]);
                
                            var cals;
                
                            var bmival = document.getElementById('BMIVal').value
                            
                            cals = Math.round(((result1[0]*bmival*3.5)/200)*result1[1],2)
                
                            document.getElementById('calVal').value= cals;
                            
                        }
                        
                        } 
                    )
     
 }
 
 }
 
 
 
   
     /*********************************************************************************************
    Name    : fnCalWeight
    @params  : val - numeric, eleName - string
    Returns : None
    Purpose : Function to display wegight for an exercise when its % of 1RM is changed
    **********************************************************************************************/
    function fnCalWeight(val,eleName)
    {
           
      var indexVal = eleName.substring((eleName.length)-1);
      var rmVal = document.getElementById('RM'+indexVal).value ;
      var per =  document.getElementById('reps_per'+indexVal).value ;
      var reps =  document.getElementById('reps'+indexVal).value ; 
  
      if ( rmVal == "")
      {
        document.getElementById('RM'+indexVal).value=0;
      } 
        document.getElementById('weight'+indexVal).value  = Math.round(rmVal * per/100);
           // alert(document.getElementById('weight'+indexVal).value)
      
    }
    
    
    /*********************************************************************************************
    Name    : fnCalWeight
    @params  : val - numeric, eleName - string
    Returns : None
    Purpose : Function to display wegight for an exercise when its % of 1RM is changed
    **********************************************************************************************/ 
    function fnGetActList(Val,refreshId,trackId,isRotation,met_val)
    {
        // track id == 1 is for sidebar 
        // track id == 2 is for main 
    
       var url=DIR+"/getActList.php?task=List&val="+Val+"&trackId="+trackId+"&isRotation="+isRotation+"&met="+met_val;
       
       //show loading
       nowLoading('block');             
    
       new Ajax.Request(url,
                    {   
                        method: 'get',
                        onComplete:function(response)
                        {   
                             //hide loading
                             nowLoading('none');
                             
                              var newResult=response.responseText;
                                        
                              var returnStr = newResult.split("~");
                            
                              $(refreshId).innerHTML=returnStr[1]; 
                              //      $(refreshId).innerHTML='change';
                                
                        }
                    }    
                    );   
    }
    
        /*********************************************************************************************
    Name    : fnCalWeight
    @params  : val - numeric, eleName - string
    Returns : None
    Purpose : Function to display wegight for an exercise when its % of 1RM is changed
    **********************************************************************************************/
    function fnGetMET(Val,refreshId)
    {    
    // track id == 1 is for sidebar 
        // track id == 2 is for main                    
       var url=DIR+"/getActList.php?task=MET&val="+Val;
    
         //show loading
       nowLoading('block');             
    
       new Ajax.Request(url,
                    {   
                        method: 'get',
                        onComplete:function(response)
                        {   
                             //hide loading
                             nowLoading('none');
                             
                              var newResult=response.responseText;
                              
                              var returnStr = newResult.split("~");
                            
                              $(refreshId).value=returnStr[1]; 
                              
                              if(refreshId == 'sidebar_METVal')
                                getCalBurnedForSideBar()
                              else if(refreshId == 'sidebar_rotation_METVal') 
                                getCalBurnedForSideBar(1)
                              else  
                                 getCalBurned()                                     
                        }
                    }
                    );
         }                    
         
       /*********************************************************************************************
    Name    : fnCalWeight
    @params  : val - numeric, eleName - string
    Returns : None
    Purpose : Function to display wegight for an exercise when its % of 1RM is changed
    **********************************************************************************************/
 function fnGetDVDMETVal(val,isRotation,index,load)
 {
     var append = (isRotation)?'sidebar_rotation_DVD':'sidebar_DVD';     
     if (val == "" || val==null)
     {
        document.getElementById(append+'_METVal_'+index).value=0;
     } 
     else
     {  
       var url=DIR+"/getDVDMet.php?val="+val+"&isRotation="+isRotation+"&index="+index+"&load="+load; 
        
          //show loading
       nowLoading('block');          
    
       new Ajax.Request(url,
                    {   
                        method: 'get',
                        onComplete:function(response)
                        {   
                             //hide loading
                            nowLoading('none');
                             
                            var result = response.responseText;
                            var result1 = result.split("~");
                            $('dvd_premix_'+index).innerHTML = result1[0];
                            $('premixTitle_'+index).innerHTML = result1[3];    
                            document.getElementById(append+'_METVal_'+index).value=result1[1];
                            document.getElementById(append+'_txttime_'+index).value=result1[2];
                            var cals;
                            var bmival = document.getElementById(append+'_BMIVal_'+index).value;
                            cals = Math.round(((result1[1]*bmival*3.5)/200)*result1[2],2);
                            document.getElementById(append+'_calVal_'+index).value=cals;                                   
                        }
                    }
                    );
     }
 }
 
         /*********************************************************************************************
    Name    : fnCalWeight
    @params  : val - numeric, eleName - string
    Returns : None
    Purpose : Function to display wegight for an exercise when its % of 1RM is changed
    **********************************************************************************************/
 function fnloadExercises(val,eleName)
 {    
       if (eleName == "sort")
       {      
          var url= DIR+"/getExerciseDetails.php?eleName=sort&val="+val
       } 
       else 
       {
            var url=DIR+"/getExerciseDetails.php?val="+val // for create workout

       } 

       //show loading
       nowLoading('block');

       new Ajax.Request(url,
                    {   
                        method: 'get',
                        onComplete:function(response)
                        {   
                             //hide loading
                            nowLoading('none');
                             
                            var result = response.responseText;
                            $('loadSelectedExercises').innerHTML = result;
                        }
                    }
                    );

 }
 
 // get scheduled workout details
          /*********************************************************************************************
    Name    : fnCallOnBodyLoad
    @params  : val - numeric 
    Returns : None
    Purpose : Function to display wegight for an exercise when its % of 1RM is changed
    **********************************************************************************************/
    function fnCallOnBodyLoad(val,isRotation)
    {

        var url=DIR+"/getSubRecords.php?wid="+val+"&isRotation="+isRotation+"&load=2"; //2 to load from recorded table              

       //show loading
       nowLoading('block');

       new Ajax.Request(url,
                    {   
                        method: 'get',
                        onComplete:function(response)
                        {   
                             //hide loading
                            nowLoading('none');
                             
                            var result=response.responseText;
                            
                            $('loadOnNeed').style.display = 'block';
                            $("weightExerciseList").innerHTML =result; 
                        }
                    }
                    );  
     }

  
  
     