function processChecked(id)
{
  field = document.getElementById(id);
  chk_name = 'process_array['+id+']';
  
  chk_box = document.getElementById(chk_name);
  
  if (chk_box==null)
  {
    return ;
  }
  
  if(chk_box.checked)
  {
    chk_box.checked = false;
    if (id%2==0)
    field.className = 'even_row';    
    else
    field.className = 'odd_row';
  }
  else
  {
    chk_box.checked = true;
    field.className = 'selected';
  }
}

function set_color(id,color)
{
  field = document.getElementById(id);
  field.className = color;
  
  chk_name = 'process_array['+id+']';
  
  chk_box = document.getElementById(chk_name);
  if (chk_box==null)
  {
    return ;
  }
  
  if(chk_box.checked)
  {
    field.className = 'selected';
  }
  else
  {
    field.className = color;
  }
}

function gEBI(id) {
  return document.getElementById(id);
}

function gEBN(nm, el) {
  return el==undefined ? document.getElementsByName(nm) : el.getElementsByName(nm);
}

function gEBTN(tn, el) {
  return el==undefined ? document.getElementsByTagName(tn) : el.getElementsByTagName(tn);
}

//last modified : 2007-12-14
function makeTextAreaBigger(direction,id) {
  var txtarea = document.getElementById(id);
  if (direction==1) {
    txtarea.cols = txtarea.cols + 10;
    txtarea.rows = txtarea.rows + 3;
  } else {
    txtarea.cols = txtarea.cols - 10;
    txtarea.rows = txtarea.rows - 3;
  }
  //document.getElementById("textarea_next_time").value=txtarea.cols+","+txtarea.rows;
}

//pritesh
//last modified : 2007-12-14
var myGlobalHandlers = {
		onCreate: function(){
			Element.show('systemWorking');
		},

		onComplete: function() {
			if(Ajax.activeRequestCount == 0){
				Element.hide('systemWorking');
			}
		}
	};

//pritesh
//last modified : 2007-11-29

function isInteger(value)
{
  ///(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
  var regex = /(^\d\d*$)/;
  if (!regex.test(value)) 
  {
    return false;
  }
  else
  {
    return true;
  }
}

function ShowCheckBoxConfirmation(id,msg)
{
  checked_box = $(id);
  
  if(checked_box.checked)
  {
    var r = showConfirmationBox(msg);
    if(r==false)
    {
      checked_box.checked = '';
    }
  }
}

function ShowHideElement(id,show_id,hide_id,status)
{
  tr= $(id);
  
  show = $(show_id);
  hide = $(hide_id);
  
  if(status==1)
  {
    tr.style.display = "";
    show.style.display = "none";
    hide.style.display = "block";
  }
  else
  {
    tr.style.display = "none";    
    show.style.display = "block";
    hide.style.display = "none";
  }
  
}

function showConfirmationBox(msg)
{ 
    var r = confirm(msg);  
    if(r==true) 
    { 
      return true;
    }
    else 
    { 
      return false;
    }
}

function prepare(form_id) {
var formblock;

formblock= document.getElementById(form_id);
forminputs = formblock.getElementsByTagName('input');

return forminputs;
}

function select_all(formname,name, value, change_color) 
{

  forminputs = prepare(formname);
   
  for (i = 0; i < forminputs.length; i++) 
  {
    // regex here to check name attribute   
    
    var regex = new RegExp(name, "i");
    if (regex.test(forminputs[i].getAttribute('name'))) 
    {
      if (value == '1') 
      {
        forminputs[i].checked = true;
        if (change_color==1)
        {
          set_color(forminputs[i].value,'selected');
        }        
      } 
      else 
      {
        forminputs[i].checked = false;
        if (change_color==1)
        {
          if (forminputs[i].value%2==0)
          set_color(forminputs[i].value,'even_row');
          else
          set_color(forminputs[i].value,'odd_row');
        }        
      }
    }
  }
}

openWins = new Array();
curWin = 0;
function new_openpopup(url,width,height) 
{
   openWins[curWin++] = window.open(
        url, 'new' ,
        'width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');          
}



function new_opener(url)
{
  opener.location = url;
  self.close();
}

function getXMLValue(xml_response,tag_name)
{
  var xml_element =  xml_response.getElementsByTagName(tag_name);
  var xml_value   =  xml_element.item(0).firstChild.data.toString();
  return xml_value;   
}

function resetTextValue()
{
	var object = document.getElementById('s');
	if(object.value == 'SEARCH OUR SHIRTS')
	{
		object.value = '';
	}
}

function defaultTextValue()
{
	var object = document.getElementById('s');
	if(object.value == '')
	{
		object.value = 'SEARCH OUR SHIRTS';
	}
}