<!--
function m_htmlTitle() {
   var t = new String(document.location);
   t = t.substr(t.indexOf('/')+2);
   t = t.substr(t.indexOf('/'));
   document.title = 'ScanAlert -' + t;
}
function m_setc(obj,cln) {
   obj.className = cln;
}
function m_topMenuOn(p,sec,lang) {
   var e = document.getElementById('topMenu'  +p); 
   if(e) e.src = '/images/'+(lang&&'EN'!=lang?lang.toLowerCase()+'/':'')+'topMenu-'+sec+'-on-tx'+p+'.gif';
}
function m_topMenuOut(p,sec,lang) {
   var e = document.getElementById('topMenu'  +p); 
   if(e) e.src = '/images/'+(lang&&'EN'!=lang?lang.toLowerCase()+'/':'')+'topMenu-'+sec+'-off-tx'+p+'.gif';
}
function m_setLang(lang) {
   var path = document.location.pathname
   if(path == '/customer/Login.sa') {
      document.location = '/customer/Login.sa?lang='+lang;
      return;
   }
   myregexp = /\/site\/([a-z][a-z])\/(.*)/;
   mymatch = myregexp.exec(path);
   if(mymatch) {
      document.location = new String(document.location).replace("/site/"+mymatch[1]+"/","/site/"+lang.toLowerCase()+"/");
      return;
   }
   document.location = '/?lang='+lang;
}
function replaceAll(str, searchTerm, replaceWith, ignoreCase )   {
   var regex = "/"+searchTerm+"/g";
   if(ignoreCase) regex += "i";
   return str.replace(eval(regex), replaceWith);
}
function getHTTPObject() {
   var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
   try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
      try {
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
         xmlhttp = false;
      }
   }
@else
   xmlhttp = false;
