﻿//var DOMAIN = 'http://localhost:1903/Website/';
//var DOMAIN = 'http://dev.buildsystem.in/';
var DOMAIN = 'http://buildsystem.in/';
//document.write("<script type='text/javascript' src='/scripts/global.js'> <\/script>");

//// JScript File
function show() {
    alert("hi");
}
//===================to confirm==============================================
//=call like this== OnClientClick="javascript:return confirm_delete();"
function confirm_delete() {
    var yes = confirm("Are you sure to delete?");
    if (yes == true) {
        return true;
    }
    else {
        return false;
    }
}
//========================================================================
// Removes leading whitespaces
function LTrim(value) {

    var re = /\s*((\S+\s*)*)/;
    return value.replace(re, "$1");

}

// Removes ending whitespaces
function RTrim(value) {

    var re = /((\s*\S+)*)\s*/;
    return value.replace(re, "$1");

}

// Removes leading and ending whitespaces
function trim(value) {

    return LTrim(RTrim(value));

}
//=================================================================
//function trim(str)
//{
//    while (str.substring(0, 1) == ' ') {
//        str = str.substring(1, str.length);
//    }
//    while (str.substring(str.length - 1, str.length) == ' ') {
//        str = str.substring(0, str.length - 1);
//    }
//    return str;
//}
//========================================================================
function OpenWindow(url) {
    var wihe = 'width=' + screen.availWidth + ',height=' + screen.availHeight;
    //window.open ("taxdetails.aspx?"+url+"","mywindow", "menubar=0,resizable=1," + "width=650,height=400,toolbars=0");
    window.open("taxdetails.aspx?" + url + "", 'Directory', 'menubars=0,resizable=1,scrollbars=1,maximize=1 ,screenX=1,screenY=1,left=1,top=1,' + wihe);
}
//===========================================================================
function popup(url, winwidth, winheight) {
    var width = winwidth;
    var height = winheight;
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    var params = 'width=' + width + ', height=' + height;
    params += ', top=' + top + ', left=' + left;
    params += ', directories=no';
    params += ', location=no';
    params += ', menubar=no';
    params += ', resizable=no';
    params += ', scrollbars=yes';
    params += ', status=no';
    params += ', toolbar=no';
    params += ',_new';
    params += ', maximize=no';
    newwin = window.open(url, 'windowname5', params);

    if (window.focus) { newwin.focus(); }
    return false;

}
//======================================================================================
function win_open_popup() {
    window.open("sendconfirmation.aspx", 'anycontent', 'resizable=yes,scrollbars=yes,width=550,height=400,status', '_new');
}
//==================================================================================
function Validate_no() {
    var count = arguments[0].length;
    //    if (count < 10) {
    //        return false;
    //    }
    var valid_str = "0123456789-+() ";

    for (var pos = 0; pos <= count; pos++) {
        if (valid_str.search(phone.charAt(pos)) == -1)
            return false;
    }

}
//===========================================================
function ValidateNumeric(strString)
//  check for valid numeric strings	
{
    var strValidChars = "0123456789";
    var strChar;
    var blnResult = true;

    if (strString.length == 0) return false;

    //  test strString consists of valid characters listed above
    for (i = 0; i < strString.length && blnResult == true; i++) {
        strChar = strString.charAt(i);
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false;
        }
    }
    return blnResult;
}

//===============================================================
//use like this  onkeydown="javascript:IsNumeric(this);"
function IsNumeric(obj)
//  check for valid numeric strings	
{
    var strValidChars = "0123456789";
    var strChar;
    var blnResult = true;

    if (obj.value.length == 0) return false;

    //  test strString consists of valid characters listed above
    for (i = 0; i < obj.value.length && blnResult == true; i++) {
        strChar = obj.value.charAt(i);
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false;
            alert("Invalid,Please Enter a Number")
            obj.value = obj.value.replace(strChar, '');
        }
    }
    return blnResult;
}

//============================================================================================
//use like this  onkeydown="javascript:IsNumeric_withoutalert(this);"
function IsNumeric_withoutalert(obj)
//  check for valid numeric strings	
{
    var strValidChars = "0123456789";
    var strChar;
    var blnResult = true;

    if (obj.value.length == 0) return false;

    //  test strString consists of valid characters listed above
    for (i = 0; i < obj.value.length && blnResult == true; i++) {
        strChar = obj.value.charAt(i);
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false;
            //alert("Invalid,Please Enter a Number")
            obj.value = obj.value.replace(strChar, '');
        }
    }
    return blnResult;
}

