
function setDefault(field, defaultVal)
{
    var ip = document.getElementById(field);
    if(ip.value == "")
    {
        ip.value = defaultVal;
    }
}

//used by IPControl.ascx
function moveNext(field, ndx)
{
    var ip = document.getElementById(field);
    var nextip;
    var ipname;
    
    if(ndx == "1")
    {
        ipname = field.replace("txtIP1", "txtIP2");
        nextip = document.getElementById(ipname);
    }
    else if(ndx == "2")
    {
        ipname = field.replace("txtIP2", "txtIP3");
        nextip = document.getElementById(ipname);
    }
    else if(ndx == "3")
    {
        ipname = field.replace("txtIP3", "txtIP4");
        nextip = document.getElementById(ipname);
    }
    else if(ndx == "4")
    {
        ipname = field.replace("txtIP4", "txtIP1");
        nextip = document.getElementById(ipname);
    }

    
    //examine "value" NOT "innerText"
    if(window.event.keyCode != 9) //tab
    {

        //if user enters ".", then remove and advance to next field
        if (ip.value.indexOf('.') != -1) {
            ip.value = ip.value.replace('.', '');
            nextip.focus();
            nextip.select();
        }
        
        if(ip.value.length == 3)
        {
            nextip.focus();
            nextip.select();
        }


    }
    
}

function popupReport(type, reportName)
{
    window.open("/ReportViewer.aspx?type=" + type + "&report=" + reportName, "report_window","height=600;width=900;status=1,toolbar=1,menubar=1,location=1,scrollbars=1;resizable=1;");

}

function popupReportTelerik(type, reportName) {
    window.open("/ReportViewerTelerik.aspx?type=" + type + "&report=" + reportName, "report_window", "status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function popupReportExcel(type, reportName) {
    window.open("/ExcelReport.aspx?report=" + reportName, "report_window", "status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function CopyToClipBoard(txtName) 
{
    var txt = document.getElementById(txtName);
    Copied = txt.createTextRange();
    Copied.execCommand("Copy");
    
    //alert('Text copied');
}


function popupVCS(ptitle, pdate) 
{ 
    var title = document.getElementById(ptitle).value; 
    if(title == "undefined" || title == null)
        title = document.getElementById(ptitle).innerText; 
    
    var date = document.getElementById(pdate).value; 

    var mywindow = window.open('/VCS.aspx?title=' + title + '&date=' + date, 'calendar_window','width=280px,height=250px'); 
    
  	if (window.focus) {mywindow.focus()}

}


function showPassword(pfield)
{
    var pwd = document.getElementById(pfield).value; 
    
    alert(pwd);

}

function popupHelp(pname) 
{ 
    //showModalDialog causes a new window to open on postback
    //var mywindow = window.showModalDialog('/Help.aspx?subject=' + pname, 'help_window','width=600px,height=400px,status=0,toolbar=0,menubar=0,location=0,scrollbars=0;'); 
    var mywindow = window.open('/Help.aspx?subject=' + pname, 'help_window','width=700px,height=500px,status=0,toolbar=0,menubar=0,location=0,scrollbars=1,resizable=1;'); 
    
  	if (window.focus) {mywindow.focus()}

}

function popupFeedback() 
{ 
    //showModalDialog causes a new window to open on postback
    //var mywindow = window.showModalDialog('/Help.aspx?subject=' + pname, 'help_window','width=600px,height=400px,status=0,toolbar=0,menubar=0,location=0,scrollbars=0;'); 
    var mywindow = window.open('/Feedback.aspx', 'feedback_window','width=600px,height=500px,status=0,toolbar=0,menubar=0,location=0,scrollbars=0,resizable=0;'); 
    
  	if (window.focus) {mywindow.focus()}

}