﻿var divArray = new Array();
divArray[0] = "noConfirm";
divArray[1] = "noMagazine";
divArray[2] = "noInvoice";
divArray[3] = "orderAbroad";
divArray[4] = "quit";
divArray[5] = "question";
divArray[6] = "coop";
divArray[7] = "suggestion";
divArray[8] = "unreg";

function Question(strId) {

    $.each(divArray, function (key, value) {
        $('#' + value).css('display', 'none');
    });


    if (strId != "x") {
        document.getElementById(strId).style.display = 'inline';
    }
    if (strId == "quit" || strId == "noInvoice" || strId == "noMagazine")
        document.getElementById('magSelect').style.display = 'inline';
    else
        document.getElementById('magSelect').style.display = 'none';

}

function Title(intValue, intText) {
    switch (intText) {
        case 0:
            document.getElementById("noMagCon").innerHTML = Magazine(intValue, intText);
            break;
        case 1:
            document.getElementById("noInvoiceCon").innerHTML = Magazine(intValue, intText);
            break;
        case 2:
            document.getElementById("quitCon").innerHTML = Magazine(intValue, intText);
            break;
        default:
            document.getElementById("noMagCon").innerHTML = Magazine(intValue, intText);
    }
}



function GetContactInfo(divId, intProductId)//, intProductId)
{
    var question = $("ddlQuestion").value;

    /*

    new Ajax.Updater(divId, '/service/CSService.aspx',
    { parameters:
    {
    q: $("ddlQuestion").value
    , intProductId: intProductId
    
    }
    });
    */
    $.ajax({
        url: '/service/CSService.aspx',
        data: { intProductId: intProductId, q: $('#ddlQuestion').val() },
        type: 'POST',
        success: function (data) {
            $('#' + divId).html(data);
        }
    });

//    var xmlHttp;
//    xmlHttp = new XMLHttpRequest();
//    xmlHttp.onreadystatechange = function() {
//        if (xmlHttp.readyState == 4) {
//            document.getElementById(divId).innerHTML = xmlHttp.responseText;
//        }
//    }
//    xmlHttp.open("GET", "CS/CS.aspx?q=" + question + "&intProductId=" + intProductId, true);
//    xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
//    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
//    xmlHttp.send(null);
}