//=================================================================================
function validate_email(email) {
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    var address = email;
    if (reg.test(address) == false) {
        return false;
    } else {
        return true;
    }
}
//==================================================================================
function chkLogin() {
    // alert(DOMAIN )
    document.getElementById("txtHint").innerHTML = "<img src='" + DOMAIN + "images/loading.gif'>&nbsp;<font face='verdana' size='1' >checking...</font>"
    var xmlhttp;
    var uid, pwd, type, from, memberType;

    uid = document.getElementById(arguments[0]).value;
    pwd = document.getElementById(arguments[1]).value;


    if (document.getElementById("ctl00_left_drpMemberType") != null) {
        var mtid = document.getElementById("ctl00_left_drpMemberType").options[document.getElementById("ctl00_left_drpMemberType").selectedIndex].value;

        if (mtid == '2') {
            type = 'M';
            memberType = '2';
        }
        else if (mtid == '3') {
            type = 'V';
            memberType = '3';
        }
        else if (mtid == '5') {
            type = 'A';
            memberType = '5';
        }
    }
    else {
        type = 'D';
        memberType = '4';
    }
    from = arguments[3];
    if (uid == 0) {

        alert("UserId can't be blank");
        document.getElementById("txtHint").innerHTML = "";

        return;
    }
    else if (pwd == 0) {

        alert("Password can't be blank");
        document.getElementById("txtHint").innerHTML = "";

        return;
    }
    else if (validate_email(uid) == false) {
        alert("Wrong email format");
        document.getElementById("txtHint").innerHTML = "";

        return;
    }
    else {
        if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        }
        else {// code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        if (xmlhttp != null) {
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    // document.getElementById("txtHint").innerHTML = xmlhttp.responseText; // to show msg in div
                    var res = xmlhttp.responseText.toString();
                    if (res == 'Valid') {
                        var from = "login";

                        if (type == 'M') {
                            location.href = DOMAIN + 'member/Default.aspx?type=' + type + "&from=" + from;
                        }
                        else if (type == 'V') {

                            location.href = DOMAIN + 'member/Default.aspx?type=' + type + "&from=" + from;
                        }
                        else if (type == 'A') {

                            location.href = DOMAIN + 'member/Default.aspx?type=' + type + "&from=" + from;
                        }
                        else if (type == 'D') {

                            location.href = DOMAIN + 'desktop_application/dashboard';
                        }
                    }
                    else {
                        alert(res)
                        document.getElementById("txtHint").innerHTML = "";
                    }
                }
            }


            xmlhttp.open("GET", DOMAIN + "chklogin.aspx?uid=" + uid + "&pwd=" + pwd + "&from=" + from + "&memberType=" + memberType, true);
            xmlhttp.send();
        }
        else {

            alert("The XMLHttpRequest not supported");
            //document.getElementById("errMessage").innerHTML = "<img src='images/loading.gif'>&nbsp;<font face='verdana' size='1' color='#000000'>checking...</font>" 

        }

    }
}
// <p><span id="txtHint"></span></p> ==Place this to show msg in span
//======================================================================================================================

