

 
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  var docMode = ( document.forms )? true: false;
  
  if(!theDoc) theDoc = ( docMode )? document : window;

  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)];
    theDoc = ( docMode )? theDoc.document : theDoc.window;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all ) foundObj = theDoc.all[theObj] ;

  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

  return foundObj;
}

function confirm_delete()
{
  if ( window.confirm( 'You are about to permanently delete this user. Are you sure?' )==true )
    return true;
  else
    return false;
}

function validate_TC(source, args)
{
      args.IsValid = findObj('ctl00_ContentPlaceHolder1_chkbox_TC').checked;
}


function createRequestObject() {
     var ro;
     var browser = navigator.appName;
     if(browser == "Microsoft Internet Explorer"){
          ro = new ActiveXObject("Microsoft.XMLHTTP");
     }else{
          ro = new XMLHttpRequest();
     }
     return ro;
}

var http = createRequestObject();

function sndReq( action, pageName) {
     http.open('get', pageName+'?'+action);
     http.onreadystatechange = handleResponse;
     http.send(null);
}

function handleResponse() 
{
     if(http.readyState == 4)
     {
         var responseContent  = http.responseText;
         var startContent = responseContent.indexOf("<!--div_Singlebest-->");
         var endContent = responseContent.indexOf("<!--enddiv_Singlebest-->");
         newDivContent =  responseContent.substring(startContent, endContent);
         alert(startContent + ' - ' + newDivContent);
         //findObj('div_Singlebest').innerHTML = "";
         //findObj('test').innerHTML = newDivContent;
         //document.write = newDivContent;
     }
}
