


function DeleteComDefSetting() {

    if (confirm("Are you sure you want to Delete ? ")) {

        return true;
    }
    else {
        return false;
    }
}


function SetValue() {
    //alert("jhgh")
    //alert(checkNotional("1k"))

    if (document.getElementById("txt_notional1").value == '') {
        document.getElementById('lblerror').innerText = "Please enter notional."
        document.getElementById('txt_notional1').focus();

        return false;
    }

    document.getElementById("txt_notional2").value = addCommas(checkNotional(document.getElementById("txt_notional1").value));
    document.getElementById('lblerror').innerText = ''

}
function Visibletable() {
    document.getElementById("table2").style.visibility = "visible";
}
function hidetable() {
    document.getElementById("table2").style.visibility = "hidden";
}
function GetXmlHttpObject(handler) {
    var objXmlHttp = null;
    if (navigator.userAgent.indexOf("MSIE") >= 0) {
        var strName = "Msxml2.XMLHTTP";
        if (navigator.appVersion.indexOf("MSIE 5.5") >= 0) {
            strName = "Microsoft.XMLHTTP";
        }
        try {
            objXmlHttp = new ActiveXObject(strName);
            objXmlHttp.onreadystatechange = handler;
            return objXmlHttp;
        }
        catch (e) {
            alert("Error. Scripting for ActiveX might be disabled");
            return;
        }
    }
    if (navigator.userAgent.indexOf("Mozilla") >= 0) {
        objXmlHttp = new XMLHttpRequest();
        objXmlHttp.onload = handler;
        objXmlHttp.onerror = handler;
        return objXmlHttp;
    }
}
function setvaltocnt(txt_maturity1, lstTenor) {
    document.getElementById(txt_maturity1).value = document.getElementById(lstTenor).value;
}

function GetCode(txt_maturity1, lstTenor, lblerror, ddlDepositccy) {
    if (document.getElementById(txt_maturity1).visibility == hidden) {
        var id = document.getElementById(lstTenor).value;
    }
    else {
        var id = document.getElementById(txt_maturity1).value
    }
    if (id == '') {
        document.getElementById(lblerror).innerText = "Please enter maturity."
        document.getElementById(txt_maturity1).focus();
        return false;
    }
    var ccy = document.getElementById(ddlDepositccy).value
    var url = "MaturityChange.aspx?mdate=" + id + "&ccy=" + ccy + "&rnd=" + MathRandom();
    xmlHttp = GetXmlHttpObject(stateChanged);
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function stateChanged() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
        var str = xmlHttp.responseText;

        if (str == "WRONGFORMAT") {
            document.getElementById("lblerror").innerText = "Please enter valid matuarity Range";
        }
        else {

            document.getElementById("lblerror").innerText = ""
        }

    }

}

function GetCodeValue(lstTenor, lblerror, txt_maturity1, ddlDepositccy) {

    var id = document.getElementById(lstTenor).value;

    if (id == '') {
        document.getElementById(lblerror).innerText = "Please enter maturity."
        document.getElementById(txt_maturity1).focus();
        return false;
    }
    var ccy = document.getElementById(ddlDepositccy).value
    var url = "MaturityChange.aspx?mdate=" + id + "&ccy=" + ccy + "&rnd=" + MathRandom();
    xmlHttp = GetXmlHttpObject(stchnageGetCodeValue);
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function stchnageGetCodeValue() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
        var str = xmlHttp.responseText;

        if (str == "WRONGFORMAT") {
            document.getElementById("lblerror").innerText = "Please enter valid matuarity Range";
        }
        else {

           document.getElementById("lblerror").innerText = ""
        }

    }

}

function showToolTip() {
    document.getElementById('ddlCustomer').title = document.getElementById('ddlCustomer').options[document.getElementById('ddlCustomer').selectedIndex].innerText;
}
function TooltipTxt() {
    return document.getElementById('ddlCustomer').options[document.getElementById('ddlCustomer').selectedIndex].innerText;
}

function convertamt() {
    document.getElementById('lblerror').innerText = "";
    if (FormatNotional(document.getElementById('txt_notional1').value) != null) {
        document.getElementById('txt_notional1').value = document.getElementById('txt_notional1').value;
    }
    else {
        document.getElementById("lblerror").innerText = "Invalid notional, Please enter valid notional( '1M' or '3B' etc)";
        document.getElementById('txt_notional1').value = "";

    }

}
var newwindow;
newwindow = null;

// Added by goraksha on 19-Jun-2009

function DisplayCustomerListPopUP(path, h, w) {


    document.getElementById('lblerror').innerText = ""
    if (!newwindow || newwindow.closed) {

    }
    else {
        newwindow.close();

    }

    var width = w;
    var height = h;
    var center = true;
    var winName = "CustomerMapping"
    var pageToLoad;
    var ObjectName;
    var LoginID;
    var DealerName;



    var lstObject = document.getElementById('ddlObjectName')
    ObjectName = lstObject.options[lstObject.selectedIndex].text
    var lstLoginID = document.getElementById('ddlLoginName')
    LoginID = lstLoginID.options[lstLoginID.selectedIndex].text

    var lstDealerName = document.getElementById('ddlRMDealing')
    DealerName = ""
    if (lstDealerName.selectedIndex != -1) {
        DealerName = lstDealerName.options[lstDealerName.selectedIndex].text
    }

    pageToLoad = path + "?ObjectName=" + ObjectName + "&LoginID=" + LoginID + "&DealerName=" + DealerName




    var xposition = 0;
    var yposition = 0;
    if ((parseInt(navigator.appVersion) >= 4) && (center)) {
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }

    //0 => no
    //1 => yes
    var args = "";
    args += "width=" + width + "," + "height=" + height + ","
						+ "location=0,"
						+ "menubar=0,"
						+ "resizable=1,"
						+ "scrollbars=0,"
						+ "statusbar=false,dependent,alwaysraised,"
						+ "status=false,"
						+ "titlebar=no,"
						+ "toolbar=0,"
						+ "hotkeys=0,"
						+ "screenx=" + xposition + ","  //NN Only
						+ "screeny=" + yposition + ","  //NN Only
						+ "left=" + xposition + ","     //IE Only
						+ "top=" + yposition;           //IE Only
    //fullscreen=yes, add for full screen
    newwindow = window.open(pageToLoad, winName, args);
    //to open the popup if it is minimised
    if (window.focus) { newwindow.focus() }
    return false;

}


//Added by Goraksha on 1-Jul-2009
function CustomerListChange() {
    var lstGroup = document.getElementById('ddlRMDealing')
    GroupName = lstGroup.options[lstGroup.selectedIndex].text
    document.getElementById("hdnRM").value = GroupName
    document.getElementById("hdnCustomerID").value = document.getElementById('ddlCustomer').options[document.getElementById('ddlCustomer').selectedIndex].value;
    document.getElementById("hdnCustomerName").value = document.getElementById('ddlCustomer').options[document.getElementById('ddlCustomer').selectedIndex].text;


}

function RMListChange() {

    if (newwindow || !newwindow.closed) {
        newwindow.close();
    }

    return true;

}