function onBeforePageUnload() {
   strConfirm = confirmDirtyNavigation();
   return strConfirm;
}
function Go(sUrl) {
   try {
      window.location.href=sUrl;
   }
   catch(e) { }
}
function noenter() {
   return !(window.event&&window.event.keyCode==13&&window.event.srcElement.tagName!="TEXTAREA");
}
function SelectAll(MeId,ObjId) {
   /*Example of Button and Call*/
   /*<a id="btnSelectAll" href="javascript:SelectAll('btnSelectAll','<%= listArticles.ClientId%>')">*/
   var oMe=document.getElementById(MeId);
   if(oMe.innerText=="Select All") {
      oMe.innerText="De-Select All";
      var oSelect=document.getElementById(ObjId);
      for(i=0;i<oSelect.options.length;i++) {
         oSelect.options[i].selected=true;
      }
   }
   else {
      oMe.innerText="Select All";
      var oSelect=document.getElementById(ObjId);
      for(i=0;i<oSelect.options.length;i++) {
         oSelect.options[i].selected=false;
      }
   }
}
function toggleSize(editImg,moduleDivId) {
   var moduleDiv;
   var imgSrc;
   var iMoveSpeed=80 //Speed in milliseconds.
   moduleDiv=document.getElementById(moduleDivId);
   myUrl=new String(editImg.src);
   //This must be set in order for the collapse scrolling to work properly
   moduleDiv.style.overflow="hidden";
   //Collapse Scrolling
   if(moduleDiv.getAttribute("STATUS")=="OPEN"||moduleDiv.getAttribute("STATUS")==null) {
      editImg.src=editImg.src.replace("minus","plus");
      editImg.alt="Maximize";
      moduleDiv.setAttribute("STATUS","MOVING");
      moduleScrollUp(moduleDiv.id,iMoveSpeed);
   } else if(moduleDiv.getAttribute("STATUS")=="CLOSED") {
      editImg.src=editImg.src.replace("plus","minus");
      editImg.alt="Minimize";
      moduleDiv.setAttribute("STATUS","MOVING");
      moduleScrollDown(moduleDiv.id,iMoveSpeed);
   }
}
function moduleScrollUp(objID,MoveSpeed) {
   var iHeight=0;
   var iOrgHeight=0;
   var iOpacity=0;
   var objElement=document.getElementById(objID);
   var pixelMultiplier=0;
   if(objElement.style.height!="") {
      iHeight=parseInt(objElement.style.height);
   } else {
      iHeight=parseInt(objElement.offsetHeight);
      objElement.style.height=iHeight+"px";
   }
   if(objElement.getAttribute("ORIG_HEIGHT")==null) {
      objElement.setAttribute("ORIG_HEIGHT",parseInt(objElement.offsetHeight));
   }
   iOrigHeight=objElement.getAttribute("ORIG_HEIGHT");
   iPixelMultiplier=(iOrigHeight/5);
   if((iHeight-iPixelMultiplier)>iPixelMultiplier) {
      objElement.style.height=iHeight-iPixelMultiplier+"px";
      setTimeout("moduleScrollUp('"+objID+"',"+MoveSpeed+")",MoveSpeed);
      iOpacity=((parseInt(iHeight)/parseInt(iOrigHeight))*100)-5;
      if(objElement.filters) {
         objElement.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity="+iOpacity+")";
      }
      else {
         objElement.style.opacity=iOpacity/100;
         objElement.style.MozOpacity=iOpacity/100;
      }

   } else {
      objElement.style.display="none";
      objElement.setAttribute("STATUS","CLOSED");
      if(objElement.filters) {
         objElement.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
      }
      else {
         objElement.style.opacity=0;
         objElement.style.MozOpacity=0;
      }
   }
}
function moduleScrollDown(objID,MoveSpeed) {
   var iHeight=0;
   var objElement=document.getElementById(objID);
   var iOrigHeight=0;
   var iOpacity=0;
   var pixelMultiplier=0;
   objElement.style.display="";
   iHeight=parseInt(objElement.style.height);
   iOrigHeight=objElement.getAttribute("ORIG_HEIGHT");
   iPixelMultiplier=(iOrigHeight/5);
   if((iHeight+iPixelMultiplier)<iOrigHeight) {
      objElement.style.height=iHeight+iPixelMultiplier+"px";
      setTimeout("moduleScrollDown('"+objID+"',"+MoveSpeed+")",MoveSpeed);
      iOpacity=((parseInt(iHeight)/parseInt(iOrigHeight))*100)+5;
      if(objElement.filters) {
         objElement.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity="+iOpacity+")";
      }
      else {
         objElement.style.opacity=iOpacity/100;
         objElement.style.MozOpacity=iOpacity/100;
      }
   } else {
      objElement.setAttribute("STATUS","OPEN");
      objElement.style.height = iOrigHeight + "px";
      objElement.style.overflow = "";

      if(objElement.filters) {
         objElement.style.filter="";
      }
      else {
         objElement.style.opacity="";
         objElement.style.MozOpacity="";
      }
   }
}

