function expandAll(layerSet){
	expandAll(layerSet,null);
}

function expandAllLayers(layerSet){
	for(var i = 0 ; i < layerSet.length; i++){
		showLayerMain(layerSet[i]);
		togAllImage(layerSet[i] , "expand");
	}
}

function expandAll(layerSet,layerSuffix){ //Expanding all ROCs in the section
	if (document.getElementById) {
	var layer;
	var layern;
	var mySource;
	if (((mySource = document.getElementById(layerSet + 'Tab')) != null) && ((layern = document.getElementById(layerSet)) != null)) {
		var myRows = mySource.rows.length;
		if (layern.style.visibility != "hidden") {
				 for(i=1;i <= myRows;i++){
				 	if(layerSuffix != null){
				 		for(n = 0; n < layerSuffix.length; n++){
				 			showLayerMain(layerSet + layerSuffix[n]+i);
				 		}
				 	} else {
				  	layerid = layerSet + i;
				  	alert(layerid);
						if ((layer = document.getElementById(layerid)) != null) {
							layer.style.position = "relative";
							layer.style.visibility = "visible";
							togAllImage(layerid , "expand");
						}
					}
				}
			}
		}
	}
}

function collapseAll(layerSet){
	collapseAll(layerSet,null);
}

function collapseAllLayers(layerSet){
	for(var i = 0 ; i < layerSet.length; i++){
		hideLayerMain(layerSet[i]);
		togAllImage(layerSet[i] , "collapse");
	}
}

function collapseAll(layerSet,layerSuffix){ // Collapsing all ROCs in the section
	if (document.getElementById) {
		var layer;
		var mySource;
		if ((mySource = document.getElementById(layerSet + 'Tab')) != null) {
	  	var myRows = mySource.rows.length;
			for(i=1;i <= myRows; i++){
				if(layerSuffix != null){
				 	for(n = 0; n < layerSuffix.length; n++){
				 		hideLayerMain(layerSet + layerSuffix[n]+i);
					}
				} else {
					layerid = layerSet + i;
					if ((layer = document.getElementById(layerid)) != null) {
						layer.style.position = "absolute";
						layer.style.visibility = "hidden";
						togAllImage(layerid , "collapse");
					}
				}
			}
		}
	}
}

function togLayers(layerSet,rowNumber,layerSuffix){ // Collapsing all ROCs in the section
	if (document.getElementById) {
		for(n = 0; n < layerSuffix.length; n++){
				togLayer(layerSet + layerSuffix[n]+rowNumber);
		}
		togImage(layerSet+rowNumber);
	}
}

function showOnlyCard(selObj){ //Used for show hiding basic supp card trans sections
	for (m=2; m < selObj.length;m++) {
		if ((selObj.options[m].value == selObj.value)||(selObj.value == "0"))
			 showLayerMain(selObj.options[m].value);
		else		
		 hideLayerMain(selObj.options[m].value);

	}
}
function showLayerMain(layerid){ // Entire section show - hide
		var layer = document.getElementById(layerid);
 		layer.style.position = "relative";
		layer.style.visibility = "visible";
		if (navigator.userAgent.indexOf("MSIE") != -1)
                    layer.style.height = '100%';
		return 1;
}
function hideLayerMain(layerid){
				 var layer = document.getElementById(layerid);
 					collapseAll(layerid);
		 	  layer.style.position = "absolute";
   			layer.style.visibility = "hidden";
				return 1;
}		
function toggleLayerMain(layerid){ //Show -hide entire section based on the click arrow
var layer = document.getElementById(layerid);
		if (layer.style.visibility == "hidden")
			 showLayerMain(layerid);
		else
		 hideLayerMain(layerid);
}
function togLayer(layerid){ //toggle layer - For Expand ROC
  var layer;
  if (document.getElementById && ((layer = document.getElementById(layerid)) != null)) {
		 if (layer.style.visibility == "visible") {
		 	  layer.style.position = "absolute";
   			layer.style.visibility = "hidden";
		 } else {
		 		layer.style.position = "relative";
     		layer.style.visibility = "visible";		 
		 }
	togImage(layerid);
  }
}
function togImage(layerid){ //toggle Image
     var imgref;
	if ((imgref = document.getElementById('img'+layerid)) != null ) {
		if (imgref.src.indexOf("plus") > -1 ) {
			imgref.src = "/images/minus.gif";
			imgref.title = "Collapse details";
		}
		else {
			imgref.src = "/images/plus.gif";
			imgref.title = "Expand details";
		}
	}
    return imgref;
}

function plusImage(layerid) {
    var imgref;
    if ((imgref = document.getElementById('img'+layerid)) != null ) {
        imgref.src = "/images/plus.gif";
        imgref.title = "Expand details";
    }
    return imgref;
}

function minusImage(layerid) {
    var imgref;
    if ((imgref = document.getElementById('img'+layerid)) != null ) {
        imgref.src = "/images/minus.gif";
        imgref.title = "Collapse details";
    }
    return imgref;
}

function togAllImage(layerid,funType){ //toggle Image
     var imgref;
	if ((imgref = document.getElementById('img'+layerid)) != null) {
                if (funType == "expand") 
                        imgref.src = "/images/minus.gif";
                else imgref.src = "/images/plus.gif";
	}
}
function togLayerNoShift(layerid){ //toogle without shift
var layer;
	if (document.getElementById && ((layer = document.getElementById(layerid)) != null)) {
		 if (layer.style.visibility == "hidden") {
     		layer.style.visibility = "visible";
		 } else {
   			layer.style.visibility = "hidden";
		 }
	}
}
var innerHT = 0;
function showLayer1(layerid){ //toggle with Inner height 
     var layer = document.getElementById(layerid);
 		 if (layer.style.visibility == "hidden") {
	     		layer.style.visibility = "visible";
					layer.style.position = "relative";
					innerHT = layer.style.height;
					layer.style.height=1;
		 } else {
		 if (layer.style.height == 1) {
			 layer.style.height = innerHT; }
		 layer.style.position = "absolute";
  		layer.style.visibility = "hidden";
		 }
}
function addOption(dropdownId,OptionText,OptionValue) { //For adding new options to the dropdown dinamically.
var drpDwn = document.getElementById(dropdownId);
var drpDwnLength =0;
		if (drpDwn != null) {
			 drpDwnLength = drpDwn.options.length;
			 drpDwn.options[drpDwnLength] = new Option(OptionText,OptionValue);
		}
		else { //hardcoded for opera
		drpDwn = eval('document.EStmtPageOne_form.'+dropdownId);
		drpDwnLength = drpDwn.options.length;
		//alert(drpDwn.options.length);
 	  drpDwn.options[drpDwnLength] = new Option(OptionText,OptionValue);
		} 
}

