﻿//
// set country flag + tel code 
// 
function bcUpdateFlagTelCode(iLocID, spnTelCodeID, imgFlagID) {
    if (iLocID > 0) {
        $.getJSON("../_api/utils_json.ashx?method=100&lid="+iLocID+"&ts="+(new Date()).getTime(), function(json,textStatus){
            var bError = false;
            if (textStatus=="success") {
                var iStatus = parseInt(json[0].status);
                if (iStatus > 0) {
                    if (spnTelCodeID != null) $(spnTelCodeID).html("+" + json[0].telCode + " ");
                    if (imgFlagID != null) $(imgFlagID).attr("src","../images/flags/" + json[0].countryCode + ".gif");
                } else {
                    bError = true;
                }
            } else {
                bError = true;
            }  
            //if (bError) {alert("Error: Request could not be processed.");}                 
        });
    }                                
}