﻿// Copyright Channel Intelligence, Inc. 2002-2005
function ykb_popupWindow_version() { return '2.36'; }
function manu_CDLink(rsOEM, rsSKU, rnH, rnW, rbFC, rsCT, rbShowMenu, rnSCID, rsAName) {
    var oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsOEM, 'http://' + rsOEM + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+', '%2B') + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+', '%2B') : ''), (rnH && rnH != '' ? rnH : '430'), (rnW && rnW != '' ? rnW : '800'), 'middle', 'center', true, (rbFC ? 'browser' : ''), true, true, true, (rbShowMenu ? 'true' : 'false'));
    oWin.focus();
}
function manu_CDLinkNoURL(rsOEM, rsSKU, rnH, rnW, rsCT, rnSCID) { manu_CDLink(rsOEM, rsSKU, rnH, rnW, false, rsCT, true, rnSCID); }
function manu_CDLinkFullChrome(rsOEM, rsSKU, rnH, rnW, rsCT, rnSCID) { manu_CDLink(rsOEM, rsSKU, rnH, rnW, true, rsCT, rnSCID); }
function manu_CDLinkMinimal(rsOEM, rsSKU, rnH, rnW, rsCT, rnSCID) {
    var oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsOEM, 'http://' + rsOEM + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+', '%2B') + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : ''), (rnH && rnH != '' ? rnH : '430'), (rnW && rnW != '' ? rnW : '800'), 'middle', 'center', true, '', true, false, false, false, false);
    oWin.focus();
}
function manu_Purchase(rsOEM, rsSKU, rnVID, rsCT, rbICI, rnCTID, rnSCID) {
    if (!rnCTID) { rnCTID = 4; if (!rnSCID) { rnSCID = 0; } }
    if (!rnSCID) { rnSCID = rnCTID; }
    document.location = 'http://' + rsOEM + '.links.channelintelligence.com/pages/redirector.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'nCTID=' + rnCTID + '&sSKU=' + escape(rsSKU).replace('+', '%2B') + '&nVID=' + rnVID + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '') + (rbICI ? '&nICI=1' : '');
}
function manu_PurchaseInWindow(rsOEM, rsSKU, rnVID, rsCT, rnH, rnW, rbFC, rbICI, rnCTID, rnSCID) {
    if (!rnCTID) { rnCTID = 4; if (!rnSCID) { rnSCID = 0; } }
    if (!rnSCID) { rnSCID = rnCTID; }
    var oWin = ykb_PopUp('cii_com', rsOEM, 'http://' + rsOEM + '.links.channelintelligence.com/pages/redirector.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'nCTID=' + rnCTID + '&sSKU=' + escape(rsSKU).replace('+', '%2B') + '&nVID=' + rnVID + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '') + (rbICI ? '&nICI=1' : ''), (rnH && rnH != '' ? rnH : '430'), (rnW && rnW != '' ? rnW : '800'), 'middle', 'center', true, (rbFC ? 'browser' : ''), true, true, true, true);
    oWin.focus();
}
function manu_InlineCDLink(rsOEM, rsSKU, rsCT, rnSCID) { document.location.replace('http://' + rsOEM + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+', '%2B') + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '')); }
function manu_InlineCDRuleGroupLink(rsOEM, rsSKU, rnRGID, rsCT, rnSCID) { document.location.replace('http://' + rsOEM + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+', '%2B') + '&nRGID=' + rnRGID + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '')); }
function manu_DirectCDLink(rsOEM, rsSKU, rsCT, rnSCID, rsAName) { document.location = 'http://' + rsOEM + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+', '%2B') + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+', '%2B') : ''); }
function manu_DirectCDRuleGroupLink(rsOEM, rsSKU, rnRGID, rsCT, rnSCID, rsAName) { document.location = 'http://' + rsOEM + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+', '%2B') + '&nRGID=' + rnRGID + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+', '%2B') : ''); }
function manu_CDRuleLink(rsOEM, rsSKU, rnRID, rnH, rnW, rbFC, rsCT, rnSCID, rsAName) {
    var oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsOEM, 'http://' + rsOEM + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+', '%2B') + '&nRID=' + rnRID + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+', '%2B') : ''), (rnH && rnH != '' ? rnH : '430'), (rnW && rnW != '' ? rnW : '800'), 'middle', 'center', true, (rbFC ? 'browser' : ''), true, true, true);
    oWin.focus();
}
function manu_CDRuleGroupLink(rsOEM, rsSKU, rnRGID, rnH, rnW, rbFC, rsCT, rnSCID, rsAName) {
    var oWin = ykb_PopUp('cii_com_' + Math.round(Math.random() * 1000), rsOEM, 'http://' + rsOEM + '.links.channelintelligence.com/pages/prices.asp?' + (rnSCID ? 'nSCID=' + rnSCID + '&' : '') + 'sSKU=' + escape(rsSKU).replace('+', '%2B') + '&nRGID=' + rnRGID + (rsCT ? '&sCT=' + escape(rsCT).replace('+', '%2B') : '') + (rsAName ? '&sAName=' + escape(rsAName).replace('+', '%2B') : ''), (rnH && rnH != '' ? rnH : '430'), (rnW && rnW != '' ? rnW : '800'), 'middle', 'center', true, (rbFC ? 'browser' : ''), true, true, true);
    oWin.focus();
}
function ykb_PopUp(sName, sTitle, sURL, rnH, rnW, sValign, sAlign, bResizeable, sType, bScrollBars, bToolbar, bStatusBar, bMenuBar, bLocation) {
    if (!rnH) { rnH = 10; }
    if (!rnW) { rnW = 10; }
    if (rnH != '-1') {
        var sStr = ciiLC(rnH);
        if (sStr.substr(sStr.length - 1, 1) == '%') { rnH = screen.height * sStr.substr(0, sStr.length - 1) / 100; }
        else if (rnH == 0) { rnH = 100; }
        else { rnH = rnH / 1; }
    }
    if (rnW != '-1') {
        var sStr = ciiLC(rnW);
        if (sStr.substr(sStr.length - 1, 1) == '%') { rnW = screen.width * sStr.substr(0, sStr.length - 1) / 100; }
        else if (rnW == 0) { rnW = 100; }
        else { rnW = rnW / 1; }
    }
    var sCfg = '';
    if (!bResizeable) { sCfg += ',resizable=no'; }
    else { sCfg += ',resizable=yes'; }
    if (sType && ciiLC(sType) == 'browser') {
        sCfg += ',directories=no,location=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes,scrollbars=yes';
    } else {
        sCfg += ',directories=no,titlebar=no';
        if (!bStatusBar) { sCfg += ',status=no'; }
        else {
            sCfg += ',status=yes';
            rnH += 20;
        }
        if (!bToolbar) { sCfg += ',toolbar=no' }
        else {
            sCfg += ',toolbar=yes';
            rnH += 80;
        }
        if (!bScrollBars) { sCfg += ',scrollbars=no' }
        else { sCfg += ',scrollbars=yes'; }
        if (!bLocation) { sCfg += ',location=no' }
        else { sCfg += ',location=yes'; }
        if (!bMenuBar) { sCfg += ',menubar=no' }
        else { sCfg += ',menubar=yes'; }
    }
    if (rnH > screen.height - 5) { rnH = screen.height - 20; }
    if (rnW > screen.width - 5) { rnW = screen.width - 20; }
    var nY = 0;
    if (sValign) {
        sValign = ciiLC(sValign);
        if (sValign == 'middle') { nY = (screen.height - (!bToolbar ? 0 : 80) - rnH) / 2; }
        else if (sValign == 'top') { nY = 0; }
        else if (sValign == 'bottom') { nY = screen.height - rnH; }
        else if (event && sValign == 'here') { nY = event.screenY; }
        else if (sValign == 'hidden') { nY = screen.height + 1; }
        else { nY = (screen.height - rnH) / 2 }
        if (nY > 0 && (nY + rnH > screen.height)) { nY = screen.height - rnH - 40; }
        if (nY < 0) { nY = 0; }
        sCfg += ',screenY=' + nY + ',top=' + nY;
    }
    var nX = 0;
    if (sAlign) {
        sAlign = ciiLC(sAlign);
        if (sAlign == 'center') { nX = (screen.width - rnW) / 2 - 5; }
        else if (sAlign == 'left') { nX = 0; }
        else if (sAlign == 'right') { nX = screen.width - rnW - 13; }
        else if (event && sAlign == 'here') { nX = event.screenX + 10; }
        else if (sAlign == 'hidden') { nX = screen.width + 1; }
        else { nX = (screen.width - rnW) / 2; }
        if (nX > 0 && (nX + rnW > screen.width)) { nX = screen.width - rnW - 40; }
        if (nX < 0) { nX = 0; }
        sCfg += ',screenX=' + nX + ',left=' + nX;
    }
    if (rnH != -1) { sCfg = 'height=' + rnH + ',' + sCfg; }
    if (rnW != -1) { sCfg = 'width=' + rnW + ',' + sCfg; }
    if (sName) { sName = cii_StrRep(cii_StrRep(cii_StrRep(cii_StrRep(sName, '-', '_'), ')', '_'), '(', '_'), ' ', '_'); }
    var loWin = window.open(sURL, sName, config = '' + sCfg, false);
    if (loWin != null) { loWin.focus(); }
    return loWin;
}
function ykb_WindowMoveTo(roWin, rnH, rnW, rsV, rsA) {
    var nY = 0;
    if (!rnH) { rnH = roWin.document.body.offsetHeight + 20; }
    if (!rnW) { rnW = roWin.document.body.offsetWidth; }
    if (rsV) {
        rsV = ciiLC(rsV);
        if (rsV == 'middle') { nY = (screen.height - rnH) / 2 }
        else if (rsV == 'top') { nY = 0; }
        else if (rsV == 'bottom') { nY = screen.height - rnH; }
        else if (event && rsV == 'here') { nY = event.screenY; }
        else if (sValign == 'hidden') { nY = screen.height + 1; }
        else { nY = (screen.height - rnH) / 2 }
    }
    var nX = 0;
    if (rsA) {
        rsA = ciiLC(rsA);
        if (rsA == 'center') { nX = (screen.width - rnW) / 2; }
        else if (rsA == 'left') { nX = 0; }
        else if (rsA == 'right') { nX = screen.width - rnW - 10; }
        else if (event && rsA == 'here') { nX = event.screenX + 10; }
        else if (sAlign == 'hidden') { nX = screen.width + 1; }
        else { nX = (screen.width - rnW) / 2; }
    }
    if (nY > 0 && (nY + rnH > screen.height)) { nY = screen.height - rnH - 40; }
    if (nX > 0 && (nX + rnW > screen.width)) { nX = screen.width - rnW - 40; }
    if (nY < 0) { nY = 0; }
    if (nX < 0) { nX = 0; }
    roWin.moveTo(nX, nY);
}
function cii_WindowResize(roWin, rnH, rnW) {
    var sStr = ciiLC(rnH);
    if (sStr.substr(sStr.length - 1, 1) == '%') { rnH = screen.height * sStr.substr(0, sStr.length - 1) / 100; }
    var sStr = ciiLC(rnW);
    if (sStr.substr(sStr.length - 1, 1) == '%') { rnW = screen.width * sStr.substr(0, sStr.length - 1) / 100; }
    oDim = new Object();
    oDim.rnW = rnW;
    oDim.rnH = rnH;
    roWin.resizeTo(oDim.rnW, oDim.rnH);
    return oDim;
}
function ciiLC(rsStr) { var sStr = new String(rsStr); return sStr.toLowerCase(); }
function cii_StrRep(rsStr, rsOStr, rsNStr) {
    var nLen = rsStr.length;
    var nOLen = rsOStr.length;
    var nPos = rsStr.indexOf(rsOStr);
    if ((nLen == 0) || (nOLen == 0)) return rsStr;
    if ((!nPos) && (rsOStr != rsStr.substring(0, nOLen))) return rsStr;
    if (nPos == -1) return rsStr;
    var sStr = rsStr.substring(0, nPos) + rsNStr;
    if (nPos + nOLen < nLen) { sStr += cii_StrRep(rsStr.substring(nPos + nOLen, nLen), rsOStr, rsNStr); }
    return sStr;
}
