function _fGetFullName()
{
return this.fFirst() + " " + this.fLast();
}function _fDrawPS(ps)
{
for(var t in this)
{
if(ps.indexOf("["+t+"]") >= 0)
{
var re=new RegExp("\\["+t+"\\]","ig");
re.global="g";
ps = ps.replace(re,this[t])
}
}
return ps;
}function _fMember(memberid,value)
{
if(value!=null)this[memberid]=value;return this[memberid];
}function fSerialize(obj)
{
try{if(obj.getTime) return 'new Date("'+obj+'")';}catch(e){}
if(typeof(obj) == "string")
return '"'+(String(obj).replace(/(\'|\")/g,"\\$1"))+'"';
if(typeof(obj) == "date")
return '"'+obj+'"';
if(typeof(obj) == "number")
return obj;
if(typeof(obj) == "undefined")
return "null";
if(typeof(obj) == "function")
return null;
var atxt=[];
if(typeof(obj) == "object")
{
try
{
if(obj.fToString)
return obj.fToString();
}catch(fSerializeE){}
if(String(obj) == "null")
return null;
try
{
if(String(obj.valueOf()).charAt(0) == "/")
return "new RegExp('"+String(obj.valueOf()).replace(/\/(.*)\/(.*)/,"$1','$2'")+")";
else if(obj.length != null)
{
var aobj = [];
for(var o=0;o<obj.length;o++)
{
if(typeof(obj[o]) == "function")
continue;
aobj[aobj.length]=fSerialize(obj[o]);
}
atxt[atxt.length]="[ "+aobj.join(", ")+" ]";
}
else
{
var aobj = [];
for(var o in obj)
{
if(o.charAt(0)=="_" || o.charAt(0)=="$" || o.charAt(0)=="f" || typeof(obj[o]) == "function")
{
continue;
}
aobj[aobj.length]='"'+o+'":'+fSerialize(obj[o]);
}
atxt[atxt.length]="{ "+aobj.join(", ")+" }";
}
}
catch(e)
{
atxt[atxt.length]="Error:\""+String(e.description)+"\"";
}
}
return(atxt.join(", "));
}function _fFormatDate(d)
{
var D = new Date(String(d));
return (D.getMonth()+1) +"/"+ D.getDate() +"/"+ D.getFullYear() +" "+ D.toLocaleTimeString();
}
var currency = [ "USD", "AUD", "BRL", "GBP", "CAD", "CNY", "DKK", "EUR", "HKD", "INR", "JPY", "MYR", "MXN", "NZD", "NOK", "SGD", "ZAR", "KRW", "LKR", "SEK", "CHF", "TWD", "THB", "VEB" ];
var country  = [ "US", "AU", "BR", "GB", "CA", "CN", "DK", "EU", "HK", "IN", "JP", "MY", "MX", "NZ", "NO", "SG", "ZA", "KR", "LK", "SE", "CH", "TW", "TH", "VE" ];
var rate = [ "1", "1.22594", "1.9672", "0.495909", "1.056", "7.5462", "5.4594", "0.733084", "7.7968", "40.63", "115.83", "3.5015", "11.032", "1.42349", "5.821", "1.5242", "7.162", "938.1", "113", "6.8822", "1.2071", "33.02", "32.5", "2144.6" ];
var hTaxRates  = { "WA":{ "ID":1, "Name":"WA Sales Tax", "Rate":0.086, "Abrv":"WA" }, "GST":{ "ID":2, "Name":"GST", "Rate":0.05, "Abrv":"GST" }, "GST/HST":{ "ID":3, "Name":"GST/HST", "Rate":0.05, "Abrv":"GST/HST" }, " ":{ "ID":4, "Name":"No Tax", "Rate":0, "Abrv":" " }, "MA":{ "ID":6, "Name":"MA Sales Tax", "Rate":0.05, "Abrv":"MA" }, "CANADA":{ "ID":7, "Name":"Canada", "Rate":0.05, "Abrv":"CANADA" }, "MD":{ "ID":9, "Name":"MD Sales Tax", "Rate":0.05, "Abrv":"MD" }, "AB":{ "ID":10, "Name":"Alberta", "Rate":0.05, "Abrv":"AB" }, "BC":{ "ID":11, "Name":"British Columbia", "Rate":0.05, "Abrv":"BC" }, "MB":{ "ID":12, "Name":"Manitoba", "Rate":0.05, "Abrv":"MB" }, "NB":{ "ID":13, "Name":"New Brunswick", "Rate":0.05, "Abrv":"NB" }, "NL":{ "ID":14, "Name":"Newfoundland", "Rate":0.05, "Abrv":"NL" }, "NS":{ "ID":15, "Name":"Nova Scotia", "Rate":0.05, "Abrv":"NS" }, "ON":{ "ID":16, "Name":"Ontario", "Rate":0.05, "Abrv":"ON" }, "PE":{ "ID":17, "Name":"Prince Edward Island", "Rate":0.05, "Abrv":"PE" }, "QC":{ "ID":18, "Name":"Quebec", "Rate":0.05, "Abrv":"QC" }, "SK":{ "ID":19, "Name":"Saskatchewan", "Rate":0.05, "Abrv":"SK" }, "NT":{ "ID":20, "Name":"Northwest Territories", "Rate":0.05, "Abrv":"NT" }, "YT":{ "ID":21, "Name":"Yukon", "Rate":0.05, "Abrv":"YT" }, "NU":{ "ID":22, "Name":"Nunavut", "Rate":0.05, "Abrv":"NU" }, "CA":{ "ID":23, "Name":"CA Sales Tax", "Rate":0.0875, "Abrv":"CA" } };

Number.prototype.fFormatCurrency = function (d)
{
x = this.toFixed(d).split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}; 
String.prototype.fMakeArray = function (obj)
{
if(this.length==0)
return [];
if(obj && obj.fPreProcess)
{
return obj.fPreProcess(this).split(obj.Delimitor|| ",");
}
return this.split((obj && obj.Delimitor) || ",");
};
function fToggle(id)
{
 var el = document.getElementById(id);
 if(el.style.display =="none")
 {
  el.style.display = "";
 }
 else
 {
  el.style.display = "none";
 } 
}
function fSetErrorClass(el,value)
{
 if(value != null)
  el.setAttribute("Err",String(value));
 else
  value = el.getAttribute("Err");


 if(value == "SUCCESS" || value == "")
 {
  el.className=String(el.className).replace(/Error {0}/i,"");
 }
 else
 {
  el.className="Error "+String(el.className).replace(/Error {0}/,"");
 }
}
function fIsRequired(elid)
{
 try
 {
  return (String(document.getElementById(elid).getAttribute("Required")).replace(/undefined|null| /g,"")!="");
 }
 catch(e){}
 return false; 
}
function faListMembers(hlist,member)
{
 var aL = [];
 for(var h in hlist){try{aL[aL.length]=hlist[h][member];}catch(e){}}
 return aL;
}
function fAdvertising(el,page)
{
 if(page == "Profile" || page == "Browse")
 {
  var aAdv = [];

  if(fPageHandler().fGetActiveCustomer().fGetActiveRegProduct().Version < 10.0)
   aAdv.push("<IMG SRC='images/upgradenow.gif' class='bdrgry bbn'>");

  aAdv.push("<IMG SRC='images/pluspacks.gif' class='bdrgry bbn'>");
 
  aAdv.push("<IMG SRC='images/maxprocharts.gif' class='bdrgry bbn'>");
 
  aAdv.push("<IMG SRC='images/radarupgrade.gif' class='bdrgry'>");
 
  if(aAdv.length > 0)
   document.getElementById(el).innerHTML=aAdv.join("<br>");
 }
}
function fGD(id,attrib)
{
 if(attrib)
  return fGDA(id,attrib);
 return document.getElementById(id);
}
function fGDA(id,attrib)
{
 return document.getElementById(id).getAttribute(attrib);
}
function fGDS(id)
{
 return document.getElementById(id).style;
}
function fFadeInTimer(elid,op,wait,adj)
{
 var el = fGD(elid);
 if(op==null) var op=0;
 if(wait==null) var wait=10;
 if(adj==null) var adj=10;
 op+=adj;
 if(el == null || el.style.display=="none")
  return false;
 el.style.filter="alpha(opacity="+op+")";
 el.style["-moz-opacity"]=op/100;
 if(op < 100)
  window.setTimeout("fFadeInTimer('"+elid+"',"+op+","+wait+");",wait);
 return false;
}
function fFadeOutTimer(elid,op,wait,adj)
{
 var el = fGD(elid);
 if(op==null) var op=100;
 if(wait==null) var wait=10;
 if(adj==null) var adj=10;
 op-=adj;
 if(op == 0)
  el.style.display="none";
 if(el == null || el.style.display=="none")
  return false;
 el.style.filter="alpha(opacity="+op+")";
 if(op <= 0)
 {
  el.style["-moz-opacity"]=0;
  return;
 }
 el.style["-moz-opacity"]=op/100;
 window.setTimeout("fFadeOutTimer('"+elid+"',"+op+","+wait+");",wait);
 return false;
}
function clsBusinessUnit()
{
return this;
};
function clsSite(hsh)
{
this.Site            = "JM";
this.Branding        = "";
this.CompanyName     = "";
this.aCompanyAddress = [];
this.Telephone       = "";
this.SalesPhone      = "";
this.ServicePhone    = "";
this.FAXPhone        = "";
this.Email           = "";
this.WebSite         = "";
this.WebStore        = "";
this.LogoImg         = "";
this.DataSet         = "MAXPro";
this.Currency        = "USD";
this.IsLoggedIn      = 0;
this.hExchange       = {};
this.fIsLoggedIn = function()
{
return this.IsLoggedIn;
}
this.fExchange = function(amt,from,to)
{
if(this.hExchange["USD"]==null) this.fSetupExchange();
try
{
if(from != "USD")
amt = amt/this.hExchange[from].Rate;
return amt*this.hExchange[to].Rate;
}
catch(e)
{
return null;
}
}
this.fExchangeSelector = function(handler)
{
return '<li class="liNavItem">Currency:<SELECT ID="selExchange" class="clsButton" onchange="fPageHandler().fExchangeRate(\'selExchange\',\''+handler+'\');" >'+ this.fExchangeOptions()+'</SELECT>'
+'&nbsp;<input id="btnExchangeUpdate" type=button class="clsButton" style="display:none;width:50px;" onclick="fPageHandler().fExchangeRate(\'selExchange\',\''+handler+'\');" value="Update"/>'
+'<li class="liNavItem"><a href="#" HelpKey="Currency" onclick="return fPageHandler().fHelpHandler(this);">Currency Key</a></li>'
+'<br>';
}
this.fExchangeOptions = function()
{
if(this.hExchange["USD"]==null) this.fSetupExchange();
var aTxt = [];
for(var e in this.hExchange)
aTxt[aTxt.length]="<option value='"+e+"' "+(this.Currency==e?" SELECTED ":"")+">"+e+"["+this.hExchange[e].Rate+"]</option>";
return aTxt.join("");
}
this.fSetupExchange = function()
{
this.hExchange = {};
// Call http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
// Call http://www.bankofcanada.ca/rss/fx/noon/fx-noon-all.xml
var currency = new Array("USD","AUD","BRL","GBP","CAD","CNY","DKK","EUR","HKD","INR","JPY","MYR","MXN","NZD","NOK","SGD","ZAR","KRW","LKR","SEK","CHF","TWD","THB","VEB");
//var country  = new Array("US", "AU", "BR", "GB", "CA", "CN", "DK", "EU", "HK", "IN", "JP", "MY", "MX", "NZ", "NO", "SG", "ZA", "KR", "LK", "SE", "CH", "TW", "TH", "VE");
var rate = new Array("1","1.22594","1.9672","0.495909","1.056","7.5462","5.4594","0.733084","7.7968","40.63","115.83","3.5015","11.032","1.42349","5.821","1.5242","7.162","938.1","113","6.8822","1.2071","33.02","32.5","2144.6");
for(var c=0;c < currency.length;c++)
this.hExchange[currency[c]]={Currency:currency[c],Country:currency[c].substr(0,2),Rate:rate[c]};
}
this.fContacts       = function (){this.fContacts=this["f"+this.Site+"Contacts"]; return this.fContacts();}
this.fFAQs           = function (){return {}}
this.fEstablished    = function (){return this.CompanyName!="";};
this.fCompanyName    = function (){return this.CompanyName;};
this.fCompanyAddress = function (br){if(br==null)br = "<br>"; return this.aCompanyAddress.join(br);};
this.fTelephone      = function (){return this.Telephone;};
this.fSalesPhone     = function (){return this.SalesPhone;};
this.fServicePhone   = function (){return this.ServicePhone;};
this.fFAXPhone       = function (){return this.FAXPhone;};
this.fEmail          = function (){return this.Email;};
this.fWebSite        = function (){return this.WebSite;};
this.fSite           = function (v){if(v)this.Site=v;return this.Site;};
this.fWebStore       = function (v){if(v)this.WebStore=v;return this.WebStore;};
this.fDataSet        = function (v){if(v)this.DataSet=v;return this.DataSet;};
this.fBranding       = function (v){if(v)this.Branding=v;return this.Branding;};
this.fLogoImg        = function (){return this.LogoImg;};
this.fBrandImg       = function (){if(this.Branding=="" )return "images/logo_nobeltec_home2.gif";if(this.Site=="JM")return "images/pixel_clear.gif";return this.LogoImg;}
this.fDealer         = function (v){if(v!=null)this.hDealer=v;if(this.hDealer)return this.hDealer; return null;}
for(var h in hsh)
{
if(h == "hDealer")
this[h] = new clsDealer(hsh[h]);
else
this[h] = hsh[h];
}
return this;
};
function clsOperator(hsh)
{
var d = new Date();
this.SortBy   = "D";
this.Detail   = "S";
this.Starting = 	"1/1/"+d.getFullYear();
d.setMonth(d.getMonth()+1);
this.Ending = (d.getMonth()+1)+"/1/"+d.getFullYear();
this.fSortBy = function (v){if( v != null)this.SortBy=v; return this.SortBy;}
this.fDetail = function (v){if( v != null)this.Detail=v; return this.Detail;}
this.fStarting = function (v){if( v != null)this.Starting=v; return this.Starting;}
this.fEnding = function (v){if( v != null)this.Ending=v; return this.Ending;}
for(var h in hsh)
{
this[h] = hsh[h];
}
return this;
};
function clsDealer(hsh)
{
this.clsOperator=clsOperator;
this.clsOperator();
this.DealerID        = 0;
this.AccountID       = 0;
this.PriceGroup      = "Dealer"
this.Name            = "";
this.AuthContact     = "";
this.BillContact     = "";
this.Address1        = "";
this.Address2        = "";
this.City            = "";
this.Region          = "";
this.PostalCode      = "";
this.CountryID       = "";
this.Phone1          = "";
this.Phone2          = "";
this.Fax             = "";
this.Email           = "";
this.WebVisible      = "";
this.Web             = "";
this.PassportClass   = "";
this.CreditLimit     = "";
this.RemainingCredit = "";
this.Status          = "";
this.County          = "";
this.Lat             = "";
this.Lon             = "";
this.GeoCode         = "";
this.QBID            = "";
this.CreditOnHold    = "";
this.CUSTNMBR        = "";
this.CUSTDISC        = "";
this.PRCLEVEL        = "";
this.SALSTERR        = "";
this.CUSTCLAS        = "";
this.Section         = "";
this.SalesTerritory  = "";
this.InvoiceEmail    = "";
this.TaxExempt       = "";
this.UserEmail       = "";
this.UserFullName    = "";
this.UserStatus      = "";
this.UserPriv        = "";
this.UserAccess      = "";
this.UserDealerShip  = "";
this.UserInvoiceEmail= "";
this.OrderType       = "";
this.fName           = function (){return this.Name;};
this.fUserFullName   = function (){return this.UserFullName;};
this.fUserStatus     = function (){return this.UserStatus;};
this.fOrderType      = function(ot){if(ot != null)this.OrderType=ot;return ot;}
this.fInternal       = function(){if(this.DealerID==0){return true;}return false;}
for(var h in hsh)
{
this[h] = hsh[h];
}
return this;
};
function clsDistributor(hsh)
{
this.clsDealer=clsDealer;
this.clsDealer(hsh);
this.PriceGroup="Distributor"
return this;
};
function clsLogin()
{
return this;
};
function clsDemographics(hsh)
{
this.InfoID          = 0;
this.DealerID        = 0;
this.FirstName       = "";
this.LastName        = "";
this.Address1        = "";
this.Address2        = "";
this.Address3        = "";
this.Address4        = "";
this.City            = "";
this.Region          = "";
this.DayPhone        = "";
this.EmailAddress    = "";
this.NewsLetterEmail = "";
this.PostalCode      = "";
this.EvePhone        = "";
this.FaxPhone        = "";
this.MobilePhone     = "";
this.Company         = "";
this.UseType         = "";
this.County          = "";
this.Country         = "";
this.UserName        = "";
this.Password        = "";
this.Marketing       = "";
this.Status          = "";
this.IsOrganization = 0;
this.CUSTOMER_REF    = 0;
this.CONTACT_REF     = 0;
this.ADDRESS_REF     = 0;
this.DEALER_REF      = 0;
this.BILLTO_REF      = 0;
this.DAYPHONE_REF    = 0;
this.EVEPHONE_REF    = 0;
this.FAXPHONE_REF    = 0;
this.MOBILEPHONE_REF = 0;
this.EMAIL_REF       = 0;
this.Lat             = "";
this.Lon             = "";
// Added for Passing MaxPro Transaction Info
this.BirthDate       = "";
for(var h in hsh)
{
switch(h)
{
default:
this[h] = hsh[h];
}
}
this.fFirst = function (v){if(v!=null)this.FirstName=v;return this.FirstName;}
this.fLast  = function (v){if(v!=null)this.LastName=v;return this.LastName;}
return this;
};
function clsShipping(hsh)
{
this.$ShippingMethods=null;
this.ShipperID       = -1;
this.ShipName1       = "";
this.ShipName2       = "";
this.Address1        = "";
this.Address2        = "";
this.Address3        = "";
this.Address4        = "";
this.City            = "";
this.Region          = "";
this.DayPhone        = "";
this.EmailAddress    = "";
this.PostalCode      = "";
this.County          = "";
this.Country         = "";
for(var h in hsh)
{
switch(h)
{
default:
this[h] = hsh[h];
}
}
this.fGetItem      = function(i){if(this[i])return this[i]; return "";}
this.fDrawShipping = function()
{
var aAddress = [];
var sTxt = "";
var tmp = "";
try
{
for(var i=1; i <= 4; i++)
{
tmp = eval("this.Address" +i );
if(aAddress[aAddress.length] == 0)
break;
aAddress[aAddress.length] = tmp;
tmp += "<br>";
}
sTxt = '<table width="100%" cellpadding=0 cellspacing=0 ><tr>'
+ '<td class="dvGrayBar" colspan="2">Shipping&nbsp;Address&nbsp;Information</td>'
+ '</tr></table>'
+'<table class="vt" width="100%" cellpadding=0 cellspacing=3>'
+ '<tr>'
+ '<th width="150px" class="ar" scope="row">Name:</th>'
+ '<td>' +this.ShipName1 +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th width="150px" class="ar" scope="row">Address:</th>'
+ '<td>' +aAddress.join("") +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th width="150px" class="ar" scope="row">Secondary Name:</th>'
+ '<td>' +this.ShipName2 +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th width="150px" class="ar" scope="row">City:</th>'
+ '<td>' +this.City +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th width="150px" class="ar" scope="row">State:</th>'
+ '<td>' +this.Region +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th width="150px" class="ar" scope="row">Country:</th>'
+ '<td>' +this.Country +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th width="150px" class="ar" scope="row">ZIP/PostalCode:</th>'
+ '<td>' +this.PostalCode +'</td>'
+ '</tr>'
+ '</table>';
}
catch(e){e.description}
return sTxt;
}//end of fDrawShipping prototype
return this;
};
function clsPayment(hsh)
{
this.OrderType      = "";
this.CCName         = "";
this.CCType         = "";
this.CCMonth        = "";
this.CCYear         = "";
this.CCExpires      = "";
this.CCNumber       = "";
this.Description    = "";
this.Explanation    = "";
this.PONumber       = "";
this.CCAuthCode="";
this.CCAvsCode="";
this.CCStatus="";
this.CCRefCode="";
this.CCTransID="";
this.CCErrorCode="";
this.CCErrorMessage="";
this.AssignToDealer = 0;
this.fPONumber  = function(n){if(n!=null){this.PONumber = n;} return this.PONumber;}
this.fCCNumber  = function(n){if(n!=null){this.CCNumber = n.replace(/[^\d]/g, '');} return this.CCNumber;}
this.fCCType    = function(){return this.CCType;}
this.fCCMonth   = function(){return this.CCMonth;}
this.fCCYear    = function(){return this.CCYear;}
this.fCCExpires = function()
{
var returnValue = ""
if(this.CCMonth !="" && this.CCYear !="")
{
if(String(this.CCMonth).length < 2)
this.CCMonth="0"+this.CCMonth;
if(String(this.CCYear).length < 2)
this.CCYear="0"+this.CCYear;
returnValue = this.fCCMonth() +"/" +this.fCCYear();
}
return returnValue;
}
this.fGetItem    = function(i){if(this[i])return this[i]; return "";}
for(var h in hsh)
{
switch(h)
{
default:
this[h] = hsh[h];
}
}
this.fModulus10=function()
{
// digits 0-9 doubled with nines cast out
var doubled = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9];
var d = null;
var digits = this.CCNumber.split('');
var alt = false;
var total = 0;
// alternate between summing the digits
// or the result of doubling the digits and
// casting out nines (see Luhn description)
while (digits.length)
{
d = Number(digits.pop());
total += (alt ? doubled[d] : d);
alt = !alt;
}
return total % 10 == 0;
}
this.fCheckCreditCard=function()
{
var aLength      = new Array();
var aPrefix      = new Array();
var bDateValid   = false;
var bLengthValid = false;
var bPrefixValid = false;
var bReturn      = false;
var ex           = null;
var month        = this.CCMonth;
var year         = this.CCYear;
var today        = new Date();
//object literal of acceptable credit cards
var hCard =
{
0 : {NAME : "Visa",       LENGTH : "13,16", PREFIXES : "4",              CHECKDIGIT : true}
,1 : {NAME : "MasterCard", LENGTH : "16",    PREFIXES : "51,52,53,54,55", CHECKDIGIT : true}
,2 : {NAME : "AMEX",       LENGTH : "15",    PREFIXES : "34,37",          CHECKDIGIT : true}
};
//set input date to the first of next month
year = (year.length == 2) ? "20" +year : year;
var expireDate = new Date((Number(month)+1)+"/01/"+year);
expireDate.setHours(23);
expireDate.setMinutes(59);
expireDate.setSeconds(59);
expireDate.setMilliseconds(999);
//subtract one day to get the last date/time
//the card will expire
expireDate.setDate(expireDate.getDate()-1)
//test to see if the expire date is greater than the date today
bDateValid = (expireDate >= today)? true : false;
if(bDateValid)
{
for(var c in hCard)
{
if(hCard[c].NAME.toLowerCase() == this.CCType.toLowerCase())
{
aLength = hCard[c].LENGTH.split(",");
aPrefix = hCard[c].PREFIXES.split(",");
}
}
for(var i=0; i<aLength.length; i++)
{
ex = new RegExp ("^" + aLength[i]);
if(ex.test(this.CCNumber.length))
bLengthValid = true;
}
}
//if the length is valid continue
if(bLengthValid)
{
for(var i=0; i<aPrefix.length; i++)
{
ex = new RegExp ("^" + aPrefix[i]);
if(ex.test(this.CCNumber))
bPrefixValid = true;
}
//if prefix is valid continue
//execute fModulus10 function.
if(bPrefixValid)
{
bReturn = this.fModulus10();
}
}
return bReturn;
}//end fCheckCreditCard function
this.fDrawPayment = function()
{
var sTxt = "";
var tmp = "";
try
{
if(this.OrderType=="CC")
{
//Build CC
sTxt = '<tr><th width="150px" class="ar" scope="row">Credit Card Name:</th><td>' +this.CCName +'</td></tr>'
+ '<tr><th width="150px" class="ar" scope="row">Credit Card Type:</th><td>' +this.fCCType() +'</td></tr>'
+ '<tr><th width="150px" class="ar" scope="row">Credit Card Number:</th><td>' +this.fCCNumber() +'</td></tr>'
+ '<tr><th width="150px" class="ar" scope="row">Credit Card Date:</th><td>' +this.fCCExpires() +'</td></tr>'
+ '';
}
else if(this.OrderType=="PO" && !fPageHandler().fDealer().fInternal())
{
//PO payment
sTxt = '<tr><th width="150px" class="ar" scope="row">PONumber:</th><td>' +this.PONumber +'</td></tr>'
}
else
{
//Other order type
var hOrderTypes=
{
"CC":"Sales Transaction"
,"PO":"Dealer Order"
,"OR":"Oracle Order"
,"DE":"Dealer Error"
,"RP":"Replacement"
,"PR":"Promotion"
,"GW":"Good Will"
,"TS":"Test"
,"IT":"Internal"
,"DM":"Demonstration"
}
sTxt = ''
+ '<tr><th width="150px" class="ar" scope="row">Order Type:</th><td>' +hOrderTypes[this.OrderType] +'</td></tr>'
+ '<tr><th width="150px" class="ar" scope="row">Dealer:</th><td>' +(this.AssignToDealer > 0?this.DealerName:'n/a') +'</td></tr>'
+ '<tr><th width="150px" class="ar" scope="row">PONumber:</th><td>' +this.PONumber +'</td></tr>'
+ '';
}
}
catch(e){e.description}
return ''
+ '<table width="100%" cellpadding=0 cellspacing=0 >'
+ '<tr><td class="dvGrayBar" colspan="2" >Payment&nbsp;Information</td>'
+ '</tr>'
+sTxt
+ '</table>';
}//end of fDrawPayment prototype
return this;
};
function clsCustomer(hsh)
{
this.CustID=0;
this.hDemographics = new clsDemographics();
this.hRegProducts = new clsRegProducts();
this.hShipping = new clsShipping();
this.hPayment = new clsPayment();
this.hCart = new clsCart();
for(var h in hsh)
{
switch(h)
{
case "hRegProducts":
case "hDemographics":
case "hShipping":
case "hPayment":
case "hCart":
eval("this[h] = new cls"+(h.substr(1))+"(hsh[h]);");
break;
case "hMaxProCart":
eval("this[h] = new clsCart(hsh[h]);");
break;
default:
this[h] = hsh[h];
}
}
this.fCart = function ()
{
if(this.hMaxProCart)
return this.hMaxProCart;
return this.hCart;
}
this.fGetActiveRegProduct = function (){return this.hRegProducts.fGetActiveProduct();}
this.fDemographics = function(){return this.hDemographics;}
this.fShipping = function (){return this.hShipping;}
this.fPayment = function (){return this.hPayment;}
return this;
};
function clsCart(hsh)
{
this.DealerID     = 0;
this.AccountID    = 0;
this.Freight      = 0.0;
this.TaxRate      = 0.0;
this.OrderType    = "";
this.PONumber     = "";
this.Explanation  = "";
this.PriceGroup   = "Retail";
this.AltEmail     = "";
this.LoadedWF     = 0;
this.hItems       = {};
this.aVouchers    = new Array();
if(hsh && typeof(hsh)=="object")
{
for(var h in hsh)
{
switch(h)
{
case "hItems":
for(var i in hsh[h])
eval("this[h][i] = new clsCartItem(hsh[h][i]);");
break;
default:
this[h]=hsh[h];
}
}
}
this.fPriceGroup=function(pg,elid)
{
//  alert("PriceGroup:"+pg)
if(pg != null)
{
this.PriceGroup=pg;
for(var i in this.hItems)
{
this.hItems[i].PriceGroup=pg;
}
}
if(elid)
this.fDraw(fGD(elid));
return this.PriceGroup;
}
this.fFindItem = function (pid)
{
return this.hItems[String(pid)];
}
this.fDelayedProcess = function()
{
for(var ci in this.hItems)
{
if(this.hItems[ci].fDelayedProcess())
{
return true;
}
}
return false;
}
this.fHasUpgrade = function()
{
for(var ci in this.hItems)
{
if(this.hItems[ci].fIsUpgrade())
{
return true;
}
}
return false;
}
this.fAddItem = function (){}
this.fRemoveItem = function (pid)
{
if(this.hItems[String(pid)]!=null)
delete this.hItems[String(pid)];
}
this.fToggle = function (el,hproduct)
{
var pid = el.getAttribute("productid");
var producttype = el.getAttribute("ProductType");
var cust=fPageHandler().fGetActiveCustomer();
var name=el.getAttribute("Name");
if(this.hItems[String(pid)]==null)
{
if(producttype == "ChartRegion" || producttype == "ChartUpdate")
{
if(name.indexOf("-") < 0 && this.LoadedWF==0)
{
this.LoadedWF=1;
//     alert(fPageHandler().hMiscItems["1262"]);
if(fPageHandler().hMiscItems["1262"])
this.fToggle({getAttribute:function(id){if(id=="productid") return 1262;if(id=="ProductType") return "MiscItem";if(id=="Name") return "World Folio DVD";}},
fPageHandler().hMiscItems["1262"])
}
}
if(producttype == "ChartRegion")
{
var passportregion = cust.fGetActiveRegProduct().fMapsToMAXPro(name);
if(passportregion)
{
if(hMappings[passportregion.RegionID].Used)
return false;
hMappings[passportregion.RegionID].fSetUsed();
}
}
if(hproduct==null)
{
hproduct={
ProductID:pid
,Name:name
,ElID:el.id
,ProductType:producttype
,Weight:el.getAttribute("Weight")||0
,Description:el.getAttribute("Description")
,Retail:el.getAttribute("Retail")
,RetailUpdate:el.getAttribute("RetailUpdate")
,Dealer:el.getAttribute("Dealer")
,DealerUpdate:el.getAttribute("DealerUpdate")
,Distributor:el.getAttribute("Distributor")
,DistributorUpdate:el.getAttribute("DistributorUpdate")
,VAD:el.getAttribute("VAD")
,VADUpdate:el.getAttribute("VADUpdate")
,TRX:el.getAttribute("TRX")
,TRXUpdate:el.getAttribute("TRXUpdate")
}
}
this.hItems[String(pid)] = new clsCartItem(hproduct);
}
else
{
if(producttype == "ChartRegion")
{
var passportregion = cust.fGetActiveRegProduct().fMapsToMAXPro(name);
if(passportregion)
hMappings[passportregion.RegionID].fClearUsed();
}
delete this.hItems[String(pid)];
}
return true;
}
this.fDrawItem     = function (){}
// this.fGetItem      = function(i){if(this[i])return this[i]; return null;}
this.fAltEmail     = function (v){if(v!=null)this.AltEmail=v; return this.AltEmail;}
this.fFreight      = function (v){if(v!=null)this.Freight=v; return this.Freight;}
this.fWeight       = function (){var c=0.0;for(var i in this.hItems)c+=parseFloat(this.hItems[i].fWeight());return c;}
this.fTaxAmount    = function (hship,dealer)
{
if(dealer && dealer.TaxExempt==1)
return this.TaxRate=0.0;
if(hship!=null)
{
this.TaxRate=0.0;
if(String(hship.Country).toUpperCase().substr(0,2)=="CA")
{
if(hTaxRates["CANADA"])
this.TaxRate = hTaxRates["CANADA"].Rate;
}
else if(hTaxRates[String(hship.Region).toUpperCase().substr(0,2)])
this.TaxRate = hTaxRates[String(hship.Region).toUpperCase().substr(0,2)].Rate;
}
return this.fSubTotal()*this.TaxRate;
}
this.fItemCount    = function (){var c=0;for(var i in this.hItems)c++;c+=this.aVouchers.length; return c;}
this.fSubTotal     = function (){var c=0.0;for(var i in this.hItems)c+=parseFloat(this.hItems[i].fPrice());return c;}
this.fTotal        = function (){var c=parseFloat(this.fSubTotal())+parseFloat(this.fTaxAmount())+parseFloat(this.fFreight());return c;}
this.fDealerID     = function (){return this.DealerID;}
this.fDealerAccountID = function (){return this.AccountID;}
this.fOrderType    = function (){if(this.Dealer==0) return ""; return this.OrderType;}
this.fPONumber     = function (){if(this.fOrderType() == "") return ""; return this.PONumber;}
this.fExplanation  = function (){if(this.fOrderType() == "") return ""; return this.Explanation;}
this.fFixFields    = function(p)
{
/*
p is the page which called this function
the cust is upgrading to MaxCharts the hMappings determines what can be upgraded
*/
for(var i in this.hItems)
{
try
{
if(this.hItems[i].ProductType=="ChartUpdate")
{
var el = document.getElementById(this.hItems[i].ElID);
if(el)
{
if(p=="Charts")
el.disabled=true;
else
el.checked = true;
}
el = document.getElementById("ckPID_"+i+"_RENT");
if(el)
el.disabled=true;
el=document.getElementById("ckPID_"+i+"_BUY");
if(el)
el.disabled=true;
}
else if(this.hItems[i].ElID != null)
document.getElementById(this.hItems[i].ElID).checked = true;
else
document.getElementById("ckPID_"+i).checked = true;
}
catch(e)
{
//    alert(i+":"+e.description);
}
}
}
this.fDraw = function (el)
{
var aTxt = [];
aTxt.push("<tr>"
+"<th class='btgry brgry bb' height=22 width='80' nowrap>Item#</th>"
+"<th class='btgry brgry bb al'>Remove</th>"
+"<th class='btgry brgry bb al'>Type</th>"
+"<th class='btgry brgry bb al'>Description</th>"
+"<th class='btgry brgry bb al'>Wt.</th>"
+"<th class='btgry brgry bb'>Price</th>"
+"</tr>");
var exchange = fPageHandler().fSite().fExchange(1.0,"USD",fPageHandler().fSite().Currency);
var dealer=fPageHandler().fDealer();
var cust=fPageHandler().fGetActiveCustomer();
var rp=cust.fGetActiveRegProduct();
var ChartCountDown=0; // rp.fRegionCount(); // Used for Region Upgrade promotion
var aChartUpgradeErrors= new Array();
if(dealer)
{
if(!dealer.fInternal())
{
this.PriceGroup=dealer.PriceGroup;
dealer=null;
}
}
for(var i in this.hItems)
{
this.hItems[i].PriceGroup=this.PriceGroup;
if(this.hItems[i].ProductType=='ProgramUpgrade')
aTxt.push(this.hItems[i].fDrawPS("<tr>"
+"<td class='btgry brgry vt ar'>[ProductID]</td>"
+"<td class='btgry brgry vt ac'><input type='button' value='Remove' type=button class='clsButton'  "
+" onmouseover='this.style.border=\"2px inset\";'"
+" onmouseout='this.style.border=\"2px outset\";'"
+" onclick='fPageHandler().fRemoveCartItem(\"[ProductID]\"); return fPageHandler().fOnSubmit(\"Cart\");' id='button'1 name='button'1>"
+"</td>"
+"<td class='btgry brgry vt'>[ProductType]</td>"
+"<td class='btgry brgry vt'>[Description]</td>"
+"<td class='btgry brgry vt'>"+(this.hItems[i].fWeight()||"&nbsp;")+"</td>"
+(dealer?
("<td class='ar btgry brgry vt'><input align=right size=10 onblur='fPageHandler().fCart().hItems[\""+i+"\"].OverRide=Number(String(this.value));' value='"+Number(this.hItems[i].fPrice()*exchange)+"'></td>")
:"<td class='ar btgry brgry vt'>"+Number(this.hItems[i].fPrice()*exchange).fFormatCurrency(2)+"</td>"
)
+"</tr>"
));
}
for(var i in this.hItems)
{
if(this.hItems[i].ProductType=='PlusPack')
aTxt.push(this.hItems[i].fDrawPS("<tr>"
+"<td class='btgry brgry vt ar'>[ProductID]</td>"
+"<td class='btgry brgry vt ac'><input type='button' value='Remove' type=button class='clsButton'  "
+" onmouseover='this.style.border=\"2px inset\";'"
+" onmouseout='this.style.border=\"2px outset\";'"
+" onclick='fPageHandler().fRemoveCartItem(\"[ProductID]\"); return fPageHandler().fOnSubmit(\"Cart\");' id='button'1 name='button'1>"
+"</td>"
+"<td class='btgry brgry vt'>[ProductType]</td>"
+"<td class='btgry brgry vt'>[Description]</td>"
+"<td class='btgry brgry vt'>"+(this.hItems[i].fWeight()||"&nbsp;")+"</td>"
+(dealer?
("<td class='ar btgry brgry vt'><input align=right size=10 onblur='fPageHandler().fCart().hItems[\""+i+"\"].OverRide=Number(String(this.value));' value='"+Number(this.hItems[i].fPrice()*exchange)+"' id=text1 name=text1></td>")
:"<td class='ar btgry brgry vt'>"+Number(this.hItems[i].fPrice()*exchange).fFormatCurrency(2)+"</td>"
)
+"</tr>"
));
}
for(var i in this.hItems)
{
var Price=this.hItems[i].fPrice();
if(this.hItems[i].ProductType=='ChartRegion' || this.hItems[i].ProductType=='ChartUpdate')
{
var passport=rp.fMapsToMAXPro(this.hItems[i].Name);
if(ChartCountDown > 0 && passport)
{
try
{
switch(parseInt(rp.fMember("Version")))
{
case 9:
this.hItems[i].OverRide=(Price=0.0);
break;
case 8: case 7: case 6: case 5:
for(var p in passport.hPermits)
{
if(parseInt(passport.hPermits[p].Folio)>=30)
{
this.hItems[i].OverRide=(Price=Math.ceil(this.hItems[i].fPrice(-1)*.5));
break;
}
else if(parseInt(passport.hPermits[p].Folio)>=19)
{
this.hItems[i].OverRide=(Price=Math.ceil(this.hItems[i].fPrice(-1)*.75));
break;
}
}
break;
}
}
catch(e){
aChartUpgradeErrors.push(i+":"+e.description+"\r\n"+fSerialize(this.hItems[i]));
}
ChartCountDown--;
}
aTxt.push(this.hItems[i].fDrawPS("<tr>"
+"<td class='btgry brgry vt ar'>[ProductID]</td>"
+"<td class='btgry brgry vt ac'><input type='button' value='Remove'  class='clsButton' "
+" onmouseover='this.style.border=\"2px inset\";'"
+" onmouseout='this.style.border=\"2px outset\";'"
+" onclick='fPageHandler().fRemoveCartItem(\"[ProductID]\"); return fPageHandler().fOnSubmit(\"Cart\");' id='button'1 name='button'1>"
+"</td>"
+"<td class='btgry brgry vt'>[ProductType]</td>"
+"<td class='btgry brgry vt'>[Description]</td>"
+"<td class='btgry brgry vt'>"+(this.hItems[i].fWeight()||"&nbsp;")+"</td>"
+(dealer?
("<td class='ar btgry brgry vt'><input align=right size=10 onblur='fPageHandler().fCart().hItems[\""+i+"\"].OverRide=Number(String(this.value));' value='"+Number(Price*exchange)+"'></td>")
:"<td class='ar btgry brgry vt'>"+Number(Price*exchange).fFormatCurrency(2)+"</td>"
)
+"</tr>"
));
}
}
if(aChartUpgradeErrors.length)
{
alert(""
+"There was a problem determining your Raster Upgrade Price."
+"\r\nWe are on hand to assist you with your upgrade."
+"\r\nPlease call our Sales Office for additional assistance."
+"\r\n\r\nPh:"+0
+"\r\nEmail:"+"Email"
+"\r\n\r\nError:"+aChartUpgradeErrors.join("\r\n"));
}
for(var i in this.hItems)
{
if(this.hItems[i].ProductType=='MiscItem')
aTxt.push(this.hItems[i].fDrawPS("<tr>"
+"<td class='btgry brgry vt ar'>[ProductID]</td>"
+"<td class='btgry brgry vt ac'><input type='button' value='Remove'  class='clsButton' "
+" onmouseover='this.style.border=\"2px inset\";'"
+" onmouseout='this.style.border=\"2px outset\";'"
+" onclick='fPageHandler().fRemoveCartItem(\"[ProductID]\"); return fPageHandler().fOnSubmit(\"Cart\");' id='button'1 name='button'1>"
+"</td>"
+"<td class='btgry brgry vt'>[ProductType]</td>"
+"<td class='btgry brgry vt'>[Description]</td>"
+"<td class='btgry brgry vt'>"+(this.hItems[i].fWeight()||"&nbsp;")+"</td>"
+(dealer?
("<td class='ar btgry brgry vt'><input align=right size=10 onblur='fPageHandler().fCart().hItems[\""+i+"\"].OverRide=Number(String(this.value));' value='"+Number(this.hItems[i].fPrice()*exchange).fFormatCurrency(2)+"' id=text1 name=text1></td>")
:"<td class='ar btgry brgry vt'>"+Number(this.hItems[i].fPrice()*exchange).fFormatCurrency(2)+"</td>"
)
+"</tr>"
));
}
for(var i in this.aVouchers)
{
with(this.aVouchers[i])
{
aTxt.push("<tr>"
+"<td class='btgry brgry vt ar'>"+ProductID+"</td>"
+"<td class='btgry brgry vt ac'><input type='button' value='Remove' type=button class='clsButton'  "
+" onmouseover='this.style.border=\"2px inset\";'"
+" onmouseout='this.style.border=\"2px outset\";'"
+" onclick='fPageHandler().fCart().fRemoveVoucher("+i+"); return fPageHandler().fOnSubmit(\"Cart\");'>"
+"</td>"
+"<td class='btgry brgry vt'>Voucher:"+Key+"</td>"
+"<td class='btgry brgry vt'>"+Description+"</td>"
+"<td class='btgry brgry vt'>&nbsp;</td>"
+"<td class='ar btgry brgry vt'>No Charge</td>"
+"</tr>"
);
}
}
aTxt.push("<tr>"
+"<th class='bt brgry bb' height=22 width='10'>"+this.fItemCount()+"&nbsp;items</th>"
+"<th class='bt brgry ar bb'>&nbsp;</th>"
+"<th class='bt brgry ar bb'>&nbsp;</th>"
+"<th class='bt brgry ar bb'>SubTotal</th>"
+"<th class='bt brgry ar bb'>"+Number(this.fWeight()).toFixed(2)+"</th>"
+"<th class='bt brgry ar bb'>$"+Number(this.fSubTotal()*exchange).fFormatCurrency(2)+"</th>"
+"</tr>");
if(el)
{
el.innerHTML="<table class='blgry bbgry vt' width='100%' cellpadding=0 cellspacing=0>"+aTxt.join("")+"</table>";
return el.innerHTML;
}
return "<table class='blgry bbgry vt' width='100%' cellpadding=0 cellspacing=0>"+aTxt.join("")+"</table>";
}
this.fDrawSummaryHeader = function()
{
var exchange = fPageHandler().fSite().fExchange(1.0,"USD",fPageHandler().fSite().Currency);
return ""
+"&nbsp;&nbsp;Items&nbsp;:"+this.fItemCount()
+"&nbsp;&nbsp;SubTotal:&nbsp;$"+Number(this.fSubTotal()*exchange).fFormatCurrency(2)
+"&nbsp;&nbsp;Weight:&nbsp;"+Number(this.fWeight()).toFixed(2)
+'&nbsp;&nbsp;Freight:<span id="tdFreight">&nbsp;'+Number(this.fFreightAmount(fPageHandler().fGetActiveCustomer())*exchange).fFormatCurrency(2) +'</span>'
+'&nbsp;&nbsp;Tax&nbsp;:<span id="tdTaxAmount">&nbsp;' +Number(this.fTaxAmount()*exchange).fFormatCurrency(2) +'</span>'
+'&nbsp;&nbsp;Total:&nbsp;$<span id="tdTotal">&nbsp;'+Number(this.fTotal()*exchange).fFormatCurrency(2) +'</span>';
}
this.fDrawCartSummary = function()
{
var sTxt = "";
var exchange = fPageHandler().fSite().fExchange(1.0,"USD",fPageHandler().fSite().Currency);
try
{
sTxt = '<table cellpadding=0 cellspacing=3 style="border:1px solid #afafaf;width:240px;padding:3px;"><tr>'
+ '<td class="dvGrayBar" colspan="2" width="100%" ><a href="#" title="View the Cart" onclick="return fPageHandler().fOnSubmit(\'Cart\');">Cart&nbsp;Summary</a></td>'
+ '</tr>'
+ '<tr>'
+ '<th class="ar" scope="row">Number Of Items&nbsp;:</th>'
+ '<td class="ar">' +this.fItemCount() +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th class="ar" scope="row">SubTotal&nbsp;:</th>'
+ '<td class="ar">' +Number(this.fSubTotal()*exchange).fFormatCurrency(2) +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th class="ar" scope="row">Weight&nbsp;:</th>'
+ '<td class="ar">' +this.fWeight() +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th class="ar" scope="row">Freight&nbsp;:</th>'
+ '<td  class="ar" id="tdFreight">' +Number(this.fFreightAmount(fPageHandler().fGetActiveCustomer())*exchange).fFormatCurrency(2) +'</td>'
+ '</tr>'
+ '<tr><th class="ar" scope="row">Tax&nbsp;:</th>'
+ '<td  class="ar" id="tdTaxAmount">' +Number(this.fTaxAmount()*exchange).fFormatCurrency(2) +'</td>'
+ '</tr>'
+ '<tr>'
+ '<th class="ar" scope="row">Total&nbsp;:</th>'
+ '<td class="ar" id=tdTotal>' +Number(this.fTotal()*exchange).fFormatCurrency(2) +'</td>'
+ '</tr>'
+ '</table>';
}
catch(e){sTxt= e.description+"<BR>"+sTxt}
return sTxt;
}//end of fDrawReadOnlyCart prototype
return this;
};
function clsCartItem(hsh)
{
var bProcessed=false;
this.ProductID=0;
this.Name='';
//this.hProduct ={};
this.OverRide   = null;
this.ProductType="";
this.PriceGroup ="Retail";
this.Retail     = 0.0;
this.Weight     = 0.0;
this.Freight    = 0.0;
this.Quantity   = 1;
this.fCalcPrice=null;
this.fName=function (v){if(v != null)this.Name = v; return this.Name;}
this.fDescription=function (v){if(v != null) this.Description = v; if(this.Description)return this.Description; return "";}
this.fWeight=function (v){if(v != null)this.Weight = v; return this.Weight?(parseFloat(this.Weight)*this.Quantity):0.0;}
this.fFreight=function (v){if(v != null)this.Freight = v; return this.Freight?(parseFloat(this.Freight)*this.Quantity):0.0;}
this.fQuantity=function (v){if(v != null)this.Quantity = v; return this.Quantity?parseFloat(this.Quantity):0.0;}
this.fTaxable=function (){return this.fWeight() > 0?1:0;}
this.fEach=function (v){if(v != null)this.Retail = v; return parseFloat(this.Retail);}
this.fPrice=function (v)
{
var hPGs={"Dealer":"Retail","Distributor":"Dealer","VAD":"Distributor","TRX":"VAD"};
if(v != null && v > 0)
this.Retail = v;
if(this.OverRide!=null && this.OverRide!="null"  && (v==null || v > -1))
return this.OverRide;
if(this.ProductType.match(/update/i))
{
//   alert("ProductType:"+this.ProductType+"\r\nPriceGroup:"+this.PriceGroup+"\r\nValue"+this[this.PriceGroup+"Update"])
if(this[this.PriceGroup+"Update"]!=null)
return parseFloat(this[this.PriceGroup+"Update"]*this.Quantity);
}
if(this[this.PriceGroup]!=null)
{
if(this[this.PriceGroup] < 0)
{
for(var pg=this.PriceGroup;hPGs[pg] && this[pg] < 0;)
{
pg=hPGs[pg];
}
this.PriceGroup=pg;
}
return parseFloat(this[this.PriceGroup]*this.Quantity);
}
return parseFloat(this.Retail)*this.Quantity;
}
this.fDrawPS=_fDrawPS;
this.fDelayedProcess = function()
{
// Currently true for all upgrades
// Change to evaluate Product upgrade partnumber set
return (this.ProductType == "ProgramUpgrade");
}
this.fIsUpgrade = function()
{
return (this.ProductType == "ProgramUpgrade");
}
this.fProcessed = function(v)
{
if(v != null)
bProcessed=v;
return bProcessed;
}
this.fDraw=function ()
{
var txt = "";
return txt;
}
this.fMSRP=function (){}
if(hsh && typeof(hsh)=="object")
{
for(var h in hsh)
{
switch(h)
{
case "hProduct":
eval("this[h] = new cls"+(h.substr(1))+"(hsh[h]);");
break;
default:
this[h]=hsh[h];
}
}
}
return this;
};
function clsDisclaimer()
{
return this;
};
function clsDiscount()
{
return this;
};
function clsFAQ()
{
return this;
};
function clsFAQs()
{
return this;
};
function clsInstructions()
{
return this;
};
function clsMenu()
{
return this;
};
function clsPermit(hsh)
{
this.SerialNumber="";
this.iKey="";
this.Permit="";
this.RegionID="";
this.LicType=1; // 1 - Purchase, 2 - Rental
this.Folio=0;
this.OrderID=0;
this.DetailID=0;
this.Date="";
for(var h in hsh)
{
this[h] = hsh[h];
}
this.fDrawPS = _fDrawPS;
return this;
};
function clsUnLock(hsh)
{
this.SerialNumber = "";
this.iKey         = "";
this.Permit       = "";
this.UpgradeID    = "";
this.Type         = "";
this.Name         = "";
this.ProductID    = 0;
for(var h in hsh)
{
this[h] = hsh[h];
}
return this;
};
function clsProduct(hsh)
{
this.ProductID=0;
this.SKU='';
this.PartNumber='';
this.Name='';
this.ProductType='';
this.Description='';
this.Image='';
this.Inventory=1;
this.Retail=0.0;
this.Dealer=0.0;
this.Distributor=0.0;
this.RetailUpdate=0.0;
this.DealerUpdate=0.0;
this.DistributorUpdate=0.0;
this.Weight=0.0;
this.Freight=0.0;
this.fCalcPrice=null;
this.fWeight=function (v){if(v != null)this.Weight = v; return this.Weight;}
this.fFreight=function (v){if(v != null)this.Freight = v; return this.Freight;}
this.fInventory=function (v){if(v != null)this.Inventory = v; return this.Inventory;}
this.fPrice=function (v){if(v != null)this.Retail = v; return this.Retail;}
this.fGetPrice=function (hsh){return this.Retail;}
this.fMSRP=function (){}
if(hsh && typeof(hsh)=="object")
{
for(var h in hsh)
this[h]=hsh[h];
}
return this;
};
function clsBOM()
{
return this;
};
function clsMapping(passport,mega,wide)
{
this.Passport=passport;
this.AllWide=String(wide).replace(/undefined/,"").indexOf("&")>0;
this.AllMega=String(mega).replace(/undefined/,"").indexOf("&")>0;
this.aWide=String(wide).replace(/undefined/,"").fMakeArray(this);
this.aMega=String(mega).replace(/undefined/,"").fMakeArray(this);
this.Used=0;
this.fToString = function (){
return 'new clsMapping("'+this.Passport+'","'
+this.aMega.join(this.AllMega?"&":",")+'","'
+this.aWide.join(this.AllWide?"&":",")+'")';
}
this.fSetUsed=function()
{
if((this.aWide.length>0 && this.AllWide < 0)||(this.aMega.length>0 && this.AllMega < 0))
this.Used=1;
}
this.fClearUsed=function()
{
if((this.aWide.length>0 && this.AllWide < 0)||(this.aMega.length>0 && this.AllMega < 0))
this.Used=0;
}
this.fMapsTo = function ()
{
var promo = "";//"<br><span CLASS='txtDisclaimer' style='color:#ff0000;'> Promotional Pricing for this region is available to you as an owner of Passport Chart Region "+passport+"</span></font>";
var aTxt = [];
if(this.aWide.length==0)
{
for(var m=0;m<this.aMega.length;m++)
aTxt.push("<a href='#' helpkey='UpdateMap' passport='"+this.Passport+"' maxpro='"+this.aMega[m]+"' onclick='return fPageHandler().fHelpHandler(this);'>"+this.aMega[m]+"</a>");
return "MegaWide :"+aTxt.join(this.AllMega?" and ":" or ")+promo;
}
if(this.aMega.length==0)
{
for(var m=0;m<this.aWide.length;m++)
aTxt.push("<a href='#' helpkey='UpdateMap' passport='"+this.Passport+"' maxpro='"+this.aWide[m]+"' onclick='return fPageHandler().fHelpHandler(this);'>"+this.aWide[m]+"</a>");
return "Wide :"+aTxt.join(this.AllWide?" and ":" or ")+promo;
}
for(var m=0;m<this.aMega.length;m++)
aTxt.push("<a href='#' helpkey='UpdateMap' passport='"+this.Passport+"' maxpro='"+this.aMega[m]+"' onclick='return fPageHandler().fHelpHandler(this);'>"+this.aMega[m]+"</a>")+promo;
var aTxt2 = [];
for(var m=0;m<this.aWide.length;m++)
aTxt2.push("<a href='#' helpkey='UpdateMap' passport='"+this.Passport+"' maxpro='"+this.aWide[m]+"' onclick='return fPageHandler().fHelpHandler(this);'>"+this.aWide[m]+"</a>");
return "Wide :"+aTxt2.join(this.AllMega?" and ":" or ")+ " OR MegaWide :"+aTxt.join(this.AllWide?" and ":" or ")+promo;
}
this.fMapsFrom = function (s)
{
if(this.aWide.length>0)
{
for(var i=0;i<this.aWide.length;i++)
{
if(s==this.aWide[i])
return this.Passport;
}
}
if(this.aMega.length>0)
{
for(var i=0;i<this.aMega.length;i++)
{
if(s==this.aMega[i])
return this.Passport;
}
}
return null;
}
return this;
};
clsMapping.prototype.fPreProcess = function(s){return String(s).replace(/ /g,"").replace(/\&/g,",");};
function clsRegion(hsh)
{
this.Region="";
this.RegionID="";
this.ProductID="";
this.TransasCharts=0;
this.hPermits = {};
for(var h in hsh)
{
switch(h)
{
case "hPermits":
for(var rp in hsh[h])
eval("this[h][rp] = new clsPermit(hsh[h][rp]);");
break;
default:
this[h] = hsh[h];
}
}
this.fDrawPS = function(ps)
{
var aTxt = [];
for(var t in this)
{
if(ps.indexOf("["+t+"]") >= 0)
{
if(t=="Region") continue;
var re=new RegExp("\\["+t+"\\]","ig");
re.global="g";
if(t=="RegionID")
ps = ps.replace(re,(this.Region!=this.RegionID)?(this[t].replace(/^M\-/g,"")+"("+this.Region+")"):this[t].replace(/^M\-/g,""));
else
ps = ps.replace(re,(t=="RegionID" && this.Region!=this.RegionID)?(this[t]+"("+this.Region+")"):this[t]);
for(var p in this.hPermits)
{
aTxt[aTxt.length] = this.hPermits[p].fDrawPS(ps);
//    if(PH.hPreferences.fMember("AllPermits")) continue;
break;
}
}
}
return aTxt.join("");
}
return this;
};
function clsRegProduct(hsh)
{
this.RegID=0;
this.CustID=0;
this.RegDate = new Date("1/1/1900");
this.ProductID=0;
this.ProductName="";
this.Version=0.0;
this.SerialNumber="";
this.Counter=0;
this.Prefix="0086";
this.UsedOn=""
this.MarketSegment="";
this.VesselName="";
this.Product="";
this.Type="COM";
this.SubType="";
this.Use="";
this.Class="REC";
this.SubClass="JM";
this.hRegions = {};
this.hUnLocks = {};
for(var h in hsh)
{
switch(h)
{
case "hRegions":
for(var rp in hsh[h])
{
eval("this[h][rp] = new clsRegion(hsh[h][rp]);");
}
break;
default:
this[h] = hsh[h];
}
}
this.fProductName = function(){if(this.SubClass=="NS")return "NorthStar "+this.SubType;if(this.SubClass=="SR")return "SIMRAD "+this.SubType;return this.ProductName;}
this.fUnlockCount = function(){var c = 0;for(var r in this.hUnLocks)c++; return c;}
this.fRegionCount = function(){var c = 0;for(var r in this.hRegions)c++; return c;}
this.fMapsToMAXPro = function(mp){for(var r in this.hRegions){if(hMappings[r] && hMappings[r].fMapsFrom(mp)) return this.hRegions[r];} return null;}
this.fMember=_fMember;
return this;
};
function clsRegProducts(hsh)
{
this.Active = "";
this.hChildren = {};
for(var h in hsh)
{
switch(h)
{
case "hChildren":
for(var rp in hsh[h])
{
eval("this[h][rp] = new clsRegProduct(hsh[h][rp]);");
}
break;
default:
this[h] = hsh[h];
}
}
this.fActive = function (a)
{
if(a != null) this.Active=a; return this.Active;
}
this.fGetActiveProduct = function ()
{
for(var h in this.hChildren)
{
//alert("FIRST:"+h)
if(this.Active=="" || this.Active==h)
return this.hChildren[this.Active=h];
}
for(var h in this.hChildren)
{
//alert("SECOND:"+h)
return this.hChildren[this.Active=h];
}
return this.hChildren["new"] = new clsRegProduct();
}
return this;
};
function clsCookie()
{
var Name="";
var SerialNumber="";
var CookieName="JM_STORE";
var Site="";
var Branding="";
var Expire=new Date("12/12/2100").toGMTString();
var Domain="www.nobeltec.com";
this.fName = function(name){if(name != null)Name=name;return Name};
this.fSerialNumber = function(serialnumber){if(serialnumber != null)SerialNumber=String(serialnumber);return SerialNumber};
this.fSite = function(site){if(site != null)Site=String(site);return Site};
this.fBranding = function(branding){if(branding != null)Branding=String(branding);return Branding};
this.fExists = function(){return Name==""?false:true;}
this.fDraw = function(elid)
{
try
{
if(this.fExists())
{
document.getElementById(elid).style.display="";
try{document.getElementById("SerialNumber").value = SerialNumber;}catch(ee){}
document.getElementById(elid).innerHTML= Name+', you last logged on with the following serial number: '
+SerialNumber.replace(/\-/g,"&minus;");
}
else
document.getElementById(elid).style.display="none";
}catch(e){}
}//end of fDraw function
this.fLoad = function (hsh)
{
if(!this.fExists())
{
if(hsh && typeof(hsh)=="hCookie")
{
for(var h in hsh)
{
this[h]=hsh[h];
}
}
try
{
Name = this.fGetCrumb(CookieName, "Name");
Name = (Name == null)?"":Name;
SerialNumber = this.fGetCrumb(CookieName, "SerialNumber");
SerialNumber = (SerialNumber == null)?"":SerialNumber;
Branding = this.fGetCrumb(CookieName, "Branding");
Branding = (Branding == null)?"":Branding;
Site = this.fGetCrumb(CookieName, "Site");
Site = (Site == null)?"":Site;
}catch(e){}
}
}//end of fLoad function
this.fSave = function (hsh)
{
if(hsh && typeof(hsh)=="hCookie")
{
for(var h in hsh)
{
this[h]=hsh[h];
}
}
try
{
this.fSetCrumb(CookieName, "Name",this.fName());
this.fSetCrumb(CookieName, "SerialNumber", this.fSerialNumber());
this.fSetCrumb(CookieName, "Branding", this.fBranding());
this.fSetCrumb(CookieName, "Site", this.fSite());
}catch(e){Response.Write(e.description());}
}//end of fSave function
// Use this function to retrieve a cookie.
this.fGetCookie = function (name)
{
var bReturn = null;
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0)
{
begin = dc.indexOf(cname);
if (begin != -1)
{
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
bReturn = unescape(dc.substring(begin, end));
}
}
return bReturn;
}//end of fGetCookie function
// Use this function to save a cookie.
this.fSetCookie = function (name, value, expires)
{
document.cookie = name + "=" + escape(value) + "; "//domain=" +Domain
+ ((expires == null) ? "expires=" + Expire : "; expires=" + expires);
}//end of fSetCookie function
// Use this function to delete a cookie.
this.fDelCookie = function (name)
{
var expire = new Date("07/21/1969").toGMTString();
document.cookie = name + "=; expires=" + expire +  "; ";//domain=" +Domain;
}//end of fDelCookie function
// Use this function to retrieve a Crumb inside a cookie.
this.fGetCrumb = function (cookie, name)
{
var bReturn = null;
var cn = name + '=';
var dc = this.fGetCookie(cookie);
if (dc != null)
{
var start = dc.indexOf(cn);
if (start != -1)
{
start += cn.length;
var end = dc.indexOf(':', start);
if (end != -1) bReturn = unescape(dc.substring(start, end));
}
}
return bReturn;
}//end of fGetCrumb function
//Use this function to get save a Crumb inside a cookie.
this.fSetCrumb = function (cookie, name, value)
{
var dc = this.fGetCookie(cookie);
var cc = this.fGetCrumb(cookie, name);
var exp = Expire;
var cn = name + '=';
if (cc != null)
{
var start = dc.indexOf(cn);
if (start != -1)
{
var end = dc.indexOf(':', start);
this.fSetCookie(cookie, dc.substring(0, start) + cn + value + ':' + dc.substring(end + 1, dc.length), exp);
}
}
else
{
if (dc != null) dc += cn + value + ':';
else dc = cn + value + ':';
this.fSetCookie(cookie, dc, exp);
}
}//end of fSetCrumb function
// Use this function to delete a Crumb inside a cookie.
this.fDelCrumb = function (cookie, name)
{
var dc = this.fGetCookie(cookie);
var cc = this.fGetCrumb(cookie, name);
var cn = name + '=';
if (cc != null)
{
var start = dc.indexOf(cn);
var end = dc.indexOf(':', start);
this.fSetCookie(cookie, dc.substring(0, start) + dc.substring(end + 1, dc.length), exp);
}
}//end of fDelCrumb function
};
function clsNavigator(hsh)
{
this.ID = "";
this.Text = "";
this.bIsOpen = 0;
this.bKeepOpen = 0;
this.pParent = 0;
this.pNext = 0;
this.pChildren = 0;
this.fAdd=function(hsh)
{
try
{
if(this.ID.length==hsh.ID.length)
{
if(this.ID > hsh.ID)
{ // 'on return replace this with n
var n = new clsNavigator(hsh);
n.pParent = this.pParent;
n.pNext = this;
return n;
}
if(this.ID < hsh.ID)
{
if(this.pNext)
this.pNext = this.pNext.fAdd(hsh);
else
{
this.pNext = new clsNavigator(hsh);
this.pNext.pParent = this.pParent;
}
}
}
else if(this.ID==hsh.ID.substr(0,this.ID.length))
{
if(this.pChildren)
{
this.pChildren = this.pChildren.fAdd(hsh);
}
else
{
this.pChildren=new clsNavigator(hsh);
this.pChildren.pParent=this;
}
}
else
this.pNext.fAdd(hsh);
}
catch(e){}
return this;
}
/* Client Prototypes */
/**
* fDraw - Draws the chart directory
* If el has fDraw - send to el.fDraw
* @author Richard Taylor-Kenny
* date:
*
*/
this.fDraw = function (el)
{
if(el && el.fDraw)
return el.fDraw(this);
var aTxt = [];
aTxt[aTxt.length] = "<li id='liNav_"+this.ID+"' class='liNavItem' "
+"><a href='#' onclick='fPageHandler().fNavigator().f"+(this.pChildren?"Toggle":"Toggle")+"(\""+this.ID+"\");return false;'"+">"+this.Text+"</a></li>";
if(this.pChildren)
{
if(this.bIsOpen==1)
aTxt[aTxt.length] = "<div class='Nav' id='dvNav_"+this.ID+"' >"+this.pChildren.fDraw()+"</div>";
else
aTxt[aTxt.length] = "<div class='Nav' id='dvNav_"+this.ID+"' style='display:none;'></div>";
}
if(this.pNext)
aTxt[aTxt.length] = this.pNext.fDraw();
return aTxt.join("");
}
/**
* fOpen - Finds and Opens the node id
* @author Richard Taylor-Kenny
* date:
*
*/
this.fOpen = function (id)
{
if(this.ID==id)
{
if(this.bIsOpen != 1)
{
if(this.pChildren)
{
this.bIsOpen = 1;
var el = document.getElementById("dvNav_"+this.ID);
if(el)
{
el.style.display="";
el.innerHTML = this.pChildren.fDraw();
}
}
}
else
{
this.bIsOpen = 0;
try{document.getElementById("dvNav_"+this.ID).style.display="none";}catch(e){};
}
return this;
}
if(this.pChildren)
{
var p = this.pChildren.fOpen(id);
if(p)
return p;
}
if(this.pNext)
return this.pNext.fOpen(id);
return null;
}
this.fFirstOpen = function ()
{
if(this.bIsOpen==1)
{
if(this.pChildren && this.pChildren.fFirstOpen())
return this.pChildren.fFirstOpen();
return this;
}
if(this.pNext && this.pNext.fFirstOpen())
return this.pNext.fFirstOpen();
return null;
}
/**
* fToggle - Finds and Toggles the node id
* @author Richard Taylor-Kenny
* date:
*
*/
this.fToggle = function (id)
{
if(this.ID==id)
{
if(this.bIsOpen == 1)
return this.fClose(id);
return this.fOpen(id);
}
if(this.pChildren)
{
var p = this.pChildren.fToggle(id)
if(p)
return p;
}
if(this.pNext)
{
return this.pNext.fToggle(id);
}
return null;
}
/**
* fClose - Finds and Closes the node id
* @author Richard Taylor-Kenny
* date:
*
*/
this.fClose = function (id)
{
if(this.ID==id)
{
if(this.bIsOpen == 1)
{
this.bIsOpen = 0;
var el = document.getElementById("dvNav_"+this.ID);
if(el)
el.style.display="none";
//  try{document.getElementById("liNav_"+this.ID).className="";}catch(e){};
}
return this;
}
if(this.pChildren)
{
var p=this.pChildren.fOpen(id);
if(p)
return p;
}
if(this.pNext)
return this.pNext.fOpen(id);
return null;
}
for(var h in hsh)
{
if(h == "pNext")
this[h] = new clsNavigator(hsh[h]);
else if(h == "pChildren")
this[h] = new clsNavigator(hsh[h]);
else
this[h] = hsh[h];
}
return this;
};
function clsRootNavigator(hsh)
{
this.CurrentEdition=34; // Action item : get the current edition for the data set
this.LatestEdition=34; // Action item : get the latest edition for the data set
this.clsNavigator = clsNavigator;
this.clsNavigator(hsh);
this.fToggle=function (id)
{
var p = this.pChildren.fToggle(id);
this.fDrawCharts(p);
}
this.fOpen=function (id)
{
var p = this.pChildren.fOpen(id);
this.fDrawCharts(p);
}
this.fDraw=function (el)
{
return this.pChildren.fDraw(el);
}
return this;
};
function clsPassportNavigator(hsh)
{
this.clsRootNavigator = clsRootNavigator;
this.clsRootNavigator(hsh);
this.fLoadDirectory();
return this;
};
function clsMaxProNavigator(hsh)
{
this.clsRootNavigator = clsRootNavigator;
this.clsRootNavigator(hsh);
this.fLoadDirectory();
return this;
};
function clsPageHandler(hsh)
{
var hCookie = new clsCookie();
this.hSite = new clsSite();
this.hMenu = new clsMenu();
this.hBusinessUnit = new clsBusinessUnit();
this.hProducts = {};
this.hOperator = new clsOperator();
this.aCustomers = [new clsCustomer()];
this.afResize = new Array();
var Requestor="";
var Receiver="";
var hHandlers =
{
Login:{ID:"Login",fcallback:fCallBack,url:"pages/Login.asp"}
,Profile:{ID:"Profile",fcallback:fCallBack,url:"pages/Profile.asp"}
,Charts:{ID:"Charts",fcallback:fCallBack,url:"pages/Browse.asp"}
,Vouchers:{ID:"Vouchers",fcallback:fCallBack,url:"pages/Vouchers.asp"}
,Customer:{ID:"Customer",fcallback:fCallBack,url:"pages/Customer.asp"}
,Dealers:{ID:"Dealers",fcallback:fCallBack,url:"pages/Dealers.asp"}
,MiscItems:{ID:"Cart",fcallback:fCallBack,url:"pages/MiscItems.asp"}
,Cart:{ID:"Cart",fcallback:fCallBack,url:"pages/Cart.asp"}
,Receipt:{ID:"Receipt",fcallback:fCallBack,url:"pages/Receipt.asp"}
,Contact:{ID:"Contact",fcallback:fCallBack,url:"pages/contact.asp"}
,Privacy:{ID:"Privacy",fcallback:fCallBack,url:"pages/privacy.asp"}
,FAQs:{ID:"FAQs",fcallback:fCallBack,url:"pages/FAQs.asp"}
,HowToUse:{ID:"HowToUse",fcallback:fCallBack,url:"pages/howtouse.asp"}
,NewsLetter:{ID:"NewsLetter",fcallback:fCallBack,url:"pages/NewsLetter.asp"}
,_Estimates:{ID:"_Estimates",fcallback:fCallBack,url:"specifications/estimates.asp"}
,_UseCases:{ID:"_UseCases",fcallback:fCallBack,url:"specifications/UseCases.asp"}
}
this.fCookie=function (){return hCookie;}
this.fAssignRequestor=function (obj){Requestor=obj;}
this.fAssignReceiver=function (obj){Receiver=obj;}
this.fHandler=function (handler,obj){if(obj){hHandlers[handler]=obj;} return hHandlers[handler];}
this.fDeleteHandler    = function(handler){delete hHandlers[handler];}
this.fGetActiveCustomer =function(){return this.aCustomers[0];}
this.fBranding         = function (v){return this.hSite.fBranding(v);}
this.fSite             = function (){return this.hSite;}
this.fDataSet          = function (v){return this.hSite.fDataSet(v);}
this.fDealer           = function (v){return this.hSite.fDealer(v);}
if(hsh != null && typeof(hsh)=="object")
{
for(var h in hsh)
{
if(h == "hSite")
this[h]= new clsSite(hsh[h]);
else if(h == "hCookie")
this[h]= new clsCookie(hsh[h]);
else if(h == "hBusinessUnit")
this[h]= new clsBusinessUnit(hsh[h]);
else if(h == "hOperator")
this[h]= new clsOperator(hsh[h]);
else
this[h]=hsh[h];
}
}
return this;
};
function clsValidate()
{
//CONSTANT VARIABLES
this.DIGITS = "0123456789";
this.LWR = 'abcdefghijklmnopqrstuvwxyz';
this.UPR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
this.SPACE = " ";
this.WHITESPACE = " \t\n\r";
this.PHONEPATTERN = "()-+ ";
this.POSTALPATTERN = "-";
this.EMAILPATTERN = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;
this.NAMEPATTERN = this.DIGITS+this.LWR+this.UPR+this.SPACE+".\\#-/`'";
this.ADDRESSPATTERN = this.DIGITS+this.LWR+this.UPR+this.SPACE+"\\-/`',:";
this.aTxt = new Array();
this.aInvalid = new Array();
//common tests for validation
this.fIsWhitespace=function(s)
{
try
{
var i;
if(this.fIsEmpty(s)) return true;
for(i = 0; i < s.length; i++)
{
//check that current character isn't whitespace.
var c = s.charAt(i);
if(this.WHITESPACE.indexOf(c) == -1) return false;
}
return true;
}
catch(e){return false;}
}//end fIsWhitespace function
this.fIsValid=function(s,delimiter)
{
this.aInvalid = new Array();
try
{
if(this.fIsWhitespace(s)) return false;
for(i=0; i<s.length; i++)
{
if(delimiter.indexOf(s.charAt(i),0) == -1)
this.aInvalid.push(s.charAt(i));
}
if(this.aInvalid.length > 0)
{
return false;
}
return true;
}
catch(e){return false;}
}//end fIsValid function
this.fIsNumeric=function(s) {return this.fIsValid(s,DIGITS);}
this.fIsPhone=function(s) {return this.fIsValid(s,this.DIGITS+this.PHONEPATTERN);}
this.fIsPostalCode=function(s) {return this.fIsValid(s.replace(/ /g,""),this.DIGITS+this.POSTALPATTERN+this.SPACE);}
this.fIsLower=function(s) {return this.fIsValid(s,this.LWR);}
this.fIsUpper=function(s) {return this.fIsValid(s,this.UPR);}
this.fIsAlpha=function(s) {return this.fIsValid(s,this.LWR+this.UPR+this.SPACE);}
this.fIsAlphanum=function(s) {return this.fIsValid(s,this.LWR+this.UPR+this.DIGITS+this.SPACE);}
this.fIsName=function(s) {return this.fIsValid(s,this.NAMEPATTERN);}
this.fIsCompany=function(s) {return this.fIsValid(s,this.NAMEPATTERN+"&,");}
this.fIsStreetAddress=function(s) {return this.fIsValid(s,this.LWR+this.UPR+this.DIGITS+this.ADDRESSPATTERN);}
this.fIsEmailAddress=function(s) {return this.EMAILPATTERN.test(s);}
this.fIsEmpty=function(s) {return ((s == null) || (s.length == 0))}
this.fSetErrorMessage=function(s) {this.aTxt.push(s); if(this.aInvalid.length > 0){this.aTxt.push("Remove :<b><u>"+this.aInvalid.join("").replace(/ /,"[space]")+"</u></b>");this.aInvalid=[];}}
this.fGetErrorMessage=function() {return this.aTxt;}
this.fClearErrorMessage=function() {this.aTxt=[];}
return this;
};
/**
 * Class clsPageHandler Client Prototypes
 * 
 * @author Richard Taylor-Kenny
 * @date May 2007
 * 
 */

/**
 * Draw prototype for clsPageHandler
 * @param el  an element that the will contain what is drawn.
*/
clsPageHandler.prototype.OVERWEIGHT=2.0;
var fImgRotator=function(f,elid,aray,opts)
{
 var el = fGD(elid);
 try
 {
  if(el==null)
   return;
  if(opts.controllerid)
  {
   var controller=fGDS(opts.controllerid);
   if(controller==null || controller.display=="none")
   return;
  }
 }
 catch(e)
 {
  return;
 }
 var img;
 var imgnum;
 if(opts && opts.cycle!=null)
 {
  opts.cycle=imgnum=((++opts.cycle)%aray.length);
  img = aray[imgnum];
 }
 else
 {
  imgnum= parseInt(Math.random()*aray.length);
  img = aray[imgnum];
  if(String(el.getAttribute("src")).indexOf(img)>0)
  {
   window.setTimeout(function (){fImgRotator(fImgRotator,elid,aray,opts);},1)
   return;
  }
 }
 fFadeOutTimer(elid,99,20);
 el.setAttribute("src",img);
 fFadeInTimer(elid,0,20);
 window.setTimeout(function (){fImgRotator(fImgRotator,elid,aray,opts);},(opts && opts.waittime?opts.waittime:4000))
}

clsPageHandler.prototype.fTaxAmount = function()
{
 var dealer = this.fDealer();
 var cust = this.fGetActiveCustomer();
 var cart = this.fCart();
 var exchange=this.fSite().fExchange(1.0,"USD",this.fSite().Currency);
 var el = fGD("tdTaxAmount");
 if(el)
  el.innerHTML=Number(cart.fTaxAmount(cust.hShipping,dealer)*exchange).fFormatCurrency(2);
 else
  cart.fTaxAmount(cust.hShipping,dealer);

 el = fGD("tdFreight");
 if(el)
  el.innerHTML=Number(cart.fFreightAmount(cust)*exchange).fFormatCurrency(2);

 el = fGD("tdTotal");
 if(el)
  el.innerHTML=Number(cart.fTotal()*exchange).fFormatCurrency(2);
}
clsPageHandler.prototype.fExchangeRate=function(elid,handler)
{
	try
 {
  var el = fGD(elid);
  fAjaxCall({ID:"none",script:1,url:"include/Server/DBI.asp?VERB=ExchangeRate&CURRENCY="+String(el.options[el.selectedIndex].value)});
		if(handler)
		{
//			alert(handler);
		 this.fOnSubmit(handler);
		}
 }
 catch(e)
 {
  this.fError(e);
 }
 return false;
}
clsPageHandler.prototype.fChartSearch=function(elid)
{
	try
 {
  var el = fGD(elid);
  if(String(el.value).replace(/ /g,"") == "")
   throw({number:1,description:"Please, provide a search string."});
  if(fGD("dvSubMainBody"))
  {
   fAjaxCall({ID:"dvSubMainBody",fcallback:fCallBack,url:"include/Server/DBI.asp?VERB=ChartTable&Search="+String(el.value)});
   this.fGetActiveCustomer().fCart().fFixFields("Charts");
  }
 }
 catch(e)
 {
  this.fError(e);
 }
 return false;
}
/*
clsPageHandler.prototype.fSetCartHandler = function()
{
 var str = escape(fSerialize(fPageHandler().fGetActiveCustomer()));
 //alert(str.length+"\n"+str.substr(9,60)+":"+unescape(str.substr(9,60)));
 //fGD("specialTest").innerHTML=str;
 this.fHandler("CompleteOrder",{ID:"none",script:1,url:"include/server/DBI.asp?VERB=ProcessOrder&CLASS=clsCustomer&VALUE="+str.substr(9,6)});
}
*/
clsPageHandler.prototype.fGetActiveSerialNumber = function()
{
 return this.fGetActiveCustomer().fGetActiveRegProduct().SerialNumber;
}
clsPageHandler.prototype.fIsLoggedIn = function()
{
 return this.fGetActiveSerialNumber().length==23;
}
clsPageHandler.prototype.fOnSubmit = function(handler)
{
 try
 {
  if(handler=="Profile" && !this.fIsLoggedIn())
  {
   handler="Login";
  }
  else if(handler=="Cart")
  {
   if(this.ProductStatus=="UPGRADE" || this.ProductStatus=="DEAD")
   {
    this.fHelpHandler("UpgradeError");
    handler="Profile";
   }
   else
    this.fRefreshCart();
  }
  var h = this.fHandler(handler);
  if(h.fOnSubmit != null && !h.fOnSubmit())
  {
   return false;
  }
/*
  if(handler=="CompleteOrder")
  {
   alert(unescape(fSerialize(h)));
   return false;
  }
*/
  fAjaxCall(h);
  if(h.fOnLoad != null)
  {
   h.fOnLoad(this);
  }
 }
 catch(e){alert("Handler Error["+handler+"] "+e.description);}
 return false;
}
clsPageHandler.prototype.fMaxProCart = function (page)
{
 try
 {
  var c = this.fGetActiveCustomer();
  if(c.hMaxProCart==null)
  {
//   alert("TODO:"+"\n Transfer cart items"+"\n Convert Regions To MAX Pro DataSet"+"\n Caller:"+page);
   fAjaxCall({ID:"none",script:1,url:"include/server/DBI.asp?VERB=DataSetChange&Page="+page+"&DataSet=MAXPro"});
   c.hMaxProCart = new clsCart();
  }
  c.hMaxProCart.hItems={};
  for(var i in c.hCart.hItems)
  {
   if(c.hCart.hItems[i].ProductType=="ChartUpdate" || c.hCart.hItems[i].ProductType=="ChartRegion" || i==1262)
    continue;
   c.hMaxProCart.hItems[i] = c.hCart.hItems[i];
  }
  
  return c.fCart();
 }
 catch(e){}
}
clsPageHandler.prototype.fPassportCart = function (page)
{
 try
 {
  var c = this.fGetActiveCustomer();
//  alert("TODO:"+"\n Transfer cart items"+"\n Revert Regions To Passport DataSet"+"\n Caller:"+page);
  delete c.hMaxProCart;
  c.hMaxProCart=null;
  fAjaxCall({ID:"none",script:1,url:"include/server/DBI.asp?VERB=DataSetChange&Page="+page+"&DataSet=Passport"});
  return c.fCart();
 }
 catch(e){}
}
clsPageHandler.prototype.fCart = function ()
{
 try
 {
  return this.fGetActiveCustomer().fCart();
 }
 catch(e){}
}
clsPageHandler.prototype.fDrawCart = function (el)
{
 try
 {
  this.fGetActiveCustomer().fDrawCart(el);
  var c = this.fGetActiveCustomer();
  for(var d in c.hShipping)
  {
   try
   {
    var e = fGD(d);
    if(e && e.getAttribute("objClass")=="clsShipping")
    {
     if(d == "Address1")
     {
      e.value = String(c.hShipping.Address1+"\r\n"+c.hShipping.Address2+"\r\n"+c.hShipping.Address3+"\r\n"+c.hShipping.Address4).replace(/\r\n(\r\n)+/g,"\r\n").replace(/^(\r\n| )+|( |\r\n)+$/g,"");
     }
     else
      e.value = c.hShipping[d];
    }
   }catch(ee){};
  }
  for(var d in c.hPayment)
  {
   try
   {
    var e = fGD(d);
    if(e && e.getAttribute("objClass")=="clsPayment")
    {
     if(d == "Address1")
     {
      e.value = String(c.hPayment.Address1+"\r\n"+c.hPayment.Address2+"\r\n"+c.hPayment.Address3+"\r\n"+c.hPayment.Address4).replace(/\r\n(\r\n)+/g,"\r\n").replace(/^(\r\n| )+|( |\r\n)+$/g,"");
     }
     else
      e.value = c.hPayment[d];
    }
   }catch(ee){};
  }
 }
 catch(e){}
}
clsPageHandler.prototype.fRefreshCart = function (hCart)
{
 try
 {
  if(hCart==null)
   hCart = this.fCart();
  var items = hCart.fItemCount();
  var cart = fGD("mnuCart");
  cart.style.display=items?"":"none";
  var cartsummary=fGD("dvCartSummary");
  if(cartsummary)
  {
   cartsummary.style.display=items?"":"none";
   if(items)
    cartsummary.innerHTML=hCart.fDrawCartSummary();
  }
/*
  if(items)
   cart.innerHTML="("+items+")";
  else
   cart.innerHTML="(empty)";
*/
 }
 catch(e){}
}
clsPageHandler.prototype.fRemoveCartItem = function (pid)
{
 var hCart = this.fGetActiveCustomer().fCart();
 var item = hCart.fFindItem(pid);
 hCart.fRemoveItem(pid);
 if(item.ProductType=="ProgramUpgrade")
  this.fPassportCart();
 this.fRefreshCart(hCart);
}
clsPageHandler.prototype.fCartAction = function (el)
{
 try
 {
  if(el.getAttribute("producttype")=="ChartUpdate")
  {
   if(this.hSite.fDataSet().toLowerCase()=="maxpro")
   {
    if(el.getAttribute("name").indexOf("-") < 0)
    {
     alert(el.getAttribute("name") + " is not available with "+this.hSite.fDataSet()+ " products.");
     return false;
    }
   }
  } 
  var cartaction = el.getAttribute("CartAction");
  var hCart = this.fGetActiveCustomer().fCart();
  var rc = hCart["f"+cartaction](el);
  if(el.getAttribute("refresh"))
   this.fOnSubmit(el.getAttribute("refresh"))
  else
   this.fRefreshCart(hCart);
  return rc;
 }
 catch(e)
 {
  if(el)
   alert("Cart Error\r\n"+el.getAttribute("ProductID")+"\r\n"+e.description);
  else
   alert("Cart Error\r\n\r\n"+e.description);
 }
 return false;
}
clsPageHandler.prototype.fToggleBox = function (el)
{
 try
 {		
		//initialize variables
		var bReturn = false;
  var boxId   = el.getAttribute("id");
  var boxGroup   = el.getAttribute("group");
  var pid = el.getAttribute("ProductID");
		var aTags     = document.getElementsByTagName("input");
		for(var t=0;t<aTags.length;t++)
		{
		 if(aTags[t].getAttribute("group")==boxGroup)
		 {
		  if(aTags[t].getAttribute("id")!=boxId && aTags[t].checked)
		  {
			  //change checked status and call cart action to remove item from cart
		   aTags[t].checked = false;
			  if(fPageHandler().fCartAction(aTags[t])==false)
			   return false;
			 }
		 }
		}
		//call cart action to add/remove clicked item
  if(el.checked)
  {
   if(el.getAttribute("actionadd"))
    eval(el.getAttribute("actionadd"));
  }
		bReturn = fPageHandler().fCartAction(el);
  if(!el.checked)
  {
   if(el.getAttribute("actionremove"))
    eval(el.getAttribute("actionremove"));
  }
 }
 catch(e){}
	return bReturn;
}
clsPageHandler.prototype.fProgramUpgrades = function ()
{
 if(this.hProgramUpgrades == null)
  fAjaxCall({ID:0,script:1,url:"include/Server/DBI.asp?VERB=LoadProgramUpgrades"});
 return this.hProgramUpgrades;
}
clsPageHandler.prototype.fLicenseFile = function ()
{
 try
 {
  var hRegProduct = this.fGetActiveCustomer().fGetActiveRegProduct();
  if(hRegProduct.fRegionCount() == 0)
   alert("You have no regions!");
  else
  {
   window.open("include/Server/DBI.asp?VERB=LicenseFile&SN="+hRegProduct.SerialNumber,"LicenseFile");
  }
  return false;
 }
 catch(e){}
 return false;
}
clsPageHandler.prototype.fSoftwareUpgrades = function ()
{
 if(this.hSoftwareUpgrades == null)
  fAjaxCall({ID:0,script:1,url:"include/Server/DBI.asp?VERB=LoadSoftwareUpgrades"});
 return this.hSoftwareUpgrades;
}
clsPageHandler.prototype.fLoadedProduct = function (pid)
{
 if(this.hLoadedProducts[String(pid)])
  return this.hLoadedProducts[String(pid)];
 if(this.hSoftwareUpgrades)
 {
  for(var u in this.hSoftwareUpgrades)
  {
   if(this.hSoftwareUpgrades[u].ProductID==pid) 
    return this.hSoftwareUpgrades[u];
  }
 }
 return null;
}
clsPageHandler.prototype.fLoadProducts = function (hlist)
{
 this.hLoadedProducts = {};
 var aList = faListMembers(hlist,"ProductID");
 fAjaxCall({ID:0,script:1,url:"include/Server/DBI.asp?VERB=LoadRegionProducts&LIST="+aList.join(",")});
 return this.hLoadedProducts;
}
clsPageHandler.prototype.fLoadMiscItems = function (hlist)
{
 fAjaxCall({ID:0,script:1,url:"include/Server/DBI.asp?VERB=LoadMiscItems"});
 return this.hMiscItems;
}
clsPageHandler.prototype.fSetDealer = function (dealerid,dealer)
{
 //var c = this.fGetActiveCustomer();
	//var demographics = "hDemographics";
 //fGD("Dealer").setAttribute("DealerID",dealerid);
 //fGD("Dealer").value=dealer;
 //fGD('dvDealerList').style.display='none';
	//c[demographics].DealerID=dealerid;
 return false;
}
clsPageHandler.prototype.fSetRegionCountry = function (region,country)
{
 fGD("Region").value=region;
 fGD("Country").value=country;
 fSetErrorClass(fGD("Region"),country==""?"REQUIRED":"");
 fGD('dvStateCountryList').style.display='none';
 return false;
}
clsPageHandler.prototype.fCustomerUpdate = function (elid)
{
 try
 {
  var OVERRIDEADDRESS=0;
  if(elid=="btnOverride")
  {
   if(fGD("btnComplete"))
    elid="btnComplete";
   else if(fGD("btnRegister"))
    elid="btnRegister";
   OVERRIDEADDRESS=1;
  }
  var el = fGD(elid);
  var cls = el.getAttribute("objClass") || "clsCustomer";
  var c = this.fGetActiveCustomer();
		var activeSN = c.hRegProducts["Active"];
		var children = "hChildren";
		var hValidate = new clsValidate();
		var hDemographics = c.fDemographics();
		var hShipping = c.fShipping();
		var hPayment = c.fPayment();
		var errors  = null;
		var v  = null;
		var value="";
		if(el.value)
		 value=String(el.value).replace(/^( )+|( )+$/g,"");
// *
		if(0 && elid=="ShipName1" && value=="JME")
		{
		 hShipping.ShipName1="Jeppesen M. Employee";
		 hShipping.Address1="15160 NW Laidlaw Rd";
		 hShipping.Address2="";
		 hShipping.Address3="";
		 hShipping.Address4="";
		 hShipping.City="Portland";
   hShipping.Country="US";
		 hShipping.Region="OR";
		 hShipping.PostalCode="97229";
		 if(!dlr)
		 {
		  hPayment.CCName="JM";
		  hPayment.CCNumber="4460 5404 9012 3536";
		  hPayment.CCType="VISA";
		  hPayment.CCMonth="11";
    hPayment.CCYear="11";
   }
   this.fDrawCart(fGD("dvSubMainBody"));
   this.fDrawShipMethods();
   return;
		}
//* /
		if(elid=="OrderType")
		{
		 hPayment.OrderType=value;
		 // Found in pages/Cart.asp
		 this.fLoadPaymentSection();
		 return;
		}
  if(elid=="btnRegister")
		{
   if(0) 
   {
    this.fHelpHandler("Maintenance");
		  return false;
		 }
			//0086-460646-6261-751088
		 errors  = "";
			v  = null;

			//clear out the previous errors before any validation
			hValidate.fClearErrorMessage(); 
			
			//validate data in demographics hash
			if(!hValidate.fIsName(hDemographics.FirstName))
				hValidate.fSetErrorMessage("Error in \"First Name\" box.");
			if(!hValidate.fIsName(hDemographics.LastName))
				hValidate.fSetErrorMessage("Error in \"Last Name\" box.");
			if(hDemographics.Company != "" && !hValidate.fIsCompany(hDemographics.Company))
				hValidate.fSetErrorMessage("Error in \"Company\" box.");
			var address = hDemographics.Address1+hDemographics.Address2+hDemographics.Address4+hDemographics.Address4;
			if(!hValidate.fIsStreetAddress(address))
				hValidate.fSetErrorMessage("Error in \"Address\" box.");
			if(!hValidate.fIsAlpha(hDemographics.City))
				hValidate.fSetErrorMessage("Error in \"City\" box.");
			if(hDemographics.Country == "")
				hValidate.fSetErrorMessage("Error in \"Country\" dropdown.");
			v = fGD("dvState").innerHTML;
			if(!hValidate.fIsWhitespace(v))
			 if(hDemographics.Region == "")
				 hValidate.fSetErrorMessage("Error in \"Region/State\" dropdown.");
			if(hDemographics.Country == "United States")
			{
			 if(hValidate.fIsWhitespace(hDemographics.PostalCode))
			 {
				 hValidate.fSetErrorMessage("Error in \"Zip/PostalCode\" box.");
				}
				else
				{
					if(hDemographics.PostalCode.length >= 5 && hDemographics.PostalCode.length <= 11)
					{
						if(!hValidate.fIsPostalCode(hDemographics.PostalCode))
						{
							hValidate.fSetErrorMessage("Error in \"Zip/PostalCode\" box.");
						}
					}
					else
					{
						hValidate.fSetErrorMessage("Error in \"Zip/PostalCode\" box.");
					}					
				}
			}
			else if(!hValidate.fIsWhitespace(hDemographics.PostalCode))
			{
		 }
			if(!hValidate.fIsWhitespace(hDemographics.DayPhone))
			{
				if(!hValidate.fIsPhone(hDemographics.DayPhone))
					hValidate.fSetErrorMessage("Error in \"Phone\" box.");
			}
			if(!hValidate.fIsWhitespace(hDemographics.MobilePhone))
			{
				if(!hValidate.fIsPhone(hDemographics.MobilePhone))
					hValidate.fSetErrorMessage("Error in \"Mobile\" box.");
			}
			if(!hValidate.fIsWhitespace(hDemographics.EvePhone))
			{
				if(!hValidate.fIsPhone(hDemographics.EvePhone))
					hValidate.fSetErrorMessage("Error in \"Evening Phone\" box.");
			}
			if(!hValidate.fIsWhitespace(hDemographics.FaxPhone))
			{
				if(!hValidate.fIsPhone(hDemographics.FaxPhone))
					hValidate.fSetErrorMessage("Error in \"Mobile\" box.");
			}
			if(!hValidate.fIsWhitespace(hDemographics.NewsLetter) && !hValidate.fIsEmailAddress(hDemographics.NewsLetterEmail))
				hValidate.fSetErrorMessage("Error in \"NewsLetter\" box.");
			
			if(!hValidate.fIsEmailAddress(hDemographics.EmailAddress))
				hValidate.fSetErrorMessage("Error in \"Email\" box.");
			
		 if(c.fGetActiveRegProduct().Class=="DMAX")
			{
			 ; //if(fGD("Dealer").selectedIndex <=0 ) hValidate.fSetErrorMessage("Dealer cannot be Jeppesen Marine.");
			}
			
			if(hDemographics.Version == "")
				hValidate.fSetErrorMessage("Error in \"Version\" box.");
			
			//get any errors
			errors = hValidate.fGetErrorMessage();
			if(errors.length > 0)
			{
				fGD("dvMsg").innerHTML=(errors.join("<br>"));
			}
			else
			{
				//call to process the page
//				fGDS("dvGMap").display=""; 
//			 fGD("dvGMap").innerHTML=("CLASS=clsCustomer&OVERRIDEADDRESS="+OVERRIDEADDRESS+"&VALUE="+escape(fSerialize(this.fGetActiveCustomer())));
			 fAjaxCall({ID:0,script:1,url:"include/Server/DBI.asp?VERB=RegisterCustomer"
													,method:"POST",content:"CLASS=clsCustomer&OVERRIDEADDRESS="+OVERRIDEADDRESS+"&VALUE="+escape(fSerialize(this.fGetActiveCustomer()))});
			}
   return;
  }
  fSetErrorClass(el,"");
  if(elid=="Address1")
  {
   value= String(value).replace(/\r\n(\r\n)+/g,"\r\n").replace(/^(\r\n| )+|( |\r\n)+$/g,"");
   el.value = value = String(value).split("\r\n").splice(0,2).join("\r\n");
//    alert(escape(value));
  }
  //else if(elid=="Dealer")
 // {
   
		//	fAjaxCall({ID:0,script:1,url:"include/Server/DBI.asp?VERB=DealerDropdown&CLASS="+cls+"&VALUE="+value});
			
 // }
  else 
  {
   if(elid == "EmailAddress" || elid == "NewsLetterEmail")
   {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    if(value == "" && !fIsRequired(elid)) 
     fSetErrorClass(el,"");
    else if (!value.match(re)) 
     fSetErrorClass(el,"FAILURE");
    else
     fSetErrorClass(el,"SUCCESS");
//   alert("Required:"+fGD(elid).getAttribute("Required")
//   +"\n["+String(value)+"]");
   }
   else if(fIsRequired(elid) && String(value).replace(/ /g,"")=="")
    fSetErrorClass(el,"REQUIRED");
  }
		if(cls=="clsShipping")
		 cls="hShipping"
  else if(cls=="clsPayment")
		 cls="hPayment";
  else if(cls=="clsCustomer")
		 cls="hDemographics";
			
  if(elid=="Country")
  {
			try
			{
			 c[cls].Country=fGD("Country").value;
			 c[cls].Region="";
    if(cls=="hShipping")
    {
     c[cls].ShipperID=-1;
     this.fDrawShipMethods();
    }   
			}
			catch(e){}
		}
		else if(elid=="Region")
		 try
			{
    c[cls].Region=fGD("Region").value;
    if(cls=="hShipping")
    {
     c[cls].ShipperID=-1;
     this.fDrawShipMethods();
    }   
			}
			catch(e){}
	 else if(elid=="Address1")
  {
   c[cls].Address1=c[cls].Address2=c[cls].Address3=c[cls].Address4="";
   var aLines = String(value).split("\r\n");
   for(var l=1,a=0;a < aLines.length;a++)
    if(aLines[a])
     c[cls]["Address"+(l++)]=aLines[a].substr(0,50);
  }
  else if(elid=="CCType")
		{
			var oCCType = document.getElementsByName("CCType");
			for (var i=0;i<oCCType.length;i++)
			{
				if (oCCType[i].checked==true)
				 c[cls].CCType=oCCType[i].cardType;
			}
		}
  else if(elid=="AssignToDealer")
  {
   try
   {
    c[cls][elid]=el.options[el.selectedIndex].value;
		  c[cls].DealerName=el.options[el.selectedIndex].text;
				fAjaxCall({ID:0,script:1,url:"include/Server/DBI.asp?VERB=LoadDealerForPayment&DealerID="+c[cls][elid]});
   }
   catch(de)
   {
    alert(de.description);
   }
  }
  else if(elid=="Dealer")
		 c[cls].DealerID=fGD("Dealer").value;
  else if(elid=="VesselName")
   c.hRegProducts[children][activeSN].VesselName=fGD("VesselName").value;
  else if(elid=="Version")
   c.hRegProducts[children][activeSN].Version=fGD("Version").value;
  else if(elid=="MarketSegment")
   c.hRegProducts[children][activeSN].MarketSegment=fGD("MarketSegment").value;
  else if(elid=="UsedOn")
   c.hRegProducts[children][activeSN].UsedOn=fGD("UsedOn").value;		
		else if(elid=="ShipperID")
		{
		 c[cls][elid]=value;
		 c.fCart().fFreightAmount(c);
		 fGD("dvNavBar").innerHTML=""+c.fCart().fDrawSummaryHeader();
		}
		else
		 c[cls][elid]=value;
		
		if(elid=="btnComplete")
		{
   if(0) 
   {
    this.fHelpHandler("Maintenance");
		  return false;
		 }
   var dlr = this.fDealer();
			errors = "";
			v = null;

		 c.fCart().fFreightAmount(c);

		 fGD("dvNavBar").innerHTML=""+c.fCart().fDrawSummaryHeader();

   if(hShipping.ShipperID==-1 && c.fCart().fWeight() > 0)
    hValidate.fSetErrorMessage("A shipping method must be chosen.");

   if(!hValidate.fIsName(hShipping.ShipName1))
    hValidate.fSetErrorMessage("Error in \"Shipping Name\" box.");

   var address = hShipping.Address1+hShipping.Address2+hShipping.Address4+hShipping.Address4;
   if(!hValidate.fIsStreetAddress(address))
    hValidate.fSetErrorMessage("Error in \"Address\" box.");
   if(!hValidate.fIsWhitespace(hShipping.ShipName2))
    if(!hValidate.fIsAlpha(hShipping.ShipName2))
     hValidate.fSetErrorMessage("Error in \"Secondary Name\" box.");
   if(!hValidate.fIsAlpha(hShipping.City))
    hValidate.fSetErrorMessage("Error in \"City\" box.");
   if(hShipping.Country == "")
    hValidate.fSetErrorMessage("Error in \"Country\" dropdown.");
   v = fGD("dvState").innerHTML;
   if(!hValidate.fIsWhitespace(v))
   {
    if(hShipping.Region == "")
     hValidate.fSetErrorMessage("Error in \"Region/State\" dropdown.");
   }
			if(hShipping.Country == "United States")
			{
    if(hShipping.PostalCode.length >= 5 && hShipping.PostalCode.length < 11)
    {
     if(!hValidate.fIsPostalCode(hShipping.PostalCode))
     {
      hValidate.fSetErrorMessage("Error in \"Zip/PostalCode\" box.");
     }
    }
    else 
    {
     hValidate.fSetErrorMessage("Error in \"Zip/PostalCode\" box.<br>Length is invalid.");
    }
   }
			if(dlr)
			{
			 if(!dlr.fInternal())
			 {
     if(hValidate.fIsWhitespace(hPayment.PONumber))
      hValidate.fSetErrorMessage("PO Number field needs attention.");
			 }
			 else
			 {
     if(hPayment.OrderType=="PO")
     {
      if(hValidate.fIsWhitespace(hPayment.PONumber))
       hValidate.fSetErrorMessage("PO Number field needs attention.");
      if(hPayment.AssignToDealer <=0)
       hValidate.fSetErrorMessage("Dealer Orders must to be assigned to a Dealer.");
     }
			  else if(hPayment.OrderType=="OR")
			  {
      if(hValidate.fIsWhitespace(hPayment.PONumber))
       hValidate.fSetErrorMessage("PO Number field requires an Oracle Reference #.");
			  }
			  else if(hPayment.OrderType=="")
			  {
      hValidate.fSetErrorMessage("Choose the Type of Order you are placing.");
			  }
			  else if(hPayment.OrderType!="CC")
			  {
      if(hValidate.fIsWhitespace(hPayment.PONumber))
       hValidate.fSetErrorMessage("PO Number field requires a brief description for this order.");
			  }
			 }
   }
   if(hPayment.OrderType=="CC")
   {
			 var bFilled = 0;
    if(!hValidate.fIsName(hPayment.CCName))
     hValidate.fSetErrorMessage("Error in \"Credit Card Name\" box.");
    if(hValidate.fIsWhitespace(hPayment.CCType))
		  { 
			 	hValidate.fSetErrorMessage("Error in \"Credit Card Type\" box.");
			 }
			 else
			  bFilled++;
			 if(hValidate.fIsWhitespace(hPayment.CCNumber))
    {
			 	hValidate.fSetErrorMessage("Error in \"Credit Card Number\" box.");
			 }
			 else
			 {
			 	hPayment.fCCNumber(hPayment.CCNumber);
			  bFilled++;
			 }
			 if(hValidate.fIsWhitespace(hPayment.CCMonth))
    {
			 	hValidate.fSetErrorMessage("Error in \"Expiration Date \(month\)\" box.");
			 }
			 else
			  bFilled++;
			 if(hValidate.fIsWhitespace(hPayment.CCYear))
    {
			 	hValidate.fSetErrorMessage("Error in \"Expiration Date \(year\)\" box.");
			 }
			 else
			  bFilled++;
			 if(bFilled==4)
			 {
			  if(!hPayment.fCheckCreditCard())
      hValidate.fSetErrorMessage("Error validating credit card number.");
			 }
			}
			//get any errors
			errors = hValidate.fGetErrorMessage();
			if(errors.length > 0)
			{
				fGD("dvMsg").innerHTML=(errors.join("<br>"));
			}
			else
			{
			 if(OVERRIDEADDRESS)
			 {
				 fGD("dvMsg").innerHTML = "";
				}
				else
			 {
					fAjaxCall({ID:0,script:1,url:"include/Server/DBI.asp?VERB=ValidateShipping"
					,method:"POST",content:"CLASS=clsCustomer&VALUE="+escape(fSerialize(this.fGetActiveCustomer()))});
				}
				if(fGD("dvMsg").innerHTML == "")
			 {
				 //call to process the page
	    fGDS("tblOrderDealer").display  = "none";
     fGDS("tblOrderType").display    = "none";
			  fAjaxCall({ID:0,script:1,url:"pages/Confirm.asp"});
				}
			}
   return;
		}
	}
 catch(e){alert(e.description)};
}	

clsPageHandler.prototype.fChangeCustomer = function (hsh)
{
 this.oldCustomer=this.aCustomers[0];
 if(hsh != null)
 {
  this.aCustomers[0] = new clsCustomer(hsh);
  this.fRefreshCart(this.aCustomers[0].fCart());
  this.fRefreshMenu();
  if(fGD("dvReceipt") != null)
  {
  }
  else if(this.aCustomers[0].CustID<=0)
   this.fOnSubmit('Customer');
  else 
   this.fOnSubmit('Profile');
  fPageHandler().fLoadMiscItems();
 }
}
clsPageHandler.prototype.hHelpInfo = 
{
 "":{Title:"",Description:"",Message:""}
 ,"Maintenance":
 {
  Title:"Scheduled Maintenance"
  ,Description:"<center>Scheduled Maintenance</center>"
  ,Message:"<p class='Error'>Please excuse the interuption. "
  +"We will undergo maintenance Saturday evening from 9:00&nbsp;PM until approximately 10:00&nbsp;PM&nbsp; Pacific Daylight Time. "
  +"You will be unable to perform transactions during that period until our maintenance is complete."
  +"<p>You may continue to browse the store, although your activities may be disrupted."
  +"<p>Thank you for bearing with us during this period of down-time."
  +"<p>The Jeppesen Marine Team"
  +"</p>"
 }
 ,"Upgrade":
 {
  Title:"<img src='/images/logo_jepp.gif' align=center>"
  ,Description:""
  ,Message:""
   +'<p width="100%" align=left>'
   +'<b>Admiral MAX Pro&reg;</b> —the Most Powerful Electronic Navigation Solution Available and '
   +'<b>VNS MAX Pro&reg;</b> —the Most Popular Navigation Software with '
   +'<b>C-Map&reg; MAX Pro&trade; Charts</b> —the Best Marine Cartography</b>'
   +'<img src="/images/MAXPro/2DVDs.gif" align=right>'
   +'<br><br>Discover a new world of navigation performance and cartographic accuracy.'
   +'<br><br>Upgrade to our award winning software online —'
   +'<br><b>VNS Max Pro</b>* upgrades from <b>$130</b> <small>USD</small>'
   +'<br><b>Admiral Max Pro</b>* upgrades from <b>$280</b> <small>USD</small>'
   +'<br><br>...Or visit a <a href="/services/dealerlocater.asp" target="_new">Jeppesen Marine Dealer</a> '
   +'near you for new software purchases.'
   +'</p>'
   +'<p width="100%">'
   +'<STRONG>Contact our sales department for assistance*:</STRONG>'
   +'<br><br><STRONG>Toll-Free:</STRONG> (800) 946-2877'
   +'<br><STRONG>Direct:</STRONG> +1 503 579 1414'
   +'<br><STRONG>Email:</STRONG> <a href="mailto:sales@jeppesen.com">sales@jeppesen.com</a>'
   +'<p width="100%">'
   +'<small><i>*Upgrade price is based on the version of your current software product being upgraded.</i></small>'
   +'</p>'
   +""
  ,OldMessage:""
   +'<p width="100%" align=center>'
   +'<b>Special Upgrade Offers&nbsp;...&nbsp;For a Limited Time Only!</b>'
   +'<br><br>'
   +'<b>Offers Expire July 15, 2008</b>'
   +'</p>'
   +'<p width="100%">'
   +'<STRONG>Contact our sales department to inquire about special upgrade&nbsp;offers*:</STRONG>'
   +'<img src="/images/MAXPro/2DVDs.gif" align=right>'
   +'<br><br><STRONG>Toll-Free:</STRONG> (800) 946-2877'
   +'<br><STRONG>Direct:</STRONG> +1 503 579 1414'
   +'<br><STRONG>Email:</STRONG> <a href="mailto:sales@jeppesen.com">sales@jeppesen.com</a>'
   +'<br><br><br><br><br></p>'
   +'<p width="100%">'
   +'<small><i>*Nobeltec Navigation Software and Chart Users must meet eligibility requirements to receive special upgrade offers on Admiral MAX Pro, VNS MAX Pro, Raster Plus Pack, MAX Pro Charts.</i></small>'
   +'</p>'
   +""
  }
 ,"UpgradeError":
 {
  Title:"<img src='/images/logo_jepp.gif' align=center>"
  ,Description:""
  ,Message:""
   +'<p width="100%" align=center>'
   +'<b>Serialnumber No Longer Available For Purchasing</b>'
   +'</p>'
   +'<p width="100%">'
   +'This serialnumber you entered is currently in the upgrade process. You will not be able to make further purchases with it.'
   +'<br><br>Permits purchased during your last upgrade order will not be available until the upgrade order has been processed.'
   +'<br><br>If you have questions please contact our sales department:'
   +'<br><br><STRONG>Toll-Free:</STRONG> (800) 946-2877'
   +'<br><STRONG>Direct:</STRONG> +1 503 579 1414'
   +'<br><STRONG>Email:</STRONG> <a href="mailto:sales@jeppesen.com">sales@jeppesen.com</a>'
   +'</p>'
   +""
  }
 ,"MAXCharts":{Title:"NOBELTEC® AND C-MAP® :THE BEST OF BOTH WORLDS!",Description:"",Message:""
 +"<div class='fr ac' style='width:200px;'>"
 +"<p class='ac bold'>MAX Pro™ Data Layers</p>"
 +"<img id='img_MAXCharts' src='images/advimgs/maxcharts_adv_0.png' width=200 border=0></div>"
 +"New Visual Navigation Suite™ MAX Pro (VNS MAX Pro™) and Admiral™ MAX Pro deliver the “Best of Both Worlds” —the powerful features of Nobeltec Navigation Software combined with C-Map MAX Pro™ electronic charts, the most advanced cartography available for the leisure marine market."
 +"<p>These new systems provide you a whole new level of navigational performance, delivering popular Nobeltec features with the incomparable cartographic detail and accuracy of MAX Pro.  In addition, MAX Pro’s Quick Sync Updates allows you to download recent Notice to Mariner advisories, so every voyage can begin with the most accurate, up-to-date data available." 
 +"<p><a href=# onclick='fFadeOutTimer(\"dvHelpfulInfo\");return fPageHandler().fOnSubmit(\"Charts\");'>Browse MAX Pro Charts</a>"
 +""}
 ,"GPS":{Title:"GPS – 1600 with WAAS",Description:"",Message:""
 +"The Jeppesen® Marine Nobeltec& GPS-1600 with WAAS is based on a 16-channel GPS engine that delivers location accuracy within less than 3 meters by decoding GPS correction signals from satellite-based WAAS (Wide Area Augmentation System).The GPS engine, interface electronics, and passive antenna are enclosed inside durable waterproof plastic housing. This superior-quality GPS provides advanced, state-of-the-art positioning performance and plug-and-play use with Nobeltec Navigation Software charting programs. "
 +"<img src='images/gps_adv_1.jpg' align=right border=0>"
 +"<p>Nobeltec Navigation Software (VNS Max Pro&trade;, Admiral Max Pro&trade; software, sold separately), interfaced with the GPS-1600 with WAAS using your onboard computer, intelligently interprets and displays GPS data in an easy-to-comprehend onscreen format, providing you with the ability to make safer and more prudent navigation decisions in shorter periods of time."
 +""}
 ,"PlusPacks":{Title:"UNLOCK NOBELTEC PLUS PACKS<br>TO ENHANCE YOUR ON-WATER EXPERIENCE!"
 ,Description:"Check out our feature add-on packs for Admiral MAX Pro and VNS MAX Pro:"
 ,Message:""
 +"<b>Sailing Plus Pack</b>"
 +"<img src='images/pluspack_adv_sailing.jpg' align=right border=0 width=60>"
 +"<br>Introducing Windvantage™ Weather Router, the newest feature we’ve added to the popular Sailing Plus Pack. This feature relies on the Route Wizard to make calculations based on your boat's performance characteristics, which are stored in the polar files, and a GRIB weather file. The calculations then create the best possible route. Upgrade Now"
 +"<P>"
 +"<b>Weather Plus Pack</b>"
 +"<img src='images/pluspack_adv_weather.jpg' align=right border=0 width=60>"
 +"<br>Jeppesen Marine® is dedicated to providing navigators key weather data at the right time and displaying it over navigation charts and routes for real-time analysis and trip planning. Our new weather options transform simple weather data for informed navigation decision-making and extended time on the water without compromising safety. Choose from free GRIB support, OCENS WeatherNet GRIB data service*, XM Satellite Weather overlay**, SkyMate integrated weather†, WxWorx on Water***, and Nobeltec WeatherMail options.††  Upgrade Now"
 +"<P>"
 +"<b>Bathy Recorder Plus Pack</b>"
 +"<img src='images/pluspack_adv_fishing.jpg' align=right border=0 width=60>"
 +"<br>Sold as a Plus Pack to VNS™ and Admiral™, Bathy Recorder enables you to record sea floor topographic information using your depth sounder device, and to incorporate that data into your 3D charts. When you use the Bathy Recorder to customize your sea floor charts, those charts will constantly improve with repeat trips over the same areas, enabling you to have a perfect picture of important sea floor terrain, as well as your favorite fishing and diving spots. Upgrade Now"
 +"<P>"
 +"<b>Tender Tracker Plus Pack^</b>"
 +"<img src='images/pluspack_adv_tender.jpg' align=right border=0 width=60>"
 +"<br>Jeppesen Marine® teams with Seetrac® Tender Tracking™ to introduce the safest and best way to instantly know the location of jet skis, wave runners, and tenders. Very simply, the solution tracks the location of each tender and instantly reports it back to the mother yacht for immediate on-chart display inside Nobeltec Admiral software. When security and safety are at stake, Nobeltec and Seetrac Tender Tracking deliver peace of mind. Upgrade Now"
 +"<P>"
 +"<i style='font-size:8pt;'>"
 +"<br>*OCENS WeatherNet service is included with Admiral 9 and requires an annual license fee and per usage charges."
 +"<br>** XM Satellite Weather overlay requires purchase of Nobeltec’s XM Weather Plus Pack and an XM Satellite Weather hardware/data subscription."
 +"<br>† SkyMate weather data solutions available through SkyMate, Inc."
 +"<br>***WxWorx on Water weather data solution available through WxWorx."
 +"<br>†† Nobeltec WeatherMail data solution information is available through the Jeppesen Marine sales office (800) 946-2877 (U.S.) or (503) 579-1414 (Global)"
 +"<P>"
 +"^Tender Tracker Plus Pack works with Admiral version 9 and higher only."
 +"</i>"
 +""}
};
clsPageHandler.prototype.fHelpHandler = function (el)
{
 var helpkey=null;
 try
 {
  helpkey=el.getAttribute("HelpKey");
 }
 catch(e)
 {
  helpkey=el;
 }
 if(helpkey && clsPageHandler.prototype.hHelpInfo[helpkey])
 {
  this.fHelpfulInfo(clsPageHandler.prototype.hHelpInfo[helpkey]);
  if(helpkey=="MAXCharts")
   window.setTimeout(function (){fImgRotator(fImgRotator,'img_MAXCharts',['images/advimgs/maxcharts_adv_0.png','images/advimgs/maxcharts_adv_1.png','images/advimgs/maxcharts_adv_2.png','images/advimgs/maxcharts_adv_3.png']
   ,{controllerid:'dvHelpfulInfo',cycle:0,waittime:5000});},5000);

 }
 else if(helpkey=="Currency")
 {
	 try
  {
   fAjaxCall({ID:"none",script:1,url:"include/Server/DBI.asp?VERB=ExchangeTable"});
  }
  catch(e)
  {
   this.fError(e);
  }
  return false;
 }
 else if(helpkey=="HowToUse")
 {
	 try
  {
    this.fHelpfulInfo(
    {
     Title:"How To Use"
     ,Description:""
     ,Message:""
      +""
    });
   fAjaxCall({ID:"dvHIMessage",fcallback:fCallBack,url:"pages/howtouse.htm"});
  }
  catch(e)
  {
   this.fError(e);
  }
  return false;
 }
 else if(helpkey=="UpdateMap")
 {
	 try
  {
    this.fHelpfulInfo(
    {
     Title:"Chart Region Updates"
     ,Description:"<br>Updating from your Passport Region <b>"+el.getAttribute("passport")+"</b> to the MAX Pro Chart Region <b>"+el.getAttribute("maxpro")+"</b>.<br>"
     ,Message:""
      +""
    });
   fAjaxCall({ID:"dvHIMessage",fcallback:fCallBack,url:"include/Server/DBI.asp?VERB=RegionUpdate&MaxPro="+el.getAttribute("maxpro")+"&passport="+el.getAttribute("passport")});
  }
  catch(e)
  {
   this.fError(e);
  }
  return false;
 }
 else
 {
  this.fHelpfulInfo(
   {
    Title:"Adv/Help Information"
    ,Description:"<b>Handle click on '"+(helpkey||"No Help")+"' element.</b>"
    ,Message:"Message area."
     +""
   }
  );
 }
 return false;
}
clsPageHandler.prototype.fSiteChange = function (hsh)
{
 if(hsh != null)
 {
  this.hSite = new clsSite(hsh);
 }
 if(fPageHandler().hSite.fDataSet().toLowerCase()=="maxpro")
 {
  var rules = document.styleSheets[0].rules==null?"cssRules":"rules";
  if(document.styleSheets[0][rules][1].selectorText==".Passport")
   document.styleSheets[0][rules][1].style.display="none";
  if(document.styleSheets[0][rules][0].selectorText==".MaxPro")
   document.styleSheets[0][rules][0].style.display="";
  this.fNavigator(new clsMaxProNavigator({ID:"",Handle:"A",Text:"Browse Charts"}));
 }
 else
 {
  var rules = document.styleSheets[0].rules==null?"cssRules":"rules";
  if(document.styleSheets[0][rules][0].selectorText==".MaxPro")
   document.styleSheets[0][rules][0].style.display="none";
  if(document.styleSheets[0][rules][1].selectorText==".Passport")
   document.styleSheets[0][rules][1].style.display="";
  this.fNavigator(new clsPassportNavigator({ID:"",Handle:"A",Text:"Browse Charts"}));
 }
 this.fRefreshMenu();
 this.fLogo("dvTitle");
}
clsPageHandler.prototype.fFAQs = function (id)
{
 fAjaxCall({ID:id,fcallback:fCallBack,url:"pages/"+this.hSite.Site+"faqs.asp"});
}
clsPageHandler.prototype.fLogin = function (id)
{
 fAjaxCall({ID:id,fcallback:fCallBack,url:"pages/"+this.hSite.Site+"Login.asp"});
}
clsPageHandler.prototype.fLogo = function (elid)
{
	var sHTML="";
	sHTML = '<img class="fl" id="imgLogo" src="images/JeppesenMarineLogo.gif" border="0">'
 + '<img class="fr" id="imgBrand" src="'+this.hSite.fBrandImg()+'" border="0">';
	try{fGD(elid).innerHTML = sHTML}catch(e){};
}
clsPageHandler.prototype.fError = function (e)
{
 if(e != null)
 {
  alert("Error:"+e.description);
 }
}
clsPageHandler.prototype.fRefreshMenu = function ()
{
 this.hMenu.fShowProfile(this.aCustomers[0].CustID > 0);
 //this.hMenu.fShowVouchers(this.aCustomers[0].CustID > 0 && this.aCustomers[0].fGetActiveRegProduct().Class=="DMAX");
}
clsPageHandler.prototype.fReSize = function()
{
 for(var r=0;r<this.afResize.length;r++)
 {
  try
  {
   this.afResize[r]();
  }
  catch(e)
  {
   this.afResize.splice(r,1);
  }
 }
}
clsPageHandler.prototype.fAddReSize = function (f)
{
 for(var r=0;r<this.afResize.length;r++)
 {
  if(this.afResize[r] == f)
   return;
 }
 this.afResize.push(f);
}
clsPageHandler.prototype.fViewCharts=function(elid,regionid,sort)
{
 try
 {
  var el = fGD(elid);
  if(sort)
  {
   fAjaxCall({ID:elid,fcallback:fCallBack,url:"include/Server/DBI.asp?VERB=ChartView&RegionID="+regionid+"&Sort="+sort});
  }
  else if(el.style.display =="")
  {
   el.style.display="none";
   el.innerHTML="";
  }
  else
  {
   if(el.innerHTML=="")
    fAjaxCall({ID:elid,fcallback:fCallBack,url:"include/Server/DBI.asp?VERB=ChartView&RegionID="+regionid});
   el.style.display="";
  }
 }
 catch(e){}
 return false;
}
clsPageHandler.prototype.fNavigator=function(nav)
{
 if(nav && typeof(nav)=="object") this.hNavigator=nav; return this.hNavigator;
}
/** 
* This is a common function called in the browse.asp page, profile.asp, newsletter.asp
*/
clsPageHandler.prototype.fSubContainerResize = function()
{
 var ctr = fGD("dvContainer");
 var subcon = fGD("dvSubContainer");
 var submain = fGD("dvSubMain");
 var subheader = fGD("dvSubMainHeader");
 var subbody = fGD("dvSubMainBody");
 var navbar = fGD("dvNavBar");
 var ltnav = fGD("dvLeftNav");
 var rtnav = fGD("dvRightNav");
 try
 {
    subcon.style.height=(ctr.offsetHeight-(subcon.offsetTop+1))+"px";
    try
    {
     submain.style.left = (ltnav.offsetLeft+ltnav.offsetWidth)+"px";
    }
    catch(e2){}
    submain.style.width=Math.max(500,Math.min(700,parseInt(ctr.offsetWidth)-submain.offsetLeft))+"px";
    if(submain.scrollHeight < submain.clientHeight)
     subcon.style.overflow="hidden";
    else
     subcon.style.overflow="auto";
    try
    {
     rtnav.style.display="";
     if((rtnav.offsetWidth+submain.offsetLeft+submain.offsetWidth) > subcon.offsetWidth)
     {
      rtnav.style.display="none";
     }
     //else if(rtnav.offsetWidth > 0)
      rtnav.style.left = (submain.offsetLeft+submain.offsetWidth)+"px";
    }
    catch(e2){}
    if(navbar)
    {
     navbar.style.top=Math.max(1,subheader.offsetTop+subheader.offsetHeight)+"px";
     subbody.style.top=Math.max(1,navbar.offsetTop+navbar.offsetHeight)+"px";
    }
    else
     subbody.style.top=(subheader.offsetHeight)+"px";
    subbody.style.height=Math.max(1,submain.offsetHeight-(subbody.offsetTop))+"px";
    subheader.style.width=((submain.offsetWidth-(window.event?0:28))+"px");
    subbody.style.width=((submain.offsetWidth-(window.event?0:28))+"px");
 }
 catch(e){}
}
clsPageHandler.prototype.fHelpfulInfo = function (hsh)
{
 var hi = fGD("dvHelpfulInfo");
 try
	{
	 if(hsh==null) ;
		else 
		{
			fGD("dvHITitle").innerHTML="Helpful Information";
			fGD("dvHIDescription").innerHTML="";
			fGD("dvHIMessage").innerHTML="";
		 if(typeof(hsh) == "object")
			{
					if(hsh.Title)
						fGD("dvHITitle").innerHTML=hsh.Title;
					if(hsh.Description)
						fGD("dvHIDescription").innerHTML=hsh.Description;
					if(hsh.Message)
						fGD("dvHIMessage").innerHTML=hsh.Message;
			}
			else
			{
				fGD("dvHIMessage").innerHTML=hsh;
			}
		}
	}
 catch(e)
	{
  fGD("dvHIMessage").innerHTML=e.description;
	}
 hi.style.display="";
 fFadeInTimer("dvHelpfulInfo");
}
clsPageHandler.prototype.fHideHelpfulInfo = function ()
{
 try
	{
	 fGD("dvHelpfulInfo").style.display="none";
	}
 catch(e)
	{
	  alert(e.description);
	}
}

 /**
 * Class clsNavigator Client Prototypes
 * 
 * @author Richard Taylor-kenny
 * @date May 2007
 * 
 */
  /**
  * Draw prototype for clsRegProduct
  * @param el  an element that the will contain what is drawn.
  */
clsPassportNavigator.prototype.fDrawCharts=function (p)
{
 if(p==null)
  p = this.pChildren.fFirstOpen();
 //document.getElementById("dvChartHeader").innerHTML="Passport World Charts"):"")
 //alert(p+":"+(p?p.Handle:"xxx"))
 fAjaxCall({ID:"dvCharts",script:1,url:"include/Server/DBI.asp?VERB=Navigate&Handle="+(p?p.Handle:"A")});
 try
 {
  
  if(document.getElementById("dvSubMainBody"))
  {
   fAjaxCall({ID:"dvSubMainBody",fcallback:fCallBack,url:"include/Server/DBI.asp?VERB=ChartTable&Handle="+(p?p.Handle:"A")});
   fPageHandler().fGetActiveCustomer().fCart().fFixFields("Charts");
  }
 }
 catch(e){}
 return p;
}

clsPassportNavigator.prototype.fLoadDirectory = function ()
{
 var p = this.pChildren = new clsNavigator({ID:"A",Handle:"A",Text:"World View"});
 p.pNext = new clsNavigator({ID:"NA",Handle:"AA",Text:"North America"});
 p.pNext.pChildren=new clsNavigator({ID:"NA.WC",Handle:"AAA",Text:"West Coast"});
 p.pNext.pChildren.pNext=new clsNavigator({ID:"NA.EC",Handle:"AAB",Text:"East And Gulf Coast"});
 p.pNext.pChildren.pNext.pNext=new clsNavigator({ID:"NA.XL",Handle:"AAC",Text:"Extra-Large Regions"});
 p.pNext.pChildren.pNext.pNext.pNext=new clsNavigator({ID:"NA.GL",Handle:"AAD",Text:"Great Lakes"});

 p.pNext.pNext=new clsNavigator({ID:"CC",Handle:"AB",Text:"Central &amp; Caribbean"});

 p.pNext.pNext.pChildren=new clsNavigator({ID:"CC.CN",Handle:"ABA",Text:"Central"});
 p.pNext.pNext.pChildren.pNext=new clsNavigator({ID:"CC.CB",Handle:"ABB",Text:"Caribbean"});

 p.pNext.pNext.pNext=new clsNavigator({ID:"SA",Handle:"AC",Text:"South America"});

 p.pNext.pNext.pNext.pNext=new clsNavigator({ID:"EM",Handle:"AD",Text:"Europe/Mediterranean"});
 p.pNext.pNext.pNext.pNext.pChildren=new clsNavigator({ID:"EM.SC",Handle:"ADA",Text:"Scandinavia"});
 p.pNext.pNext.pNext.pNext.pChildren.pNext=new clsNavigator({ID:"EM.WE",Handle:"ADB",Text:"Western Europe"});
 p.pNext.pNext.pNext.pNext.pChildren.pNext.pNext=new clsNavigator({ID:"EM.UI",Handle:"ADC",Text:"U.K. &amp; Ireland"});
 p.pNext.pNext.pNext.pNext.pChildren.pNext.pNext.pNext=new clsNavigator({ID:"EM.ME",Handle:"ADD",Text:"Mediterranean"});

 p.pNext.pNext.pNext.pNext.pNext=new clsNavigator({ID:"AM",Handle:"AE",Text:"Africa &amp; Middle East"});

 p.pNext.pNext.pNext.pNext.pNext.pNext=new clsNavigator({ID:"AS",Handle:"AF",Text:"Asia"});
 p.pNext.pNext.pNext.pNext.pNext.pNext.pChildren=new clsNavigator({ID:"AS.NA",Handle:"AFA",Text:"Northeast Asia"});
 p.pNext.pNext.pNext.pNext.pNext.pNext.pChildren.pNext=new clsNavigator({ID:"AS.JKC",Handle:"AFB",Text:"Japan, Korea &amp; China"});
 p.pNext.pNext.pNext.pNext.pNext.pNext.pChildren.pNext.pNext=new clsNavigator({ID:"AS.SE",Handle:"AFC",Text:"S.E. Asia &amp; Indian Oc."});

 p.pNext.pNext.pNext.pNext.pNext.pNext.pNext=new clsNavigator({ID:"AN",Handle:"AG",Text:"Australia/New Zealand"});

 p.pNext.pNext.pNext.pNext.pNext.pNext.pNext.pNext=new clsNavigator({ID:"SR",Handle:"AH",Text:"Super Regions"});
 p.pNext.pNext.pNext.pNext.pNext.pNext.pNext.pNext.pChildren=new clsNavigator({ID:"SR.XL",Handle:"AHA",Text:"XLg:N Am &amp; Caribbean"});
}
clsMaxProNavigator.prototype.fLoadDirectory = function ()
{
 var p = this.pChildren = new clsNavigator({ID:"A",Handle:"0",Text:"World View",ImgSrc:"worldmap.gif"});

  p.fAdd({ID:"AA",Handle:"A",Text:"North America",ImgSrc:"",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AB",Handle:"B",Text:"Western Europe",ImgSrc:"",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AC",Handle:"C",Text:"Northern Europe",ImgSrc:"",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AD",Handle:"D",Text:"Europe Mediterrean",ImgSrc:"",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AF",Handle:"F",Text:"Southeast Asia",ImgSrc:"",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AG",Handle:"G",Text:"Australia",ImgSrc:"",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AH",Handle:"H",Text:"South America",ImgSrc:"",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AI",Handle:"I",Text:"Africa",ImgSrc:"",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AAA",Handle:"AA",Text:"Additional Lake Coverage",ImgSrc:"ALC.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AAB",Handle:"AB",Text:"Alaska &amp; Western Canada (MW)",ImgSrc:"AWC.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AAC",Handle:"AC",Text:"Eastern Canada (W)",ImgSrc:"ECA.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AAD",Handle:"AD",Text:"The Great Lakes (W)",ImgSrc:"GLK.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AAE",Handle:"AE",Text:"North America E&amp;W Coasts (MW)",ImgSrc:"NAM.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AAF",Handle:"AF",Text:"North America West coasts &amp; Hawaii",ImgSrc:"WAM.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AAG",Handle:"AG",Text:"Alaska &amp; Western Canada (W)",ImgSrc:"WCA.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AAH",Handle:"AH",Text:"North America East &amp; Central Coasts (W)",ImgSrc:"NCA.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ABA",Handle:"BA",Text:"Western &amp; Central Europe (W)",ImgSrc:"WCE.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ABB",Handle:"BB",Text:"Western Europe (MW)",ImgSrc:"WEU.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ACA",Handle:"CA",Text:"Benelux, Germany, Poland &amp; Denmark (W)",ImgSrc:"BGD.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ACB",Handle:"CB",Text:"Baltic Sea, G. of Bothnia &amp; Finland (W)",ImgSrc:"BSC.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ACC",Handle:"CC",Text:"Northern Europe (MW)",ImgSrc:"NEU.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ACD",Handle:"CD",Text:"Norwegian Coasts (W)",ImgSrc:"NRC.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ACE",Handle:"CE",Text:"Russian Federation (W)",ImgSrc:"RFD.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ACF",Handle:"CF",Text:"River Volga (W)",ImgSrc:"VOL.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ACH",Handle:"CH",Text:"Russian Federation (MW)",ImgSrc:"RUS.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ADA",Handle:"DA",Text:"Med &amp; Red Sea, Caspian &amp; Black Sea (W)",ImgSrc:"MBC.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"ADB",Handle:"DB",Text:"Med &amp; Red Sea, Caspian &amp; Black Sea (MW)",ImgSrc:"MCB.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AFA",Handle:"FA",Text:"Indian Ocean, Asia &amp; Oceania (MW)",ImgSrc:"A&O.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AFB",Handle:"FB",Text:"Indian Ocean &amp; Asia (W)",ImgSrc:"ASI.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AGA",Handle:"GA",Text:"Oceania (W)",ImgSrc:"OCE.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AHA",Handle:"HA",Text:"Central &amp; South America (MW)",ImgSrc:"CSA.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AHB",Handle:"HB",Text:"Central &amp; South America (W)",ImgSrc:"ACS.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AIA",Handle:"IA",Text:"Antarctic (MW)",ImgSrc:"ANT.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AIB",Handle:"IB",Text:"Africa &amp; The Middle East (MW)",ImgSrc:"AMI.gif",ImgMap:"null",PolyPts:"null"})

  p.fAdd({ID:"AIC",Handle:"IC",Text:"Africa &amp; The Middle East (W)",ImgSrc:"MIA.gif",ImgMap:"null",PolyPts:"null"})

 p.pNext=p.pChildren;
 p.pChildren=null;
}
clsMaxProNavigator.prototype.fDrawCharts=function (p)
{
 if(p==null)
  p = this.pChildren.fFirstOpen();
 //document.getElementById("dvChartHeader").innerHTML="Passport World Charts"):"")
 //alert(p+":"+(p?p.Handle:"xxx"))
 if(p==null) 
  p = this.pChildren;
	fAjaxCall({ID:"dvCharts",script:1,url:"include/Server/DBI.asp?VERB=Navigate&Handle="+(p?p.Handle:"")});
	if(!p || p.Handle=="0")
	{
		document.getElementById("dvSubMainHeader").innerHTML="<img "
			+ ' onmouseover="document.getElementById(\'img_wmw\').style.height=\'auto\';document.getElementById(\'img_wmw\').style.width=\'auto\';"'
			+ ' onmouseout="document.getElementById(\'img_wmw\').style.height=\'200px\';document.getElementById(\'img_wmw\').style.width=\'auto\';"'
			+ " style='height:200px;' id='img_wmw' SRC='images/maps/wmw.gif'>";
	}
	try
	{
		
		if(document.getElementById("dvSubMainBody"))
		{
			fAjaxCall({ID:"dvSubMainBody",fcallback:fCallBack,url:"include/Server/DBI.asp?VERB=ChartTable&Handle="+(p?p.Handle:"0")});
			fPageHandler().fGetActiveCustomer().fCart().fFixFields("Charts");
		}
	}
	catch(e){}
 return p;
}

 /**
 * Class clsRegProduct Client Prototypes
 * 
 * This class 
 * program uses multiple arrays for colors, color names (to  
 * create image names), gravity check boxes and number of balls.  
 * For alignment I also use an array of panels.
 * 
 * Follow instructions at top of the dialog window.
 * 
 * @author Terry McEntee
 * @date May 2007
 * 
 */
  /**
  * Draw prototype for clsRegProduct
  * @param el  an element that the will contain what is drawn.
  */
 clsRegProduct.prototype.fDraw = function (elProgram,elPermits)
 {   
  var aTxt=[];   
	 var exchange = fPageHandler().fSite().fExchange(1.0,"USD",fPageHandler().fSite().Currency);
	 var dataset=fPageHandler().fSite().fDataSet().toUpperCase();
  aTxt[aTxt.length] = ""
   +"<table class='m0px p0px' border='0' cellspacing='0' cellpadding='0' width='100%'>"
   +"<caption id='dvProductHeading' class='dvGrayBar al'>Product Information</caption>"
   +"<tr>"
   +"<th class='bold bgGold blgry ac'>Program</th>"
   +"<th class='bold bgGold blgry ac'>Serial Number</th>"
   +"<th class='bold bgGold blgry ac'>Version</th>"
   +"<th class='bold bgGold blgry brgry ac'>Registration Date</th>"
   +"</tr>"
   +"<tr>"
   +"<td class='bdrgry brn ac'>"+this.fProductName()+"&nbsp;</td>"
   +"<td class='bdrgry brn ac'>"+(this.newSN||this.fMember("SerialNumber"))+"&nbsp;</td>"
   +"<td class='bdrgry brn ac'>"+((this.newSN||this.fMember("Version")== 10)?"MAX Pro":String(this.fMember("Version")))+"&nbsp;</td>"
   +"<td class='bdrgry ac'>"+this.fMember("RegDate")+"&nbsp;</td>"
   +"</tr>";
   if(this.newSN)
   {
    aTxt[aTxt.length] = "<tr>"
    +"<th class='bdrgry brn ac'>Old Passport Program</th>"
    +"<td class='bdrgry brn ac'>"+this.fMember("SerialNumber")+"&nbsp;</td>"
    +"<td class='bdrgry brn ac'>"+this.fMember("Version")+"&nbsp;</td>"
    +"<th class='bdrgry ac'>To Be Deactivated</th>"
    +"</tr>";
   }
   if(this.fMember("Version") < 10 && this.fMember("SubClass") == "JM" && this.newSN == null)
   {
    var hUpgrades = fPageHandler().fProgramUpgrades();
//    alert(fSerialize(hUpgrades))
    for(var u in hUpgrades)
    {
     var Retail=hUpgrades[u].Retail;
     var Dealer=hUpgrades[u].Dealer;
     var Distributor=hUpgrades[u].Distributor;
     var VAD=hUpgrades[u].VAD;
     var TRX=hUpgrades[u].TRX;
     if(hUpgrades[u].FromID==this.fMember("ProductID"))
     {
      /*
// Code block for Upgrade Special Promotion
      if(hUpgrades[u].FromID==hUpgrades[u].ToID)
      {
       try
       {
        switch(parseInt(this.fMember("Version")))
        {
         case 9:
          Dealer=Distributor=VAD=TRX=Retail=0.0;
          break;
         case 8: case 7: case 6: case 5:
          Retail=(this.fMember("ProductID")==6?130.0:280.0);
          break;
        }
       }
       catch(e){
        alert(""
        +"There was a problem determining your Upgrade Price."
        +"\r\nWe are on hand to assist you with your upgrade."
        +"\r\nPlease, contact Jeppesen Marine Sales for assistance:\r\n\r\n(800) 946-2877\r\nDirect: (503) 579-1414"
        +"\r\n\r\nError:"+e.description);
       }
      }
      */
      aTxt[aTxt.length] = ""
       +"<tr>"
       +"<td class='pl2px bdrgry brn'><b><i>Upgrade&nbsp;Now&nbsp;Available!</i></b></td>"
       +"<td class='bdrgry brn'>"+hUpgrades[u].Description+"&nbsp;</td>"
       +"<td class='ac bdrgry brn'><input type='checkbox' "
       +" onclick='return fPageHandler().fToggleBox(this);' "
       +" cartaction='Toggle' "
       +" refresh='Profile' "
       +" actionadd='fPageHandler().fMaxProCart(\"Profile\")' " 
       +" actionremove='fPageHandler().fPassportCart(\"Profile\")' " 
       +" producttype='ProgramUpgrade' "
       +" weight='"+hUpgrades[u].Weight+"' "
       +" group='ProgramUpgrade' "
       +" productid='"+hUpgrades[u].ProductID+"' "
       +" Description='"+hUpgrades[u].Description.replace(/v10/,"v1")+"' "
       +" Retail='"+Retail+"' "
       +" Dealer='"+Dealer+"' "
       +" Distributor='"+Distributor+"' "
       +" VAD='"+VAD+"' "
       +" TRX='"+TRX+"' "
       +" id='ckPID_"+hUpgrades[u].ProductID+"' "
       +"></td>"
       +"<td class='bdrgry brn ar'>"+(Retail?Number(Retail*exchange).fFormatCurrency(2):"<i style='color:#FF0000;'>No Charge!</i>")+"</td>"
       +"</tr>";
     }
    }
   }

   hUpgrades = fPageHandler().fSoftwareUpgrades();
   aTxt[aTxt.length] = "<tr><td colspan=4 class='brgry'>"
   aTxt[aTxt.length] = "<table width='100%' border=0 cellpadding=0 cellspacing=0>";
    aTxt[aTxt.length] = "<tr>"
    +"<th class='pl0px bold bgGold bbgry ac'>Software&nbsp;Upgrades</th>"
    +"<th class='bold bgGold bbgry blgry ac'>Unlock&nbsp;Code</th>"
    +"<th class='bold bgGold bbgry blgry ac'>Price&nbsp;"+fPageHandler().fSite().Currency+"</th>"
    +"</tr>"
   for(var r in this.hUnLocks)
   {
    try
    {
     if(hUpgrades[r])
     {
      aTxt[aTxt.length] = "<tr>"
       +"<td class='pl2px bbgry MAXPRO'>"+hUpgrades[r].Name+"&nbsp;</td>"
       +"<td class='bbgry blgry ac MAXPRO'>Add&nbsp;To&nbsp;Cart&nbsp;<input type='checkbox' "
       +" onclick='return fPageHandler().fCartAction(this);' cartaction='Toggle' "
       +" producttype='"+hUpgrades[r].ProductType+"' "
       +" name='"+hUpgrades[r].Name+"' "
       +" group='"+hUpgrades[r].ProductID+"' "
       +" productid='"+hUpgrades[r].ProductID+"' "
       +" weight='"+hUpgrades[r].Weight+"' "
       +" partnumber='"+hUpgrades[r].PartNumber+"' "
       +" id='ckPID_"+hUpgrades[r].ProductID+"'"
       +" description='"+hUpgrades[r].Description+"'"
       +" Retail='0.0'"
       +" Dealer='0.0'"
       +" Distributor='0.0'"
       +" VAD='0.0'"
       +" TRX='0.0'"
       +"></td>"
       +"<td height=22 class='bbgry blgry ar MAXPRO'><i style='color:#FF0000;'>No Charge Upgrade!</i></td>"
       +"</tr>";
     }
     aTxt[aTxt.length] = "<tr>"
      +"<td class='pl2px pl0px bbgry PASSPORT'>"+hUpgrades[r].Name+"&nbsp;</td>"
      +"<td class='bbgry blgry ac PASSPORT'>"+this.hUnLocks[r].Permit+"&nbsp;</td>"
      +"<td height=22 class='bbgry blgry PASSPORT'>&nbsp;</td>"
      +"</tr>";
//     if(this.SetupNFR)  this.SetupNFR=0;
    }
    catch(e){}
   }
   var aNFRCartAutomation=new Array();
   if(this.Class=="DMAX" && this.SetupNFR!=1)
    this.SetupNFR=1;


   for(var r in hUpgrades)
   {
    var maxproonlyclass="";
    if(this.hUnLocks[r]==null)
    {
     aNFRCartAutomation.push("fPageHandler().fCartAction(fGD('ckPID_"+hUpgrades[r].ProductID+"'));");
     if(hUpgrades[r].ProductID==1457) // NFR Unlock code
     {
      aTxt[aTxt.length] = ""
       +"<input type='hidden' "
       +" cartaction='Toggle' "
       +" producttype='"+hUpgrades[r].ProductType+"' "
       +" name='"+hUpgrades[r].Name+"' "
       +" group='"+hUpgrades[r].ProductID+"' "
       +" productid='"+hUpgrades[r].ProductID+"' "
       +" weight='"+hUpgrades[r].Weight+"' "
       +" partnumber='"+hUpgrades[r].PartNumber+"' "
       +" id='ckPID_"+hUpgrades[r].ProductID+"'"
       +" description='"+hUpgrades[r].Description+"'"
       +" retail='"+hUpgrades[r].Retail+"'"
       +" dealer='"+hUpgrades[r].Dealer+"'"
       +" distributor='"+hUpgrades[r].Distributor+"'"
       +">";
     }
     else
     {
      var Retail=hUpgrades[r].fPrice();
      var Dealer=hUpgrades[r].Dealer;
      var Distributor=hUpgrades[r].Distributor;
      var VAD=hUpgrades[r].VAD;
      var TRX=hUpgrades[r].TRX;
/*
// Code block for Raster Plus Pack Special Promotion
      if(hUpgrades[r].Name=="Raster Plus Pack")
      {
       maxproonlyclass=this.newSN==null?" MAXPRO":"";
       try
       {
        switch(parseInt(this.fMember("Version")))
        {
         case 9:
          Dealer=Distributor=VAD=TRX=Retail=0.0;
          break;
         case 8: case 7: case 6: case 5:
          Retail=(this.fMember("ProductID")==6?50.0:50.0);
          break;
        }
       }
       catch(e)
       {
        alert(""
        +"There was a problem determining your Raster Upgrade Price."
        +"\r\nWe are on hand to assist you with your upgrade."
        +"\r\nPlease, contact Jeppesen Marine Sales  for assistance:\r\n\r\n(800) 946-2877\r\nDirect: (503) 579-1414"
        +"\r\n\r\nError:"+e.description);
       }
      }
      else 
*/
      if(this.hUnLocks[r])
      {
       maxproonlyclass=" MAXPRO";
       Dealer=Distributor=VAD=TRX=Retail=0.0;
      }
       
      aTxt[aTxt.length] = "<tr>"
       +"<td class='pl2px bbgry"+maxproonlyclass+"'>"+hUpgrades[r].Name+"&nbsp;</td>"
       +"<td class='bbgry blgry ac"+maxproonlyclass+"'>Add&nbsp;To&nbsp;Cart&nbsp;<input type='checkbox' "
       +" onclick='return fPageHandler().fCartAction(this);' cartaction='Toggle' "
       +" producttype='"+hUpgrades[r].ProductType+"' "
       +" name='"+hUpgrades[r].Name+"' "
       +" group='"+hUpgrades[r].ProductID+"' "
       +" productid='"+hUpgrades[r].ProductID+"' "
       +" weight='"+hUpgrades[r].Weight+"' "
       +" partnumber='"+hUpgrades[r].PartNumber+"' "
       +" id='ckPID_"+hUpgrades[r].ProductID+"'"
       +" description='"+hUpgrades[r].Description+"'"
       +" Retail='"+Retail+"'"
       +" Dealer='"+Dealer+"'"
       +" Distributor='"+Distributor+"'"
       +" VAD='"+VAD+"'"
       +" TRX='"+TRX+"'"
       +"></td>"
       +"<td height=22 class='bbgry blgry ar"+maxproonlyclass+"'>"+(Retail?Number(Retail*exchange).fFormatCurrency(2):"<i style='color:#FF0000;'>&nbsp;&nbsp;&nbsp;&nbsp;No Charge!</i>")+"&nbsp;</td>"
       +"</tr>";
     }
    }
   }
   aTxt[aTxt.length] = "</td></tr><tr></tr></table></td>";

  aTxt[aTxt.length] = "</table>";    
  elProgram.innerHTML=aTxt.join("");
  if(this.Class=="DMAX" && this.SetupNFR)
  {
   for(var a=0;a<aNFRCartAutomation.length;a++)
   {
    try
    {
//     alert(aNFRCartAutomation[a]);
     eval(aNFRCartAutomation[a]);
    }
    catch(e){alert("NFR Automation Failed :"+e.description);};
   }
   this.SetupNFR=0;
  }
  aTxt = [];
  if(this.fRegionCount() > 0) // && this.newSN == null)
  {			
   aTxt[aTxt.length] = ""
    +"<table class='m0px p0px bdrgry' border='0' cellspacing='0' cellpadding='0' width='100%'>"
    +"<caption id='dvPermitHeading' class='dvGrayBar al'>"
    +(dataset=="MAXPRO"?
      (
       "<a href='#' onclick='return fPageHandler().fLicenseFile();' class='MaxPro dvOrangebar fr bdr txtBlack bgTransparent'>Save License File</a>"
      ):""
     )
    +"Permits&nbsp;</caption>"
    +"<tr><td colspan=5 class='ac bold MaxPro p10px'>Price adjustments for chart region updates will be calculated at checkout.</td><tr>"
    +"<tr>"
    +"<th class='bold bgGold blgry bln ac'>Region</th>"
    +"<th class='bold bgGold blgry ac'>Permit Number</th>"
    +"<th class='bold bgGold blgry ac'>Purchase Date</th>"
    +(
      (
       "<th class='Passport bold bgGold blgry ac' width='10'>&nbsp;Folio&nbsp;</th>"
//       +"<th class='bold bgGold blgry ac' width='10'>&nbsp;Information&nbsp;</th>"
      )
     )
    +"<th class='bold bgGold blgry ac' width='10'>&nbsp;Update&nbsp;</th>"
    +"<th class='bold bgGold blgry brgry brn ac' width='10'>&nbsp;Price&nbsp;"+fPageHandler().fSite().Currency+"&nbsp;</th>"
    +"</tr>";
    
   var hRegions = this.fMember("hRegions");
   var hProducts = fPageHandler().fLoadProducts(hRegions);
   for(var r in hRegions)
   {
    try
    {
     aTxt[aTxt.length] = hRegions[r].fDrawPS("<tr>"
      +"<td class='bdrgry brn bln ac'>[RegionID]</td>"
      +"<td class='bdrgry brn ac'><b>[Permit]</b></td>"
      +"<td class='bdrgry brn ac'>[Date]</td>"
      +(
        (
         "<td class='Passport bdrgry brn ac'>[Folio]</td>"
/*
         +"<td class='MaxPro bdrgry brn ac'><input type='button' class='clsButton' "
         +" onmouseover=\"this.style.border='2px inset';\""
         +" onmouseout=\"this.style.border='2px outset';\""
         +"style='width:60px;' onclick='this.value=(this.value==\"Close\"?\"More\":\"Close\"); return fOpenDiv(\"dvMore_[RegionID][Folio]\");' value='More'"
         +"></td>"
*/
        )
       )
      +"<td class='bdrgry brn ac'><input type='checkbox' "
      +(hRegions[r].TransasCharts >0 || this.newSN != null ?" DISABLED ":"")
      +" onclick='return fPageHandler().fCartAction(this);' "
      +" cartaction='Toggle' "
      +" producttype='ChartUpdate' "
      +" productid='"+hRegions[r].ProductID+"' "
      +" weight='"+hProducts[String(hRegions[r].ProductID)].Weight+"' "
      +" group='"+hRegions[r].ProductID+"' "
      +" id='ckPID_"+hRegions[r].ProductID+"'"
      +" name='"+hProducts[String(hRegions[r].ProductID)].Name+"'" 
      +" description='"+hProducts[String(hRegions[r].ProductID)].Description+"'"
      +" retail='"+hProducts[String(hRegions[r].ProductID)].Retail+"'"
      +" retailupdate='"+hProducts[String(hRegions[r].ProductID)].RetailUpdate+"'"
      +" dealer='"+hProducts[String(hRegions[r].ProductID)].Dealer+"'" 
      +" dealerupdate='"+hProducts[String(hRegions[r].ProductID)].DealerUpdate+"'" 
      +" distributor='"+hProducts[String(hRegions[r].ProductID)].Distributor+"'" 
      +" distributorupdate='"+hProducts[String(hRegions[r].ProductID)].DistributorUpdate+"'" 
      +"></td>"
      +"<td class='bdrgry brn ar'>"+Number(hProducts[String(hRegions[r].ProductID)].RetailUpdate*exchange).fFormatCurrency(2)+"</td>"
      +"</tr>"
      +(this.fMember("SubClass") != "JM"?"":(""
        +"<tr><td colspan='6'><div style='margin-left:30px;' class='MaxPro bdr' id='dvMore_[RegionID][Folio]'>"
						  +"<br>"+(hMappings[r]?("Your Passport Region <b>[RegionID]</b> "
						  +"is equivalent to the following C-MAP MAX Pro regions:<br>"+hMappings[r].fMapsTo()):"<b>No upgrade to MAXPro data is available for region [RegionID].</b>")
						 ))
						+""
//						+"<br>Edition differences for [RegionID] from WF[Folio] to WF34"
						+"</div></td>"
      +"</tr>");
     }
     catch(e){}
   }
   aTxt[aTxt.length] = "</table>";
  }
  elPermits.innerHTML=aTxt.join("");
 }
 clsDealer.prototype.fRunReport = function (rpt)
{
 if(rpt.id=="DlrAccountRpt")
  this.RptRep=document.getElementById('selAccountRpt').options[document.getElementById('selAccountRpt').selectedIndex].value;
 this.RptReport = String(rpt.id).replace(/Dlr/,"");
 var hAjax = {
  ID:"dvSubMainBody"
  ,fcallback:fCallBack
  ,method:"post"
  ,url:"include/Server/DBI.asp?VERB=DealerReport&Operator="+fSerialize(this).replace(/\&/g," and ")
 };
 fAjaxCall(hAjax);
}
clsDealer.prototype.fOpen = function (rpt)
{
 this.RptReport = String(rpt.id).replace(/Dlr/,"");
 var hAjax = {
  ID:"dvSubMainBody"
  ,fcallback:fCallBack
  ,method:"post"
  ,url:"include/Server/DBI.asp?VERB=DealerReport&Operator="+fSerialize(this).replace(/\&/g," and ")
 };
 fAjaxCall(hAjax);
}
clsCustomer.prototype.fDrawCart = function (el)
{
 try
 {
  el = document.getElementById("dvCartTable")
  return this.fCart().fDraw(el);
 }
 catch(e){}
}
clsDemographics.prototype.fGetFullName = _fGetFullName;
/**
 * Class clsMenu Client Prototypes
 * 
 * @author Richard Taylor-Kenny
 * @date May 2007
 * 
 */

/**
 * Draw prototype for clsMenu
 * @param el  an element that the will contain what is drawn.
*/
 clsMenu.prototype.fShowProfile = function(how)
 {
  try{document.getElementById("mnuProfile").style.display=how?"":"none";}catch(e){};
 }
 clsMenu.prototype.fShowVouchers = function(how)
 {
  try{document.getElementById("mnuVouchers").style.display=how?"":"none";}catch(e){};
 }


/**
 * Draw prototype for clsMenu
 * @param el  an element that the will contain what is drawn.
*/
 clsMenu.prototype.fShowCart = function(how)
 {
  try{document.getElementById("mnuCart").style.display=how?"":"none";}catch(e){};
 }

clsCart.prototype.fRemoveVoucher = function (v)
{
 var voucher=this.aVouchers.splice(v,1);
 try
 {
  fGD("msgVoucher").innerHTML=voucher.Key+" has been removed.";
  this.fDrawGoodVouchers();
 }
 catch(e){}
}
clsCart.prototype.fValidateVoucher = function (elid)
{
 var el = fGD(elid);
 if(String(el.value).replace(/ /g,"") == "")
  fGD("msgVoucher").innerHTML="Please, provide a voucher to validate.";
 else if(String(el.value).charAt(0).toUpperCase() != "U")
 {
  fGD("msgVoucher").innerHTML="<font class='txtRed'>The voucher you entered, "+el.value+", is invalid.</font>";
 }
 else if(this.fFindVoucher(String(el.value).replace(/ /g,"")))
 {
  fGD("msgVoucher").innerHTML="<font class='txtRed'>The voucher you entered, "+el.value+", is already in the list.</font>";
  el.value = "";
 }
 else
 {
  try
  {
   fAjaxCall({ID:"none",script:1,url:"include/server/DBI.asp?VERB=VoucherValidation&Voucher="+el.value});
   el.value="";
   this.fDrawGoodVouchers();
  }
  catch(e)
  {
   this.fError(e);
  }
 }
 el.focus();
}
clsCart.prototype.fDrawGoodVouchers = function ()
{
 var aTxt = new Array();
 for(var v=0;v<this.aVouchers.length;v++)
 {
  aTxt.push("<tr><th class=ar>"+(v+1)+")</th>"
  +"<td>"+this.aVouchers[v].Key+"</td>"
  +"<td><input type=button onclick='fPageHandler().fCart().fRemoveVoucher("+v+");return false' value='Remove' "
   +" class='clsButton' "
   +" onmouseover='this.style.border=\"2px inset\";'"
   +" onmouseout='this.style.border=\"2px outset\";'"
   +"></td></tr>");
 }
 if(this.aVouchers.length == 0)
  fGD("GoodVouchers").innerHTML="";
 else
 {
  fGD("GoodVouchers").innerHTML="<table class='bdr'><caption>Validated Vouchers</caption>"+aTxt.join("")+"</table>"
   +"<p><input type=button value='Check Out' onclick='return fPageHandler().fOnSubmit(\"Cart\");' "
   +" class='clsButton' "
   +" onmouseover='this.style.border=\"2px inset\";'"
   +" onmouseout='this.style.border=\"2px outset\";'"
   +" >&nbsp;&nbsp;&nbsp;or continue browsing.";
 }
}
clsCart.prototype.fFindVoucher = function (f)
{
 for(var v=0;v<this.aVouchers.length;v++)
 {
  if(f==this.aVouchers[v].Key)
   return this.aVouchers[v];
 }
 return null;
}
clsCart.prototype.fFreightAmount= function (cust)
{	
 try
 {
  if(cust)
  {
	 	var extra=this.fWeight()-fPageHandler().OVERWEIGHT;
	 	var cost=Math.max(0.0,this.fWeight()?1.0:0.0)*cust.hShipping.$hShippingMethods[cust.hShipping.ShipperID].FreightCharge;
	 	if(extra > 0.0)
	 	 cost += Math.ceil(extra)*cust.hShipping.$hShippingMethods[cust.hShipping.ShipperID].PerPoundExtra;
	 	this.fFreight(cost);
	 }
	}
	catch(e){/*alert("ERROR:Calculating Freight Charges");*/}
 return this.Freight;
}


function fCallBack(doc)
{
 if(doc.responseText.substr(1,12).replace(/SCRIPT/i,"")!=doc.responseTe