/* Design & Code (c) LA Showroom, Inc. 2006 */

/*  OLD SCRIPTS - START  */
// Brian Lee
// Last Update: March.10.2004

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

var browser = navigator.appName;

function selectColor(passedvar) {
//colorIndex = document.add_cart.lightColor.options[document.add_cart.lightColor.selectedIndex].value;
//var colorIndex = colorIndex.split("(");
//document.images['productImage'].src = "item_images/" + colorIndex[0];
if (passedvar.indexOf(':') == -1)
	{
document.images['productImage'].src = "item_images/" + passedvar;
		}
else
document.images['productImage'].src = passedvar;
//document.smalllayer.images['theSmallIm'].src = "item_images/" + passedvar;
//document.images['theSmallIm'].src = "item_images/" + passedvar;
//init();

}
/*   OLD SCRIPTS - END   */


// automatic URL jump on drop-down selection
function jumpMenu(targ,selObj,restore) {
  eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
  if (restore) selObj.selectedIndex = 0;
}

/* POP-UPS-UP-THE-WAZOO SECTION - START */
// view all open carts
function viewOpenCarts(all) {
  mesg = 'cartview' + all + '.htm';
  window.open(mesg, 'cartview', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=540, height=560, left=10, top=10');
}

// storefront help
function homeHelp(req) {
  mesg = 'help.htm?req=' + req;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=400, height=430, left=10, top=10');
}

// item detail and item list larger view
function viewItem(store, pid, colorfile) {
  mesg = 'picview.htm?store=' + store + '&pid=' + pid + '&colorfile=' + colorfile;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=550, height=800, left=10, top=10');
}

// item description and cart view
function quickView(store, pid, cat) {
  mesg = 'item.quickview.htm?store=' + store + '&pid=' + pid + '&cat=' + cat;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=625, height=650, left=10, top=10');
}

// view my orders and store orders
function viewOrder(store, po) {
  mesg = 'showorder.htm?store=' + store + '&po=' + po;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=700, height=650, left=10, top=10');
}

// view MAGIC orders
function viewMagicOrder(store, po, index) {
  mesg = 'showordermagic.htm?store=' + store + '&po=' + po + '&index=' + index;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=700, height=650, left=10, top=10');
}

// credit card form 
function printCCForm(store, id) {
  mesg = 'docs/ccform.htm?store=' + store + '&id=' + id;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=750, height=800, left=10, top=10');
}
// MAGIC credit card form 
function printMagicCCForm(store, id) {
  mesg = 'docs/ccform_magic2.htm?store=' + store + '&id=' + id;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=750, height=800, left=10, top=10');
}

// image download subscription; help and view respectively
function imageDLHelp(req, imagedl) {
  mesg = 'help.htm?req=' + req + '&imagedl=' + imagedl;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=400, height=500, left=10, top=10');
}
function imageDLView(store,order_id) {
  mesg = 'showimg.htm?store=' + store + '&order_id=' + order_id;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=700, height=680, left=10, top=10');
}

// main feedback in top header
function popFeedback(type, store) {
  mesg = 'feedback' + type + '.htm?store=' + store;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=670, height=680, left=10, top=10');
}

// store feedback
function popFeedback1(type, store) {
  mesg = 'feedback' + type + '.htm?store=' + store;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=660, height=840, left=10, top=10');
}

// main feedback in top header
function popQAImg(store) {
  mesg = 'home.compare.htm?store=' + store;
  window.open(mesg, '', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=620, height=650, left=10, top=10');
}

/* POP-UPS-UP-THE-WAZOO SECTION - END */

// expand/collapse favorites list in left nav
function delAnnounceMsg(msgID) {
  mesg = 'user.prefs.update.htm?update=notice&msgID=' + msgID;
  window.location(mesg);
}
/* STORE REPLY WRITE */

/* ORDER CONSOLIDATION CONFIRMATION */
function verifyLASOrder() {
    var x = confirm("You are checking out with LAS Order Consolidation.\n\nBy continuing, you understand that you must process each order by contacting the Manufacturer first. All completed orders will then be shipped to LA Showroom offices for order consolidation. Please contact LA Showroom and provide all P.O. numbers for orders to be shipped. LA Showroom will charge $10 service fee per order.\n\nIf you agree, click OK and continue. Otherwise, click Cancel and continue with regular Checkout.");
    
    if(x == true) {
        return true;
    }
    else {
        return false;
    }
}

function toggle(nr) {
    if (document.layers) {
        vista = (document.layers[nr].visibility == 'show') ? 'hide' : 'show'
        document.layers[nr].visibility = vista;
    }
    else if (document.all) {
        vista = (document.all[nr].style.visibility == 'visible') ? 'hidden' : 'visible';
        document.all[nr].style.visibility = vista;
    }
    else if (document.getElementById) {
        vista = (document.getElementById(nr).style.visibility == 'visible') ? 'hidden' : 'visible';
        document.getElementById(nr).style.visibility = vista;

    }
}

/* DISABLE RIGHT-CLICK - START */

//var message = "Function Disabled!";
function clickIE4() {
  if (event.button == 2) {
    //alert(message);
    return false;
  }
}
function clickNS4(e) {
  if (document.layers || document.getElementById&&!document.all) {
    if (e.which == 2 || e.which == 3) {
      //alert(message);
      return false;
    }
  }
}

if (document.layers){
  document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown = clickNS4;
}
else if (document.all && !document.getElementById) {
  document.onmousedown = clickIE4;
}

// document.oncontextmenu = new Function("alert(message);return false")
document.oncontextmenu = new Function("return false")

/* DISABLE RIGHT-CLICK - END */

/* Open Code - START */

