function windowFrame(windowName,frameWidth,frameHeight,url) {
  fw=window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  fw.focus();
}

function windowNonResizable(windowname,frameWidth,frameHeight,url, centered){
  fw=window.open(url,windowname,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  if(centered==true){
    fw.moveTo((screen.Width-frameWidth)/2,(screen.Height-frameHeight)/2 );
  }
  fw.focus();
}

function windowReference(windowName,url) {
   fw=window.open(url,windowName,"toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,left=0,top=0,width=780,height=500");     
   fw.moveTo((screen.Width-780)/2,(screen.Height-500)/2 );
   fw.focus();
}

function checkEmpty(control) {
    var a= document.getElementById(control);
    
    if (a.value.length == 0)
    {
        alert('Please enter a search term');
        return false;
     }
     else
    {
    return true;
}
}

function checkEmpty2(control) {
    var a= document.getElementById(control);
    
    if (a.value.length == 0)
    {
        alert('Please enter a search term');
        return false;
     }
     else
    {
    document.frmSearch.submit();
    return true;
}
}
function updateDownlevelSelections(curCheckBox){
	var curState = curCheckBox.checked;
	var curValue = curCheckBox.value;
	var curParent = Left(curValue, curValue.length - 3);
	for(i=0; i<document.aspnetForm.taxonomyAxis.length; i++) {
		if(document.aspnetForm.taxonomyAxis.item(i).value.indexOf(curValue) == 0) {
			document.aspnetForm.taxonomyAxis.item(i).checked = curState;
		}
		if(curState==false) {
		    if(document.aspnetForm.taxonomyAxis.item(i).value == curParent) {
			    document.aspnetForm.taxonomyAxis.item(i).checked = curState;
		    }
		}
	}
}

function Left(str, n)
{
   if (n <= 0)
         return "";
   else if (n > String(str).length)
         return str;
   else
         return String(str).substring(0,n);
}

function popupGlossary(name) {

    if (window.radopen) {
        var oWnd = window.radopen("/popup_glossary.aspx?name=" + escape(name) + "", "CasePopup");
        oWnd.add_close(clearSession);
    }
    else {
        windowReference("CasePopup", "/popup_glossary.aspx?name=" + escape(name))
    }
}
