var useID =0, useLayers = 0, useAll = 0;
if (document.getElementById) useID=1;
if (document.layers) useLayers = 1;
if (document.all) useAll = 1;
function getObj (obj)
{
  var myObj;
  if (useID) myObj = document.getElementById(obj).style;
  else if (useAll) myObj = document.all[obj].style;
  else if (useLayers) myObj = document.layers[obj];
  return myObj;
}


function perItem(string)
{
  window.status=string;
  return 1;
}


window.status = "GSAMall";


function checkDelete ()
{
  if (document.forms.updateForm.skuDelete.checked) {
    return confirm ("Are you sure you want to delete this record?");
  }
  return 1;
}

function accountUpdate ()
{
  return confirm ("Are you sure you want to update your record?");
}


var prefix = "/images/menu/";
var images = new Array();
images['home-over']      = newImage("home-over.gif");
images['home-off']       = newImage("home.gif");
images['myaccount-over'] = newImage("my-account-over.gif");
images['myaccount-off']  = newImage("my-account.gif");
images['viewcart-over']  = newImage("view-cart-over.gif");
images['viewcart-off']   = newImage("view-cart.gif");
images['search-over']    = newImage("search-over.gif");
images['search-off']     = newImage("search.gif");
images['directory-over'] = newImage("directory-over.gif");
images['directory-off']  = newImage("directory.gif");
images['aboutus-over']   = newImage("about-us-over.gif");
images['aboutus-off']    = newImage("about-us.gif");
images['contactus-over'] = newImage("contact-us-over.gif");
images['contactus-off']  = newImage("contact-us.gif");
images['reseller-over']  = newImage("reseller-over.gif");
images['reseller-off']   = newImage("reseller.gif");

function newImage(imgName) {
  if (document.images) {
    rVal = new Image();
    rVal.src = prefix+imgName;
    return rVal;
  }
}

function changeImage(imageName,newImage) {
  if (!document.images) {
    return;
  }
  var thisImage = document.images[imageName];
  thisImage.src=images[newImage].src;
  return 1;
}

function openWindow(tPage, tName, width, height, scroll) {
  var winl = (screen.width - width) / 2;
  var wint = (screen.height - height) / 2;
  winprops  = 'height='+height+',width='+width;
  winprops += ',top='+wint+',left='+winl;
  winprops += ',scrollbars='+scroll+',resizable';
  win = window.open(tPage, tName, winprops);
  if (parseInt(navigator.appVersion) >= 4) { 
    win.window.focus(); 
  }
}

function closeWindow () {
  window.close();
}

function submitAndCloseWindow(t) {
  document.forms.addNote.submit();
  return true;
}

function _verisignPopup(url) {
	sealWin=window.open(url,"win",'toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin";
}


function updateShipping() {

	thisForm = document.verifyForm;
	if (thisForm["shipping.same"].checked) {
		thisForm["shipping.email"].value=thisForm["billing.email"].value;
		thisForm["shipping.fname"].value=thisForm["billing.fname"].value;
		thisForm["shipping.mname"].value=thisForm["billing.mname"].value;
		thisForm["shipping.lname"].value=thisForm["billing.lname"].value;
		thisForm["shipping.company"].value=thisForm["billing.company"].value;
		thisForm["shipping.addr1"].value=thisForm["billing.addr1"].value;
		thisForm["shipping.addr2"].value=thisForm["billing.addr2"].value;
		thisForm["shipping.city"].value=thisForm["billing.city"].value;
		thisForm["shipping.state"].value=thisForm["billing.state"].value;
		thisForm["shipping.zip"].value=thisForm["billing.zip"].value;
		thisForm["shipping.country"].value=thisForm["billing.country"].value;
		thisForm["shipping.phone"].value=thisForm["billing.phone"].value;
	} else {
		thisForm["shipping.email"].value="";
		thisForm["shipping.fname"].value="";
		thisForm["shipping.mname"].value="";
		thisForm["shipping.lname"].value="";
		thisForm["shipping.company"].value="";
		thisForm["shipping.addr1"].value="";
		thisForm["shipping.addr2"].value="";
		thisForm["shipping.city"].value="";
		thisForm["shipping.state"].value="";
		thisForm["shipping.zip"].value="";
		thisForm["shipping.country"].value="";
		thisForm["shipping.phone"].value="";
	}
	return 1;
}
	

function updateCreditCard() {
	thisForm = document.verifyForm;
	thisForm["payment.type"][0].checked=true;
	return 1;
}
