﻿Ajax.Responders.register(
			{
			onCreate: function() 
				{
				if($('busy') && Ajax.activeRequestCount>0)
				Effect.Appear('busy',{duration:0.1,queue:'end'});
				},
			onComplete: function() 
				{
				if($('busy') && Ajax.activeRequestCount==0)
				Effect.Fade('busy',{duration:0.1,queue:'end'});
				}
			});

function getPartial(page_name, params, divloc)
    {
    //debugger;
    var url ='Partials/' + page_name + '.aspx';
    if (params ==null)
        params ='';
    var options =  {method: 'get', parameters: params, evalScripts:true}
    new Ajax.Updater (divloc, url, options);
    return false;
    }
    
function getAjaxContent(page_name, params, divloc)
    {
    //debugger;
    var url = page_name + '.ashx';
    if (params ==null)
        params ='';
    var options =  {method: 'get', parameters: params, evalScripts:true}
    new Ajax.Updater (divloc, url, options);
    return false;
    }

function checkMaxLen(txt,maxLen) 
    {
    if(txt.value.length > (maxLen-1)) {
        var cont = txt.value;
        txt.value = cont.substring(0,(maxLen -1));
        return false;
    };
    }

//  toggle checkboxes in gridview javascript function 
function SelectAllCheckboxes(spanChk)
    {
     
    var oItem = spanChk.children;
    var theBox= (spanChk.type=="checkbox") ? 
    spanChk : spanChk.children.item[0];
    xState=theBox.checked;
    elm=theBox.form.elements;

   for(i=0;i<elm.length;i++)
     if(elm[i].type=="checkbox" && 
              elm[i].id!=theBox.id)
     {
       //elm[i].click();

       if(elm[i].checked!=xState)
         elm[i].click();
       //elm[i].checked=xState;

     }
     }
         