var atHereMenu = '';
var atHereTopper = '';
var baseHREF = 'http://www.buycoin.com';


function toggleShipTo() {
  if (document.getElementById('btshSame').checked==true) { togVal=1; } else { togVal=0; }
  if (togVal==1) {
    document.getElementById('contCheckoutSame').style.width='500px';
    document.getElementById('contCheckoutSame').style.height='20px';
    document.getElementById('shiptoDif').style.height='0px';
    document.getElementById('shiptoDif').style.width='0px';
    document.getElementById('contCheckoutDif').style.height='0px';
    document.getElementById('contCheckoutDif').style.width='0px';
  }
  else {
    document.getElementById('contCheckoutSame').style.width='0px';
    document.getElementById('contCheckoutSame').style.height='0px';
    document.getElementById('shiptoDif').style.height='280px';
    document.getElementById('shiptoDif').style.width='500px';
    document.getElementById('contCheckoutDif').style.height='20px';
    document.getElementById('contCheckoutDif').style.width='500px';
  }
}

function updateShipto() {
  document.forms.enterShipto.submit();
}

function doContinueCheckout() {
  document.forms.continueCheckout.submit();
}


function poserPopper(url,xWidth,yHeight,winName) {
  var x = Math.round((document.body.clientWidth - xWidth) / 2);
  var y = Math.round((document.body.clientHeight - yHeight) / 2);
  if (typeof(popupWin) != "object"){
    poserArgs = "width=" + xWidth + ",height=" + yHeight + ",left=" + x + ",top=" + y + ",scrollbars=1,toolbar=0,status=0,menubar=0,rezisable=0,location=0,directories=0";
    popupWin = window.open(url,winName,poserArgs);
  }
  else {
    poserArgs = "width=" + xWidth + ",height=" + yHeight + ",left=" + x + ",top=" + y + ",scrollbars=1,toolbar=0,status=0,menubar=0,rezisable=0,location=0,directories=0";
    popupWin = window.open(url,winName,poserArgs);
  }
  popupWin.focus();
}



function launchPlayer(thefile) {
  poserPopper(baseHREF + '/mediaplayer.php?vidid=' + thefile , 400 ,325 , 'mediaplayer');
}


function updateQuant(theitem) {
  subform = document.forms.modquantForm;
  useID = theitem.split('_',2);
  thecode = useID[1];
  newquant=document.getElementById('MQ_' + thecode).options[document.getElementById('MQ_' + thecode).selectedIndex].value;
  subform.newquant.value=newquant;
  subform.itemid.value=thecode;
  subform.submit();
  // alert('Code: ' + subform.itemid.value + '\nQuant: ' + subform.newquant.value);
}

function removeItem(theitem) {
  subform = document.forms.modquantForm;
  subform.newquant.value=0;
  subform.itemid.value=theitem;
  subform.submit();
}

function continueShopping(continueLink) {
  top.location.href = continueLink;
}

function gotoCheckout() {
  top.location.href = 'checkout.php';
}


function finalizeOrder() {
  if (document.getElementById('acceptTerms').checked!=true) { alert('You must agree to the terms of sale!'); return false; }
  else { document.forms.finalizeFrm.submit(); }
}


function swapImg(theid,theimg) {
  document.getElementById(theid).src='img/navheader/' + theimg;
}