function validatePwd() {
    document.getElementById("txtHint").innerHTML = "<img src='" + DOMAIN + "images/loading.gif'>&nbsp;<font face='verdana' size='1' >checking...</font>"
    var xmlhttp;

    var oldpwd, newpwd1, newpwd2, from, contact_person_id;

    oldpwd = trim(document.getElementById(arguments[0]).value);
    newpwd1 = trim(document.getElementById(arguments[1]).value);
    newpwd2 = trim(document.getElementById(arguments[2]).value);
    from = arguments[3];

    contact_person_id = trim(document.getElementById(arguments[4]).value);

    if (oldpwd == 0) {
        alert("Old Password can't be blank");
        return false;
    }

    else if (newpwd1 == '' || newpwd2 == '') {
        alert('Please enter your password twice.');
        return false;
    }
    else {
        if (newpwd1 != newpwd2) {
            alert("You did not enter the same new password twice. Please re-enter your password.");
            return false;
        }
        else {//

            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }

            if (xmlhttp != null) {
                xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {

                        var res = xmlhttp.responseText.toString();

                        if (res == 'Valid') {

                            alert('Password Sucessfully Updated');
                            document.getElementById("txtHint").innerHTML = "";
                            document.getElementById("oldpwd").value = "";
                            document.getElementById("newpwd1").value = "";
                            document.getElementById("newpwd2").value = "";
                        }
                        else {
                            alert(res);
                            document.getElementById("txtHint").innerHTML = "";
                        }
                    }
                }
                xmlhttp.open("GET", DOMAIN + "chklogin.aspx?oldpwd=" + oldpwd + "&pwd=" + newpwd1 + "&from=" + from + "&contact_person_id=" + contact_person_id, true);
                xmlhttp.send();
            }
            else {

                alert("The XMLHttpRequest not supported");
                document.getElementById("txtHint").innerHTML = "";
            }

            //alert('Nice job.');
            // return true;
        } //
    }
}
//=================================================================
function ShowFullGrid() {
    $("#slidingDiv").hide();
    $("#centerDiv").width(1004);
    $("#ctl00_main_gvmanufacturer").width(1004);
    resizeJqGridWidth('ctl00_main_gvmanufacturer', '1004');

    if (document.getElementById('image') != null) {
        document.getElementById('image').src = DOMAIN + "images/show.GIF";
        document.getElementById('image').title = "Show";
        //document.getElementById('Divalign').align = "left";
    }

}

function ShowFullGridOfLevel5() {
    $("#slidingDiv").hide();
    $("#centerDiv").width(1004);
    $("#ctl00_main_gvLevel5").width(1004);
    resizeJqGridWidth('ctl00_main_gvLevel5', '1004');

    if (document.getElementById('image') != null) {
        document.getElementById('image').src = DOMAIN + "images/show.GIF";
        document.getElementById('image').title = "Show";
        //document.getElementById('Divalign').align = "left";
    }

}

function ShowFullGridLevel4() {
    $("#slidingDiv").hide();
    $("#centerDiv").width(1004);
    $("#ctl00_main_gvLevel4").width(1004);
    resizeJqGridWidth('ctl00_main_gvLevel4', '1004');

    if (document.getElementById('image') != null) {
        document.getElementById('image').src = DOMAIN + "images/show.GIF";
        document.getElementById('image').title = "Show";
        //document.getElementById('Divalign').align = "left";
    }

}

function ShowFullGridOfManufacturerDetails() {
    $("#slidingDiv").hide();
    $("#centerDiv").width(1004);
    $("#ctl00_main_gvvendor").width(1004);
    resizeJqGridWidth('ctl00_main_gvvendor', '1004');

    if (document.getElementById('image') != null) {
        document.getElementById('image').src = DOMAIN + "images/show.GIF";
        document.getElementById('image').title = "Show";
        //document.getElementById('Divalign').align = "left";
    }

    $("#ctl00_main_gvLevel4").width(1004);
    resizeJqGridWidth('ctl00_main_gvLevel4', '1004');

    if (document.getElementById('image') != null) {
        document.getElementById('image').src = DOMAIN + "images/show.GIF";
        document.getElementById('image').title = "Show";
        //document.getElementById('Divalign').align = "left";
    }

}
//=========================================================================
function ShowHide(grid_id) {
    if ($('#slidingDiv:visible').length > 0) {

        $("#slidingDiv").animate({ "width": "toggle" }, { duration: 100 });
        // $("#slidingDiv").hide();
        $("#slidingDiv").width(0);
        $("#centerDiv").width(1004);
        d = document.getElementById(grid_id);
        d.style.width = "1004px";
        resizeJqGridWidth(grid_id, '1004');

        if (document.getElementById('image') != null) {

            document.getElementById('image').src = DOMAIN + "images/show.GIF";
            document.getElementById('image').title = "Show";
            //document.getElementById('Divalign').align = "left";
        }

    }
    else {

        $("#slidingDiv").animate({ "width": "toggle" }, { duration: 500 });
        //$("#slidingDiv").show();
        $("#slidingDiv").width(200);
        $("#centerDiv").width(785);

        d = document.getElementById(grid_id);
        d.style.width = "785px";
        resizeJqGridWidth(grid_id, '785');

        if (document.getElementById('image') != null) {

            document.getElementById('image').src = DOMAIN + "images/hide.GIF";
            document.getElementById('image').title = "Hide";
            //document.getElementById('Divalign').align = "right";
        }

    }

}

