
    function resizegrid(value){
	    var dh = document.getElementById("grid1").offsetHeight
	    if (value==1){
	    document.getElementById("grid1").style.height = document.body.clientHeight - 135;
	    //document.getElementById("grid1").style.width = document.body.clientWidth - 20;
//	    var url1 = window.location.href;
//	    if(url1.indexOf('#b1')<1){
//		    window.location.href = window.location.href + "#b1";
//		    }
//	    else
//		    window.location.href = window.location.href
	    }
    }

    function SelectAllCheckboxes(spanChk){

        // Added as ASPX uses SPAN for checkbox
        var oItem = spanChk.children;
        var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
        xState=theBox.checked;

        elm=theBox.form.elements;
        for(i=0;i<elm.length;i++)
        if(elm[i].type=="checkbox" && elm[i].id!="ChkShowHide" && elm[i].id!=theBox.id  && elm[i].id!="chkDates" && elm[i].id!="chkInfoAltiris" && elm[i].id!="chkInfoCoordinator" && elm[i].id!="chkInfoUserInput" && elm[i].id!="chkInfoUser" && elm[i].id!="chkstatusproj" && elm[i].id!="ChkESource" && elm[i].id!="chkUserName")
        {
        //elm[i].click();
        if(elm[i].checked!=xState)
        elm[i].click();
        //elm[i].checked=xState;
        }
    }
   
    
   function numbersonly(e){
        var unicode=e.charCode? e.charCode : e.keyCode
        if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
        if (unicode<48||unicode>57) //if not a number
        return false; //disable key press
        }
   }
   function ShowHideInsert(){
        divInsert.style.display='block';
        divMain.style.display='none';
    }
//   function showdiv()
//        {
//        selectedvalue = document.getElementById("ddlMyActions").value;
//        if(selectedvalue==7)
//            {divEmail.style.display='block';}
//        else
//            {divEmail.style.display='none';}
//        if(selectedvalue==8) 
//            {ShowHideInsert();}
//        }
    function attachFlyoutToLink(oLink,Title,Text) {	
        try {	        
              FlyoutMain.Close();
              FlyoutMain.AttachTo(oLink.id);
            //var sNewHtml = getRecordInfo(oLink);
            if (Title=="History:")
            { Text = "<span class='History'>" + Text + "</span>" }
            else
            { Text = "<span class='Comments'>" + Text + "</span>" }
            document.getElementById("divFlyoutContent").innerHTML = "<b>" + Title + "</b><br>" + Text;
            FlyoutMain.Open();
        } catch(ex){}
    }
    function attachFlyoutToLinkCal(oLink,Title,Text) {	
        try {	        
              FlyoutMain.Close();
              FlyoutMain.AttachTo(oLink.id);
            //var sNewHtml = getRecordInfo(oLink);
            //Text = "<span>" + Text + "</span>";
            document.getElementById("divFlyoutContent").innerHTML = "<b>" + Title + "</b><br>" + Text;
            FlyoutMain.Open();
        } catch(ex){}
    }
    
    function closeFlyout() {
        //objFlyout1.Close();
    }
    
    function getRecordInfo(oLink) {
        var oRecord = oLink.parentNode.parentNode.parentNode;
        
        // getting row index:
        var iIndex = 0;
        var oTempRecord = oRecord.parentNode.firstChild;
        while(oTempRecord != null && oTempRecord != oRecord) {
            oTempRecord = oTempRecord.nextSibling;
            iIndex++;
        }
        
        if(oTempRecord == null) {
            return;
        }
        
        var sSupplierID = GridView1.Rows[iIndex].Cells[0].Value;
        var sCompanyName = GridView1.Rows[iIndex].Cells[1].Value;
        var sContactName = GridView1.Rows[iIndex].Cells[2].Value;
        var sContactTitle = GridView1.Rows[iIndex].Cells[3].Value;
        var sAddress = GridView1.Rows[iIndex].Cells[4].Value;
        var sCity = GridView1.Rows[iIndex].Cells[5].Value;
        var sRegion = GridView1.Rows[iIndex].Cells[6].Value;
        var sPostalCode = GridView1.Rows[iIndex].Cells[7].Value;
        var sCountry = GridView1.Rows[iIndex].Cells[8].Value;
        var sPhone = GridView1.Rows[iIndex].Cells[9].Value;
        var sFax = GridView1.Rows[iIndex].Cells[10].Value;
       
    
    
        var sNewHtml = "<table>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>ID:</b></td><td class='tdText'>" + sID + "</td></tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>COMPANY NAME:</b></td><td class='tdText'>" + sCompanyName + "</tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>CONTACT NAME:</b></td><td class='tdText'>" + sContactName + "</tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>CONTACT TITLE:</b></td><td class='tdText'>" + sContactTitle + "</tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>ADDRESS:</b></td><td class='tdText'>" + sAddress + "</tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>CITY:</b></td><td class='tdText'>" + sCity + "</tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>REGION:</b></td><td class='tdText'>" + sRegion + "</tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>POSTAL CODE:</b></td><td class='tdText'>" + sPostalCode + "</tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>COUNTRY:</b></td><td class='tdText'>" + sCountry + "</tr>";
        sNewHtml += "<tr><td class='tdText' nowrap><b>PHONE:</b></td><td class='tdText'>" + sPhone + "</tr>";
        sNewHtml += "</table>";
        
        return sNewHtml;
    }
//    function chkShowHideNow(){
//     if(document.getElementById("ChkShowHide").checked)
//        {divAdv.style.display='block';}
//     else
//        {divAdv.style.display='none';}
//    }

        function SetDiv2(){
            var strCook = document.cookie;
            if(strCook.indexOf("!~")!=0){
              var intS = strCook.indexOf("!~");
              var intE = strCook.indexOf("~!");
              var strPos = strCook.substring(intS+2,intE);
              if (document.getElementById("grid1"))
              {
                document.getElementById("grid1").scrollTop = strPos;
              }
            }
          }
          function SetDivPosition(){
            var intY = document.getElementById("grid1").scrollTop;
            //document.title = intY;
            document.cookie = "yPos=!~" + intY + "~!";
          }
          
          
        function windowOpen(){
	        window.open('images/map.jpg','Map','width=703px,height=672px,toolbar=0,menubar=0,location=0,status=0,directories=0,scrollbars=0,resizable=0');
        }

        function checkKey(e)
        {
          if (browser == "Microsoft Internet Explorer") {
              if (window.event.keyCode == "13")
	        {
		        submitForm(document.loginform);
   	        }
          }else {
              if (e.which == 13)
	        {
		        submitForm(document.loginform);
	        }

	        return true;
          }
        }
        var browser = navigator.appName;
        if (browser.indexOf("Netscape") >= 0){
          window.captureEvents(Event.KEYPRESS);
          window.onkeypress = checkKey;
        }

        function FrontPageValidator(theForm)
          {
            if (theForm.login.value == "")
            {
              alert("Please enter a value for the \"username\" field.");
              theForm.login.focus();
              return (false);
            }

            if (theForm.pass.value == "")
            {
              alert("Please enter a value for the \"password\" field.");
              theForm.pass.focus();
              return (false);
            }
            return (true);
          }
          
          function submitForm(theForm) {
            if (FrontPageValidator(theForm)) {
	          theForm.submit();
	        }
          }
          
