// JavaScript Document
function changecolor(row)
{
	row.className='blue';
}

function restorecolor(row)
{
	row.className='white';
}

var pop='';
function openwin(nm,width,height) {
   var name=nm;
   if (pop && !pop.closed) {
      pop.close();
   }
   pop=eval("window.open('"+name+"','NewWIN','chrome[4],toolbar=no,left=5,top=5,width="+width+",height="+height+",directories=no,menubar=no,SCROLLBARS=yes,left=2,right=2')");
   if (!pop.opener) popUpWin.opener = self;
}

var pop='';
function openwin1(nm,width,height) {
   var name=nm;
   if (pop && !pop.closed) {
      pop.close();
   }
   pop=eval("window.open('"+name+"','NewWIN','chrome[4],toolbar=no,left=5,top=5,width="+width+",height="+height+",directories=no,menubar=no,SCROLLBARS=yes,left=2,right=2')");
   if (!pop.opener) popUpWin.opener = self;
}
function checkAll(val,val1) {
   dml=document.form1;
   len=dml.elements.length;
   var i=0;
   	for (i=0; i<len; i++) {

	   var s = "The quick brown fox jumped over the lazy yellow dog.";
  		ss = dml.elements[i].name
  		s = ss.substr(0, 4);

     	if (dml.elements[i].type == "checkbox" && s==val1) {
        	if (val == 1) { 
           		dml.elements[i].checked=true;
        	} 
			else {
           		dml.elements[i].checked=false;
        	}
     	}   
   	}
}

function chk4() {
     chk2=document.form1;
     len=chk2.elements.length;
	 var i=0;
 	 var pp=1;
   	 for (i=0; i<len; i++) {
        if ((chk2.elements[i].type == "checkbox") && (chk2.elements[i].checked==true)) {
           pp=2;
	    }
	 }
     if (pp==1) {
	    return ("1");
     }  
}

function chktrim(inputString) {
    if (typeof inputString != "string") { return inputString; }
    var retValue = inputString;
    var ch = retValue.substring(0, 1);
    while (ch == " ") { 
       retValue = retValue.substring(1, retValue.length);
       ch = retValue.substring(0, 1);
    } 
    ch = retValue.substring(retValue.length-1, retValue.length);
    while (ch == " ") { 
       retValue = retValue.substring(0, retValue.length-1);
       ch = retValue.substring(retValue.length-1, retValue.length);
    }
    while (retValue.indexOf("  ") != -1) { 
       retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
    }
    return retValue; 
}