// Nicola Zordan, 8:33 1/19/2005
//var TestLink;



TestLinksPage='/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD';
TestLinks= new Array();


//Clients
if (Clients!=null) {
  for (var cc=0;cc<Clients.length-1;cc++) {
    TestLinks[TestLinks.length]=[Clients[cc][0], Clients[cc][1]+TestLinksPage];
  }
}

// Prospects
if (Prospects!=null) {
  for (var cp=0;cp<Prospects.length-1;cp++) {
    TestLinks[TestLinks.length]=[Prospects[cp][0], Prospects[cp][1]+TestLinksPage];
  }
}


// Additional test
var TestAdditional=new Array();
TestAdditional=[

  //['DMS Clients test <!--AJAX--> <a href="C:\\Documents and Settings\\All Users\\Documents\\DMS\\Qwik-Order web\\DEVelopment\\ClientsSummary\\ClientsTestAJAX.htm" 0href="ClientsSummary/ClientsTestAJAX.htm" target="_blank"><font color="#444477" style="{text-decoration: none;};">local</font></a>','http://www.ZordanSoftware.com/AJAX/ClientsTest/DMS/ClientsTestAJAX.htm'],
  ['DMS Clients test <span id="ClientsCount"></span>&nbsp; <!--AJAX--> <a href="C:\\Documents and Settings\\All Users\\Documents\\DMS\\Qwik-Order web\\DEVelopment\\ClientsSummary\\ClientsTestAJAX.htm" 0href="ClientsSummary/ClientsTestAJAX.htm" target="_blank"><font color="#444477" style="{text-decoration: none;};">local</font></a>','http://www.ZordanSoftware.com/AJAX/ClientsTest/DMS/ClientsTestAJAX.htm'],
  ['DMS Catalog Clients test <span id="ClientsCatalogCount"></span>&nbsp; <!--AJAX--> <a href="C:\\Documents and Settings\\All Users\\Documents\\DMS\\Qwik-Order web\\DEVelopment\\ClientsSummary\\ClientsCatalogTestAJAX.htm" 0href="ClientsSummary/ClientsCatalogTestAJAX.htm" target="_blank"><font color="#444477" style="{text-decoration: none;};">local</font></a>','http://www.ZordanSoftware.com/AJAX/ClientsTest/DMS/ClientsCatalogTestAJAX.htm'],

  //['Demo (old server)','http://66.179.164.68:90/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  //['IEP (old server)','http://66.179.164.68:94/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],

  //-['IEP (old server)','http://66.179.164.68:94/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],

  //['TeST OLD','http://66.179.164.68:86/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+TST'],
  //['DEVelopment OLD','http://66.179.164.68:85/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+DEV'],

  //['Demo','http://66.179.164.71:90/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  //-['Demo','http://demo.qwik-order.com'],
  //-['Customize','http://66.179.164.71:89/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],

  //['TeST','http://66.179.164.71:86/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+TST'],
  //-['DEVelopment qo','http://66.179.164.71:85/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+DEV'],
  ['DEVelopment QO','http://dev.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+DEV'],

  //
  //['CE Development','http://66.179.164.71:88/cgi-bin/lansaweb?procfun+ce_build+hompge1+ced'],
  //['CE Maintenance <a onClick="alert(\'dmsadmin\')"><font color="#444477" style="{text-decoration: none}">-</font></a>','http://66.179.164.71:88/cgi-bin/lansaweb?procfun+lw3gen+lw3gn21+ced'],
  //['CE Wizard','http://66.179.164.71:88/cgi-bin/lansaweb?procfun+wizard2+wiz02+ced'],
  //['CE Development','http://66.179.164.71/cgi-bin/lansaweb?procfun+ce_build+hompge1+ced'],
  //['CE Development','http://www.qwik-orderdirect.com'],
  //-['CE Development','http://demo.qwik-orderdirect.com'],
  //--['Development ce','https://dev.qwik-orderdirect.com/cgi-bin/lansaweb?procfun+ce_build+hompge1+ced'],
  ['Development CE QOD','http://dev.qwik-orderdirect.com'],
  ['Temp QO','http://temp.Qwik-Order.com'],

  //['CE Maintenance <a onClick="alert(\'dmsadmin\')"><font color="#444477" style="{text-decoration: none}">-</font></a>','http://66.179.164.71/cgi-bin/lansaweb?procfun+lw3gen+lw3gn21+ced'],
  //=['CE Maintenance <a onClick="alert(\'dmsadmin\')"><font color="#444477" style="{text-decoration: none}">-</font></a>','https://demo.qwik-orderdirect.com/cgi-bin/lansaweb?procfun+lw3gen+lw3gn21+ced'],
  //['CE Wizard','http://66.179.164.71/cgi-bin/lansaweb?procfun+wizard2+wiz02+ced'],
  //--['CE Wizard','https://dev.qwik-orderdirect.com/cgi-bin/lansaweb?procfun+wizard2+wiz02+ced'],
  ['CE Wizard','https://dev.qwik-orderdirect.com/cgi-bin/lansaweb?procfun+wizard2+wiz02+ced'],


['By Application', [

['Catalog Activant', [
  ['American Performance','http://66.179.164.71:99/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Cedar Valley (One Call)','http://OneCall.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Cocncho','http://66.179.164.71:91/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['EMS','http://66.179.164.71:93/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Jobbers','http://Jobbers.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
//  ['Star Sales','http://66.179.164.71:92/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Wahlberg','http://66.179.164.71:97/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  //['Demo','http://demo.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  //['DEVelopment','http://66.179.164.71:85/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+DEV'],

['',''] ]],

['Wrenchead Central Integration', [
  ['Cocncho','http://66.179.164.71:91/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
//  ['Star Sales','http://66.179.164.71:92/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Wahlberg','http://66.179.164.71:97/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  //['Demo','http://demo.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  //['DEVelopment','http://66.179.164.71:85/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+DEV'],

['',''] ]],


['CE Qwik-Order Direct', [
  ['EMS','http://EMS.Qwik-OrderDirect.com'],
//  ['FBM','http://FBM.Qwik-OrderDirect.com'],
//  ['IEP','http://EPC.Qwik-OrderDirect.com'],
  ////['Demo ce','https://demo.qwik-orderdirect.com/'],
  //////['Development ce','https://dev.qwik-orderdirect.com/cgi-bin/lansaweb?procfun+ce_build+hompge1+ced'],
  ////['Development ce','https://dev.qwik-orderdirect.com/'],
  //['Demo','http://demo.qwik-orderdirect.com/'],
  ////['Development','https://dev.qwik-orderdirect.com/cgi-bin/lansaweb?procfun+ce_build+hompge1+ced'],
  //['Development','http://dev.qwik-orderdirect.com/'],
['',''] ]],

['Qwik-Order', [
  ['American Performance','http://66.179.164.71:99/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Carter','http://66.179.164.71:93/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Cedar Valley (One Call)','http://OneCall.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Cocncho','http://66.179.164.71:91/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['EMS','http://66.179.164.71:93/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Foland','http://66.179.164.71:101/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['IEP','http://66.179.164.71:94/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['IEP2','http://iep.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Jobbers','http://Jobbers.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Spartan (demo)','http://Spartan.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
//  ['Star Sales','http://66.179.164.71:92/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['US Automitive (AP2)','http://66.179.164.71:100/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Vita Plate','http://66.179.164.71:98/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  ['Wahlberg','http://66.179.164.71:97/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  //['Demo','http://demo.Qwik-Order.com/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
  //['DEVelopment','http://66.179.164.71:85/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+DEV'],

['',''] ]],

['',''] ]],


];

for (var ca=0;ca<TestAdditional.length;ca++) {
  //TestLinks[TestLinks.length]=[TestAdditional[ca][0], TestAdditional[ca][1]+TestLinksPage];
  TestLinks[TestLinks.length]=TestAdditional[ca];
}


/* no test *
//DEBUG
TestLinks= [
  ['Test link','http://66.179.164.71:95/CGI-BIN/LANSAWEB?PROCFUN+EORDER1WEV+WBSU010+PRD'],
];
* */

//WriteWorkLinksTable(WorkLink);

function OpenTestLinks() {
var confirmed=false, LinksText='',i=0;
  //alert('open\n'+TestLinks.length);
  LinksText=LinksText+'Open the following '+(TestLinks.length-1)+' sites ?';
  for(i=0;i<TestLinks.length-1;i++) {
    // LinksText=LinksText+'\n '+(i+1)+'. '+TestLinks[i][0]+': '+TestLinks[i][1];
    LinksText=LinksText+'\n '+(i+1)+'. '+TestLinks[i][0];
  };
  confirmed=confirm(LinksText);
  if (confirmed) {
    OpenAllLinks(TestLinks,false);
    //CheckWindows();
    //CloseWindows();
  };
};

function OpenTestLinksOneByOne() {
    OpenAllLinks(TestLinks,true);
};


var LinksWindows=null;

function OpenAllLinks(Links,ask) {
var i,name,url;
  if (ask == null) { ask=false; };
  LinksWindows=new Array(Links.length);
  for (i=0;i<Links.length-1;i++) {
    name=Links[i][0];
    url=Links[i][1];
    LinksWindows[i]=OpenLinkWindow(name,url,i+1,Links.length-1,ask);
  };
  window.status='('+(Links.length-1)+') sites opened'; 
};

function OpenLinkWindow(name,url,index,n,ask) {
var confirmOpen=true, askText='', linkWindow=null;
  if (ask) {
    askText='Open site ? ('+index+' of '+n+')\n\n'+name+'\n'+url;
    confirmOpen=confirm(askText); 
  };
  if (confirmOpen) {
    //window.open(url,name);
    linkWindow=window.open(url);
    //alert(name+'\n'+url);
    window.status=''+index+'. '+name+' = '+url;
  };
  return (linkWindow);
};


//var CheckWindowVariable='LoggedIn';
var CheckWindowVariable='WindowTitle';
var CheckWindowOK='OK';
var CheckWindowNotOK='Not OK';

function CheckWindows () {
 var noWindow=(LinksWindows==null);
 var message='Tested:\n', windowOK=false, checkAgain=false;
  if (!noWindow) {
    noWindow=true;
    checkAgain=true;
    while (checkAgain) {
      checkAgain=false;
      message='Tested:\n';
      for(var i=0;i<LinksWindows.length-1;i++) {
        windowOK=false;
        if(LinksWindows[i]!=null && !LinksWindows[i].closed) {
          noWindow=false;  
          windowOK= !(LinksWindows[i][CheckWindowVariable]==undefined);
          //alert(CheckWindowVariable+'\n'+LinksWindows[i].WindowTitle+'\n'+LinksWindows[i][CheckWindowVariable]+'\n'+(LinksWindows[i][CheckWindowVariable]==undefined));
        };
        message=message+'\n'+TestLinks[i][0];
        message=message+': \t ';
        if (windowOK) {
          message=message+CheckWindowOK;
        } else {
          message=message+CheckWindowNotOK;
        };        
      };
      if (!noWindow) {
        message=message+'\n\n'+'Check Again ?';
        checkAgain=confirm(message);
      };
    };
  };
  if (!noWindow) {
  } else {
    alert('No Window opened to check');
  };
};

function CloseWindows () {
 var noWindow=(LinksWindows==null);
  if (!noWindow) {
    noWindow=true;
    for(var i=0;i<LinksWindows.length-1;i++) {
      if(LinksWindows[i]!=null && !LinksWindows[i].closed) {
        LinksWindows[i].close();
      };
    };
  };
  if (!noWindow) {
  } else {
    //alert('No Window opened to close');
  };
};



function CheckWindowsOpened () {
 var noWindow=(LinksWindows==null);
 var message='Tested:\n', windowOK=false, checkAgain=false;
  if (!noWindow) {
    noWindow=true;
    checkAgain=true;
    while (checkAgain) {
      checkAgain=false;
      message='Tested:\n';
      for(var i=0;i<LinksWindows.length-1;i++) {
        windowOK=false;
        if(LinksWindows[i]!=null) {
          noWindow=false;  
          windowOK= !LinksWindows[i].closed;
          //alert(CheckWindowVariable+'\n'+LinksWindows[i].WindowTitle+'\n'+LinksWindows[i][CheckWindowVariable]+'\n'+(LinksWindows[i][CheckWindowVariable]==undefined));
        };
        message=message+'\n'+TestLinks[i][0];
        message=message+': \t ';
        if (windowOK) {
          message=message+CheckWindowOK;
        } else {
          message=message+CheckWindowNotOK;
        };        
      };
      if (!noWindow) {
        message=message+'\n\n'+'Check Again ?';
        checkAgain=confirm(message);
      };
    };
  };
  if (!noWindow) {
  } else {
    alert('No Window opened to check');
  };
};


