﻿
//------------------------- Disable batton-------------------------------
  function DisableButton() {
               
                window.setTimeout("disableButton('" + 
                   window.event.srcElement.id + "')", 0);
            }
            function disableButton(buttonID) {
                document.getElementById(buttonID).disabled=true;
            }
//----------------------------- Pop Up ----------------------------------
var popbackground="white"
var windowtitle="Image Window"  //pop window title

function detectexist(obj){
return (typeof obj !="undefined")
}

function jkpopimage(imgpath, popwidth, popheight, textdescription){

function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=no,left='+leftpos+',top='+toppos
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
jkpopwin.resizeTo(popwidth, popheight+30)
}
jkpopwin.document.open()
jkpopwin.document.write('<html><title>'+windowtitle+'</title><body '+bodyattribute+'><img src="'+imgpath+'" style="margin-bottom: 0.5em"><br>'+textdescription+'</body></html>')
jkpopwin.document.close()
jkpopwin.focus()
}
 
 function CheckAllDataGridCheckBoxes(aspCheckBoxID) {            
        re = new RegExp(':' + aspCheckBoxID + '$')  //generated control name starts with a colon
        for(i = 0; i < document.forms[0].elements.length; i++) {
            elm = document.forms[0].elements[i]
            if (elm.type == 'checkbox') {
                if (re.test(elm.name)) {
                    elm.checked = true
                }
            }
        }
    }

 function changeCurrentCheckBoxesValue( checked )
    {
        var frm = document.forms[0];
        for (i=0; i<frm.length; i++) 
        {
            if (frm.elements[i].id.indexOf('chkboxCurrentItemTemplate') != -1)
            {
                frm.elements[i].checked = checked;
            }
        }
    }

function changePreviousCheckBoxesValue( checked )
    {
        var frm = document.forms[0];
        for (i=0; i<frm.length; i++) 
        {
            if (frm.elements[i].id.indexOf('chkboxPreviousItemTemplate') != -1)
            {
                frm.elements[i].checked = checked;
            }
        }
    }
    
/*
function PopupWindowEl()
    {
        mywindow = window.open('/cyta/ebill/HtmlPages/Terms_OnlineOrder_el.htm', 'Terms', 'height=600px,width=800px,toolbar=no,scrollbars=1', false);
     mywindow.location.reload(false); 
    }
    
function PopupWindowEn() {
    mywindow = window.open('/cyta/ebill/HtmlPages/Terms_OnlineOrder_en.htm', 'Terms', 'height=600px,width=800px,toolbar=no,scrollbars=1', false);
        mywindow.location.reload(false);
    } 
*/

function PrintThisPage() 
{ 
   var sOption="toolbar=no,location=no,directories=no,menubar=no,"; 
       sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 

   var sWinHTML = document.getElementById('print').innerHTML; 
   
  var HeaderHTML="<table border=0 cellpadding=0 cellspacing=0 height=76 width=100%><tr><td align=right><a href=javascript:window.print()> <img border=0 src=/PortalInfo/images/btnPrint.gif></a></td></tr><tr><td><img src=/PortalInfo/images/logo-CYTA-branding.gif></td></tr></table>";
   var ClearHTML = HeaderHTML + sWinHTML.replace(/href/g,"");
   //sWinHTML= HeaderHTML + sWinHTML ;

   var winprint = window.open("", "", sOption);
       winprint.location.reload(false); 
       winprint.document.open(); 
       winprint.document.write('<html><LINK href=/App_Themes/Default/Default.css rel=Stylesheet><body>'); 
       winprint.document.write(ClearHTML);          
       winprint.document.write('</body></html>'); 
       winprint.document.close(); 
       winprint.focus(); 
}
//--------------------------------------------------------------------------------------


