﻿// JScript File
function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                         if (buttonid != 'NoBut')
                        {
                        bt.click(); 
                       
                        }
                         return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13)
                  { 
                        if (buttonid != 'NoBut')
                        {
                        bt.click(); 
                        
                        }
                        return false; 
                      
                  } 
            } 
      } 
} 
function OpenWindow(path,name) {
  win = window.open(path, name);
}


function ReplaceChar(orgchar,newchar,id) {
out = orgchar; // replace this
add = newchar; // with this
var temp =  document.getElementById('ctl00$CPHBody$TB'+ id ).value;

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.getElementById('ctl00$CPHBody$TB'+ id ).value = temp;
}
 
function CheckMoneyInput(e,id){ 
      var c = '';
      var value =  document.getElementById('ctl00$CPHBody$TB'+ id ).value;
      var idx1 = -1;
      var idx2 = -1;
        if(navigator.appName.indexOf("Netscape")>(-1)){ 
              c = String.fromCharCode(e.keyCode);
              
              
        } 
        if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
               c = String.fromCharCode(event.keyCode);
        }
        if ((c=='.')||(c==','))
        {
            idx1= value.indexOf('.');
            idx2= value.indexOf(',');
            if ((idx1<0) && (idx2<0))
            {
               
            }
            else
            {
            return false;
            }
        }
        else if (c=='0' || c=='1' || c=='2'  || c=='3' || c=='4' || c=='5' || c=='6' || c=='7' || c=='8' || c=='9') 
        {
        
        }
        else
        {
        return false;
        }
        
              
}

function CheckIntInput(e,id){ 
      var c = '';
      var value = document.getElementById('ctl00$CPHBody$TB'+ id ).value;
      var idx1 = -1;
      var idx2 = -1;
      var IntC = 0;
        if(navigator.appName.indexOf("Netscape")>(-1)){ 
              c = String.fromCharCode(e.keyCode);
        } 
        if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
               c = String.fromCharCode(event.keyCode);
        }
        if (c=='0' || c=='1' || c=='2'  || c=='3' || c=='4' || c=='5' || c=='6' || c=='7' || c=='8' || c=='9') 
        {
               IntC=parseInt(value+c);
//               if (IntC<100)
//               {
//               
//               }
//               else
//            {
//            return false;
//            }
        }
        else
        {
        return false;
        }
        
              
}
function CheckMaxIntInput(e,id,max){ 
      var c = '';
      var value = document.getElementById('ctl00$CPHBody$TB'+ id ).value;
      var idx1 = -1;
      var idx2 = -1;
      var IntC = 0;
        if(navigator.appName.indexOf("Netscape")>(-1)){ 
              c = String.fromCharCode(e.keyCode);
        } 
        if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
               c = String.fromCharCode(event.keyCode);
        }
        if (c=='0' || c=='1' || c=='2'  || c=='3' || c=='4' || c=='5' || c=='6' || c=='7' || c=='8' || c=='9') 
        {
               IntC=parseInt(value+c);
               if (IntC<max)
               {
               
               }
               else
            {
            return false;
            }
        }
        else
        {
        return false;
        }
        
              
}

function PrintThisPage() 
{ 
     var sWinHTML = document.getElementById('contentstart').innerHTML; 
     var winprint=window.open("","_blank"); 
       winprint.document.open(); 
       winprint.document.write('<html>'); 
       winprint.document.write('<head>');
       winprint.document.write('<link href="Styles/print.css" type="text/css" rel="stylesheet" />')
        winprint.document.write('</head>'); 
       winprint.document.write('<body alink="black" vlink="black" link="black">');
      winprint.document.write('<img src="Images/printheader.jpg" id="Img2"/><br><br>')
	 
       winprint.document.write(sWinHTML); 
        winprint.document.write('<script type="text/javascript">window.print();</script>');  
                        
       winprint.document.write('</body></html>'); 
       winprint.document.close(); 
       winprint.focus(); 
   
      
}
function doRollOver(ctrl)
{
ctrl.className='fontover';
}

function doRollOff(ctrl)
{
ctrl.className='regfont';
}

function SwitchCheckbox(actioncb,reactioncb) 
{
    if (document.getElementById('ctl00$CPHBody$'+ actioncb).checked) 
    {
        document.getElementById('ctl00$CPHBody$'+ reactioncb).checked = false;
    } 
    else 
    {
    document.getElementById('ctl00$CPHBody$'+ reactioncb).checked = true;
    }
} 


