self.onerror = null;
function SelectAllItems(){
        if(navigator.userAgent.search("MSIE") == -1){ // Netscape code
		   //msgWindow=window.open("","msg","width=400,height=400,scrollbars=1")
			 var item;
			 item =  document.forms["LIST"];
             for (thisItem in item.elements){
				if (item[thisItem].type = "checkbox"){
					//	document.write document.forms["LIST"][thisitem];
					if (item["button"].value == "Clear All"){
						item[thisItem].checked = false;
					}
					else{
						item[thisItem].checked = true;
					}
				}
             }
             if (item["button"].value == "Select All"){
				item["button"].value = "Clear All";
			 }
			 else{
				item["button"].value = "Select All";
			}
        }
        else{ //Microsoft code
			for (i in document.LIST){
			    if (i.search("fid") > -1){
				   for (j = 0; j < document.LIST[i].length; j++){
			   			if (document.LIST.button.value == "Clear All"){
				            document.LIST[i][j].checked = false;
				         }
				         else{
				           document.LIST[i][j].checked = true;
				         }
			       }
			    }
			 }
			if (document.LIST.button.value == "Clear All"){
				document.LIST.button.value = "Select All";
			}
			else{
				document.LIST.button.value = "Clear All";
			}			
        }
        return true;
}
function DownloadComplete() {
	var Done = false;
	var Skip = false;
   for (var i = 0; i < document.images.length; i++) {
      if(document.images[i].name.substring(0,8) == "checkbox"){
		if (document.images[i].src.substring((document.images[i].src.length - 12),(document.images[i].src.length)) != "inactive.gif"){
			Skip = true;	
		}
		else{Done = true;}
      }
   }
   if ((Done == true) & (Skip == false)){
	//window.location = "DownloadComplete.asp?app=<%=iApplicationID%>";
	document.forms.Complete.submit();
	return true;
   }
   else{
	return false;
   }
}


self.onerror = null;
// browser test:
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if ((browserName == "Netscape" && browserVer >= 3) || (browserVer >=4)) version = "1";
else version = "2";

// preload images:
if (version == "1") {

inactive = new Image(15,15);
inactive.src = "images/inactive.gif";

active = new Image(15,15);
active.src = "images/active.gif";

}

// function for the highlighting of images
function hiLite(imgDocID,imgObjName) {
if (version == "1") {
        document.images[imgDocID].src = eval(imgObjName + ".src")
       // document.layers["DownLink" + imgDocID].visibility = "hide";
                }
                return false;
}


function PowerDownload() {
	var Done = false;
	var Skip = false;
   for (var i = 0; i < document.images.length; i++) {
	//print document.images[i].name.substring(0,8);
      if(document.images[i].name.substring(0,8) == "checkbox"){
		if (document.images[i].src.substring((document.images[i].src.length - 12),(document.images[i].src.length)) != "inactive.gif"){
			Skip = true;	
		}
		else{Done = true;}
      }
   }
   if ((Done == true) & (Skip == false)){
	//window.location = "DownloadComplete.asp?app=<%=iApplicationID%>";
	document.forms.Complete.submit();
	return true;
   }
   else{
	return false;
   }
}
