    
function BixPageSpecificFunctionsLoad()
{ 
   var tmpHeading = $("#bixHeading").html();
   tmpHeading = tmpHeading.replace('-', '[#]');
   tmpHeading =  tmpHeading.split('[#]')[0] + ' :: <span class="ib-green">' + tmpHeading.split('[#]')[1] + '</span>';
   $("#bixHeading").html(tmpHeading);
          
    $('.bix-td-option > a').click( function()
    {
        var lnkName = this.id;               
        var optNo   = lnkName.split('_')[1];            /*lnkOptionLink_A_11*/ 
        var qusNo   = lnkName.split('_')[2];
        var ansNo   = $('#hdnAnswer_' + qusNo ).val(); 
        
        if( optNo == ansNo ) // Show Answer & Description with Tick mark image..
        {
            $("#tdAnswerIMG_" + qusNo).slideDown('slow'); 
            $("#divAnswer_"  + qusNo).slideDown('slow');
        }
        else 
        {
            $("#tdOptionDt_" + optNo + '_' + qusNo).fadeTo('slow', 0.2);
        }
        
    }); 
     
    $(".calc-box").calculator({ 
        layout: $.calculator.scientificLayout,
        showOn: 'both', buttonImageOnly: true, buttonImage: '/_files/images/website/calculator.png'
    });
    
    var txtTitleID  = $('#hdnTitleID').val();
                                                /*  
    define( "IB_APTITUDE_ID"         , 1 );
    define( "IB_C_PROGRAMMING_ID"    , 2 ); 
    define( "IB_VERBAL_ABILITY_ID"   , 3 );  
    define( "IB_VERBAL_RESONING_ID"  , 4 );  
    define( "IB_LOGICAL_RESONING_ID" , 5 );  
     */
        
    if(txtTitleID == '2') TechnicalCPageSpecificFunctionsLoad(); 
    if(txtTitleID == '13') TechnicalJavaPageSpecificFunctionsLoad(); 
}

function SendBixReport(pQuesNo, pQuesID)
{
  var txtTitleID      = $('#hdnTitleID').val();
  var txtQuesNo       = pQuesNo;                /* '15' , '2351' */
  var txtQuesID       = pQuesID;         
  var txtReportedURL  = window.location.href;
  var txtReportedText = escape($('#txtReport_' + pQuesID).val());
   
  if((txtReportedText.length < 10) || ($('#txtReport_' + pQuesID).attr('name').indexOf('txtReport') == -1))
  {
      alert('Please enter the details about the bug/error that you have found.');
      return false;
  }

  txtReportedText = txtReportedText.replace(/\+/g,'%2B');

  $('#txtReport_'  + pQuesID).attr('disabled' , 'disabled');
  $('#btnReport_'  + pQuesID).attr('disabled' , 'disabled');
  
  var _paramData =  "TitleID="          + txtTitleID      + 
                    "&ReportedQuesNo="  + txtQuesNo       +
                    "&QuesID="          + txtQuesID       +
                    "&ReportedURL="     + txtReportedURL  +
                    "&ReportedText="    + txtReportedText ;  
                      
  $.ajax({
        type: "POST",
        url: "/_ajax/add-bix-report.php",
        data: _paramData,
        cache: false,
        success:    function(msg)
        {
        
             //alert( msg); 
             $('input#btnReport_'  + pQuesID).replaceWith($.trim(msg));
        
        }
  });
  
}

      
function SendBixDiscussion(pIntQuesAnsID)
{
  var intTitleID        = parseInt( $('input#hdnTitleID').val()   );
  var intQuesAnsID      = parseInt(pIntQuesAnsID); //parseInt( $('input#hdnQuesAnsID').val() ); 
  var txtUserName       = escape( $.trim( $('input#txtUserName').val()          )).replace(/\+/g,'%2B');     
  var txtEmailID        = escape( $.trim( $('input#txtEmailID').val()           )).replace(/\+/g,'%2B');     
  var txtDiscussionText = escape( $.trim( $('textarea#txtDiscussionText').val() )).replace(/\+/g,'%2B');
  var intIsAlertMe      = $('input#chkAlertMe').attr('checked')? 1 : 0; 
  var txtPostedURL      = window.location.href;
  
  if(txtDiscussionText.length < 5)
  {
      alert('Please enter your comments.');
      $('textarea#txtDiscussionText').focus();
      return false;
  }
  
  if(txtUserName.length < 3)
  {
      alert('Please enter your Name.');
      $('input#txtUserName').focus();
      return false;
  }

  if( txtEmailID.length > 0 )
  {
      /* Code for validate email id */      
      if( txtEmailID.indexOf('@') < 2  )
      {
          alert('Invalid email-id. Please check your email-id.');
          $('input#txtEmailID').focus();
          return false;
      }
  }

  
  if( (intIsAlertMe == 1) && (txtEmailID.length < 1) )
  {
      alert('Please enter your email-id if you want receive alert mail when new comments are posted.');
      $('input#txtEmailID').focus();
      return false;
  }
  
  if( !(intTitleID > 0) || !(intQuesAnsID > 0) )
  {
      alert('Invalid Title or Question details provided.');
      return false;
  }
  
  
  var _paramData =  "TitleID="          + intTitleID        + 
                    "&QuesAnsID="       + intQuesAnsID      +
                    "&UserName="        + txtUserName       +
                    "&EmailID="         + txtEmailID        +
                    "&DiscussionText="  + txtDiscussionText +
                    "&IsReceiveAlert="  + intIsAlertMe      +
                    "&PostedURL="       + txtPostedURL      ;  
  
  $.ajax({
        type: "POST",
        url: "/_ajax/add-bix-discussion.php",
        data: _paramData,
        cache: false,
        success:    function(msg)
        { 
            $('textarea#txtDiscussionText').attr('readonly', true);
            //$('textarea#txtDiscussionText').attr('disabled', 'disabled'); 
            $('input#txtUserName').attr('disabled', 'disabled');
            $('input#txtEmailID').attr('disabled', 'disabled');
            $('input#chkAlertMe').attr('disabled', 'disabled');;
            
            $('input#btnPostComment').replaceWith($.trim(msg));
        }
  });
  
}


function LocalTouchUp(txtData)  
{
    return txtData.replace(/\%/g,'%25').replace(/\&/g,'%26').replace(/\+/g,'%2B');
}

function OnlineCompiler(pQuesID)
{
  $('input#btnCompiler_' + pQuesID).attr('disable', true);  
    
  var txtCoding = $('#txtCompiler_' + pQuesID).val();
  
  if(txtCoding.length < 10)
  { 
      alert('Please enter your C program.'); 
      $('input#btnCompiler_' + pQuesID).attr('disable', true);
      $('div#divCompilerOutput_' + pQuesID).hide();
      return false; 
  }

  $('div#divCompilerOutput_' + pQuesID).html('<img src="/_files/images/website/cprogress.gif" alt="Compilation in progress.." />');  
  $('div#divCompilerOutput_' + pQuesID).show(); 
  
  txtCoding = LocalTouchUp(txtCoding);
  
  var _paramData =  "&ParamCoding=" + txtCoding     +
                    "&Random="      + Math.random() ;  
                      
  $.ajax({
        type:  "POST",
        url:   "/_ajax/c-compiler.php",
        data:  _paramData,
        cache: false,
        success: function(msg)
        {
             $('div#divCompilerOutput_'  + pQuesID).html(msg);
             $('input#btnCompiler_' + pQuesID).attr('disable', false);
        }
  });
  
}