/*

  This is just a shell for showing an HTML fragment
  loaded from a separate file (not via HTTP request but "source-time" inclusion).

  This will provide only a close button to act as a cancel tool.
  It will not provide any other buttons/responses.

*/

GLOBALcurmodalholder = '';


function LaunchShipper(flavor)
{
    if (flavor == "checkout") {
		  DHTMLXSKdlog_launchModelessWithParams("ShippingCalculator", 
															 flavor=="checkout"?"Checkout Console":"Checkout Preview", 
															 25,97, 500,600, "mode="+flavor);
    }else{
		  DHTMLXSKdlog_launchModelessWithParams("ShippingCalculator", 
															 flavor=="checkout"?"Checkout Console":"Checkout Preview", 
															 25,130, 500,400, "mode="+flavor, "close");
    }
}
function UpdateShipperDialog()
{
    // This will refresh the shipper dialog only if it is indeed already visible.
    // Does not "launch" if not yet launched.
    var win = dhxWins.window("DHTMLSKdlog_win_ShippingCalculator");
    if (win) {
		  // Didn't show up: win.attachObject('DIVHOLDERspinner35');
		  win.attachURL("dialogs/" + "ShippingCalculator" + ".php", true/*useajax*/);
    }
}


function LaunchInquiry(itemID, itemTitle)
{
    DHTMLXSKdlog_launchWithParams
		  ("LaunchInquiry", 500,400, 
			"id="+itemID+ "&title="+encodeURIComponent(itemTitle));
}



function DHTMLXSKdlog_kill(dlogname)
{
    var winID = "DHTMLSKdlog_win_" + dlogname;
    if (dhxWins.window(winID)) {
		  dhxWins.window(winID).close();
    }
}




function DHTMLXSKdlog_launch(dlogname, dlogwidth, dlogheight)
{
    return DHTMLXSKdlog_launchWithParams(dlogname, dlogwidth, dlogheight, "");
}
function DHTMLXSKdlog_launchWithParams(dlogname, dlogwidth, dlogheight, params)
{
    var winID = "DHTMLSKdlog_win_" + dlogname;
    var r = SKLJScreateOrRaiseWindow(winID,"BODYroot",
												 0,0,
												 dlogwidth,dlogheight,"close");
    var win = r[1];

    win.center();
    win.hideHeader();

    win.attachEvent("onAttachURL", function(){alert("FEW384223");});

    //Initialize to show an HTML snippet (documentation, static text).
    //  We will replace this with the grid when something is first
    //  added to the cart
    win.attachURL("dialogs/" + dlogname + ".php?"+params, true/*useajax*/);

    win.setModal(true);

    return win;
}



function DHTMLXSKdlog_launchModelessWithParams(dlogname, title, dlogx, dlogy, dlogwidth, dlogheight, params, buttonstoshow)
{
    if (!buttonstoshow) {
		  buttonstoshow = "";
    }
    var winID = "DHTMLSKdlog_win_" + dlogname;
    var r = SKLJScreateOrRaiseWindow(winID,"BODYroot",
												 dlogx, dlogy,
												 dlogwidth,dlogheight,buttonstoshow);
    var win = r[1];

    win.setText(title);

    //Initialize to show an HTML snippet (documentation, static text).
    //  We will replace this with the grid when something is first
    //  added to the cart
    win.attachURL("dialogs/" + dlogname + ".php?"+params, true/*useajax*/);

    return win;
}




function WINREPOSshopcart(newht)
{
    // Keep my height but make me hug the bottom
    if (!newht) {
		  ht = GLOBALWINshopcart.clientHeight;
    }else{
		  ht = newht;
    }

    GLOBALWINshopcart.setDimension(GLOBALwinfaqbase.offsetLeft-5, ht);
    GLOBALWINshopcart.setPosition(0, GLOBALbodyroot.clientHeight-ht);
    EVTH_ensureDhtmlxWinResizing(GLOBALWINshopcart);
}









function ShowRegularOKMessage(textmsg, IDcurmodalholder)
{
    if (IDcurmodalholder) {
		  GLOBALcurmodalholder = IDcurmodalholder;
		  dhxWins.window(IDcurmodalholder).setModal(false);
    }
	
    $('HOLDERsimplemessage').innerHTML = textmsg;

    var winID = "DHTMLSKdlog_win_RegularOKMessage";
    var r = SKLJScreateOrRaiseWindow(winID,"BODYroot",
												 0,0,
												 400,200,"");
    var win = r[1];
    win.center();

    win.setText("ALERT");

    //Initialize to show an HTML snippet (documentation, static text).
    //  We will replace this with the grid when something is first
    //  added to the cart
    win.attachObject('DIVHOLDERsimplemessage');
    $('DIVHOLDERsimplemessage').style.visibility = 'visible';

    win.setModal(true);

    return win;
}

function DismissRegularOKMessage()
{
    var mywin = dhxWins.window("DHTMLSKdlog_win_RegularOKMessage");
    mywin.setModal(false);
    mywin.hide();
    
    if (GLOBALcurmodalholder) {
		  dhxWins.window(GLOBALcurmodalholder).setModal(true);
    }
    GLOBALcurmodalholder = '';
}
