﻿// File JScript
var siteUrl = "http://" + location.host;
var productUrl = "/admin/91/shop_products.aspx"
var orderUrl = "/admin/89/shop_order.aspx"



function addcornerLeft() {
if (document.getElementById) {
    document.getElementById('cornerLeftDelete').style.display = "inline";
}
}
function removecornerLeft() {
if (document.getElementById) {
    document.getElementById('cornerLeftDelete').style.display = "none";
}
}

var myRequest
function CreateXmlHttpReq(handler) {
  var xmlhttp = null;
  try {
    xmlhttp = new XMLHttpRequest();
  } catch(e) {
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  xmlhttp.onreadystatechange = handler;
  return xmlhttp;
}
function myHandler() {
    if (myRequest.readyState == 4 && myRequest.status == 200) {
        //alert(myRequest.responseText);
    } else {
//     alert(myRequest.status);
     }
}
function cartAjaxDeleteProductVariable(idVar) {
    myRequest = CreateXmlHttpReq(myHandler);
    myRequest.open("GET",siteUrl+productUrl+"?idVar="+idVar);
    myRequest.send(null);
    document.getElementById('idVar'+idVar).style.display = "none";
}
function cartAjaxDeleteProductImage(idImage) {
    myRequest = CreateXmlHttpReq(myHandler);
    myRequest.open("GET",siteUrl+productUrl+"?idImage="+idImage);
    myRequest.send(null);
    document.getElementById('idImage'+idImage).style.display = "none";
}
function cartAjaxAdminShip(id,idOrder) {
    myRequest = CreateXmlHttpReq(myHandler);
    myRequest.open("GET",siteUrl+orderUrl+"?id="+id+"&mode=setShip");
    myRequest.send(null);
    window.location.href = siteUrl+orderUrl+"?idOrder="+idOrder;
}
function cartAjaxAdminCloseOrder(id) {
    myRequest = CreateXmlHttpReq(myHandler);
    myRequest.open("GET",siteUrl+orderUrl+"?id="+id+"&mode=closeOrder");
    myRequest.send(null);
    window.location.href = siteUrl+orderUrl+"?idOrder="+id;
}
function cartAjaxAdminOpenOrder(id) {
    myRequest = CreateXmlHttpReq(myHandler);
    myRequest.open("GET",siteUrl+orderUrl+"?id="+id+"&mode=openOrder");
    myRequest.send(null);
    window.location.href = siteUrl+orderUrl+"?idOrder="+id;
}
function cartAjaxAdminPayOrder(id) {
    myRequest = CreateXmlHttpReq(myHandler);
    myRequest.open("GET",siteUrl+orderUrl+"?id="+id+"&mode=payOrder");
    myRequest.send(null);
    window.location.href = siteUrl+orderUrl+"?idOrder="+id;
}
function viewattachNote(opt) {
if (opt == "view") {
    if (document.getElementById) {
        document.getElementById('cart_attachNote').style.display = "block";
        document.getElementById('cart_notes').style.display = "none";
    }
    }
    else if(opt == "hide") {
    document.getElementById('cart_attachNote').style.display = "none";
    document.getElementById('cart_notes').style.display = "block";
}
}

function changeImage(image) {
     document.getElementById('placeholder').src = image;
     document.getElementById('linklightbox').href = image;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}