/*USE:	Simply put getCSPod("[deptCode]"); where you want the image to show up (surrounded by script tags of course)
		Valid deptCodes: BIS, EP, IP, ASD (PSD is incorrectly called EP, use EP for PSD)
		Images need to be named as follows [deptCode]_dedicated_care_[timeZone].jpg
*/

function getCSPod(dept) {
    var deptCode = dept;
    var timeZone = "PT";
    var dtDate = new Date('1/1/' + (new Date()).getUTCFullYear());
    var intOffset = 10000; //set initial offset high so it is adjusted on the first attempt
    var intMonth;

    //go through each month to find the lowest offset to account for DST
    for (intMonth = 0; intMonth < 12; intMonth++) {
        dtDate.setUTCMonth(dtDate.getUTCMonth() + 1);

        if (intOffset > (dtDate.getTimezoneOffset() * (-1))) {
            intOffset = (dtDate.getTimezoneOffset() * (-1));
        }
    }

    intOffset = intOffset / 60;

    switch (intOffset) {
        case -5: //Eastern
            timeZone = "ET";
            break;
        case -6: //Central
            timeZone = "CT";
            break;
        case -7: //Mountain (Same as default)
        case -8: //Pacific (Same as default)
        default:
            timeZone = "PT";
    } 
    //Write out the image
    //alert(deptCode+'_dedicated_care_'+timeZone+'.jpg');
    if (dept == "returnOnly") { return timeZone; }
    if (dept == "DEFAULT") {
        document.write('<img style="border-right:medium none;border-top:medium none;border-left:medium none;border-bottom:medium none" alt="Customer Support" title="Customer Support" src="/img/csPods/DEFAULT_dedicated_care.jpg" />');
    } else if (dept == "PSD_AS") {

        document.write('<img style="border-right:medium none;border-top:medium none;border-left:medium none;border-bottom:medium none" alt="Customer Support" title="Customer Support" src="/img/csPods/PSD_AS_dedi_care.jpg" />');
    } else {
        document.write('<img style="border-right:medium none;border-top:medium none;border-left:medium none;border-bottom:medium none" alt="Customer Support" title="Customer Support" src="/img/csPods/' + deptCode + '_dedicated_care_' + timeZone + '.jpg" />');
    }
}

function getIncCSPod(version) {
    timeZone = getCSPod("returnOnly");
    document.write('<img style="border-right:medium none;border-top:medium none;border-left:medium none;border-bottom:medium none" alt="Customer Support" title="Talk With a Business Formation Consultant" src="/img/csPods/legalzoom_' + version + '_business_formation_' + timeZone + '.jpg" />');
}

