			
var hidden = '';
var hidden_sub = '';

function askQ(str) {
  if (confirm(str)) {
    return true;
  }
  return false;
}

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}

// close window and reload opener window

function reloadOpener(url){
  if (document.form.form.value != ''){
    var form = document.form.form.value;
    var addon_vc = getRadioValue(document.form.addon_vc);
//[document.form.addon_vc.selectedIndex].value;
    var addon = getRadioValue(document.form.addon);
    if (addon_vc == undefined){
      addon_vc = '';
    }
    if (addon == undefined){
      addon = '';
    }
    url += '&form='+document.form.form.value+'&addon_vc='+addon_vc+
           '&addon='+addon;
  }
  window.opener.location.href = url;
  window.close();
}

function getRadioValue(radioName){
var user_input = '';
for (i=0;i<radioName.length;i++)
{
	if (radioName[i].checked)
	{
		user_input = radioName[i].value;
	}
}
return user_input;
}

function showHide(ename)
{
	if(hidden)
	{
		h = document.getElementById(hidden);
		h.style.display = "none";
	}
	if(hidden != ename)
	{
		e = document.getElementById(ename);
		e.style.display = "block";
		hidden = ename;
	}
	else
		hidden = '';
}

function showHide_sub(ename)
{
        if(hidden_sub)
        {
                h = document.getElementById(hidden_sub);
                h.style.display = "none";
        }
        if(hidden_sub != ename)
        {
                e = document.getElementById(ename);
                e.style.display = "block";
                hidden_sub = ename;
        }
        else
                hidden_sub = '';
}

function showDivs(show){
  if (show == 'prev') {
    h = document.getElementById('featured_'+cur);
    h.style.display = "none";
    if (document.getElementById('pause_'+cur).style.display == 'none'){
      document.getElementById('pause_'+cur).style.display = 'inline';
      document.getElementById('play_'+cur).style.display = 'none';
    }
    cur--;
    if (cur < 0) {cur = num-1; next = num}
    else {next = cur+1;}
    e = document.getElementById('featured_'+cur);
    e.style.display = "block";
  } else {
    rotating_Items();
  }
  if(timerid) timerid = clearTimeout(timerid);
  timerid = setTimeout("rotateDivs()", 10000);
}

function rotateDivs() {
   rotating_Items();
   timerid = setTimeout("rotateDivs()", 10000);

}

function rotating_Items(){
      h = document.getElementById('featured_'+cur);
    h.style.display = "none";
    if (document.getElementById('pause_'+cur).style.display == 'none'){
      document.getElementById('pause_'+cur).style.display = 'inline';
      document.getElementById('play_'+cur).style.display = 'none';
    }
    if(next==num) {cur=1; next=0;}
    e = document.getElementById('featured_'+next);
    e.style.display = "block";
    if (cur==1 && next==0){cur=0;next=1;
    }else {cur++; next++;}
}
function pauseRotate(){
  h = document.getElementById('play_'+cur);
  h.style.display = "inline";
  e = document.getElementById('pause_'+cur);
  e.style.display = "none";
  if(timerid) {timerid = clearTimeout(timerid);}
}
var cur =0;
var next =1;

function swapImage(tagname,imgname){
  document[tagname].src='/images/'+imgname;
}
function newImage(arg) {
        if (document.images) {
                rslt = new Image();
                rslt.src = arg;
                return rslt;
        }
}

function changeImages() {
        if (document.images) {
                for (var i=0; i<changeImages.arguments.length; i+=2) {
                        document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                }
        }
}
var First = "";
var Last = "";
var Address = "";
var City = "";
var State = "";
var StateIndex = 0;
var Country = "";
var CountryIndex = 0;
var Zip = "";

function InitialBillingInfo(form){
First = form.cc_fname.value;
Last = form.cc_lname.value;
Address = form.cc_address.value;
City = form.cc_city.value;
Zip = form.cc_zip.value;
StateIndex = form.cc_state.selectedIndex;
State = form.cc_state[StateIndex].value;
CountryIndex = form.cc_country.selectedIndex;
Country = form.cc_country[CountryIndex].value;
}

function ShipToBillPerson(form) {
if (form.copy.checked) {
  InitialBillingInfo(form);
  form.cc_fname.value = form.fname.value;
  form.cc_lname.value = form.lname.value;
  form.cc_address.value = form.address.value;
  form.cc_city.value = form.city.value;
  if (form.state.selectedIndex){
    form.cc_state.selectedIndex   = form.state.selectedIndex;
    form.cc_country.selectedIndex = form.country.selectedIndex;
  } else {
    form.cc_state.selectedIndex = form.state.value;
    form.cc_country.selectedIndex = form.country.value;
  }
  form.cc_zip.value = form.zip.value;
} else {
  form.cc_fname.value = First;
  form.cc_lname.value = Last;
  form.cc_address.value = Address;
  form.cc_city.value = City;
  form.cc_state.selectedIndex = StateIndex;
  form.cc_country.selectedIndex  = CountryIndex;
  form.cc_zip.value = Zip;
}
}

