this.nVer = navigator.appVersion;
this.nAgt = navigator.userAgent;
this.browserName = navigator.appName;
this.fullVersion = ''+parseFloat(navigator.appVersion);
this.majorVersion = parseInt(navigator.appVersion,10);
this.nameOffset;
this.verOffset;
this.ix;
// In Opera, the true version is after "Opera" or after "Version"
if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
browserName = "Opera";
fullVersion = nAgt.substring(verOffset+6);
if ((verOffset=nAgt.indexOf("Version"))!=-1)
fullVersion = nAgt.substring(verOffset+8);
}
// In MSIE, the true version is after "MSIE" in userAgent
else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
browserName = "Microsoft Internet Explorer";
fullVersion = nAgt.substring(verOffset+5);
}
// In Chrome, the true version is after "Chrome"
else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
browserName = "Chrome";
fullVersion = nAgt.substring(verOffset+7);
}
// In Safari, the true version is after "Safari" or after "Version"
else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
browserName = "Safari";
fullVersion = nAgt.substring(verOffset+7);
if ((verOffset=nAgt.indexOf("Version"))!=-1)
fullVersion = nAgt.substring(verOffset+8);
}
// In Firefox, the true version is after "Firefox"
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
browserName = "Firefox";
fullVersion = nAgt.substring(verOffset+8);
}
// In most other browsers, "name/version" is at the end of userAgent
else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) )
{
browserName = nAgt.substring(nameOffset,verOffset);
fullVersion = nAgt.substring(verOffset+1);
if (browserName.toLowerCase()==browserName.toUpperCase()) {
browserName = navigator.appName;
}
}
// trim the fullVersion string at semicolon/space if present
if ((ix=fullVersion.indexOf(";"))!=-1) fullVersion=fullVersion.substring(0,ix);
if ((ix=fullVersion.indexOf(" "))!=-1) fullVersion=fullVersion.substring(0,ix);
majorVersion = parseInt(''+fullVersion,10);
if (isNaN(majorVersion)) {
fullVersion = ''+parseFloat(navigator.appVersion);
majorVersion = parseInt(navigator.appVersion,10);
}
//----------
function GetBrowserName(){
return browserName;
}
//----------
function GetBrowserVersion(){
return fullVersion;
}
//----------
function GoToTASService(environment, brand) {
if (brand !== "") {
brand = "&b=" + brand;
}
if (window.location.hostname === "ecare.local") {
window.open("http://service.local/consumer/?m=" + environment + brand);
} else {
window.open("https://service.e-care.nl/consumer/?m=" + environment + brand);
}
}
//----------
function StartLogin_Production() {
var HwCode = "";
try{
if (WebPrinter) {
HwCode = WebPrinter.HwCode();
}
} catch(errorInfo) {
HwCode = "";
}
if (document.login_form.PointNr.value.replace(/\s/ig, '').length != 4) {
alert("U heeft geen correct point-nummer ingevoerd!");
document.login_form.PointNr.focus();
return;
}
if(document.login_form.LoginName.value.replace(/\s/ig, '') == "") {
alert("U heeft geen gebruikersnaam ingevoerd!");
document.login_form.LoginName.focus();
return;
}
if(document.login_form.PassWord.value.replace(/\s/ig, '') == "") {
alert("U heeft geen Password ingevoerd!");
document.login_form.PassWord.focus();
return;
}
else {
//document.login_form.target = "_blank";
if(document.login_form.PointNr.value.replace(/\s/ig, '') == "9999"){
document.login_form.action = "http://www.e-care.nl/E-Care/App/WebExternal/webservelexe.exe/login?UserAccept=Check_BasePath.htm&UserReject=RejectPage.htm&InActivePage=InActivePage.htm&BlockPage=BlockPage.htm";
document.login_form.submit();
} else{
if(window.location.hostname.toLowerCase() == "localnl"){
document.login_form.action = "http://localnl/E-Care/App/WebServel/webservelexe.exe/login?UserAccept=Check_BasePath.htm&UserReject=RejectPage.htm&InActivePage=InActivePage.htm&BlockPage=BlockPage.htm&Tab=Production&HwCode=" + HwCode;
} else {
document.login_form.action = "http://www.e-care.nl/E-Care/App/WebServel/webservelexe.exe/login?UserAccept=Check_BasePath.htm&UserReject=RejectPage.htm&InActivePage=InActivePage.htm&BlockPage=BlockPage.htm&Tab=Production&HwCode=" + HwCode;
}
document.login_form.submit();
}
}
}
//----------
function EvalContactForm() {
if (document.contact_form.Salutation.value == "") {
alert("U heeft geen aanhef geselecteerd!");
document.contact_form.Salutation.focus();
return false;
}
else if (document.contact_form.Name.value.replace(/\s/ig, '') == "") {
alert("U heeft geen naam ingevoerd!");
document.contact_form.Name.focus();
return false;
}
else if (document.contact_form.Email.value.replace(/\s/ig, '') == "") {
alert("U heeft geen e-mail adres ingevoerd!");
document.contact_form.Email.focus();
return false;
}
else if (!CheckEmail(document.contact_form.Email.value.replace(/\s/ig, ''))) {
alert("U heeft geen correct e-mail adres ingevoerd!");
document.contact_form.Email.focus();
return false;
}
else if (document.contact_form.Subject.value == "") {
alert("U heeft geen onderwerp geselecteerd!");
document.contact_form.Subject.focus();
return false;
}
else if (document.contact_form.Message.value.replace(/\s/ig, '') == "") {
alert("U heeft geen bericht ingevoerd!");
document.contact_form.Message.focus();
return false;
}
else {
return true;
}
}
//----------
function EvalAccountForm() {
if (document.account_form.Salutation.value == "") {
alert("U heeft geen aanhef geselecteerd!");
document.account_form.Salutation.focus();
return false;
}
else if (document.account_form.Name.value.replace(/\s/ig, '') == "") {
alert("U heeft geen naam ingevoerd!");
document.account_form.Name.focus();
return false;
}
else if (document.account_form.CompanyName.value.replace(/\s/ig, '') == "") {
alert("U heeft geen bedrijfsnaam ingevoerd!");
document.account_form.CompanyName.focus();
return false;
}
else if (document.account_form.Address.value.replace(/\s/ig, '') == "") {
alert("U heeft geen adres ingevoerd!");
document.account_form.Address.focus();
return false;
}
else if (document.account_form.ZipCode.value.replace(/\s/ig, '') == "") {
alert("U heeft geen postcode ingevoerd!");
document.account_form.ZipCode.focus();
return false;
}
else if (document.account_form.City.value.replace(/\s/ig, '') == "") {
alert("U heeft geen plaats ingevoerd!");
document.account_form.City.focus();
return false;
}
else if (document.account_form.Email.value.replace(/\s/ig, '') == "") {
alert("U heeft geen e-mail adres ingevoerd!");
document.account_form.Email.focus();
return false;
}
else if (!CheckEmail(document.account_form.Email.value.replace(/\s/ig, ''))) {
alert("U heeft geen correct e-mail adres ingevoerd!");
document.account_form.Email.focus();
return false;
}
else if (document.account_form.Phone.value.replace(/\s/ig, '') == "") {
alert("U heeft geen telefoonnummer ingevoerd!");
document.account_form.Phone.focus();
return false;
}
else {
return true;
}
}
//----------
function FAQSlideToggle(answerboxid, glyphiconid) {
$("#" + answerboxid).slideToggle();
if (document.getElementById(glyphiconid)) {
if (document.getElementById(glyphiconid).className == "glyphicon glyphicon-plus") {
document.getElementById(glyphiconid).className = "glyphicon glyphicon-minus";
} else {
document.getElementById(glyphiconid).className = "glyphicon glyphicon-plus";
}
}
}
//----------
function SSMChoiceSlideToggle(textid) {
$("#" + textid).slideToggle();
}
//----------
function ScrollToBottom() {
window.scrollTo(0,document.body.scrollHeight);
}
/* ************************************ */
/* AJAXREQUEST */
/* ************************************ */
function AjaxGetData(url, querystring, method, asynchronous, responsetype, readyfunction) {
var result = "";
var request = false;
try {
request = new XMLHttpRequest();
} catch(e) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!request) {
alert('Cannot create XMLHTTP instance');
return false;
}
request.onreadystatechange=function() {
if (request.readyState==4 && request.status==200) {
if (responsetype.toLowerCase() == 'xml') {
result = request.responseXML;
} else {
result = request.responseText;
}
if (readyfunction != '') {
eval(readyfunction + '(result)');
}
}
}
if (method == 'GET') {
//if (url.indexOf("?")==-1) {
// url = url + "?" + querystring;
//} else {
// url = url + "&" + querystring;
//}
url = querystring;
}
request.open(method, url, asynchronous);
if (method == 'GET') {
querystring = null;
}
request.send(querystring);
if (asynchronous == false) {
if (responsetype.toLowerCase() == 'xml') {
return request.responseXML;
} else {
return request.responseText;
}
}
}
/* **************** */
/* STRING FUNCTIONS */
/* **************** */
function ProtoTypeLPad(length) {
if (ProtoTypeLPad.arguments.length > 1) {
var character = ProtoTypeLPad.arguments[1];
} else {
character = ' ';
}
var str = this;
while (str.length < length) {
str = character + str;
}
return str.substr(str.length - length, length);
}
String.prototype.lpad = ProtoTypeLPad;
function ProtoTypeRPad(length) {
if (ProtoTypeRPad.arguments.length > 1) {
var character = ProtoTypeRPad.arguments[1];
} else {
character = ' ';
}
var str = this;
while (str.length < length) {
str += character;
}
return str.substr(0, length);
}
String.prototype.rpad = ProtoTypeRPad;
function ProtoTypeLTrim() {
if (ProtoTypeLTrim.arguments.length > 0) {
var characters = ProtoTypeLTrim.arguments[0];
} else {
characters = ' ';
}
var str = this;
var regex = new RegExp("^[" + characters + "]*", "ig");
return str.replace(regex, '');
}
String.prototype.ltrim = ProtoTypeLTrim;
function ProtoTypeRTrim() {
if (ProtoTypeRTrim.arguments.length > 0) {
var characters = ProtoTypeRTrim.arguments[0];
} else {
characters = ' ';
}
var str = this;
var regex = new RegExp("[" + characters + "]*$", "ig");
return str.replace(regex, '');
}
String.prototype.rtrim = ProtoTypeRTrim;
function ProtoTypeTrim() {
if (ProtoTypeTrim.arguments.length > 0) {
var characters = ProtoTypeTrim.arguments[0];
} else {
characters = ' ';
}
return this.ltrim(characters).rtrim(characters);
}
String.prototype.trim = ProtoTypeTrim;
//----------
function CheckEmail(str){
var at = "@";
var dot = ".";
var lat = str.indexOf(at);
var lstr = str.length;
var ldot = str.indexOf(dot);
if (lat==-1 || lat==0 || lat==lstr){
return false
}
else if (ldot==-1 || ldot==0 || ldot==lstr){
return false
}
else if (str.indexOf(at,(lat+1))!=-1){
return false
}
else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
return false
}
else if (str.indexOf(dot,(lat+2))==-1){
return false
}
else if (str.substring(lstr,(lstr-1))=="."){
return false
}
else if (str.substring(lstr-1,(lstr-2))=="."){
return false
}
else if (str.indexOf(" ")!=-1){
return false
}
else{
return true
}
}
//----------
function ClassNew(obj, new_style) {
obj.className = new_style;
}
// *****************************************************************************************************************
// Generieke functies om attributen te parsen
// *****************************************************************************************************************
function AllowCharset(e) {
// Only allow specified charactersets
// use onkeypress to see the difference between e.g. A and a and 5 and %
if (!e) var e = window.event;
var srcEl = e.srcElement ? e.srcElement : e.target;
if (srcEl.getAttribute) {
if (srcEl.getAttribute('allowedcharsets')) {
if (e.type == 'paste') {
var clipdata = window.clipboardData.getData("Text");
clipdata = AllowCharacters(clipdata, srcEl.getAttribute('allowedcharsets'));
window.clipboardData.setData("Text", clipdata);
e.returnValue = true;
return true;
}
if (e.type == 'keypress') {
var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
switch (keyCode) {
case 13 : // enter
case 8 : // backspace
//case 37 : // arrow left
//case 39 : // arrow right
//case 36 : // home
//case 35 : // end
case 46 : // delete
e.returnValue = true;
return true;
break;
default:
break;
}
var character = String.fromCharCode(keyCode);
var comparecharacter = AllowCharacters(character, srcEl.getAttribute('allowedcharsets'));
if (comparecharacter == character) {
if(e.preventDefault){
}else if(event){
event.returnValue = true;
}
return true;
} else {
if(e.preventDefault){
e.preventDefault();
}else if(event){
event.returnValue = false;
}
return false;
}
}
}
}
}
function AllowCharacters(str, charset) {
// Only allow specified charactersets
// if typed key is not resulting in a character then:
charset = charset.toLowerCase();
var re = new RegExp('[^a-z]+', 'gi');
charset = charset.replace(re, ',');
characterlist = charset.split(',');
characterlistlength = characterlist.length;
var regString = '';
for (var i = 0; i < characterlistlength; i++) {
// loop through all arguments to set all regular expression options
switch(characterlist[i]) {
case 'all':
// if "all" is one of the options, then don not do anything
return;
break;
case 'numeric':
regString += '0-9';
break;
case 'alpha':
regString += 'a-z';
break;
case 'space':
regString += '\\s';
break;
case 'slash':
regString += '\\/';
break;
case 'backslash':
regString += '\\\\';
break;
case 'period':
case 'point':
regString += '\\.';
break;
case 'comma':
regString += ',';
break;
case 'hyphen':
regString += '-';
break;
case 'underscore':
regString += '_';
break;
case 'at':
regString += '@';
break;
case 'questionmark':
regString += '\\?';
break;
case 'noteofexclamation':
regString += '\\!';
break;
case 'colon':
regString += ':';
break;
case 'semicolon':
regString += ';';
break;
case 'euro':
regString += '€';
break;
case 'parenthesis':
regString += '\\(\\)';
break;
case 'money': // even uitgezet ivm aanvulling en verbetering van deze functie
i = -1;
regString = "";
characterlist = new Array();
characterlist[characterlist.length] = 'numeric';
characterlist[characterlist.length] = 'comma';
characterlist[characterlist.length] = 'period';
characterlistlength = characterlist.length;
break;
}
}
// Regular Expression replaces all characters that are not in the allowlist;
regString = '[^' + regString + ']+';
re = new RegExp(regString, 'gi');
str = str.replace(re, '');
// if (','.concat(charset, ',').indexOf(',money,') >= 0) {
// // if money, then check further
// // first replace all comma's bij periods
// re = new RegExp(',', 'g');
// obj.value = obj.value.replace(re, '.');
// // only keep first period
// var arrObj = obj.value.split('.');
// if (arrObj.length > 1) {
// obj.value = arrObj.shift().concat('.', arrObj.join('').substr(0,2));
// }
// // put zero in front if needed
// re = new RegExp('^\\.');
// str = str.replace(re, '0.');
// }
return str;
}
function LoopEventObjects() {
// ****************************************
// For Allowed CharSets
// ****************************************
var TextContainingTypes = new Array('input', 'textarea');
for (var i = 0; i < TextContainingTypes.length; i++) {
var aObjects = document.getElementsByTagName(TextContainingTypes[i]);
for (var j = 0; j < aObjects.length; j++) {
var obj = aObjects[j];
if (obj.getAttribute) {
if (obj.getAttribute('allowedcharsets')) {
if(obj.addEventListener){
obj.addEventListener("keypress", AllowCharset, false);
}else if(obj.attachEvent){
obj.attachEvent('onkeypress', AllowCharset);
}
if (obj.getAttribute('allowedcharsetsonpaste')) {
if (obj.getAttribute('allowedcharsetsonpaste').toLowerCase()!="false") {
if(obj.addEventListener){
obj.addEventListener("paste", AllowCharset, false);
}else if(obj.attachEvent){
obj.attachEvent('onpaste', AllowCharset);
}
}
} else {
// if not defined, onpaste should be applied
if(obj.addEventListener){
obj.addEventListener("paste", AllowCharset, false);
}else if(obj.attachEvent){
obj.attachEvent('onpaste', AllowCharset);
}
}
}
}
}
}
// ****************************************
// For MouseOver/Mouseout Functionality
// ****************************************
if(document.all){
var aObjects = document.all;
}else{
var aObjects = document.getElementsByTagName("body")[0].getElementsByTagName("*");
}
for (var i = 0; i < aObjects.length; i++) {
var obj = aObjects[i];
if (obj.getAttribute) {
if (obj.getAttribute('overclass') != null) {
if(obj.addEventListener){
obj.addEventListener("mouseout", overclassElementOut, false);
obj.addEventListener("mouseover", overclassElementOver, false);
}else if(obj.attachEvent){
obj.attachEvent('onmouseout', overclassElementOut);
obj.attachEvent('onmouseover', overclassElementOver);
}
}
}
}
// ****************************************
// For Trim Functionality
// ****************************************
if(document.all){
var aObjects = document.all;
}else{
var aObjects = document.getElementsByTagName("body")[0].getElementsByTagName("*");
}
for (var i = 0; i < aObjects.length; i++) {
var obj = aObjects[i];
if (obj.getAttribute) {
if (obj.getAttribute('trim')) {
if (obj.getAttribute('trim').toLowerCase()!="false") {
if(obj.addEventListener){
obj.addEventListener("blur", TrimValue, false);
}else if(obj.attachEvent){
obj.attachEvent('onblur', TrimValue);
}
}
}
}
}
// ****************************************
// For Uppercase obligatory
// ****************************************
var TextContainingTypes = new Array('input', 'textarea');
for (var i = 0; i < TextContainingTypes.length; i++) {
var aObjects = document.getElementsByTagName(TextContainingTypes[i]);
for (var j = 0; j < aObjects.length; j++) {
var obj = aObjects[j];
if (obj.getAttribute) {
if (obj.getAttribute('uppercase')) {
if (obj.getAttribute('uppercase').toLowerCase()!="false") {
if(obj.addEventListener){
obj.addEventListener("keypress", OnlyUppercase, false);
}else if(obj.attachEvent){
obj.attachEvent('onkeypress', OnlyUppercase);
}
if (obj.getAttribute('uppercaseonpaste')) {
if (obj.getAttribute('uppercaseonpaste').toLowerCase()!="false") {
if(obj.addEventListener){
obj.addEventListener("paste", OnlyUppercase, false);
}else if(obj.attachEvent){
obj.attachEvent('onpaste', OnlyUppercase);
}
}
} else {
// if not defined, onpaste should be applied
if(obj.addEventListener){
obj.addEventListener("paste", OnlyUppercase, false);
}else if(obj.attachEvent){
obj.attachEvent('onpaste', OnlyUppercase);
}
}
}
}
}
}
}
}
function OnlyUppercase(e) {
// Only allow uppercase characters, automatically convert uppercases
// use onkeypress to see the difference between e.g. A and a and 5 and %
if (!e) var e = window.event;
var srcEl = e.srcElement ? e.srcElement : e.target;
if (srcEl.getAttribute) {
if (srcEl.getAttribute('uppercase')) {
if (e.type == 'paste') {
var clipdata = window.clipboardData.getData("Text");
clipdata = clipdata.toUpperCase();
window.clipboardData.setData("Text", clipdata);
e.returnValue = true;
return true;
}
if (e.type == 'keypress') {
var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
//alert(keyCode);
switch (keyCode) {
case 13: // enter
e.returnValue = true;
return true;
break;
default:
break;
}
var character = String.fromCharCode(keyCode);
character = character.toUpperCase();
//if (e.preventDefault && character != ""){
// srcEl.value += character;
// e.preventDefault();
//}else
if(e.keyCode){
e.keyCode = character.charCodeAt(0);
event.returnValue = true;
}
}
}
}
}
//----------
function DoAllUpperCase(elem){
elem.value = elem.value.toUpperCase();
}
if(window.addEventListener){
window.addEventListener("load", LoopEventObjects, false);
}else if(window.attachEvent){
window.attachEvent('onload', LoopEventObjects);
}