
if(typeof(WebnogPopUp) == "undefined"){
   WebnogPopUp = new function(){};
   WebnogPopUp.resetCookie = false;
   WebnogPopUp.debugPopUp = false;
   WebnogPopUp.insertBuildScript = false;
   
   WebnogPopUp.showPopUpBox = function(){
   
      if(!WebnogPopUp.insertBuildScript && WebnogPopUp.runTest()){
          WebnogPopUp.insertBuildScript = true;
          var webnogPopUpBuildScript = document.createElement('script');
          webnogPopUpBuildScript.src='http://www.webnographer.com/questionTask/popUpStart/jEixo';
          webnogPopUpBuildScript.onLoadDone = false;
          webnogPopUpBuildScript.onload= function(){
              webnogPopUpBuildScript.onLoadDone =  true;
          }
          webnogPopUpBuildScript.onreadystatechange = function(){
                if("loaded" === webnogPopUpBuildScript.readyState && !webnogPopUpBuildScript.onLoadDone){
                   webnogPopUpBuildScript.onLoadDone =  true;
                 }
          }
          document.getElementsByTagName('head')[0].appendChild(webnogPopUpBuildScript);
      }
   }
   
   WebnogPopUp.runTest = function(){
     if(WebnogPopUp.debug()) return true;
     if(!WebnogPopUp.urlCheck()) return false;
     if(WebnogPopUp.checkOurUrl()) return false;
     //this is so that we do not show a pop up if there is a
     //pop up from eDigitalResearch
     if(typeof ecos_go != 'undefined'){
         if(ecos_go) return false;
     }
     if(false) return false;
     if(WebnogPopUp.test() || false){
       var rnd = (Math.random()*100);
       var weight = 0
       if(WebnogPopUp.resetCookie || weight >= rnd){
           return true;
       }
     }
     return false;
   }
   
   WebnogPopUp.checkOurUrl = function(){
       if(window.location.href.indexOf("px.webnographer.com")>-1){
            return true;
       }
       return false;
   }
   
   WebnogPopUp.urlCheck = function(){
       if(true){
           var restrictedURLs = "http://www.travelinesw.com/cms/index.xhtml".split(',');
           var positionOfQueryString = window.location.href.indexOf('?');
           var locationWithoutQueryString;
           // we want to filter restricted url's without eventually query parameters
           if (positionOfQueryString != -1) {
               locationWithoutQueryString = window.location.href.substring(0, positionOfQueryString);
           } else {
               locationWithoutQueryString = window.location.href;
           }
           // we don't want to make a difference between urls ending or not on a slash, so
           // we remove all slashes
           locationWithoutQueryString = locationWithoutQueryString.replace(/\//g, '');
           for (var i = 0; i < restrictedURLs.length; i++){
               if((restrictedURLs[i].replace(/\//g, '')) === locationWithoutQueryString){
                   return true;
               }
           }
           return false;
       }else{
           return true;
       }
   }
   
   WebnogPopUp.debug = function(){
     if(window.location.href.indexOf('webnogPopUp=debug') > 0){
        WebnogPopUp.debugPopUp = true;
        return true
     }else{
        return false;
     }
   }
   
   
   WebnogPopUp.test = function(){
     if(window.location.href.indexOf('webnogPopUp=test') > 0){
        return true
     }else if(window.location.href.indexOf('webnogPopUp=reset') > 0){
       WebnogPopUp.resetCookie = true;
       return true;
     }else{
        return false;
     }
   }
}


//-------------------------------------------------

