var WONtagging = false;

function setReferrer() {
  if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){
    DCS.dcsref = self.location.href.substring(0,self.location.href.indexOf(self.location.pathname)) + DCS.dcsuri;
  }  
}

function getFolder(){
  return thisFolder = self.location.pathname.substring(0,self.location.pathname.lastIndexOf('/')+1);
}

function trackRelative(objectReference,objectTitle,keepLastReferrer){
  setReferrer();
  currentUri = DCS.dcsuri;
  path = getFolder() + objectReference;
  dcsMultiTrack('DCS.dcsuri',path,'WT.ti',objectTitle);
  if (keepLastReferrer) {
    DCS.dcsuri = currentUri;
  }
}

function trackAbsolute(objectReference,objectTitle,keepLastReferrer,edxEnabled){
  setReferrer();
  currentUri = DCS.dcsuri;
  path = objectReference;
  
  if(path.indexOf('?') != -1){
    var splitted = path.split('?');
    path = splitted[0];
    var queryString = '?'+splitted[1];
    dcsMultiTrack('DCS.dcsuri',path,'WT.ti',objectTitle, 'DCS.dcsqry', queryString);
  } 
  else {
    dcsMultiTrack('DCS.dcsuri',path,'WT.ti',objectTitle, 'DCS.dcsqry', '');
  }
  
  if (keepLastReferrer) {
    DCS.dcsuri = currentUri;
  }
  if (edxEnabled || WONtagging) {
    trackEDX(objectReference); //special call for edx-tagging Italy 
  }
}


function trackExternal(objectReference,objectTitle){
  setReferrer();
  currentUri = DCS.dcsuri;
  path = "/external/" + objectReference;
  dcsMultiTrack('DCS.dcsuri',path,'WT.ti',objectTitle);
  DCS.dcsuri = currentUri;
}

function trackEDX() {
  //function will be overwritten in /it/it/highend_content_flashmovie.html
}