var isF=(navigator.userAgent.indexOf('Firefox') != -1);

// account
function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

// account_newsletters, account_notifications, address_book etc.
function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function checkBox(object,id) {
  var x;
  if (id == 1)
    x = account_newsletter;
  else if (id == 2)
    x = account_notification;
  document.x.elements[object].checked = !document.x.elements[object].checked;
}

function checkBox(object) {
  document.account_notifications.elements[object].checked = !document.account_notifications.elements[object].checked;
}

// checkout functions
var selected;

function selectRowEffect(object, buttonSelect, type) {
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }

  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;

// one button is not an array
  if (type='payment')
  { if (document.checkout_payment.payment[0]) {
      document.checkout_payment.payment[buttonSelect].checked=true;
    } else {
      document.checkout_payment.payment.checked=true;
    }
  } else if (type='address')
  {
    if (document.checkout_address.address[0]) {
      document.checkout_address.address[buttonSelect].checked=true;
    } else {
      document.checkout_address.address.checked=true;
    }
  } else if (type='shipping')
  { if (document.checkout_address.shipping[0]) {
      document.checkout_address.shipping[buttonSelect].checked=true;
    } else {
      document.checkout_address.shipping.checked=true;
    }
  }
}

function check_form_optional(form_name) {
  var form = form_name;

  var firstname = form.elements['firstname'].value;
  var lastname = form.elements['lastname'].value;
  var street_address = form.elements['street_address'].value;

  if (firstname == '' && lastname == '' && street_address == '') {
    return true;
  } else {
    return check_form(form_name);
  }
}

// product_info etc
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150');
}

function popupWindowSearch(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=310,screenX=220,screenY=220,top=220,left=220')
}

function popupWindowSB(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=no,resizable=no,copyhistory=no,width=650,height='+(isF?538:525)+',screenX=185,screenY=75,top=75,left=185');
}

function popupWindowFull(url) {
  window.open(url,'popupWindow','toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=790,height=490,screenX=93,screenY=40,top=40,left=93');
}

function popupWindowPayment(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=650,height=350,screenX=185,screenY=175,top=175,left=185');
}

function popupWindowCompat(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=650,height=550,screenX=185,screenY=75,top=75,left=185');
}

function changetext(){
rainbow="#"+hex[r]+hex[g]+hex[b]
storetext.style.color=rainbow
}
function change(){
if (seq==6){
b--
if (b==0)
seq=1
}
if (seq==5){
r++
if (r==12)
seq=6
}
if (seq==4){
g--
if (g==0)
seq=5
}
if (seq==3){
b++
if (b==12)
seq=4
}
if (seq==2){
r--
if (r==0)
seq=3
}
if (seq==1){
g++
if (g==12)
seq=2
}
changetext()
}
function starteffect(){
if (document.all||document.getElementById)
flash=setInterval("change()",speed)
}