function ShowHideWithTwoGrid(first_grid_id, second_grid_id) {
    if ($('#slidingDiv:visible').length > 0) {

        $("#slidingDiv").animate({ "width": "toggle" }, { duration: 100 });
        // $("#slidingDiv").hide();
        $("#slidingDiv").width(0);
        $("#centerDiv").width(1004);
        d = document.getElementById(first_grid_id);
        d.style.width = "1004px";
        resizeJqGridWidth(first_grid_id, '1004');

        d = document.getElementById(second_grid_id);
        d.style.width = "1004px";
        resizeJqGridWidth(second_grid_id, '1004');

        if (document.getElementById('image') != null) {
            document.getElementById('image').src = DOMAIN + "images/show.GIF";
            document.getElementById('image').title = "Show";
            //document.getElementById('Divalign').align = "left";
        }

    }
    else {

        $("#slidingDiv").animate({ "width": "toggle" }, { duration: 500 });
        //$("#slidingDiv").show();
        $("#slidingDiv").width(200);
        $("#centerDiv").width(785);

        d = document.getElementById(first_grid_id);
        d.style.width = "785px";
        resizeJqGridWidth(first_grid_id, '785');

        d = document.getElementById(second_grid_id);
        d.style.width = "785px";
        resizeJqGridWidth(second_grid_id, '785');

        if (document.getElementById('image') != null) {
            document.getElementById('image').src = DOMAIN + "images/hide.GIF";
            document.getElementById('image').title = "Hide";
            //document.getElementById('Divalign').align = "right";
        }

    }

}

//http://www.mindfiresolutions.com/Resize-jqGrid-width-dynamically-based-on-browser-Window-size--1172.php
function resizeJqGridWidth(grid_id, width) {


    $(window).bind('resize', function() {
        $('#' + grid_id).setGridWidth(width, true); //Back to original width
        // $('#' + grid_id).setGridWidth($('#' + div_id).width(), false); //Resized to new width as per window


    }).trigger('resize');

}

function setDivWidth(grid_id) {
    d = document.getElementById(grid_id);

    d.style.width = "785px";
    if (document.getElementById('image') != null) {

        document.getElementById('image').src = DOMAIN + "images/Hide.GIF";
        document.getElementById('image').title = "Hide";
        //document.getElementById('Divalign').align = "left";
    }



}

//==================================================================
function showOHP() {
    var yes = confirm("Net amount would take about 2-3 minutes to load.\n Do you want to proceed?");
    if (yes == true) {

        var strLen = window.location.href.length;
        var url = window.location.href;
        url = url.slice(0, strLen - 2);
        window.location.href = url + '/1';

        return true;
    }
    else {

        var strLen = window.location.href.length;
        var url = window.location.href;

        if (url.substr(-2) == '/1') {
            url = url.slice(0, strLen - 2);
            window.location.href = url + '/0';
            //return false;

        }
        return false;


    }
}

//============================================
function readListControl() {
    var flag = false;

    var chkBoxList = document.getElementById(arguments[0]);

    var chkBoxCount = chkBoxList.getElementsByTagName("input");

    for (var i = 0; i < chkBoxCount.length; i++) {

        if (chkBoxCount[i].checked == true) {
            flag = true;
            return true;
        }
        else {


        }
    }
    if (flag == false) {
        alert('Please select at least one ' + arguments[1]);
        return false;
    }
    else {

    }

}

function combineReadListControl() {

    if (readListControl(arguments[0], arguments[1])) {
        if (readListControl(arguments[2], arguments[3])) {
            return true;
        }
        else {
            return false;
        }
    }
    else {
        return false;
    }
}
//=========================================================================

