// popups.js -----------------------------------------------------------

var specWindow = null
var specWindowConfig = null
var specWindowWidth = null

function techPopup(pId, pWidth, pHeight) {
  var windowCfg = "scrollbars,resizable,height=" + pHeight + ",width=" + pWidth
  var techWindow = window.open('SBCTechPopup.jsp?pid=' + pId, '', windowCfg)
}

function bullet(bulletCode) {
  if (bulletCode.substring(0, 4) == 'size') sizeChart(bulletCode)
  else {
    if (bulletCode.substring(0, 4) == '3dsm') threedsm(bulletCode)
    else specPopup(bulletCode)
  }
}

function threedsm(threedsmCode) {
  specWindowWidth = 500
  if (threedsmCode.substring(0, 8) == '3dsmsole') specWindowWidth = 700
  pOpen(500, specWindowWidth, 'http://www.specialized.com/specialized/' + threedsmCode + '.htm')
}

function specPopup(specCode) {
  specWindowWidth = 450
  if (specCode == 'bodygeometryshoes') specWindowWidth = 750
  var tableWidth = specWindowWidth - 50
  var cellWidth = specWindowWidth - 100
  pOpen(300, specWindowWidth, '/specs/spec.jsp?speccode=' + specCode + '&tablewidth=' + tableWidth + '&cellwidth=' + cellWidth)
}

function experience(experienceCode, sectURL) {
  pOpen(290, 660, '/experience/experience.jsp?expcode=' + experienceCode + '&secturl=' + sectURL)
}

function sizeChart(chartCode) {
  pOpen(400, 480, '/sizecharts/sizechart.jsp?chartcode=' + chartCode)
}

function newfor2002(new2002Code) {
  pOpen(250, 480, '/sections/new2002.jsp?new2002code=' + new2002Code)
}

function newfor2003(new2003Code) {
  pOpen(250, 480, '/sections/new2003.jsp?new2003code=' + new2003Code)
}

function newfor2004(new2004Code) {
  pOpen(250, 480, '/sections/new2004.jsp?new2004code=' + new2004Code)
}

function comparisonChart(chartCode) {
  pOpen(400, 725, '/sizecharts/comparisonchart.jsp?chartcode=' + chartCode)
}

function reviewPopup(reviewURL) {
  pOpen(450, 725, reviewURL)
}

function equipPopup(equipImage, equipModel) {
  pOpen(575, 695, 'SBCEquipPopup.jsp?equipimage=' + equipImage + '&equipmodel=' + equipModel)
}

function bikePopup(bikeImage, bikeModel) {
  pOpen(768, 1024, 'SBCBikePopup.jsp?bikeimage=' + bikeImage + '&bikemodel=' + bikeModel)
}

function bikePopup(equipImage, equipModel) {
  pOpen(768, 1024, 'SBCEquipPopup.jsp?equipimage=' + equipImage + '&equipmodel=' + equipModel)
}

function geometryPopup(spid) {
  pOpen(350, 750, 'SBCGeometryPopup.jsp?spid=' + spid)
}

function concept(conceptCode) {
  pOpen(600, 625, '/concepts/concepts.jsp?conceptcode=' + conceptCode)
}

function conceptStore(conceptStoreCode) {
  pOpen(600, 625, '/conceptstore/conceptstore.jsp?conceptstorecode=' + conceptStoreCode)
}


function bmx(bmxCode) {
  pOpen(600, 625, '/bmx/bmxs.jsp?bmxcode=' + bmxCode)
}

function buckley(buckleyCode) {
  pOpen(600, 625, '/buckley/buckleys.jsp?buckleycode=' + buckleyCode)
}


function history(historyCode) {
  pOpen(600, 625, '/history/historys.jsp?historycode=' + historyCode)
}

function faq(xsrcCode) {
  pOpen2(620, 720, 'SBCFAQPop.jsp?xsrc=' + xsrcCode)
}

function bFree(url) {
  pOpen(600, 625, url)
}

function pOpen(pHeight, pWidth, pLoc) {
  var scrollBars = 'yes'
  if (pOpen.arguments.length == 4) scrollBars = pOpen.arguments[4]
  specWindowConfig="toolbar=no,location=no,scrollbars=" + scrollBars + ",menubar=no,resizable=yes,status=no,height=" + pHeight + ",width=" + pWidth
  if (specWindow && !specWindow.closed) specWindow.close()
  specWindow = window.open(pLoc, '', specWindowConfig)
  //clearInterval(track)
}

function pOpen2(pHeight, pWidth, pLoc) {
  specWindowConfig="toolbar=yes,location=no,scrollbars=yes,menubar=no,resizable=yes,status=no,height=" + pHeight + ",width=" + pWidth
  if (specWindow && !specWindow.closed) specWindow.close()
  specWindow = window.open(pLoc, '', specWindowConfig)
  //clearInterval(track)
}

