   
function chgClassName(cellID, cellClassName) {
    cellID.className = cellClassName;
}

function doToUpperCase(o) {
	o.value=o.value.toUpperCase();
}

function showHide(divID, iconID) {

    if (iconID.state == "hide") {
        iconID.src = "/md2/images/minus.gif";
        divID.style.display = "";
        iconID.state = "show";
   }
   else {
        iconID.src = "/md2/images/plus.gif";
        divID.style.display = "none";
    iconID.state = "hide";
   }

}

function MyImage(image,state) {
    this.image = image;
    this.state = state;
}

function updateItem(id, path){
    var divId="divId"+id;
    var imgId="imgId"+id;
    
function updateItem(id, path){
    var divId="divId"+id;
    var imgId="imgId"+id;
    
    if (document.getElementById(imgId) & document.getElementById(divId)){
	    mmm = new MyImage(document.getElementById(imgId),"expanded");
	
	    if (document.getElementById(imgId).state==undefined){
	        document.getElementById(imgId).state="expanded";
	    }
	    if (document.getElementById(imgId).state=="expanded"){
	        document.getElementById(imgId).src=path+"/images/plus.gif";
	        document.getElementById(imgId).state="collapsed";
	        document.getElementById(divId).style.display="none";
	    }else{
	        document.getElementById(imgId).src=path+"/images/minus.gif";
	        document.getElementById(imgId).state="expanded";
	        document.getElementById(divId).style.display="";
	    }
	}
}
}

function chgCursor(curObj){
    curObj.style.cursor="hand";    
}

function chgColor(curObj, obj1, obj2){
    curObj.style.backgroundColor="#E1E78D";
    obj1.style.backgroundColor="#E5EFF9";
    obj2.style.backgroundColor="#E5EFF9";
}

function chgTRColor(obj){
	var wnd = window;
	
    if(window.event.type=="mouseover"){
        if (obj.style.backgroundColor == "#d6e1fb"){
                obj.style.backgroundColor="#d6e1fb";
                chgCursor(obj);
        } else {
            obj.style.backgroundColor="#ebedfd";
            chgCursor(obj);
        }   
    }
    else{
        if (obj.style.backgroundColor == "#d6e1fb"){
                obj.style.backgroundColor="#d6e1fb";
        } else {
                obj.style.backgroundColor="";
        }   
    }
}

function minimizePortlet(id, path) {
    var divId = "portlet"+id+"Div";
    var imgId = "portlet"+id+"Img";
    document.getElementById(imgId).src=path+"/images/title_restore.gif";
    document.getElementById(imgId).title="Restore";
    document.getElementById(divId).style.display = 'none';
    document.getElementById(imgId).onclick=function() { restorePortlet(id, path); }
}
    
function maximizePortlet(id, path) {
    switch(eval(id)) {
        case 0: document.location = path+"issuesList.htm"; break;
        case 1: document.location = path+"dataFeeds.htm"; break;
        case 2: document.location = path+"pastReports.htm"; break;
        case 3: document.location = path+"productMappings.htm"; break;
        default:alert("No match!");
    }
}
    
function restorePortlet(id, path) {
    var divId = "portlet"+id+"Div";
    var imgId = "portlet"+id+"Img";
    document.getElementById(imgId).src=path+"/images/title_minimize.gif";
    document.getElementById(imgId).title="Minimize";
    document.getElementById(divId).style.display = 'block';
    document.getElementById(imgId).onclick=function() { minimizePortlet(id, path); }
    disableEventPropagation(event);
}

function disableEventPropagation(event) {
  if (event.stopPropagation) {
    // this code is for Mozilla and Opera
    event.stopPropagation();
  }
  else if (window.event) {
    // this code is for IE
    window.event.cancelBubble = true;
  }
}
var fileFildObj = null;
var submitButtonObj = null;

function fileCheck(fileFild, submitButton) {
    var extensionResolverRegExp = ".+\.xml";
    var validationFaildMessage = "Only XML files are supported.";
    fileFildObj = document.getElementById(fileFild);
    var fileFildValue = fileFildObj.value;
    
    if (fileFildValue != null && fileFildValue != " " && fileFildValue != "") {
        var regExp = new RegExp(extensionResolverRegExp);
        submitButtonObj = document.getElementById(submitButton);

        if (regExp.test(fileFildValue)) {
            submitButtonObj.disabled = false;
        }
        else {
            submitButtonObj.disabled = true;
            alert(validationFaildMessage);
        }
    }
}

function formSubmit(formName) {
    document.getElementById(formName).submit();
    lockInterface(true);
}        

function lockInterface(lock) {
	if(lock) {
		fileFildObj.disabled = lock;
		submitButtonObj.disabled = lock;
		submitButtonObj.blur();
	}
	else {
		fileFildObj.disabled = lock;
		submitButtonObj.disabled = lock;
	}			
}        