function homepageSearch() {

    document.getElementById("ctl00_header_txtsearch").focus();
    if (document.getElementById("ctl00_header_txtsearch").value.length > 2) {
        var ctid = document.getElementById("ctl00_header_drpComponentType").options[document.getElementById("ctl00_header_drpComponentType").selectedIndex].value;
        var ctname = trim(document.getElementById("ctl00_header_drpComponentType").options[document.getElementById("ctl00_header_drpComponentType").selectedIndex].text.toLowerCase()).replace(/ /g, "-");
        var txtsearch = trim(document.getElementById("ctl00_header_txtsearch").value);
        if (txtsearch.charAt(txtsearch.length - 1) == ".") {
            txtsearch = txtsearch.slice(0, -1)
        }

        if (ctid < 25) {

            if (ctid == 4) //item of work
            {
                // search 
                window.location.href = DOMAIN + "level4/" + ctname + "/" + ctid + "/header/" + txtsearch + "";
            }
            else //Material manufacturer
            {
                window.location.href = DOMAIN + "clear.aspx?str=" + txtsearch + "&ctid=" + ctid + "";
            }

        }
        else {
            if (ctid == 25) //manufacturer only
            {
                window.location.href = DOMAIN + "manufacturers/0/searched_manufacturer/" + txtsearch + "";
            }
        }
    }
    else {
        alert("Please enter more then 2 charecter");
        return false;
    }



}
function homepageSearchForManufacturer() {
    // arguments[0].style.fontWeight = 'bold';
    window.location.href = DOMAIN + "manufacturers/1/selected_level4_manufacturer/" + arguments[0] + "";

}
//function checktxtSerach()
//{
//    if ((document.getElementById("checkbox1").checked)) {
//        document.getElementById("txtsearch").value = '';

//    }
//    else {
//        document.getElementById("txtsearch").focus();
//    }
//}

//==================================================================================================
// use like this   OnClientClick="return CheckForTestFile(File_Upload);" 
//to check the extension of file xls
function CheckForTestFile() {

    //var file = document.getElementById('<%=File_Upload.ClientID%>');
    var file = arguments[0];
    var fileName = file.value;

    //Checking for file browsed or not 
    if (trim(fileName) == '') {
        alert("Please select a file to upload!!!");
        file.focus();
        return false;
    }

    //Setting the extension array for diff. type of text files 
    var extArray = new Array(".xls", ".xlsx");
    //getting the file name
    while (fileName.indexOf("\\") != -1)
        fileName = fileName.slice(fileName.indexOf("\\") + 1);
    //Getting the file extension                     
    var ext = fileName.slice(fileName.lastIndexOf(".")).toLowerCase();

    //matching extension with our given extensions.
    for (var i = 0; i < extArray.length; i++) {

        if (extArray[i] == ext) {
            return true;
        }
    }
    alert("Please only upload files that end in types:  "
    + (extArray.join("  ")) + "\nPlease select a new "
    + "file to upload and submit again.");
    file.focus();

    return false;
}
//====================DO NOT CHANGE ANY THING IN THIS FUNCTION===================================================
function setCheckboxInJQGrid() {
    var gridId = jQuery("#" + arguments[0]).getDataIDs();
    var txt = String(arguments[0]);
    for (var countRow = 0; countRow < gridId.length; countRow++) {
        var rowId = countRow;

        var checkboxCTL = "<input type ='checkbox' id ='" + rowId + " ' onClick = 'getCheckedIds(checked,this,\"" + arguments[0] + "\"," + arguments[1] + ",\"" + arguments[2] + "\");'/>";

        //set the checkBox
        if (jQuery("#" + arguments[0]).getCell(rowId, "Sno") != '') {
            jQuery("#" + arguments[0]).jqGrid('setRowData', rowId, { 'Sno': checkboxCTL });
        }
    }
}

//and this function will be defined like :

function getCheckedIds(checked, obj) {
    //////Some operations
    //alert(arguments[1]);
    var rowId = parseInt(obj.id)
    if (obj.checked == true) {

        arguments[3].value += jQuery("#" + trim(arguments[2])).getCell(rowId, trim(arguments[4])) + ',';
        //alert(arguments[3].value);
    }

    else {
        var strSelectedCellData = jQuery("#" + trim(arguments[2])).getCell(rowId, trim(arguments[4])) + ',';
        strSelectedCellData = "\\b" + strSelectedCellData; +"\\b"; //for exact match

        var str = arguments[3].value;

        str = str.replace(new RegExp(strSelectedCellData, 'g'), ''); // all occurence

        arguments[3].value = '';
        arguments[3].value = str;
        // alert(arguments[3].value);
    }
}
//==========================================================================================