//function SelectBookingsite(actioncb,reactiontable,tbun,tbpw,tbpin) 
//{
//    if (document.getElementById('ctl00$CPHBody$'+ actioncb).checked) 
//    {
//        document.getElementById('ctl00_CPHBody_'+ reactiontable).style.display = "";
//        if (document.getElementById('ctl00$CPHBody$'+ tbun).value=="dummy")
//        {
//        document.getElementById('ctl00$CPHBody$'+ tbun).value="";
//        }
//        if (document.getElementById('ctl00$CPHBody$'+ tbpw).value=="dummy")
//        {
//        document.getElementById('ctl00$CPHBody$'+ tbpw).value="";
//        }
//        if (document.getElementById('ctl00$CPHBody$'+ tbpin).value=="dummy")
//        {
//        document.getElementById('ctl00$CPHBody$'+ tbpin).value="";
//        }
//    } 
//    else 
//    {
//     document.getElementById('ctl00_CPHBody_'+ reactiontable).style.display = 'none';
//     if (document.getElementById('ctl00$CPHBody$'+ tbun).value=="")
//     {
//      document.getElementById('ctl00$CPHBody$'+ tbun).value="dummy";
//     }
//     if (document.getElementById('ctl00$CPHBody$'+ tbpw).value=="")
//     {
//      document.getElementById('ctl00$CPHBody$'+ tbpw).value="dummy";
//     }
//      if (document.getElementById('ctl00$CPHBody$'+ tbpin).value=="")
//     {
//      document.getElementById('ctl00$CPHBody$'+ tbpin).value="dummy";
//     }
//    }
//} 


function switchtable(actioncb,reactiontable,tb1,tb2,tb3,tb4,tb5,tb6,tb7,tb8,tb9,tb10,setvalue) 
{
    if (document.getElementById('ctl00$CPHBody$'+ actioncb).checked) 
    {
        document.getElementById('ctl00_CPHBody_'+ reactiontable).style.display = "";
        if (tb1 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb1).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb1).value="";
            }       
        }
        
        if (tb2 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb2).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb2).value="";
            }       
        }
        
        if (tb3 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb3).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb3).value="";
            }       
        }
        
        if (tb4 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb4).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb4).value="";
            }       
        }
        
        if (tb5 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb5).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb5).value="";
            }       
        }
        
        if (tb6 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb6).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb6).value="";
            }       
        }
        
        if (tb7 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb7).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb7).value="";
            }       
        }
        
        if (tb8 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb8).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb8).value="";
            }       
        }
        
        if (tb9 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb9).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb9).value="";
            }       
        }
        
        if (tb10 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb10).value==setvalue)
            {
                document.getElementById('ctl00$CPHBody$'+ tb10).value="";
            }       
        }
        
       
    } 
    else 
    {
        document.getElementById('ctl00_CPHBody_'+ reactiontable).style.display = 'none';
        if (tb1 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb1).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb1).value=setvalue;
            }       
        }
        if (tb2 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb2).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb2).value=setvalue;
            }       
        }
        if (tb3 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb3).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb3).value=setvalue;
            }       
        }
        if (tb4 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb4).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb4).value=setvalue;
            }       
        }
        if (tb5 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb5).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb5).value=setvalue;
            }       
        }
        if (tb6 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb6).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb6).value=setvalue;
            }       
        }
        if (tb7 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb7).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb7).value=setvalue;
            }       
        }
        if (tb8 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb8).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb8).value=setvalue;
            }       
        }
        if (tb9 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb9).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb9).value=setvalue;
            }       
        }
        if (tb10 != "")
        {
            if (document.getElementById('ctl00$CPHBody$'+ tb10).value=="")
            {
                document.getElementById('ctl00$CPHBody$'+ tb10).value=setvalue;
            }       
        }
     }
}

function OpenColorPicker(field)
{
    col=document.getElementById(field).value;
    //colorform = window.open("pickcolor.aspx","Pickcolor","height=500,width=500");
    colorform = window.open("pickcolor.aspx","Pickcolor","")
    colorform.focus();
    try
    {
    colorform.document.form1.HFParent.value=field;
    colorform.document.form1.TBCol1.value=col;
    colorform.document.form1.TBCol2.style.backgroundColor=col;
    }
    catch(err)
    {
    colorform.close()
    }
   
} 
