// JavaScript Document var oDirView = {BizID:"", ID:"", sKey:"", sDiv:"DirViewDiv", Count:"1", lo:"0", sHttp:"https", CSS:"", sServer:"www.b2i.us", sTitle:""}; var currItem=''; var currItemID=''; //SetMeta(); try{ var sI = getParameterByName("d", ""); if(!sI){ }else{ if(sI.length>0){ oDirView.ID=sI; } } } catch (error) { console.log("Caught Error:" + error); } //-------------------------------------- function getDirViewData(){ if(oDirView.BizID=='') { console.log('Business ID missing. You should have received this from our support team.'); return; } currItem=''; var sUrl = CreateDirViewURL(); GetDirViewApiContent('2', sUrl, null, oDirView.sDiv); } //-------------------------------------- function CreateDirViewURL(){ var sUrl = oDirView.sHttp + "://" + oDirView.sServer + "/b2i/DirectorView.asp?b=" + oDirView.BizID; if(oDirView.sKey!='') {sUrl += "&api=" + oDirView.sKey}; if(oDirView.ID!='') {sUrl += "&id=" + oDirView.ID}; if(oDirView.lo!='0') {sUrl += "&lo=" + oDirView.lo}; if(oDirView.CSS!='') {sUrl += "&css=" + oDirView.CSS}; return sUrl; } //-------------------------------------- function GetDirViewApiContent(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 getParameterByName(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 SetMeta(){ 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