//************************************************************************
// Author: Clif Collins Date: July 2007
//------------------------------------------------------------------------
//
// Copyright (c) 2008 Clifford L. Collins
// All rights are reserved
//
//************************************************************************
//============================================================
// common.js
//============================================================
var server = null;
var HOME = "";
var async = null;
var mainPage = false;
var ie7 = false;
var isWorking = false;
var workingCount = 0;
var working = null;
var workingWindow = null;
var icMap = 'http://collinssoftware.com/icmap/ic_ecp/bin/ICMapIS.cgi';
var spellCheck_Element = null;
var spellCheck_blur = false;
var spellCheckSet = false;
var show_win = null;
var show_text = '';
var account_rs = null;
var user_rs = null;
var TYPE_NEW = 1;
var TYPE_OUTFORREVIEW = 2;
var TYPE_PUBLISHREQUIRED = 3;
var TYPE_DELIVERED = 4;
var TYPE_PUBLISHED = 5;
var TYPE_ONHOLD = 6;
var TYPE_AWARDED = 7;
var TYPE_LOST = 8;
var TYPE_ARCHIVED = 9;
var TYPE_NOBID = 10;
var DEBUG_startTime = null;
var globalOutput;
var globalPic;
var localPic;
var globalWidth = 200;
var globalheight = 200;
var globalLoaded = false;
var xmlhttp = null;
var xmldom = null;
var programPopup = null;
var aa = 0;
//==========================================================================================
// bidUrl
//==========================================================================================
function bidUrl(bid)
{
var bif_file,url;
bid_file = server.sqlValue('select bif_file from q029_bid where bid_id = ' + bid);
url = F() + 'bids/' + bid_file;
return url;
}
//==========================================================================================
// bidUrl
//==========================================================================================
function ratesheetUrl(rid)
{
var file,url;
file = server.sqlValue('select ratesheet_file from q013_ratesheet where ratesheet_id = ' + rid);
url = F() + 'ratesheets/' + file;
return url;
}
//==========================================================================================
// ratesheetName
//==========================================================================================
function ratesheetName(rid)
{
var name;
name = server.sqlValue('select ratesheet_name from q013_ratesheet where ratesheet_id = ' + rid);
return name;
}
//==========================================================================================
// xmldom$
//==========================================================================================
function xmldom$init()
{
if (xmldom != null) return xmldom;
try { xmldom = new ActiveXObject("MSXML2.DOMDocument"); return xmldom; } catch (e) {}
// try { var parser = new DOMParser(); xmldom = parser.parseFromString(xml, "text/xml"); return xmldom; } catch e() {}
throw new Error( "This browser does not support XMLDom Object" );
}
//==========================================================================================
// xmlhttp$
//==========================================================================================
function xmlhttp$init()
{
if (xmlhttp != null) return xmlhttp;
try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); return xmlhttp; } catch (e) {}
try { xmlhttp = new XMLHttpRequest(); return xmlhttp; } catch (e) {}
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.6.0"); return xmlhttp; } catch (e) {}
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0"); return xmlhttp; } catch (e) {}
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); return xmlhttp; } catch (e) {}
try { xmlhttp = window.createRequest(); return xmlhttp; } catch (e) {}
throw new Error( "This browser does not support XMLHttpRequest" );
}
//=================================================================
// validEmail
//=================================================================
function makeEmail(name)
{
var email;
email = server.resolve('make_email name="' + name + '"');
return email;
}
//=================================================================
// validEmail
//=================================================================
void function validEmail(email)
{
var s,list,a;
var add;
add = trim(email);
s = true;
list = add.split('@');
if (list[0].length == 0) s = false;
if (list[0].length > 40) s = false;
if (list.length == 2)
{
a = list[1].split('.');
if (a.length == 1) s = false;
if (a[0].length == 0) s = false;
if (a[a.length-1].length == 0) s = false;
if (a[a.length-1].length > 6) s = false;
}
else s = false;
if (add.length < 4) s = false; // length >= 4
if (add.length > 255) s = false; // length < 255
if (add.indexOf('%') >= 0) s = false; // no escape characters
if (s) return true;
alert('invalid email format');
return false;
}
//=================================================================
// changeCompanyMap
//=================================================================
function changeCompanyMap(id)
{
var loc,sql,rs;
var names,values;
loc = new Object();
loc.latitude = r8(latitude.value);
loc.longitude =r8(longitude.value)
loc.level = 2;
loc.filename = 'companymap/' + id;
loc.url = '';
sql = 'select latitude,longitude,mapLevel,hasMap from t101_company where company_id = ' + id + ' and ' + A();
rs = server.sqlRead(sql);
if (rs !== null)
{
loc.level = i4(rs("mapLevel").Value);
}
if (loc.latitude == 0)
{
loc.level = 2;
loc.latitude = 29.84;
loc.longitude = -95.51;
}
if (! f_map(loc)) return false;
url = icMap;
if (local()) url = 'http://clif/ic_ecp/bin/icMapIS.cgi';
uml = new ic$UML('company',url,'ecp',map.maxHeight,map.maxWidth,loc.level,loc.longitude,loc.latitude,'states','','','');
if (! server.executeW('command=saveMapImage&url=' + escape(uml.value()) + '&name=companyMap/' + id) ) return;
names = new Array('latitude','longitude','mapLevel','hasMap');
values = new Array(loc.latitude,loc.longitude,loc.level,true);
sql = 'select * from t101_company where company_id = ' + id;
server.update(sql,names,values);
latitude.value = Math.round(loc.latitude * 10000) / 10000;
longitude.value = Math.round(loc.longitude * 10000) / 10000;
return true;
}
//=================================================================
// changeOrderMap
//=================================================================
function changeOrderMap(id)
{
var loc,sql,rs;
var names,values;
loc = new Object();
loc.latitude = r8(latitude.value);
loc.longitude =r8(longitude.value)
loc.level = 3;
loc.filename = 'ordermap/' + id;
loc.url = '';
sql = 'select latitude,longitude,mapLevel,hasMap from t024_order where order_id = ' + id + ' and ' + A();
rs = server.sqlRead(sql);
if (rs !== null)
{
loc.level = i4(rs("mapLevel").Value);
loc.latitude = r8(rs("latitude").value);
loc.longitude =r8(rs("longitude").value);
}
if (loc.latitude == 0)
{
loc.level = 2;
loc.latitude = 29.84;
loc.longitude = -95.51;
}
if (! f_map(loc)) return false;
url = icMap;
if (local()) url = 'http://clif/ic_ecp/bin/icMapIS.cgi';
uml = new ic$UML('order',url,'ecp',map.maxHeight,map.maxWidth,loc.level,loc.longitude,loc.latitude,'states','','','');
if (! server.executeW('command=saveMapImage&url=' + escape(uml.value()) + '&name=orderMap/' + id) ) return;
names = new Array('latitude','longitude','mapLevel','hasMap');
values = new Array(loc.latitude,loc.longitude,loc.level,true);
sql = 'select * from t024_order where order_id = ' + id;
server.update(sql,names,values);
latitude.value = Math.round(loc.latitude * 10000) / 10000;
longitude.value = Math.round(loc.longitude * 10000) / 10000;
return true;
}
//=================================================================
// changeJobMap
//=================================================================
function changeJobMap(id)
{
var loc,sql,rs;
var names,values;
loc = new Object();
loc.latitude = r8(latitude.value);
loc.longitude =r8(longitude.value)
loc.level = 3;
loc.filename = 'ordermap/' + id;
loc.url = '';
sql = 'select latitude,longitude,mapLevel,hasMap from t403_job where job_id = ' + id + ' and ' + A();
rs = server.sqlRead(sql);
if (rs !== null)
{
loc.level = i4(rs("mapLevel").Value);
loc.latitude = r8(rs("latitude").value);
loc.longitude =r8(rs("longitude").value);
}
if (loc.latitude == 0)
{
loc.level = 2;
loc.latitude = 29.84;
loc.longitude = -95.51;
}
if (! f_map(loc)) return false;
url = icMap;
if (local()) url = 'http://clif/ic_ecp/bin/icMapIS.cgi';
uml = new ic$UML('order',url,'ecp',map.maxHeight,map.maxWidth,loc.level,loc.longitude,loc.latitude,'states','','','');
if (! server.executeW('command=saveMapImage&url=' + escape(uml.value()) + '&name=jobMap/' + id) ) return;
names = new Array('latitude','longitude','mapLevel','hasMap');
values = new Array(loc.latitude,loc.longitude,loc.level,true);
sql = 'select * from t403_job where job_id = ' + id;
server.update(sql,names,values);
latitude.value = Math.round(loc.latitude * 10000) / 10000;
longitude.value = Math.round(loc.longitude * 10000) / 10000;
return true;
}
//=================================================================
// changeContactMap
//=================================================================
function changeContactMap(id)
{
var loc,sql,rs,sql;
var names,values;
loc = new Object();
loc.latitude = 29.8;
loc.longitude = -95.481513;
loc.level = 6;
loc.filename = 'contactMap/' + id;
loc.url = '';
sql = 'select latitude,longitude,mapLevel,hasMap from t004_contact where contact_id = ' + id + ' and AccountID = ' + account_id;
rs = server.sqlRead(sql);
if (rs !== null)
{
loc.latitude = r8(rs("latitude").value);
loc.longitude = r8(rs("longitude").Value);
if (rs("hasMap").Value) loc.level = i4(rs("mapLevel").Value);
}
if (loc.latitude == 0)
{
loc.level = 2;
loc.latitude = 29.84;
loc.longitude = -95.51;
}
if (! f_map(loc)) return false;
url = icMap;
if (local()) url = 'http://clif/ic_ecp/bin/icMapIS.cgi';
uml = new ic$UML('contact',url,'ecp',map.maxHeight,map.maxWidth,loc.level,loc.longitude,loc.latitude,'states','','','');
if (! server.executeW('command=saveMapImage&url=' + escape(uml.value()) + '&name=contactMap/' + id) ) return;
names = new Array('latitude','longitude','mapLevel','hasMap');
values = new Array(loc.latitude,loc.longitude,loc.level,true);
sql = 'select * from t004_contact where contact_id = ' + id;
server.update(sql,names,values);
return true;
}
//=================================================================
// local
//=================================================================
function local()
{
var host;
host = document.location.hostname;
host = host.toLowerCase();
if (host == 'clif') return true;
return false;
}
//=================================================================
// urlHost
//=================================================================
function urlHost()
{
var host;
host = document.location.hostname;
host = host.toLowerCase();
if (host == 'clif') return 'http://clif/free/';
return server.resolve('account_url');
}
//============================================================
// F
//============================================================
function F()
{
var dir;
dir = "files/645" + account_id + "671/";
return dir;
}
//=================================================================
// A
//=================================================================
function A()
{
if (window.parent == null) return 'account_id = ' + account_id;
if (window.parent.parent == null) return 'account_id = ' + window.parent.account_id;
return 'account_id = ' + window.parent.parent.account_id;
}
//=================================================================
// wrt
//=================================================================
function wrt(value)
{
alert(value);
}
//=================================================================
// logout
//=================================================================
function logout()
{
server.execute('command=logout');
}
//=================================================================
// changePicture
//=================================================================
function changePicture(element,output)
{
globalLoad = false;
globalOutput = output;
globalPic=new Image();
localPic = element;
fileBrowse.b_filename.onchange = changePicture_onChange;
fileBrowse.b_filename.click();
}
//=================================================================
// changePicture_onChange
//=================================================================
function changePicture_onChange()
{
var filename,outfile,ext;
globalPic=new Image();
filename = fileBrowse.b_filename.value;
if (filename == null) return;
ext = extractFileExt(filename);
ext = ext.toLowerCase();
if (! (ext == '.gif' ||
ext == '.bmp' ||
ext == '.jpg' ||
ext == '.jpeg' ||
ext == '.png'))
{
alert('Not an Image File (.gif, .bmp, .jpg, .jpeg, .png) ');
return;
}
outfile = F() + 'pictures/' + globalOutput + ext;
if (! server.fileWrite(filename,outfile)) return;
sql = 'update t004_contact set hasPicture = true where contact_id = ' + contact_id;
server.sqlExecute(sql);
globalLoaded = false;
globalPic.onreadystatechange=pictureOnReadyStateChange;
globalPic.src = outfile + '?time=' + new Date();
}
//=================================================================
// pictureOnReadyStateChange
//=================================================================
function pictureOnReadyStateChange()
{
if (globalPic.readyState=="complete")
{
pictureSize(localPic,globalPic.height,globalPic.width,localPic.maxHeight,localPic.maxWidth);
localPic.src = globalPic.src;
globalLoaded = true;
}
}
//=================================================================
// pictureSize
//=================================================================
function pictureSize(img,height,width,maxHeight,maxWidth)
{
var scl,xscl,yscl;
if ((height <= maxHeight) && (width <= maxWidth))
{
img.height = height;
img.width = width;
return;
}
if ((height <= 0) || (width <= 0))
{
img.height = maxHeight;
img.width = maxWidth;
return;
}
xscl = maxWidth / width;
yscl = maxHeight / height;
scl = xscl;
if (yscl < xscl) scl = yscl;
img.height = Math.round(height * scl);
img.width = Math.round(width * scl);
}
//==========================================================================================
// arrayDelete
//==========================================================================================
function arrayDelete(t,index)
{
var a,i,j;
a = t;
a = new Array();
j = 0;
for (i=0; i < t.length; ++i)
{
if (i == index) continue;
a[j] = t[i];
j = j + 1;
}
return a;
}
//==========================================================================================
// company
//==========================================================================================
function company(name)
{
var xid;
xid = server.sqlValue("SELECT type_id FROM t901_type WHERE (type_name = '" + name + "') ans (type_owner_name = 'division');");
if (isNaN(xid)) xid = 23;
return xid;
}
//==========================================================================================
// bool
//==========================================================================================
function emailInfo(title,xid)
{
var cid,e,sql;
cid = i4(xid);
if (cid <= 0) return null;
e = new Object();
e.title = title;
if (cid == 1)
{
e.name = "Clif Collins";
e.email = "c.collins@collinssoftware.com"
return e;
}
sql= "select fullname from t004_Contact where contact_id = " + cid
e.name = server.sqlValue(sql);
e.email = server.sqlValue("select email from T004_Contact where contact_id = " + cid);
if (e.email != '') return e;
alert("No Email Address Found For: " + title + ' ' + e.name + ' id:' + xid);
return null;
}
//==========================================================================================
// getEquipment
//==========================================================================================
function getEquipment(contact_id)
{
var cid,s,sql,text;
cid = i4(contact_id);
if (cid <= 1) return '';
s = server.sqlValue('select Employee_EquipmentSet from q001_Employee_Technician where contact_id = ' + cid);
if (s == '') return '';
sql = "select type_name from t901_type where (type_owner_name = 'Employee Equipment') and type_id in (" + s + ")";
text = server.sqlJoin(sql,', ');
return text;
}
//======================================================================================
// getDuration
//======================================================================================
function getDuration(startDate,endDate)
{
var dur,sh,eh,dx,e,s;
dur = (endDate - startDate) / milliSecondsPerHour;
if (dur < 1) dur = 1;
if (dur > 72) dur = 72;
// sh = startDate.getHours();
// eh = endDate.getHours();
// dx = 0;
// if ((eh > 12) && (sh < 13))
// {
// e = 13 - eh;
// if (e > 1) e = 1;
//
// s = 12 - sh;
// if (s > 1) s = 1;
//
// dx = e - s;
// dur = dur - dx;
// }
return dur;
}
//==========================================================================================
// getJobs
//==========================================================================================
function getJobs(contact_id)
{
var cid,s,sql,text;
cid = i4(contact_id);
if (cid <= 1) return '';
s = server.sqlValue('select Employee_JobSet from q001_Employee_Technician where contact_id = ' + cid);
if (s == '') return '';
sql = "select type_name from t901_type where (type_owner_name = 'Employee Jobs') and type_id in (" + s + ")";
text = server.sqlJoin(sql,', ');
return text;
}
//============================================================
// sqlRead
//============================================================
function sqlRead(sql)
{
var rs;
if (! server.read(sql)) return null;
if (server.rs == null) return null;
rs = server.rs;
server.rs = null;
if (rs.RecordCount == 0)
{
rs.Close();
return null;
}
return rs;
}
//=================================================================
// windowOpen
//=================================================================
function windowOpen(url)
{
var win;
win = window.open(url,'system_view');
try
{
win.focus();
}
catch (e) { }
}
//=================================================================
// eraseTable
//=================================================================
function eraseTable(tbl)
{
while (tbl.rows.length > 1) tbl.deleteRow(1);
}
//=================================================================
// eraseTableFull
//=================================================================
function eraseTableFull(tbl)
{
while (tbl.rows.length > 0) tbl.deleteRow(0);
}
//=================================================================
// editType
//=================================================================
function editType(obj,id,name)
{
var args;
var xid;
var sql;
sql = '';
args = '&countsql=' + sql + '&owner_id=' + id + '&owner_name=' + name;
f_edit_type.show(args,name);
update.getOptionsRestore(obj);
}
//=================================================================
// editFile
//=================================================================
function editFile(ownerName,ownerId,companyId,contactId)
{
var args;
var selected;
args = '&ownerName=' + escape(ownerName.toUpperCase())
args += '&ownerId=' + i4(ownerId);
args += '&companyId=' + i4(companyId);
args += '&contactId=' + i4(contactId);
result = f_file.show('',args);
}
//=================================================================
// editFileParent
//=================================================================
function editFileParent(ownerName,ownerId,companyId,contactId)
{
var args;
var selected;
args = '&ownerName=' + escape(ownerName.toUpperCase())
args += '&ownerId=' + i4(ownerId);
args += '&companyId=' + i4(companyId);
args += '&contactId=' + i4(contactId);
result = f_file.showParent('',args);
}
//=================================================================
// promptPassword
//=================================================================
function promptPassword(title,tag)
{
var ans;
while (true)
{
ans = f_password.show(title);
if (ans == null) return null;
if (! server.execute('command=message&tag=' + tag + '&a=' + xescape(ans + ':' + new Date()) ))
{
alert('invalid password\r\n' + xmlhttp.responseText)
continue;
}
ans = server.ini.read('tag');
return ans;
}
}
//=================================================================
// a
//=================================================================
function toWord(data)
{
var doc;
var word;
var wdPageBreak = 7;
var cmd,text;
list = data.split("\r\n");
word = new ActiveXObject("Word.Application");
word.Visible=false;
// doc = word.Documents.Add();
// doc.Activate();
//---------------------------------------------------------------------------------
// Insert Text
//---------------------------------------------------------------------------------
for (i = 0; i < list.length; ++i)
{
text = getText(list[i]);
cmd = getCommand(list[i]);
if (cmd == 'page')
{
word.Selection.InsertBreak(wdPageBreak);
continue;
}
if (cmd == 'bold')
word.Selection.Font.Bold = true
else word.Selection.Font.Bold = false;
word.Selection.TypeText(text);
}
word.Visible=true;
// word.Quit();
}
//==========================================================================
// spellCheckInit
//==========================================================================
function spellCheckInit()
{
if (spellCheckSet) return;
spellCheckSet = true;
document.body.attachEvent('onkeydown', spellCheck_onKeyDown);
document.body.attachEvent('onselectstart', spellCheck_onSelect);
document.body.attachEvent('onfocusin', spellCheck_focus_in);
document.body.attachEvent('onfocusout', spellCheck_focus_out);
}
function spellCheck_onSelect()
{
spellCheck_Element = event.srcElement;
}
function spellCheck_focus_in()
{
spellCheck_blur = false
}
function spellCheck_focus_out()
{
spellCheck_blur = true
// if (spellCheckButton) spellCheckButton.disabled = true;
}
function spellCheck_onKeyDown()
{
if (! event.altKey) return;
if (event.keyCode == 18) return; // alt
if (event.keyCode != 83) return; // "s" KEY
spellCheck();
}
//==========================================================================
// spellCheck
//==========================================================================
function spellCheck(obj)
{
var str, objWord, CTR
if (document.selection.type != 'Text')
{
if (arguments.length > 0)
{
myTextRange= obj.createTextRange();
myTextRange.select();
}
else
{
alert('No Text Selected (hint: use ctrl-A to select all text you want to spell check)\r\n\r\nYou can use keyboard ALT-S to begin spell check')
return;
}
}
document.execCommand("Copy")
str = window.clipboardData.getData("Text").replace(/^\s+/,"").replace(/\s+$/,"")
CTR = spellCheck_Element.createTextRange()
CTR.findText(str);
CTR.select();
document.execCommand("Copy")
objWord = new ActiveXObject('Word.Application');
try
{
objWord.WindowState = 2
objWord.Documents.Add();
objWord.visible = false
objWord.Selection.Paste();
objWord.ActiveDocument.CheckGrammar();
objWord.Selection.WholeStory();
if (! spellCheck_blur) alert('Correct spelling and grammar')
objWord.Selection.Copy();
objWord.visible = false
objWord.ActiveDocument.Close(0);
document.execCommand("Paste")
}
catch (e) { }
objWord.Quit();
objWord = null
}
//=================================================
// editNote
//=================================================
function editNote(obj,title)
{
var image;
var args;
args = new Object();
args.image = '';
if (obj.tagName.toLowerCase() == 'textarea') args.image = obj.innerText;
if (obj.tagName.toLowerCase() == 'input') args.image = obj.value;
args.status = false;
f_edit_note.show(args,title);
if (! args.status) return false;
if (obj.tagName.toLowerCase() == 'textarea') obj.innerText = args.image;
if (obj.tagName.toLowerCase() == 'input') obj.value = args.image;
if (! update) return true;
if (typeof(obj) == 'object') update.changed(obj);
}
//=================================================================
// help
//=================================================================
void function help(name)
{
url = 'source/system/' + name + '.htm';
windowOpen(url);
}
//=================================================================
// help2
//=================================================================
void function help2(name)
{
url = 'help2/' + name + '.htm';
windowOpen(url);
}
//=================================================================
// getElementByTagName
//=================================================================
function getElementByTagName(obj,name)
{
var list;
list = obj.getElementsByTagName(name);
if (list.length == 0) return null;
return list[0];
}
//=================================================
// selectRequirements
//=================================================
function selectRequirements(selectElement,listElement,owner_name)
{
var obj;
var name,title;
obj = new Object();
obj.selectedElement = selectElement;
obj.listElement = listElement;
obj.owner_name = owner_name;
name = owner_name.toLowerCase();
title = owner_name;
if (name == 'company') title = 'Company Job';
if (name == 'accounting') title = 'Company Accounting';
return (f_select_requirements.show(obj,'&owner_name=' + owner_name + '&title=' + title));
}
//=================================================
// selectBoilerplate
//=================================================
function selectBoilerplate(selectElement,listElement,owner_name)
{
var obj;
var name,title;
obj = new Object();
obj.selectedElement = selectElement;
obj.listElement = listElement;
obj.owner_name = owner_name;
name = owner_name.toLowerCase();
title = owner_name;
return (f_select_boilerplates.show(obj,'&owner_name=' + owner_name + '&title=' + title));
}
//=================================================
// addFilter
//=================================================
function addFilter(f,name)
{
if (name == '') return f;
if (f == '') return ' where (' + name + ')';
return (f + ' and (' + name + ')');
}
//=================================================
// addFilterOr
//=================================================
function addFilterOr(f,name)
{
if (name == '') return f;
if (f == '') return ' where (' + name + ')';
return (f + ' or (' + name + ')');
}
//=================================================================
// exist
//=================================================================
function exist(name)
{
var obj;
var e;
try
{
obj = eval(name);
if (obj == null) return false;
return true;
}
catch (e) { return false; }
}
//=================================================================
// fake
//=================================================================
void function fake()
{
}
//=================================================================
// activeXHint
//=================================================================
function activeXHint(name,e)
{
var bar;
bar = String.fromCharCode(124);
alert('Internet Explorer cannot open an activeX Component: ' + name +
"\r\n" + e.message +
"\r\n" +
"\r\n" + '=== This is generally caused by your security settings ===' +
"\r\n" +
"\r\n" + 'first: you must have this site in your trusted sites list ' +
"\r\n" + ' see: Tools ' + bar + ' Internet Options ' + bar + ' Security ' + bar + ' Trusted Sites ' + bar + ' Sites ' + bar + ' Add...' +
"\r\n" +
"\r\n" + 'second: you must allow activeX components to run ' +
"\r\n" + ' see: Tools ' + bar + ' Internet Options ' + bar + ' Security ' + bar + ' Trusted Sites ' + bar + ' custom level... ' + bar +
"\r\n" + ' ActiveX Controls and plug-ins ' + bar + ' Run ActivX Controls and plug-ins (Enabled)' +
"\r\n" +
"\r\n" + 'third: you must have the activeX Control installed on your computer' +
"\r\n" + ' you may not have the program installed that is wanting to be run, such as EXCEL, or other program' +
"\r\n" +
"\r\n" + 'If this still does not help: contact your technical support team');
}
//==============================================================
// setProgress
//==============================================================
function setProgress(progressbar,percent)
{
var p,span,size;
span = progressbar.getElementsByTagName('span')[0];
size = parseInt(progressBar.style.width) - 4;
p = parseInt(percent);
if (p < 0) p = 0;
if (p > 100) p = 100;
span.style.width = size * (p / 100);
}
//==============================================================
// formatDay
//==============================================================
function formatDay(value)
{
var xdate,d;
xdate = new Date(value);
d = xdate.getDay();
return dayFullname(d);
}
//=====================================================================
// blink
//=====================================================================
function blink()
{
workingCount = workingCount + 1;
if (workingCount > 50) isWorking = false;
if ((! isWorking) && (workingCount > 2))
{
working.style.display = 'none';
return;
}
if (working.style.display != '')
working.style.display = '';
else working.style.display = 'none';
setTimeout('blink()',300);
}
//=====================================================================
// startWorking
//=====================================================================
function startWorking_old()
{
var xworking;
isWorking = true;
if (working == null)
{
working = document.createElement('div');
working.style.backgroundColor = 'tomato';
working.width = 260;
working.style.height = 60;
working.style.border = 'blue 3 groove';
working.style.display = 'none';
working.style.position = 'absolute';
working.style.left = 100;
working.style.top = 200;
working.style.zIndex = 200;
working.innerHTML = '
Working...
';
document.body.appendChild(working);
}
workingCount = 0;
working.style.display = '';
setTimeout('blink()',300);
}
//=====================================================================
// stopWorking
//=====================================================================
function stopWorking_old()
{
isWorking = false;
// working.style.display = 'none';
}
//==========================================================================
// startWorking
//==========================================================================
function startWorking()
{
var text;
try
{
DEBUG_startTime = new Date();
workingWindow = window.open ("about:blank",
"hint","menubar=1,resizable=1,width=100,height=30,top=400,left=400,scrollbars=no,status=no,location=no,menubar=no,titlebar=no,toolbar=no");
text = "";
text += "\r\n"
text += "\r\n"
text += 'function setBlink(){\r\n';
text += "if (x.style.display == 'none')\r\n";
text += "{ x.style.display = '' } else { x.style.display = 'none'; }\r\n";
text += "window.setTimeout('setBlink()',300);}\r\n";
text += "\r\n";
text += "
\r\n
";
text += " ";
text += "W o r k i n g...\r\n";
text += "\r\n";
text += "setBlink()\r\n";
text += ""
workingWindow.document.write(text);
workingWindow.focus();
}
catch (e) { return }
}
//==========================================================================
// stopWorking
//==========================================================================
function stopWorking()
{
var endTime;
var dt;
if (workingWindow == null) return;
try
{
endTime = new Date();
workingWindow.close();
}
catch (e) { }
workingWindow = null;
dt = (endTime - DEBUG_startTime) / 1000;
// alert('Seconds = ' + dt);
}
//=================================================================
// getValue
//=================================================================
function getValue(field)
{
var text,f,value,name;
var TYPE_DATE = 7;
if (! field) return "";
value = field.value;
if (value == null) return "";
if (field.type == TYPE_DATE)
{
d = new Date(value);
value = formatDate(d);
}
return value;
}
//========================================================
// zoomin
//========================================================
function zoomin(img)
{
var lev,src;
lev = parseInt(img.level);
if (lev >= 6) return;
lev = lev + 1;
img.level = lev;
src = img.src;
src = src.substring(0,src.length-1) + lev;
img.src = src;
}
//========================================================
// zoomout
//========================================================
function zoomout(img)
{
var lev,src;
lev = parseInt(img.level);
if (lev <= 1) return;
lev = lev - 1;
img.level = lev;
src = img.src;
src = src.substring(0,src.length-1) + lev;
img.src = src;
}
//========================================================
// initilize
//========================================================
function initilize()
{
if (server) return;
server = new server$();
}
// ===============================================================
// form$checkLogin
//================================================================
function checkLogin(value)
{
if (value != '$$login$$') return;
if (mainPage)
{
window.location.url = LOGIN_URL;
return;
}
else
{
window.returnValue = value;
window.close();
}
}
//==========================================================================
// sendMail
//==========================================================================
void function sendMail(text)
{
if (text == '') return;
if (! text) return;
window.open("mailto://" + text,'a');
}
//==========================================================================
// webpage
//==========================================================================
void function webpagex(url)
{
var win;
if (url == '') return;
top.window.open(url,'a');
}
//================================================================
// formatPhone
//================================================================
function formatPhone(value)
{
value = trim(value);
if (value == '') return '';
if (value.indexOf('-') >= 0) return value;
if (value.length == 7)
{
value = value.substr(0,3) + '-' + value.substr(3,4);
return value;
}
if (value.length == 10)
{
value = '(' + value.substr(0,3) + ') ' + value.substr(3,3) + '-' + value.substr(6,4);
return value;
}
return value;
}
//================================================================
// formatValue
//================================================================
function formatValue(obj,ivalue)
{
var fmt,value;
fmt = '';
value = ivalue;
if (obj.format) fmt = obj.format.toLowerCase();
if ((fmt == 'int') || (fmt == 'integer') || (fmt == 'i4'))
{
value = parseInt(value);
return value;
}
if (fmt == 'date')
{
value = formatDate(value);
return singleQuote(value);
return value;
}
if (fmt == 'datetime')
{
value = formatDate(value) + ' ' + formatTime(value);
return singleQuote(value);
return value;
}
if (fmt == 'hintvalue')
{
value = obj.hintvalue;
return value;
}
if (fmt == 'float')
{
value = parseFloat(value);
return value;
}
return singleQuote(value);
}
//========================================================
// edit
//========================================================
function edit(text)
{
var name;
if (text == null) text = '';
if (text.length > 8096) return "";
name = text;
name = name.replace(/\s/g,' '); // Space
name = name.replace(/\t/g,' '); // Tab
name = name.replace(/\'/g,'');
name = name.replace(/\"/g,'');
return name;
}
//========================================================
// V
//========================================================
function V(text)
{
var name;
if (text.length > 1024) return "";
name = text;
name = name.replace(/\s/g,' '); // Space
name = name.replace(/\t/g,' '); // Tab
name = name.replace(/\;/g,'');
name = name.replace(/\=/g,'');
name = name.replace(/\-/g,'');
name = name.replace(/\*/g,'');
name = name.replace(/\+/g,'');
name = name.replace(/\/g,'');
name = name.replace(/\%/g,'');
name = name.replace(/\@/g,'');
name = name.replace(/\(/g,'');
name = name.replace(/\(/g,'');
name = name.replace(/\)/g,'');
name = name.replace(/\\/g,'');
name = name.replace(/\$/g,'');
name = name.replace(/\#/g,'');
name = name.replace(/\&/g,'');
name = name.replace(/\//g,'');
return name;
}
//========================================================
// LV
//========================================================
function LV(text)
{
var name;
if (text.length > 1024) return "";
name = V(text);
return name.toLowerCase();
}
//========================================================
// X
//========================================================
function X(text)
{
if (text.length > 32) return "";
return V(text);
}
//========================================================
// ini$
//========================================================
function ini$()
{
this.write = ini$write;
this.read = ini$read;
this.find = ini$find;
this.load = ini$load;
this.count = 0;
this.names = new Array();
this.values = new Array();
}
//========================================================
// ini$load
//========================================================
function ini$load(data)
{
var list;
var vlist;
var i,j,k;
var xname,xvalue;
this.count = 0;
this.names = new Array();
this.values = new Array();
if (data == null) return;
if (data == undefined) return;
list = data.split('|');
for (i=0; i < list.length; ++i)
{
value = list[i];
if (value == '') continue;
j = value.indexOf('=');
k = value.length - j;
this.count = i+1;
xname = list[i].substr(0,j).toLowerCase();
xvalue = list[i].substr(j+1,k);
n = this.names.length;
this.names[n] = xname;
this.values[n] = xvalue;
}
}
//========================================================
// ini$find
//========================================================
function ini$find(iname)
{
var i;
var name;
name = iname.toLowerCase();
for (i = 0; i < this.names.length; ++ i)
{
if (this.names[i] == name) return i;
}
return -1;
}
//========================================================
// ini$read
//========================================================
function ini$read(name)
{
var j;
j = this.find(name);
if (j < 0) return "";
return this.values[j];
}
//========================================================
// ini$write
//========================================================
function ini$write(name,value)
{
var j;
j = this.find(name);
if (j < 0)
{
j = this.names.length;
this.names[j] = name.toLowerCase();
}
this.values[j] = value;
return j;
}
//========================================================
// server$
//========================================================
function server$()
{
server = this;
spellCheckInit();
this.message = "";
this.ini = new ini$;
//------------------ functions ------------------------------
this.value = server$value;
this.sqlValue = server$sqlValue;
this.sqlLib = server$sqlLib;
this.sqlSet = server$sqlSet;
this.sqlList = server$sqlList;
this.sqlJoin = server$sqlJoin;
this.resolve = server$resolve;
this.transform = server$transform;
this.execute = server$execute;
this.sqlExecute = server$sqlExecute;
this.sqlExecuteW = server$sqlExecuteW;
this.executeW = server$executeW; // execute with warning (error) messages
this.executeRead = server$executeRead;
this.navigate = server$navigate;
this.recordExists = server$recordExists;
this.read = server$read; // xml read
this.fileWrite = server$fileWrite;
this.fileWrite2 = server$fileWrite2;
this.sendmail = server$sendmail;
this.sendmailHtml = server$sendmailHtml;
this.newContact = server$newContact;
this.commandValue = server$commandValue;
this.selectOptions = server$selectOptions;
this.crList = server$crList;
this.sql = server$sql;
this.insert = server$insert;
this.update = server$update;
this.changeValue = server$changeValue;
this.iniRead = server$iniRead;
this.sqlRead = server$sqlRead;
this.addFile = server$addFile;
this.addFileData = server$addFileData;
this.addFolder = server$addFolder;
this.openFile = server$openFile;
this.show = server$show;
this.readUrl = server$readUrl;
//-----------------------------------------------------------
// this.upload = server$upload;
// this.download = server$download;
this.message = "";
this.response = "";
this.account_rs = null;
this.user_rs = null;
this.receiver = "Receive.asp?";
if (window.location.href.indexOf('/htmx/') > 0) this.receiver = '../../Receive.asp?';
this.rs = null;
this.document = null;
xmlhttp$init();
}
//==========================================================================================
// sqlJoin
//==========================================================================================
function server$sqlJoin(sql,sep)
{
var rs;
var text;
var name;
rs = this.sqlRead(sql);
if (rs == null) return '';
rs.MoveFirst();
text = '';
while (! rs.EOF)
{
name = getValue(rs(0));
if (text != '') text += sep;
text += name;
rs.MoveNext();
}
rs.Close();
return text;
}
//==========================================================================================
// server$changeValue
//==========================================================================================
function server$changeValue(sql,value)
{
var cmd;
cmd = 'command=changeValue&sql=' + escape(sql) + '&value=' + escape(value);
return this.executeW(cmd);
}
//==========================================================================================
// server$sql
//==========================================================================================
function server$sql(isql)
{
var cmd;
cmd = 'command=execute&sql=' + escape(isql);
return this.executeW(cmd);
}
//==========================================================================================
// server$iniRead
//==========================================================================================
function server$iniRead(name)
{
return this.resolve('iniRead name="' + name + '"');
}
//==========================================================================================
// server$crList
//==========================================================================================
function server$crList(sql)
{
var rs;
var text;
if (! this.read(sql)) return "";
rs = this.rs;
this.rs = null;
if (rs == null) return '';
if (rs.recordCount == 0)
{
rs.Close();
return "";
}
rs.MoveFirst();
text = '';
while (! rs.EOF)
{
if (rs(0) != null)
{
if (rs(0).value != '')
{
if (text != '') text += "\r\n";
text += rs(0).value;
}
}
rs.MoveNext();
}
rs.Close();
return text;
}
//==========================================================================================
// server$sqlLib
//==========================================================================================
function server$sqlLib(sql)
{
var rs;
var text;
var list;
var obj;
list = new Array();
rs = this.sqlRead(sql);
if (rs == null) return list;
rs.MoveFirst();
while (! rs.EOF)
{
obj = new Object();
obj.id = rs(0).value;
obj.name = getValue(rs(1));
list[list.length] = obj;
rs.MoveNext();
}
rs.Close();
return list;
}
//==========================================================================================
// server$sqlList
//==========================================================================================
function server$sqlList(sql)
{
var rs;
var text;
var list;
list = new Array();
rs = this.sqlRead(sql);
if (rs == null) return list;
rs.MoveFirst();
while (! rs.EOF)
{
list[list.length] = rs(0).value;
rs.MoveNext();
}
rs.Close();
return list;
}
//==========================================================================================
// server$sqlSet
//==========================================================================================
function server$sqlSet(sql)
{
var text,i;
var list;
var tlist;
text = this.sqlValue(sql);
list = new Array();
tlist = text.split(',');
for (i = 1; i < (tlist.length-1); ++i)
{
if (tlist[i] != 0) list[list.length] = i4(tlist[i]);
}
return list;
}
//==========================================================================================
// server$addFolder
//==========================================================================================
function server$addFolder(filename,owner_id,owner_name,folder_id,folder_name)
{
var cmd;
cmd = 'command=addFolder' + args;
return this.executeW(cmd);
}
//==========================================================================================
// server$openFile
//==========================================================================================
function server$openFile(ownerName,ownerId,fileId,filename)
{
var cmd;
cmd = this.receiver + 'command=readFile' +
'&ownerName=' + escape(ownerName) +
'&ownerId=' + escape(ownerId) +
'&fileId=' + escape(fileId) +
'&filename=' + escape(filename);
// this.executeRead(cmd);
// this.show();
window.open(cmd);
}
//==========================================================================================
// server$addFile
//==========================================================================================
function server$addFile(filename,owner_name,owner_id,folder_id,folder_name)
{
var cmd;
var size;
var node;
var root;
var maxsize = 100000;
var need,offset,i,records,length,remain;
var xml_dom;
size = file$size(filename);
if (size == 0)
{
alert('file: ' + filename + '\r\nis empty, cannot upload');
return true;
}
if (size > (80*1024*1024))
{
alert('file: ' + filename + '\r\nis larger than 80MB , cannot upload');
return true;
}
var ado_stream = new ActiveXObject("ADODB.Stream");
ado_stream.Type = 1; // 1=adTypeBinary
ado_stream.Open();
ado_stream.LoadFromFile(filename);
size = ado_stream.size;
records = Math.floor(size / maxsize);
remain = size - (records * maxsize);
if (remain > 0) records = records + 1;
need = size;
for (i = 0; i < records; ++i)
{
offset = i * maxsize;
length = maxsize;
if (need < maxsize) length = need;
need = need - length;
xml_dom = xmldom$init();
xml_dom.loadXML(' ');
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
root = xml_dom.documentElement;
node = xml_dom.createElement("filename");
node.dataType = "string";
node.text = extractFileName(filename);
root.appendChild(node);
node = xml_dom.createElement("owner_name");
node.dataType = "string";
node.text = owner_name;
root.appendChild(node);
node = xml_dom.createElement("owner_id");
node.dataType = "string";
node.text = "" + owner_id;
root.appendChild(node);
node = xml_dom.createElement("folder_id");
node.dataType = "string";
node.text = "" + folder_id;
root.appendChild(node);
node = xml_dom.createElement("folder_name");
node.dataType = "string";
node.text = folder_name;
root.appendChild(node);
node = xml_dom.createElement("filesize");
node.dataType = "string";
node.text = size;
root.appendChild(node);
node = xml_dom.createElement("length");
node.dataType = "string";
node.text = length;
root.appendChild(node);
node = xml_dom.createElement("part");
node.dataType = "string";
node.text = records - i;
root.appendChild(node);
node = xml_dom.createElement("offset");
node.dataType = "string";
node.text = offset;
root.appendChild(node);
node = xml_dom.createElement("file");
node.dataType = "bin.base64";
ado_stream.position = offset;
node.nodeTypedValue = ado_stream.Read(length); // -1=adReadAll
root.appendChild(node);
xmlhttp$init();
cmd = 'ReceiveFile.asp';
xmlhttp.open("POST",cmd,false);
xmlhttp.setRequestHeader("Content-length", xml_dom.length);
xmlhttp.send(xml_dom);
this.ini.load(xmlhttp.responseText);
this.message = this.ini.read('error');
this.status = this.ini.read('status');
if (this.status != 'ok')
{
// this.show(xmlhttp.responseText);
ado_stream.Close();
return false;
}
}
ado_stream.Close();
return true;
}
//==========================================================================================
// server$addFileData
//==========================================================================================
function server$addFileData(filename,data,owner_name,owner_id,folder_id,folder_name)
{
var cmd;
var size;
var node;
var root;
var maxsize = 100000;
var need,offset,i,records,length,remain;
var xml_dom,rs,text,a;
size = data.length;
if (size == 0)
{
alert('file: ' + filename + '\r\n is empty, cannot upload');
return true;
}
if (size > (80*1024*1024))
{
alert('file: ' + filename + '\r\nis larger than 80MB , cannot upload');
return true;
}
ado_stream = new ActiveXObject("ADODB.Stream");
ado_stream.Open();
ado_stream.WriteText(data);
ado_stream.position = 0;
ado_stream.type = 1;
size = ado_stream.size;
records = Math.floor(size / maxsize);
remain = size - (records * maxsize);
if (remain > 0) records = records + 1;
need = size;
for (i = 0; i < records; ++i)
{
offset = i * maxsize;
length = maxsize;
if (need < maxsize) length = need;
need = need - length;
xml_dom = xmldom$init();
xml_dom.loadXML(' ');
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
root = xml_dom.documentElement;
node = xml_dom.createElement("filename");
node.dataType = "string";
node.text = extractFileName(filename);
root.appendChild(node);
node = xml_dom.createElement("owner_name");
node.dataType = "string";
node.text = owner_name;
root.appendChild(node);
node = xml_dom.createElement("owner_id");
node.dataType = "string";
node.text = "" + owner_id;
root.appendChild(node);
node = xml_dom.createElement("folder_id");
node.dataType = "string";
node.text = "" + folder_id;
root.appendChild(node);
node = xml_dom.createElement("folder_name");
node.dataType = "string";
node.text = folder_name;
root.appendChild(node);
node = xml_dom.createElement("filesize");
node.dataType = "string";
node.text = size;
root.appendChild(node);
node = xml_dom.createElement("length");
node.dataType = "string";
node.text = length;
root.appendChild(node);
node = xml_dom.createElement("part");
node.dataType = "string";
node.text = records - i;
root.appendChild(node);
node = xml_dom.createElement("offset");
node.dataType = "string";
node.text = offset;
root.appendChild(node);
node = xml_dom.createElement("file");
node.dataType = "bin.base64";
node.nodeTypedValue = ado_stream.Read(length);
root.appendChild(node);
xmlhttp$init();
cmd = 'ReceiveFile.asp';
xmlhttp.open("POST",cmd,false);
xmlhttp.setRequestHeader("Content-length", xml_dom.length);
xmlhttp.send(xml_dom);
this.ini.load(xmlhttp.responseText);
this.message = this.ini.read('error');
this.status = this.ini.read('status');
if (this.status != 'ok')
{
// this.show(xmlhttp.responseText);
return false;
}
}
ado_stream.close();
return true;
}
//==========================================================================================
// server$fileWrite
//==========================================================================================
function server$fileWrite(filename,output)
{
var cmd;
var size;
var node;
var root;
var maxsize = 100000;
var need,offset,i,records,length,remain;
var xml_dom;
window.status = filename;
size = file$size(filename);
if (size == 0)
{
alert('file: ' + filename + '\r\nis empty, cannot upload');
return false;
}
if (size > (8*1024*1024))
{
alert('file: ' + filename + '\r\nis larger than 8MB , cannot upload');
return false;
}
var ado_stream = new ActiveXObject("ADODB.Stream");
records = Math.floor(size / maxsize);
remain = size - (records * maxsize);
if (remain > 0) records = records + 1;
need = size;
for (i = 0; i < records; ++i)
{
offset = i * maxsize;
length = maxsize;
if (need < maxsize) length = need;
need = need - length;
xml_dom = xmldom$init();
xml_dom.loadXML(' ');
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
root = xml_dom.documentElement;
node = xml_dom.createElement("filename");
node.dataType = "string";
node.text = extractFileName(filename);
root.appendChild(node);
node = xml_dom.createElement("output");
node.dataType = "string";
node.text = output;
root.appendChild(node);
node = xml_dom.createElement("filesize");
node.dataType = "string";
node.text = size;
root.appendChild(node);
node = xml_dom.createElement("length");
node.dataType = "string";
node.text = length;
root.appendChild(node);
node = xml_dom.createElement("part");
node.dataType = "string";
node.text = records - i;
root.appendChild(node);
node = xml_dom.createElement("offset");
node.dataType = "string";
node.text = offset;
root.appendChild(node);
node = xml_dom.createElement("file");
node.dataType = "bin.base64";
ado_stream.Type = 1; // 1=adTypeBinary
ado_stream.Open();
ado_stream.LoadFromFile(filename);
ado_stream.position = offset;
node.nodeTypedValue = ado_stream.Read(length); // -1=adReadAll
ado_stream.Close();
root.appendChild(node);
xmlhttp$init();
cmd = 'ReceivePicture.asp';
xmlhttp.open("POST",cmd,false);
xmlhttp.setRequestHeader("Content-length", xml_dom.length);
xmlhttp.send(xml_dom);
this.ini.load(xmlhttp.responseText);
this.status = this.ini.read('status');
if (this.status != 'ok')
{
show(xmlhttp.responseText);
return false;
}
}
return true;
}
//==========================================================================================
// server$fileWritex
//==========================================================================================
function server$fileWritex(filename,output)
{
var cmd;
var size;
size = file$size(filename);
if (size == 0)
{
alert('file: ' + filename + '\r\nis empty, cannot upload');
return false;
}
if (size > (10*1024*1024))
{
alert('file: ' + filename + '\r\nis larger than 10MB , cannot upload');
return false;
}
var ado_stream = new ActiveXObject("ADODB.Stream");
var xml_dom = xmldom$init();
xml_dom.loadXML(' ');
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
var node1 = xml_dom.createElement("file");
node1.dataType = "bin.base64";
ado_stream.Type = 1; // 1=adTypeBinary
ado_stream.Open();
ado_stream.LoadFromFile(filename);
node1.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll
ado_stream.Close();
xml_dom.documentElement.appendChild(node1);
// we can create more XML nodes for multiple file upload
xmlhttp$init();
cmd = 'ReceivePicture.asp?output=' + escape(output);
xmlhttp.open("POST",cmd,false);
xmlhttp.send(xml_dom);
this.ini.load(xmlhttp.responseText);
this.message = this.ini.read('error');
this.status = this.ini.read('status');
if (this.message.toLowerCase() == '$$login$$')
{
alert('session timed out');
}
if (this.status == 'ok') return true;
this.show(xmlhttp.responseText);
return false;
}
//==========================================================================================
// server$fileWrite2
//==========================================================================================
function server$fileWrite2(filename,owner_name,owner_id)
{
var cmd;
var size;
var node;
size = file$size(filename);
if (size == 0)
{
alert('file: ' + filename + '\r\nis empty, cannot upload');
return false;
}
if (size > (10*1024*1024))
{
alert('file: ' + filename + '\r\nis larger than 10MB , cannot upload');
return false;
}
var ado_stream = new ActiveXObject("ADODB.Stream");
var xml_dom = xmldom$init();
xml_dom.loadXML(' ');
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
root = xml_dom.documentElement;
node = xml_dom.createElement("owner_name");
node.dataType = "string";
node.text = owner_name;
xml_dom.documentElement.appendChild(node);
node = xml_dom.createElement("owner_id");
node.dataType = "string";
node.text = "" + owner_id;
xml_dom.documentElement.appendChild(node);
node = xml_dom.createElement("filename");
node.dataType = "string";
node.text = filename;
xml_dom.documentElement.appendChild(node);
node = xml_dom.createElement("file");
node.dataType = "bin.base64";
ado_stream.Type = 1; // 1=adTypeBinary
ado_stream.Open();
ado_stream.LoadFromFile(filename);
node.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll
ado_stream.Close();
xml_dom.documentElement.appendChild(node);
// we can create more XML nodes for multiple file upload
xmlhttp$init();
cmd = 'Receive.asp?command=pictureWrite';
xmlhttp.open("POST",cmd,false);
xmlhttp.send(xml_dom);
this.response = xmlhttp.responseText;
this.ini.load(xmlhttp.responseText);
this.message = this.ini.read('error');
this.status = this.ini.read('status');
if (this.message.toLowerCase() == '$$login$$')
{
alert('session timed out');
}
if (this.status == 'ok') return true;
this.show(xmlhttp.responseText);
return false;
}
//========================================================
// server$newContact
//========================================================
function server$newContact(owner_name,owner_id,employee,iname)
{
var bar;
var names,values;
var cmd;
var cid;
var name;
name = iname;
if (name == undefined) name = 'unknown'
bar = String.fromCharCode(124);
names = 'contact_owner_name' + bar + 'contact_owner_id' + bar + 'CreatedBy' + bar + 'FullName' ;
values = owner_name + bar + owner_id + bar + employee + bar + name;
cmd = 'command=insert&table=t004_contact&columns=' + escape(names) + '&values=' + escape(values);
if (! this.executeW(cmd)) return 0;
cid = parseInt(this.ini.read('id'));
if (isNaN(cid)) cid = 0;
return cid;
}
//========================================================
// server$insert
//========================================================
function server$insert(table,names,values)
{
var cmd;
var cid;
var n,v;
n = names;
v = values;
if (typeof(names) == 'object')
{
n = names.join('|');
v = values.join('|');
}
cmd = 'command=insert&table=' + escape(table) + '&columns=' + escape(n) + '&values=' + escape(v);
if (! this.executeW(cmd))
{
alert(unescape(cmd));
return 0;
}
cid = i4(this.ini.read('id'));
return cid;
}
//========================================================
// server$update
//========================================================
function server$update(sql,names,values)
{
var cmd;
cmd = 'command=changeValues&sql=' + escape(sql) + '&columns=' + escape(names.join('|')) + '&values=' + escape(values.join('|'));
if (! this.executeW(cmd)) return false;
return true;
}
//========================================================
// server$sendmail
//========================================================
function server$sendmail(contact_id,subject,message)
{
var cmd;
var cid;
cid = parseInt(contact_id);
if (isNaN(cid))
{
alert('sendmail failed -- contact ID is not numeric');
return "";
}
if (cid <= 0)
{
alert('sendmail failed -- contact ID is unknown');
return "";
}
cmd = 'command=sendmail&contact_id=' + cid + '&subject=' + escape(subject) + '&message=' + escape(message);
if (! this.executeW(cmd)) return "";
email = this.ini.read("email");
return email;
}
//========================================================
// server$sendmailHtml
//========================================================
function server$sendmailHtml(contact_id,subject,message)
{
var cmd;
var cid;
cid = parseInt(contact_id);
if (isNaN(cid))
{
alert('sendmail failed -- contact ID is not numeric');
return "";
}
if (cid <= 0)
{
alert('sendmail failed -- contact ID is unknown');
return "";
}
cmd = 'command=sendmail&html=true&contact_id=' + cid + '&subject=' + escape(subject) + '&message=' + escape(message);
if (! this.executeW(cmd)) return "";
email = this.ini.read("email");
return email;
}
//========================================================
// server$sqlRead
//========================================================
function server$sqlRead(SQL)
{
var rs;
if (! this.read(SQL)) return null;
rs = this.rs;
this.rs = null;
if (rs.RecordCount == 0)
{
rs.Close();
rs == null;
return null;
}
return rs;
}
//========================================================
// server$read
//========================================================
function server$read(sql)
{
var text;
var result;
var n;
try
{
try
{
this.rs = new ActiveXObject("ADODB.Recordset");
}
catch (e) { activeXHint("ADODB.Recordset",e); return false; }
try
{
if (! this.document) this.document = xmldom$init();
}
catch (e) { activeXHint("XMLDOM",e); return false; }
n = 0;
text = this.receiver + "command=xmlRead&sql=" + escape(sql);
n = n + 1;
xmlhttp.open("POST",text,false);
n = n + 1;
xmlhttp.send();
n = n + 1;
if (xmlhttp.responseText == '')
{
return false;
}
this.document.loadXML(xmlhttp.responseText); //load the returned stream into the dom document
n = n + 1;
this.rs.Open(this.document); //load the dom document into the recordset
n = n + 1;
return true;
}
catch (e) {
// toClipboard(sql);
alert('n = ' + n + ' server$read - ' + sql + ' ' + "\r\n" + e.description + '\r\n' + xmlhttp.responseText +
'\r\n' + window.location.href);
return false;
}
}
//========================================================
// server$readUrl
//========================================================
function server$readUrl(url)
{
var text;
var result;
var n;
try
{
xmlhttp.open("GET",url,false);
xmlhttp.send();
return(xmlhttp.responseText);
}
catch (e) {
alert(e.description + '\r\n' + url);
return false;
}
}
//========================================================
// server$recordExists
//========================================================
function server$recordExists(SQL)
{
var text;
var result;
try
{
text = "command=recordExists&sql=" + escape(SQL);
if (this.execute(text)) return true;
if (this.message != '') alert('record Exists -- SQL: ' + SQL + "\r\n" + this.message);
return false;
}
catch (e) { alert('readExists -- ' + SQL + ' ' + e.description); return false }
}
//========================================================
// server$sqlVvalue
//========================================================
function server$sqlValue(SQL)
{
return this.value(SQL);
}
//========================================================
// server$value
//========================================================
function server$value(SQL)
{
this.execute("command=value&SQL=" + escape(SQL));
return xmlhttp.responseText
}
//========================================================
// server$resolve
//========================================================
function server$resolve(data)
{
var data;
data = this.transform("|" + escape(data) + '|');
return data;
}
//========================================================
// server$transform
//========================================================
function server$transform(data)
{
var cmd;
cmd = "command=resolve&Data=" + escape(data);
this.execute(cmd);
return xmlhttp.responseText;
}
//========================================================
// server$commandValue
//========================================================
function server$commandValue(cmd)
{
this.execute(cmd);
return xmlhttp.responseText
}
//========================================================
// server$navigate
//========================================================
function server$navigate(name,iSQL)
{
var text;
var SQL;
SQL = "";
if (! ((iSQL == undefined) || (iSQL == null)) ) SQL = "&SQL=" + iSQL;
text = this.receiver + "command=showForm&Name=" + name + escape(SQL);
document.location.href = text;
}
//========================================================
// server$sqlExecute
//========================================================
function server$sqlExecute(sql)
{
var cmd;
cmd = 'command=execute&sql=' + escape(sql);
return this.execute(cmd);
}
//========================================================
// server$sqlExecuteW
//========================================================
function server$sqlExecuteW(sql)
{
var cmd;
cmd = 'command=execute&sql=' + escape(sql);
return this.executeW(cmd);
}
//========================================================
// server$executeW
//========================================================
function server$executeW(cmd)
{
if (this.execute(cmd)) return true;
if (this.response.indexOf('HTML') >= 0)
{ this.show(this.response); }
else { alert(this.response); }
toClipboard(this.response);
return false;
}
//========================================================
// server$execute
//========================================================
function server$execute(cmd)
{
var text;
var result;
var node;
text = this.receiver;
var xml_dom = xmldom$init();
xml_dom.loadXML(' ');
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
var node = xml_dom.createElement("data");
node.dataType = "string";
node.nodeTypedValue = cmd;
xml_dom.documentElement.appendChild(node);
try
{
xmlhttp.open("POST",text,false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(xml_dom);
}
catch (e) { alert(e.message) }
this.message = "failed";
// alert(xmlhttp.responseText);
checkLogin(xmlhttp.responseText);
this.response = xmlhttp.responseText;
this.ini.load(xmlhttp.responseText);
this.message = this.ini.read('error');
this.status = this.ini.read('status');
if (this.message.toLowerCase() == '$$login$$')
{
alert('session timed out');
}
if (this.status == 'ok') return true;
return false;
}
//========================================================
// server$executeRead
//========================================================
function server$executeRead(cmd)
{
var text;
var result;
var node;
text = this.receiver;
var xml_dom = xmldom$init();
xml_dom.loadXML(' ');
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
var node = xml_dom.createElement("data");
node.dataType = "string";
node.nodeTypedValue = cmd;
xml_dom.documentElement.appendChild(node);
xmlhttp.open("POST",text,false);
xmlhttp.setRequestHeader("Content-Type", "application/download");
xmlhttp.send(xml_dom);
return xmlhttp.responseText;
}
//*****************************************************************
// toClipboard
//*****************************************************************
function toClipboard(text)
{
window.clipboardData.setData('Text', text);
}
function clipboard()
{
return window.clipboardData.getData('Text');
}
//==========================================================================
// show (show data in a new window)
//==========================================================================
function show(text)
{
show_text = text;
show_win = window.showModelessDialog("blank.htm","",
"dialogHeight: 700px; dialogWidth: 800px; dialogTop: 100px; dialogLeft:" +
"200px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
if (show_win == null) return;
show_win.document.onreadystatechange = show_onReadyStateChange;
show_onReadyStateChange();
}
//==========================================================================
// show_onReadyStateChange
//==========================================================================
function show_onReadyStateChange()
{
if (show_win.document.readyState=="complete") show_win.document.body.innerHTML = show_text;
}
//==========================================================================
// showPage
//==========================================================================
function showPage(url)
{
var win;
var d;
if (url == '') return;
window.open(url,null,"height=500,width=800,status=yes,toolbar=yes,menubar=yes,location=yes");
}
//==========================================================================
// show
//==========================================================================
function showx(text)
{
var x,y,h,w,s,tmp;
var gpopup;
gpopup = window.createPopup();
var oPopupBody = gpopup.document.body;
oPopupBody.style.border = "1px black solid";
oPopupBody.style.backgroundColor = "#ffddcc";
oPopupBody.innerHTML = "" + text + "";
gpopup.show(100, 140, 800, 700, document.body);
}
// ===============================================================
// selectAdd
//================================================================
function selectAdd(select,xid,xtext)
{
var option;
option = select.document.createElement("OPTION");
select.options.add(option);
option.innerText = xtext;
option.value = xid;
return option;
}
// ===============================================================
// selectAddSorted
//================================================================
function selectAddSorted(select,xid,xtext)
{
var option;
var index;
var i;
var opt;
var stext;
stext = trim(xtext.toLowerCase());
index = select.options.length;
for (i =0; i < select.options.length; ++i)
{
opt = select.options[i];
if (stext < opt.innerText.toLowerCase())
{
index = i;
break;
}
}
option = select.document.createElement("OPTION");
select.options.add(option,index);
option.innerText = trim(xtext);
option.value = xid;
return index;
}
// ===============================================================
// selectFindText
//================================================================
function selectFindText(obj,value)
{
var i;
var v;
var val;
if (obj.options.length == 0) return -1;
val = value;
if (typeof(value) == 'string') val = value.toLowerCase();
for (i=0; i < obj.options.length; ++i)
{
v = obj.options[i].innerText.toLowerCase();
if (val == v) return i;
}
return -1;
}
// ===============================================================
// selectFind
//================================================================
function selectFind(obj,value)
{
var i;
var v;
var val;
if (obj.options.length == 0) return -1;
val = value;
if (typeof(value) == 'string') val = value.toLowerCase();
for (i=0; i < obj.options.length; ++i)
{
v = obj.options[i].value.toLowerCase();
if (val == v) return i;
}
return -1;
}
// ===============================================================
// selectSet
//================================================================
function selectSet(obj)
{
var i;
var id;
var data
data = new Array();
for (i=0; i < obj.options.length; ++i)
{
id = i4(obj.options[i].value);
if (id <= 0) continue;
data[data.length] = id;
}
return data;
}
//=================================================
// server$selecteOptions
//=================================================
function server$selectOptions(obj,sql,blank)
{
var cmd;
var vlist;
var image,i;
var list;
obj.options.length = 0;
cmd = 'command=optionsList&sql=' + escape(sql);
this.execute(cmd);
image = this.response;
if (blank) image = '~|' + image;
selectOptions(obj,image);
}
//=================================================
// SelectOptions
//=================================================
function selectOptions(obj,image)
{
var cmd;
var vlist;
var image,i;
var list;
obj.options.length = 0;
list = image.split('|');
for (i=0; i < list.length; ++i)
{
vlist = list[i].split('~');
if (vlist.length < 2) continue;
opt = selectAdd(obj,vlist[0],vlist[1]);
if (vlist.length >= 3) opt.style.color = vlist[2];
if (vlist.length >= 4) opt.style.backgroundColor = vlist[3];
}
}
//==========================================================================
// show (show data in a new window)
//==========================================================================
function server$show()
{
this.win = window.showModelessDialog("blank.htm","",
"dialogHeight: 700px; dialogWidth: 800px; dialogTop: 100px; dialogLeft:" +
"200px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
toClipboard(xmlhttp.responseText);
if (this.win == null) return;
this.win.document.onreadystatechange = server_onReadyStateChange;
server_onReadyStateChange();
}
//==========================================================================
// show (show data in a new window)
//==========================================================================
function server_onReadyStateChange()
{
if (server.win.document.readyState=="complete")
{
server.win.document.body.innerHTML = xmlhttp.responseText;
}
}
//=================================================================
// selectClone
//=================================================================
function selectClone(a,b)
{
var v,value,text,idx;
if (a == b) return;
v = b.value;
b.options.length = 0;
for (i = 0; i < a.options.length; ++i)
{
value = a.options(i).value;
text = a.options(i).innerText;
selectAdd(b,value,text);
}
idx = selectFind(b,v);
if (idx >= 0) b.selectedIndex = idx;
}
//=================================================================
// addContact
//=================================================================
function addContact(obj,select,company_id)
{
var cmd,cid,args,fullname;
var atyp,isPublic;
var companyName;
var c,cname;
isPublic = false;
companyName = server.value('select company_name from q021_company_all where company_id = ' + company_id);
fullname = prompt(companyName + '\r\nNew contact name ? ','');
if (fullname == null) return false;
if (fullname == '') return false;
cmd = 'command=newPrivateContact&name=' + escape(fullname) + '&owner_name=company&owner_id=' + company_id;
if (! update.server.executeW(cmd)) return false;
cid = update.server.ini.read('id');
cid = i4(cid);
if (cid <= 0) return false;
args = '&contact_id=' + cid;
args += '&owner_name=company';
args += '&owner_id=' + company_id;
args += '&private=true';
f_edit_contact.show(args,escape(companyName));
cmd = 'command=privatecontacts&owner_name=company&owner_id=' + company_id;
text = update.server.commandValue(cmd);
text = "~" + String.fromCharCode(124) + text;
selectAddOptionsList(select,text);
select.selectedIndex = -1;
if (select.options.length > 0)
{
n = selectFindValue(select,cid);
if (n < 0) n = 0;
select.selectedIndex = n;
}
if (obj != null)
{
obj.value = cid;
update.changed(obj);
}
else update.changed(select);
return true;
}
// ===============================================================
// selectText
//================================================================
function selectText(obj)
{
var i;
var text;
i = obj.selectedIndex;
if (i < 0) return "";
text = obj.options[i].innerText;
return text;
}
// ===============================================================
// selectFindValue
//================================================================
function selectFindValue(obj,value)
{
var i;
var v;
var val;
if (obj.options.length == 0) return -1;
if (obj.innerHTML == '') return -1;
val = value;
if (typeof(value) == 'string') val = value.toLowerCase();
try
{
for (i=0; i < obj.options.length; ++i)
{
v = obj.options[i].value.toLowerCase();
if (val == v) return i;
}
}
catch (e) { alert('selectFindValue: ' + e.description) }
return -1;
}
// ===============================================================
// selectAddOptionsList
//================================================================
function selectAddOptionsList(select,text,value,textvalue)
{
var a,b;
var list;
var index;
select.options.length = 0;
a = text.split('|');
for (i = 0; i < a.length; ++i)
{
list = a[i].split('~');
if (list.length != 2) continue;
selectAdd(select,list[0],list[1]);
}
select.selectedIndex = 0;
if (selectAddOptionsList.arguments.length == 2) return;
if (value != null)
{
idx = selectFindValue(select,value);
if (idx >= 0)
{
select.selectedIndex = idx;
return;
}
}
if (selectAddOptionsList.arguments.length < 4) return;
idx = selectFindText(select,textvalue);
if (idx >= 0)
{
select.selectedIndex = idx;
return;
}
}
//========================================================================
// saveOrdersToCsv
//========================================================================
function saveOrdersToCsv(text)
{
var filename;
filename = "c:/Documents and Settings/allison_bolender/My Documents/company/PAYROLL/JOB NUMBERS/JOB IMPORT FILE.csv";
// filename = "c:/temp/JOB IMPORT FILE.csv";
strToFile(text,filename);
}
//========================================================================
// eraseOrders
//========================================================================
function eraseOrders()
{
if (! confirm("Clear All Orders ?")) return;
initilize();
sql = "delete from t037_NewOrder";
server.sql(sql);
}
//===================================================
// fileToStr (Debug Utility)
//===================================================
function fileToStr(filename)
{
var forReading = 1;
var fs,f;
var text;
var fname;
try
{
fs = new ActiveXObject("Scripting.FileSystemObject");
if (! fs.FileExists(filename)) return "";
f = fs.OpenTextFile(filename, forReading, true);
text = f.readAll();
f.close();
return text;
}
catch (e) { return "" }
}
//==========================================================================================
// sqlList
//==========================================================================================
function sqlList(cnn,sql)
{
var rs;
var text;
var list;
list = new Array();
rs = new ActiveXObject('ADODB.recordset');
rs.Open(sql,cnn,1,3);
if (rs.RecordCount <= 0)
{
rs.Close();
return list;
}
rs.MoveFirst();
while (! rs.EOF)
{
list[list.length] = rs(0).value;
rs.MoveNext();
}
rs.Close();
return list;
}
//==========================================================================================
// accountValue
//==========================================================================================
function accountValue(name)
{
if (account_rs == null) this.account_rs = server.sqlRead('AccountRecord');
if (account_rs == null) return '';
try
{
if (account_rs('Account_' + name).value != null) return account_rs('Account_' + name).value;
}
catch (e) { }
return '';
}
//==========================================================================================
// userValue
//==========================================================================================
function userValue(name)
{
if (user_rs == null) this.user_rs = server.sqlRead('UserRecord');
if (user_rs == null) return '';
try
{
if (user_rs(name).value != null) return user_rs(name).value;
}
catch (e) { }
return '';
}
//==========================================================================================
// editProgram
//==========================================================================================
function editProgram(pid)
{
f_edit_program.show('program_id=' + i4(pid),'');
}
//==========================================================================================
// userCommand
//==========================================================================================
function userCommand(pid,name,parms)
{
var data,src;
src = event.srcElement;
data = server.transform(unescape(parms));
programFormOpen(pid,data,src);
}
//=================================================================
// bodyClickEvent
//=================================================================
function bodyClickEvent()
{
var obj;
if (programPopup == null) return;
if (programPopup.style.display == 'none') return;
obj = event.srcElement;
while (obj != null)
{
if (obj == programPopup) return;
obj = obj.parentElement;
}
programPopup.style.display = 'none';
detachEvent('onclick', bodyClickEvent);
}
//=================================================================
// programFormOpen
//=================================================================
function programFormOpen(pid,parameters,src)
{
var h,w,url,arg,cmd,src;
var x,y,data,temp;
var isPopup;
h = i4(server.sqlValue('select program_height from t202_program where program_id = ' + pid));
if (h < 5) h = 200;
w = i4(server.sqlValue('select program_width from t202_program where program_id = ' + pid));
if (w < 5) w = 300;
kind = server.sqlValue('select program_kind from t202_program where program_id = ' + pid);
y = getBottom(src) + 6;
x = getLeft(src);
arg = '';
data = server.transform(parameters);
cmd = 'command=programForm&program_id=' + pid + '&' + data;
url = 'receive.asp?' + cmd;
//---------------------- open -------------
if (kind == 'popup')
{
//---------------------- check if already open -------------
if (programPopup != null)
{
if (programPopup.style.display == '')
{
if (programPopup.src == src)
{
programPopup.style.display = 'none';
detachEvent('onclick', bodyClickEvent);
return
}
}
}
if (programPopup == null)
{
programPopup = document.createElement('div');
programPopup.style.height = h;
programPopup.style.width = w;
programPopup.style.display = 'none';
programPopup.style.backgroundColor = 'lightsteelblue';
programPopup.style.border = '2 inset silver';
programPopup.style.position = 'absolute';
// programPopup.onclick = programPopupClickEvent;
document.body.appendChild(programPopup);
}
programPopup.style.posTop = y + 10;
programPopup.style.posLeft = x;
programPopup.src = src;
programPopup.innerHTML = server.executeRead(cmd);
programPopup.style.zInxdex = 800;
programLoadScript(pid,programPopupShow,data);
return;
}
//---------------------------- Script Only -------------------
if (kind == 'script')
{
programLoadScript(pid,programRunScript,data);
return;
}
//-------------------------- dialog -------------------
x = x + window.screenLeft;
y = y + window.screenTop;
result = window.showModalDialog(url,arg,
"dialogLeft: " + x + "px; dialogTop: " + y + "px;" +
"dialogHeight: " + h + "px; dialogWidth: " + w +
"px; edge: Sunken; center:Yes; resizable:yes; Status:no; Scroll:on");
}
//=================================================================
// programRunScript
//=================================================================
function programRunScript()
{
var script,parms;
script = document.getElementById('programScript');
script.count += 1;
if (script.count > 1) return;
userExecute(script.parms);
}
//=================================================================
// programPopupShow
//=================================================================
function programPopupShow()
{
programPopup.style.display = '';
document.body.attachEvent("onclick",bodyClickEvent);
}
//=================================================================
// programClose
//=================================================================
function programClose()
{
if (programPopup == null) return;
programPopup.style.display = 'none';
detachEvent('onclick', bodyClickEvent);
}
//=================================================================
// programLoadScript
//=================================================================
function programLoadScript(pid,callback,parms)
{
var head,script;
script = document.getElementById('programScript');
if (script == null)
{
head = document.getElementsByTagName('head')[0];
script = document.createElement('script');
script.id = 'programScript';
script.program_id = pid;
script.type = 'text/javascript';
script.callback = null;
script.onreadystatechange = onreadystatechangeProgram;
head.appendChild(script);
}
script.count = 0;
script.callback = callback;
script.program_id = pid;
script.parms = parms;
script.src = 'receive.asp?Command=program_client_Script&program_id=' + pid + '&' + parms;
}
//=================================================================
//
//=================================================================
function onreadystatechangeProgram()
{
var script;
script = document.getElementById('programScript');
//alert(script.readyState + ' ' + script.count);
if (script.readyState != 'loaded') return;
script.callback();
}
//=================================================================
// programLoadScript2
//=================================================================
function programLoadScript2(pid,callback)
{
var data;
var script;
script = document.getElementById('programScript');
if (script != null) delete script;
script = document.createElement("script")
script.count = 0;
script.type = "text/javascript";
script.id = 'programScript';
if (script.readyState)
{
if (script.readyState == "loaded" || script.readyState == "complete")
{
script.onreadystatechange = null;
callback();
};
}
else script.onload = function() { callback(); };
script.src = 'receive.asp?Command=program_client_script&program_id=' + pid;
document.getElementsByTagName("head")[0].appendChild(script);
}
//=================================================================
// editContactParent
//=================================================================
function editContactParent(cid)
{
var args;
var cid;
var isPublic;
cid = i4(cid);
if (cid <= 0) return;
args = '&contact_id=' + cid;
args += '&owner_name=contact';
args += '&owner_id=0';
args += '&private=';
f_edit_contact.showParent(args,'');
}
// ===============================================================
// userForm
//================================================================
function userForm(name,args,height,width)
{
var temp,value,url,result,arg,cnt;
var h,w,bar;
cnt = 0;
url = './Receive.asp?command=showUserForm&name=' + name + '&' + args;
h = height;
w = width;
try
{
result = window.showModalDialog(url,arg,
"dialogHeight: " + h + "px; dialogWidth: " + w +
"px; edge: Sunken; center:Yes; resizable:yes; Status:no; Scroll:on");
}
catch (e) { window.alert(e.description + "\r\n\r\n Try TURNING OFF POP-UP BLOCKER... \r\n\r\nInternet Explorer " + bar + " Tools " + bar + " Pop-up Blocker " + bar + " Turn Off Pop-up Blocker" ); }
return result;
}