function ShowHideDiv() {

    if ($('#relatedL4div:visible').length > 0) {
        $("#relatedL4div").animate({ "height": "toggle" }, { duration: 500 });
        if (document.getElementById('image1') != null) {

            document.getElementById('image1').src = DOMAIN + "images/down.GIF";
            document.getElementById('image1').title = "Show";
            //document.getElementById('Divalign').align = "right";
        } 
    
     }
     else {
         $("#relatedL4div").animate({ "height": "toggle" }, { duration: 500 });
        if (document.getElementById('image1') != null) {

            document.getElementById('image1').src = DOMAIN + "images/up.GIF";
            document.getElementById('image1').title = "Hide";
            //document.getElementById('Divalign').align = "right";
        } 
    }
    
}

//========================================================
function getSelectedL4Ids() {

    alert($("#ctl00_ctl00_main_main_hdl4").val());
}
function getSelectedL5Ids() {

    alert($("#ctl00_ctl00_main_main_hdl5").val());
}
function getSelectedCityIds() {

    alert($("#ctl00_ctl00_main_main_hdcity").val());
}

//=====================Banner at home page===============================
var quotations = new Array()
quotations[0] = "Solutions for the Construction Industry"
quotations[1] = "MasterFormat (USA) Coding System"
quotations[2] = "Materials .  Manufacturers . Vendors"
var i = 0;
function display() {
    document.getElementById('slideShow1').innerHTML = quotations[i]
    i++;
    setTimeout("display()", 1000)//1000 milliseconds, which will be 1 second.
    if (i > 2) {
        i = 0;
    }
}
//=======================================================================
function chkvalidation() {


    if (trim($("#ctl00_main_txtFirstName").val()) == '') {

        alert('First name required');
        return false;
    }
    if (trim($("#ctl00_main_txtLastName").val()) == '') {

        alert('Last name required');
        return false;
    }
    if (trim($("#ctl00_main_txtEmail").val()) == '') {

        alert('Email required');
        return false;
    }

    if (validate_email($("#ctl00_main_txtEmail").val()) == false) {
        alert("Wrong email format");
        return false;
    }
    if (trim($("#ctl00_main_txtCompany").val()) == '') {

        alert('Company name required');
        return false;
    }
    var s1 = trim($("#ctl00_main_txtphone").val());
    if (s1 == 'Phone Number' || s1 == '') {
        s1 = '';

    }
    var s2 = trim($("#ctl00_main_txtmobile").val());
    if (s2 == 'Mobile Number' || s2 == '') {
        s2 = '';

    }
    if (s1 == '' && s2 == '') {
        alert('Either Phone or Mobile number is required');
        return false;
    }

    //    if (ValidateNumeric(s1) == false ) {
    //        alert("Please enter only numerical values into Phone");
    //        return false;
    //    }

    //    if (ValidateNumeric(s2) == false) {
    //        alert("Please enter only numerical values into Mobile");
    //        return false;
    //    }







}
//=======================================================================

function getSelectedIds() {

    var grid = jQuery('#' + trim(arguments[0]));

    if (grid.getGridParam("selarrrow") != '') {

        var rowKey = grid.getGridParam("selarrrow") + ',';

        if (rowKey.length == 1) {

            rowKey = rowKey.replace(rowKey.charAt(0), "");
        }

        if (rowKey.charAt(0) == ',') {

            rowKey = rowKey.replace(rowKey.charAt(0), "");

        }

        document.getElementById(trim(arguments[1])).value = rowKey;


        return true;
    }

    else {
        alert(trim(arguments[2]));
        return false;
    }

    // alert(document.getElementById('ctl00_ctl00_main_main_hdl4').value);

}

function combinegetSelectedIds() {

    if (getSelectedIds(arguments[0], arguments[1], arguments[2])) {
        if (getSelectedIds(arguments[3], arguments[4], arguments[5])) {
            return true;
        }
        else {
            return false;
        }
    }
    else {
        return false;
    }
}
//==========================================================
function checkSelectedIds() {

    if (document.getElementById(trim(arguments[0])).value != '') {

        return true;
    }
    else {
        alert(trim(arguments[1]));
        return false;
    }



}
//==========================================================
function getIds() {
    alert($("#<%= hdl5.ClientID %>").val());
    var hiddenField = $("#<%= hdl5.ClientID %>").val();
    if (trim(hiddenField).length > 0) {

        return true;
    }
    else {
        alert(trim(arguments[0]));
        return false;
    }

    // alert(document.getElementById('ctl00_ctl00_main_main_hdl4').value);

}
//=================================================================================


function showdiv() {

    var myDivObj = document.getElementById("testDiv");
    alert(myDivObj.innerHTML);
}


