﻿var isIE5=navigator.userAgent.toUpperCase().indexOf("MSIE 5")!=-1;

function adjustHeight() {
  if (document.getElementById) {
      var targetElement=document.getElementById("menu"),
          elementOffset=45, styleOffset=80, documentHeight, totalOffset;

      if (targetElement && document.documentElement.offsetHeight
          && targetElement.offsetHeight) {
          documentHeight=document.documentElement.offsetHeight;
          if (targetElement.offsetHeight<documentHeight-elementOffset) {
              if (isIE5)
                  totalOffset=elementOffset;
                  else totalOffset=elementOffset+styleOffset;
              targetElement.style.height=String(documentHeight-totalOffset)+'px';
          }
      }
  }
window.onresize=adjustHeight();
window.onload=adjustHeight();
}

function popUp(URL) 
{
    day = new Date();
    id = day.getTime();
    
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=600');");
}

function findImage(imgName) { //v3.0

	var img = null;
	
	if(document.getElementById) {
		img = document.getElementById(imgName);
	}

	if(!img) {
		img = document[imgName];
	}

	if(!img && document.all) {
		img = document.all[imgName];
	}  
	return img;
}

function swapImage(imageName,imageSrc) { //v3.0

	var img = findImage(imageName);
	
	if(img != null) {
		img.src = imageSrc;
	}
}

function setMainImage(imageName,imageSrc) { //v3.0

	var img = findImage(imageName);
	
	if(img != null) {
		img.src = imageSrc;
	}
} 

function ForgotPassword() 
{ 
    var sOption="toolbar=no,location=no,directories=no,menubar=no,"; 
        sOption+="scrollbars=no,width=600,height=200,left=200,top=300"; 

    var x=window.open("ForgotPassword.aspx","ForgotPassword",sOption); 

    x.focus(); 
}

function GetPrintContent()
{
    var PrintDiv =  document.getElementById('printcontent');
    var ContentDiv =  window.opener.document.getElementById('content');
    PrintDiv.innerHTML = ContentDiv.innerHTML;
}

function PrintThisPage() 
{ 
    var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
         sOption+="scrollbars=yes,width=950,height=600,left=100,top=25"; 

    var winprint=window.open("PrintablePage.aspx","Print",sOption); 

    winprint.focus(); 
}

function EditNote(note)
{
    var textBox = null;
    var rowNote = null;

	if(document.getElementById) {
	    rowNote = document.getElementById("rowNote");
		textBox = document.getElementById("txtNote");
	}
	
	if(textBox != null) {
	    textBox.value = note;
	}
	
	if(rowNote != null) {
	    rowNote.style.visibility = 'visible';
	}
}