@end @*/
   if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
      try {
         xmlhttp = new XMLHttpRequest();
      } catch (e) {
         xmlhttp = false;
      }
   }
   return xmlhttp;
}
function m_curl(url,rpcfunc,rpckey) {
   var http = getHTTPObject();
   http.open("GET",url,true);
   http.onreadystatechange = function() {
   if(http.readyState == 4) {
      if(rpcfunc) {
         if(rpckey) {
            eval(rpcfunc+'("'+escape(http.responseText)+'","'+rpckey+'")');
         } else {
            eval(rpcfunc+'("'+escape(http.responseText)+'")');
         }
      }
   }
   }
   http.send(null);
}
function m_rpc_load(url,layId) {
   if(!document.getElementById(layId)) return;
   var http = getHTTPObject();
   http.open("GET",url,true);
   http.onreadystatechange = function() { if(http.readyState == 4) {document.getElementById(layId).innerHTML=http.responseText; } }
   http.send(null);
}
function m_setc(obj,cln) {
   obj.className = cln;
}
function winHeight() {
   if (parseInt(navigator.appVersion)>3) {
      if (navigator.appName=="Netscape") { return window.innerHeight; }
      if (navigator.appName.indexOf("Microsoft")!=-1) { return document.body.offsetHeight; }
   }
   return 0;
}
function winWidth() {
   if (parseInt(navigator.appVersion)>3) {
      if (navigator.appName=="Netscape") { return window.innerWidth; }
      if (navigator.appName.indexOf("Microsoft")!=-1) { return document.body.offsetWidth; }
   }
   return 0;
}
function isFlashInstalled() {
   if(navigator && navigator.plugins && navigator.plugins.length) {
      if(navigator.plugins["Shockwave Flash"]    ) { return true; }
      if(navigator.plugins["Shockwave Flash 2.0"]) { return true; }
   } else if(navigator && navigator.mimeTypes && navigator.mimeTypes.length) {
      var ele = navigator.mimeTypes['application/x-shockwave-flash'];
      if(ele && ele.enabledPlugin) { return true; }
   } else if (window.ActiveXObject) {
      for(var i = 2; i <= 20; i++) { 
         try {
            if(eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+i+"');")) { return true; } 
         } catch(e) { }
      }
   }
   return false;
}
function URLencode(sStr) {
    return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
}
function goToPage(key) {
   var url;
   if     (key == 'menu1') {  url = '/Content.sa?sec=1&sub=0'; }
   else if(key == 'menu2') {  url = '/Content.sa?sec=2&sub=0'; }
   else if(key == 'menu3') {  url = '/Content.sa?sec=3&sub=0'; }
   else if(key == 'menu4') {  url = '/Content.sa?sec=4&sub=0'; }
   else if(key == 'menu5') {  url = '/Content.sa?sec=5&sub=0'; }
   else if(key == 'menu6') {  url = '/Content.sa?sec=6&sub=0'; }
   else if(key == 'menu7') {  url = '/Content.sa?sec=7&sub=0'; }
   else if(key == 'store'               ) {  url = '/Content.sa?u=1'; }
   else if(key == 'isitsafe'            ) {  url = '/Content.sa?page=isitsafe'; }
   else if(key == 'custLogos'           ) {  url = '/directory/index.html'; }
   else if(key == 'becomehs'            ) {  url = '/Content.sa?sec=2&sub=4'; }
   else if(key == 'moreinfo'            ) {  url = '/Content.sa?sec=2&sub=4'; }
   else if(key == 'techWhitepaper'      ) {  url = '//images.scanalert.com/pdf/ScanAlert_Technology.pdf'; }
   else if(key == 'demoShoppers'        ) {  url = '/Content.sa?w=550&h=350&demo=4'; }
   else if(key == 'demoTestimonialVideo') {  url = '/Content.sa?w=400&h=350&demo=2'; } //vdemo(2,400,350); return; }
   if(url) { document.location = url; return; }
   try { if(goToPageSub(key)) { return; } } catch(ex) { }
   alert('Unsupported Link \'' + key + '\'');
}
function vdemo(id,w,h) {
   document.location = '/Content.sa?w='+w+'&h='+h+'&demo='+id;
}
function setImg(id,src) {
   var ele = document.getElementById(id);
   if(!ele) { return; }
   if(src.indexOf('.') < 0) { src = src + '.gif';   }
   if(src.indexOf('/') < 0) { src = '/images/'+src; }
   ele.src = src;
}
function popup(url,name,w,h,opt,center) {
   if(!w && !h && !opt && !center) {
      win = window.open(url);
   } else {
      if(center) {
         var l = (screen.width/2)-(w/2);
         var t = (screen.height/2)-(h/2);
         opt = opt + ',LEFT='+l+',TOP='+t;
      }
      opt = 'WIDTH='+w+',HEIGHT='+h+','+opt;
      win = window.open(url,name,opt);
   }
   return win;
}
function openWin(url,name,h,w,s,r,center) {
   if(!w) w = 200;
   if(!h) h = 400;
   var opt = '';
   var win;
   if(r) opt = opt + ',resizable=1';
   if(s) opt = opt + ',scrollbars=1';
   if(center) {
      var l = (screen.width/2)-(w/2);
      var t = (screen.height/2)-(h/2);
      opt = opt + ',LEFT='+l+',TOP='+t;
   }
   opt = 'WIDTH='+w+',HEIGHT='+h+','+opt;
   return window.open(url,name,opt);
}
function linkConf(url,msg) {
   if(!msg) { msg = "Are you sure?"; }
   if(confirm(msg)) { document.location=url; }
}
function content(key,to,nf,height,width) {
   if(!height) { height = 300; }
   if(!width ) { width  = 200; }
   showUrl('/Help?key='+key+'&to='+to+'&nf='+nf,height,width);
}
function contextHelp(id,to,nf,height,width) {
   if(!height) { height = 300; }
   if(!width ) { width  = 200; }
   showUrl('/Help?helpId='+id+'&to='+to+'&nf='+nf,height,width);
}
function showUrl(url,w,h,tit) {
   var l = (screen.width/2)-(w/2);
   var t = (screen.height/2)-(h/2);
   if(!tit) { tit = ''; }
   var w = window.open(url,tit,"SCROLLBARS=1,WIDTH="+w+",HEIGHT="+h+",LEFT="+l+",TOP="+t);
   w.focus();
   return w;
}
function validateTimestamp(date) {
   pat  = /([0-9]{2})-([A-Z]{3})-([0-9]{4}) ([0-9]{2}):([0-9]{2})/;
   day  = date.replace(pat,'$1');
   mon  = date.replace(pat,'$2');
   year = date.replace(pat,'$3');
   hour = date.replace(pat,'$4');
   min  = date.replace(pat,'$5');

   if(!(day  >= 1 && day  <= 31)) { return false; }
   if(!(hour >= 0 && hour <= 24)) { return false; }
   if(!(min  >= 0 && min  <= 59)) { return false; }
   return true;
} 
function m_menu_on (obj) { obj.className = 'menuOn' ; }
function m_menu_off(obj) { obj.className = 'menuOff'; }

