//=======FOR TRIM TEXT BOX VALUE==============
function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
    }
    return s;
  }

//======BLACK PERTICULAR TEXT BOX VALUE IN ONCHANGE EVENT=======
function word_change(txt_name,txt_value){
	if(document.getElementById(txt_name).value == txt_value){
		document.getElementById(txt_name).value = '';
	}
}

//=========DIV CLOSE AND OPEN===========
function open_close_div(pValue)
{
    if(document.getElementById(pValue).style.display == 'none')
    {
	    document.getElementById(pValue).style.display = 'block';
    }		
    else
    {
	    document.getElementById(pValue).style.display = 'none';
    }
}

//=============GET CONTROL NAME=============
function getObj(name)
{
    /* DHTML Micro API
    * Source: http://www.quirksmode.org/js/dhtmloptions.html
    */
    if (document.getElementById) // test if browser supports document.getElementById
    {
        this.obj = document.getElementById(name);
        this.style = document.getElementById(name).style;
    }
    else if (document.all) // test if browser supports document.all
    {
        this.obj = document.all[name];
        this.style = document.all[name].style;
    }
    else if (document.layers) // test if browser supports document.layers
    {
        this.obj = document.layers[name];
        this.style = document.layers[name].style;
    }
}

//=========FOR AJAX LOADER===============
function onUpdated()
{
    // get the update progress div
    var updateProgressDiv = $get('updateProgressDiv');
    //alert(updateProgressDiv);
    // make it invisible
    updateProgressDiv.style.display = 'none';
}

function onUpdating()
{
    // get the update progress div
    var updateProgressDiv = $get('updateProgressDiv');
    // make it visible
    updateProgressDiv.style.display = '';
    //alert(updateProgressDiv);
    // get the gridview element
    var gridView = $get('form1');

    // get the bounds of both the gridview and the progress div
    var gridViewBounds = Sys.UI.DomElement.getBounds(gridView);
    var updateProgressDivBounds = Sys.UI.DomElement.getBounds(updateProgressDiv);

    // do the math to figure out where to position the element (the center of the gridview)
    var x = gridViewBounds.x + Math.round(gridViewBounds.width / 2) - Math.round(updateProgressDivBounds.width / 2);
    //var y = gridViewBounds.y + Math.round(gridViewBounds.height / 2) - Math.round(updateProgressDivBounds.height / 2);

   
    var y = 500;
    //alert(Math.round(updateProgressDivBounds.height / 2));
    // set the progress element to this position
    Sys.UI.DomElement.setLocation (updateProgressDiv, x,y);
}