// JavaScript Document var oMgtView = {BizID:"", ID:"", sKey:"", sDiv:"MgtViewDiv", Count:"1", lo:"0", sHttp:"https", CSS:"", sServer:"www.b2i.us", sTitle:""}; var currItem=''; var currItemID=''; //SetMeta(); try{ var sI = getMgtParameterByName("m", ""); if(!sI){ }else{ if(sI.length>0){ oMgtView.ID=sI; } } } catch (error) { console.log("Caught Error:" + error); } //-------------------------------------- function getMgtViewData(){ if(oMgtView.BizID=='') { console.log('Business ID missing. You should have received this from our support team.'); return; } currItem=''; var sUrl = CreateMgtViewURL(); GetMgtViewApiContent('2', sUrl, null, oMgtView.sDiv); } //-------------------------------------- function CreateMgtViewURL(){ var sUrl = oMgtView.sHttp + "://" + oMgtView.sServer + "/b2i/MgtView.asp?b=" + oMgtView.BizID; if(oMgtView.sKey!='') {sUrl += "&api=" + oMgtView.sKey}; if(oMgtView.ID!='') {sUrl += "&id=" + oMgtView.ID}; if(oMgtView.lo!='0') {sUrl += "&lo=" + oMgtView.lo}; if(oMgtView.CSS!='') {sUrl += "&css=" + oMgtView.CSS}; return sUrl; } //-------------------------------------- function GetMgtViewApiContent(requestType, sURL, varString, myDiv){ // requestType: 1 = get 0 = post // sURL: page requested // varString: null if none // myDiv: where to put returned value var xmlHttp; var PostOrGet; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser does not support this function.\n\nPlease have your IT department configure your computer to work with AJAX."); return false; } } } if(requestType==1){ PostOrGet = "GET" }else{ PostOrGet = "POST" } xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4) { var sReturn = xmlHttp.responseText; var oStoryDiv = document.getElementById(myDiv); oStoryDiv.innerHTML=sReturn; } } xmlHttp.open(PostOrGet, sURL, true); xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlHttp.send(varString); } //-------------------------------------- function getMgtParameterByName(name, url) { try{ if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, '\\$&'); var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, ' ')); } catch (error) { console.log("Caught Error:" + error); } } //-------------------------------------- function SetMgtMeta(){ try{ var link = !!document.querySelector("link[rel='canonical']") ? document.querySelector("link[rel='canonical']") : document.createElement('link'); link.setAttribute('rel', 'canonical'); link.setAttribute('href', location.protocol + '//' + location.host + location.pathname + location.search); document.head.appendChild(link); link = document.createElement('meta'); link.setAttribute('property', 'og:url'); link.content = location.protocol + '//' + location.host + location.pathname + location.search; document.getElementsByTagName('head')[0].appendChild(link); } catch (error) { console.log("Caught Error:" + error); } } function SetMetaDesc(sDesc){ try{ var meta=document.getElementsByTagName("meta"); for (var i=0; i