function m_tog(imgId,layId) {
   var imgEl = document.getElementById(imgId);
   var layEl = document.getElementById(layId);

   if(imgEl) {
      imgEl.src = '//images.scanalert.com/images/ico_' + (new String(imgEl.src).indexOf('ico_expand') != -1 ? 'colapse' : 'expand') + '.gif';
   }
   if(layEl) {
      layEl.style.display = layEl.style.display == 'none' ? '' : 'none';
   }
}
function m_img(imgId, imgSrc) {
try {
   var el = document.getElementById(imgId);
   if(el) {
     if(el.src) { 
        el.src = imgSrc; 
     } else if(el.style) { 
        el.style.background = 'url('+imgSrc+')'; 
     }
   }
   } catch(e) { alert(e); }
}
function m_alertException(er) {
   alert('----- ERROR -----\n\n'+er+'\n\n'
   + 'Description: ' + er.description + "\n"
   + 'File Name: '   + er.fileName + "\n"
   + 'Line Number: ' + er.lineNumber + "\n"
   + 'Message: '     + er.message + "\n"
   + 'Name: '        + er.name + "\n"
   + 'Number: '      + er.number + "\n"
   + 'Prototype: '   + er.prototype + "\n"
   + "");
}
function checkAll(id) {
   var ele = document.getElementById(id);
   if(ele) for(i = 0; i < ele.options.length; i++) { ele.options[i].selected = true; }
}
function moveSelectedOptions(from,to) {
   var eFrom = document.getElementById(from);
   var eTo   = document.getElementById(to);
   for(i = 0; i < eFrom.options.length; i++) {
      if(eFrom.options[i].selected) {
         eTo.options[eTo.options.length] = new Option(eFrom.options[i].text,eFrom.options[i].value);
      }
   }
   for(i = 0; i < eFrom.options.length; i++) {
      if(eFrom.options[i].selected) {
         eFrom.options[i] = null;
         i--;
      }
   }
}

function m_isPopup() {
   if(!window.opener) return false;
   if(BrowserDetect.browser == 'Explorer' && BrowserDetect.version < 7) return true;
   return false; // This might be a tab
}
function ping_run(sec) {
   var http = getHTTPObject();
   http.open("GET", "/customer/Account.sa?act=ping",true);
   //http.onreadystatechange = function() { if(http.readyState == 4) alert(http.responseText); }
   http.send(null);
   if(sec) window.setTimeout("ping_run("+sec+");",sec*1000);
}
function exportTable(objId) {
   var obj = document.getElementById(objId);
   var table = obj.getElementsByTagName('tbody')[0];
   var rows = table.getElementsByTagName('tr');
   var html = '';

   for(var row = 0; row < rows.length; row++) {
      cols = rows[row].getElementsByTagName('th');
      if(cols.length > 1) {
         for(var col = 0; col < cols.length; col++) {
            if(col != 0) { html += '\t'; }
            html += replaceAll(cols[col].innerHTML,'<.*?>','',true);
         }
         html += '\n'
      }

      cols = rows[row].getElementsByTagName('td');
      if(cols.length > 1) {
         for(var col = 0; col < cols.length; col++) {
            if(col != 0) { html += '\t'; }
            html += replaceAll(cols[col].innerHTML,'<.*?>','',true);
         }
         html += '\n'
      }
   }
   var win = window.open('','','');
   win.document.write('<html><pre>' + html + '</pre></html>');
}



var BrowserDetect = {
   init: function () {
      this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
      this.version = this.searchVersion(navigator.userAgent)
         || this.searchVersion(navigator.appVersion)
         || "an unknown version";
      this.OS = this.searchString(this.dataOS) || "an unknown OS";
   },
   searchString: function (data) {
      for (var i=0;i<data.length;i++)  {
         var dataString = data[i].string;
         var dataProp = data[i].prop;
         this.versionSearchString = data[i].versionSearch || data[i].identity;
         if (dataString) {
            if (dataString.indexOf(data[i].subString) != -1)
               return data[i].identity;
         }
         else if (dataProp)
            return data[i].identity;
      }
   },
   searchVersion: function (dataString) {
      var index = dataString.indexOf(this.versionSearchString);
      if (index == -1) return;
      return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
   },
   dataBrowser: [
      { string: navigator.userAgent, subString: "OmniWeb", versionSearch: "OmniWeb/", identity: "OmniWeb" },
      { string: navigator.vendor, subString: "Apple", identity: "Safari" },
      { prop: window.opera, identity: "Opera" },
      { string: navigator.vendor, subString: "iCab", identity: "iCab" },
      { string: navigator.vendor, subString: "KDE", identity: "Konqueror" },
      { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" },
      { string: navigator.vendor, subString: "Camino", identity: "Camino" },
      { string: navigator.userAgent, subString: "Netscape", identity: "Netscape" }, 
      { string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE" },
      { string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv" },
      { string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla" }
   ],
   dataOS : [
      { string: navigator.platform, subString: "Win", identity: "Windows" },
      { string: navigator.platform, subString: "Mac", identity: "Mac" },
      { string: navigator.platform, subString: "Linux", identity: "Linux" }
   ]
};
BrowserDetect.init();
-->

