<!-- RCSid: $Header: /opt1/utm/dump101119/src/plattform/infra/docs/js/pse_sitestat.js,v 1.1.1.3 2005-11-05 11:49:39 stjo701 Exp $ -->


// Utilityfunction
function getPadding(URL){
          if (URL.indexOf('?') > 0 )
          {
            pad = '&';
          }
          else
          {
            pad = '?';
          }

    return pad;
}


// Detta script ska användas när du vill mäta sk onlinelänkar. Onlinelänkar är de länkar som ex finns på förstasidans nedre vänstra del.
function OpenWindow_scroll_resizable_ONLINE(URL,Width,Height,WinTitle, counterName){
             OpenWindow_scroll_resizable_with_Counter(URL,Width,Height,WinTitle, counterName,"ONLINE");
}
// Detta script ska användas när du vill mäta sk kampanjlänkar.
function OpenWindow_scroll_resizable_CAMPAIGN(URL,Width,Height,WinTitle, counterName){
         OpenWindow_scroll_resizable_with_Counter(URL,Width,Height,WinTitle, counterName,"CAMPAIGN");
}
// Detta script ska användas när du vill mäta sk pushlänkar.
function OpenWindow_scroll_resizable_PUSH(URL,Width,Height,WinTitle, counterName){
           OpenWindow_scroll_resizable_with_Counter(URL,Width,Height,WinTitle, counterName,"PUSH");
}
// Detta script ska användas när du vill mäta länkar som inte kan kategoriseras.
function OpenWindow_scroll_resizable_NOTYPE(URL,Width,Height,WinTitle, counterName){
          OpenWindow_scroll_resizable_with_Counter(URL,Width,Height,WinTitle, counterName,"NOTYPE");
}


function OpenWindow_scroll_resizable_REMOTE(URL,Width,Height,WinTitle, counterName){
          OpenWindow_scroll_resizable_with_Counter(URL,Width,Height,WinTitle, counterName,"REMOTE");
}

function OpenWindow_scroll_resizable_REDIRECT(URL,Width,Height,WinTitle, counterName){
          OpenWindow_scroll_resizable_with_Counter(URL,Width,Height,WinTitle, counterName,"REDIRECT");
}

// Detta script ska användas när du vill öppna ett fönster, som i window2.js, och räkna länken
function OpenWindow_scroll_resizable_with_Counter(URL,Width,Height,WinTitle,counterName,type){
          var newURL = URL;
          var pad;

           pad = getPadding(newURL);

          if (type=="ONLINE"){
             newURL += pad + "IntLinkOnlineCName=" + counterName;
          }
          if (type=="CAMPAIGN"){
             newURL += pad + "IntLinkCampaignCName=" + counterName;
          }
          if (type=="PUSH"){
             newURL += pad + "IntLinkPushCName=" + counterName;
          }
          if (type=="NOTYPE"){
             newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
          }
          if (type=="REMOTE"){
             newURL += pad + "IntLinkRemoteCName=" + counterName;
          }
           if (type=="REDIRECT"){
             newURL += pad + "RedirectCName=" + counterName;
          }



          OpenWindow_scroll_resizable(newURL,Width,Height,WinTitle);
}

// Detta script ska användas när du vill öppna ett fönster och räkna länken som en sk onlinelänk. Se dokumentation
function OpenWindow_ONLINE(URL,Width,Height,WinTitle,counterName){
   OpenWindow_with_Counter(URL,Width,Height,WinTitle, counterName,"ONLINE");
}

// Detta script ska användas när du vill öppna ett fönster och räkna länken som en sk kampanjlänk. Se dokumentation
function OpenWindow_CAMPAIGN(URL,Width,Height,WinTitle,counterName){
 OpenWindow_with_Counter(URL,Width,Height,WinTitle, counterName,"CAMPAIGN");
}

// Detta script ska användas när du vill öppna ett fönster och räkna länken som en sk pushlänk. Se dokumentation
function OpenWindow_PUSH(URL,Width,Height,WinTitle,counterName){
 OpenWindow_with_Counter(URL,Width,Height,WinTitle, counterName,"PUSH");
}

// Detta script ska användas när du vill öppna ett fönster och räkna länken som länk av någon annan typ. Se dokumentation
function OpenWindow_NOTYPE(URL,Width,Height,WinTitle,counterName){
 OpenWindow_with_Counter(URL,Width,Height,WinTitle, counterName,"NOTYPE");
}

// Detta script ska användas när du vill öppna ett fönster och räkna länken som tillhörande fjärrkontrollen. Se dokumentation
function OpenWindow_REMOTE(URL,Width,Height,WinTitle,counterName){
 OpenWindow_with_Counter(URL,Width,Height,WinTitle, counterName,"REMOTE");
}

// Detta script ska användas när du vill öppna ett fönster och räkna länken som en redirect. Se dokumentation
function OpenWindow_REDIRECT(URL,Width,Height,WinTitle,counterName){
   OpenWindow_with_Counter(URL,Width,Height,WinTitle, counterName,"REDIRECT");
}




// Privat, ska ej användas. Endast för intern bruk!
function OpenWindow_with_Counter(URL,Width,Height,WinTitle,counterName,type){
 var newURL = URL;
 var pad;


          pad = getPadding(newURL);

          if (type=="ONLINE"){
             newURL += pad + "IntLinkOnlineCName=" + counterName;
          }
          if (type=="CAMPAIGN"){
             newURL += pad + "IntLinkCampaignCName=" + counterName;
          }
          if (type=="PUSH"){
             newURL += pad + "IntLinkPushCName=" + counterName;
          }
          if (type=="NOTYPE"){
             newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
          }
          if (type=="REMOTE"){
             newURL += pad + "IntLinkRemoteCName=" + counterName;
          }
          if (type=="REDIRECT"){
             newURL += pad + "RedirectCName=" + counterName;
          }
          OpenWindow(newURL,Width,Height,WinTitle);
}




// Scipten nedan är i princip desamma som ovan, men fönstret som öppnas har scrollbars
function OpenWindow_scroll_ONLINE(URL,Width,Height,WinTitle,counterName){
   OpenWindow_scroll_with_Counter(URL,Width,Height,WinTitle, counterName,"ONLINE");
}
function OpenWindow_scroll_CAMPAIGN(URL,Width,Height,WinTitle,counterName){
  OpenWindow_scroll_with_Counter(URL,Width,Height,WinTitle, counterName,"CAMPAIGN");
}
function OpenWindow_scroll_PUSH(URL,Width,Height,WinTitle,counterName){
  OpenWindow_scroll_with_Counter(URL,Width,Height,WinTitle, counterName,"PUSH");
}
function OpenWindow_scroll_NOTYPE(URL,Width,Height,WinTitle,counterName){
   OpenWindow_scroll_with_Counter(URL,Width,Height,WinTitle, counterName,"NOTYPE");
}
function OpenWindow_scroll_REMOTE(URL,Width,Height,WinTitle,counterName){
   OpenWindow_scroll_with_Counter(URL,Width,Height,WinTitle, counterName,"REMOTE");
}
function OpenWindow_scroll_REDIRECT(URL,Width,Height,WinTitle,counterName){
   OpenWindow_scroll_with_Counter(URL,Width,Height,WinTitle, counterName,"REDIRECT");
}

// Privat, ska ej användas. Endast för intern bruk!
function OpenWindow_scroll_with_Counter(URL,Width,Height,WinTitle,counterName,type){
     var newURL = URL;
     var pad;

           pad = getPadding(newURL);

          if (type=="ONLINE"){
             newURL += pad + "IntLinkOnlineCName=" + counterName;
          }
          if (type=="CAMPAIGN"){
             newURL += pad + "IntLinkCampaignCName=" + counterName;
          }
          if (type=="PUSH"){
             newURL += pad + "IntLinkPushCName=" + counterName;
          }
          if (type=="NOTYPE"){
             newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
          }
           if (type=="REMOTE"){
             newURL += pad + "IntLinkRemoteCName=" + counterName;
          }
           if (type=="REDIRECT"){
             newURL += pad + "RedirectCName=" + counterName;
          }
          OpenWindow_scroll(newURL,Width,Height,WinTitle);
}



// Sciptet nedan är i princip desamma som ovan, men fönstret som öppnas kan positioneras
function OpenWindow_scroll_resizable_pos_ONLINE(URL,Width,Height,fromLeft,fromTop,WinTitle,counterName){
 OpenWindow_scroll_resizable_pos_with_Counter(URL,Width,Height,WinTitle, counterName,"ONLINE");
}
function OpenWindow_scroll_resizable_pos_CAMPAIGN(URL,Width,Height,fromLeft,fromTop,WinTitle,counterName){
OpenWindow_scroll_resizable_pos_with_Counter(URL,Width,Height,WinTitle, counterName,"CAMPAIGN");
}
function OpenWindow_scroll_resizable_pos_PUSH(URL,Width,Height,fromLeft,fromTop,WinTitle,counterName){
OpenWindow_scroll_resizable_pos_with_Counter(URL,Width,Height,WinTitle, counterName,"PUSH");
}
function OpenWindow_scroll_resizable_pos_NOTYPE(URL,Width,Height,fromLeft,fromTop,WinTitle,counterName){
OpenWindow_scroll_resizable_pos_with_Counter(URL,Width,Height,WinTitle, counterName,"NOTYPE");
}
function OpenWindow_scroll_resizable_pos_REMOTE(URL,Width,Height,fromLeft,fromTop,WinTitle,counterName){
OpenWindow_scroll_resizable_pos_with_Counter(URL,Width,Height,WinTitle, counterName,"REMOTE");
}
function OpenWindow_scroll_resizable_pos_REDIRECT(URL,Width,Height,fromLeft,fromTop,WinTitle,counterName){
OpenWindow_scroll_resizable_pos_with_Counter(URL,Width,Height,WinTitle, counterName,"REDIRECT");
}

// Privat, ska ej användas. Endast för intern bruk!
function OpenWindow_scroll_resizable_pos_with_Counter(URL,Width,Height,fromLeft,fromTop,WinTitle,counterName,type){
   var newURL = URL;
   var pad;

            pad = getPadding(newURL);

          if (type=="ONLINE"){
             newURL += pad + "IntLinkOnlineCName=" + counterName;
          }
          if (type=="CAMPAIGN"){
             newURL += pad + "IntLinkCampaignCName=" + counterName;
          }
          if (type=="PUSH"){
             newURL += pad + "IntLinkPushCName=" + counterName;
          }
          if (type=="NOTYPE"){
             newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
          }
           if (type=="REMOTE"){
             newURL += pad + "IntLinkRemoteCName=" + counterName;
          }
          if (type=="REDIRECT"){
             newURL += pad + "RedirectCName=" + counterName;
          }
          OpenWindow_scroll_resizable_pos(newURL,Width,Height,fromLeft,fromTop,WinTitle)
}







function OpenWindow_all_include_ONLINE(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName){
      OpenWindow_all_include_with_Counter(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName,"ONLINE");
}
function OpenWindow_all_include_CAMPAIGN(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName){
OpenWindow_all_include_with_Counter(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName,"CAMPAIGN");
}
function OpenWindow_all_include_PUSH(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName){
OpenWindow_all_include_with_Counter(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName,"PUSH");
}
function OpenWindow_all_include_NOTYPE(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName){
OpenWindow_all_include_with_Counter(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName,"NOTYPE");
}
function OpenWindow_all_include_REMOTE(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName){
OpenWindow_all_include_with_Counter(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName,"REMOTE");
}
function OpenWindow_all_include_REDIRECT(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName){
OpenWindow_all_include_with_Counter(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName,"REDIRECT");
}


// Privat, ska ej användas. Endast för intern bruk!
function OpenWindow_all_include_with_Counter(URL, Width, Height, WinTitle, FromLeft, FromTop,counterName,type){
      var newURL = URL;
      var pad;

           pad = getPadding(newURL);

          if (type=="ONLINE"){
             newURL += pad + "IntLinkOnlineCName=" + counterName;
          }
          if (type=="CAMPAIGN"){
             newURL += pad + "IntLinkCampaignCName=" + counterName;
          }
          if (type=="PUSH"){
             newURL += pad + "IntLinkPushCName=" + counterName;
          }
          if (type=="NOTYPE"){
             newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
          }
           if (type=="REMOTE"){
             newURL += pad + "IntLinkRemoteCName=" + counterName;
          }
          if (type=="REDIRECT"){
             newURL += pad + "RedirectCName=" + counterName;
          }
          OpenWindow_all_include(newURL, Width, Height, WinTitle, FromLeft, FromTop);
}






// Öppnar ett fönster i full storlek. För räkning av onlinelänk.
function fullWindow_ONLINE(url, counterName){
     fullWindow_with_Counter(url, counterName,"ONLINE");

}
// Öppnar ett fönster i full storlek. För räkning av kampanjlänk.
function fullWindow_CAMPAIGN(url, counterName){
     fullWindow_with_Counter(url, counterName,"CAMPAIGN");
}
// Öppnar ett fönster i full storlek. För räkning av pushlänk.
function fullWindow_PUSH(url, counterName){
   fullWindow_with_Counter(url, counterName,"PUSH");
}
// Öppnar ett fönster i full storlek. För räkning av oklassificerad länk.
function fullWindow_NOTYPE(url, counterName){
  fullWindow_with_Counter(url, counterName,"NOTYPE");

}
// Öppnar ett fönster i full storlek. För räkning av länk som ligger i fjärrkontrollen.
function fullWindow_REMOTE(url, counterName){
  fullWindow_with_Counter(url, counterName,"REMOTE");

}


function fullWindow_REDIRECT(url, counterName){
  fullWindow_with_Counter(url, counterName,"REDIRECT");

}

// Privat, ska ej användas. Endast för intern bruk!
function fullWindow_with_Counter(url, counterName,type){
    var newURL = url;
    var pad;

            pad = getPadding(newURL);

          if (type=="ONLINE"){
             newURL += pad + "IntLinkOnlineCName=" + counterName;
          }
          if (type=="CAMPAIGN"){
             newURL += pad + "IntLinkCampaignCName=" + counterName;
          }
          if (type=="PUSH"){
             newURL += pad + "IntLinkPushCName=" + counterName;
          }
          if (type=="NOTYPE"){
             newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
          }
          if (type=="REMOTE"){
             newURL += pad + "IntLinkRemoteCName=" + counterName;
          }
          if (type=="REDIRECT"){
             newURL += pad + "RedirectCName=" + counterName;
          }
         fullWindow(newURL);
}




// Används för att öppna en Onlinelänk i huvudfönstret
function showInMainWin_ONLINE(theUrl,counterName){
     showInMainWin_with_Counter(theUrl,counterName,"ONLINE");
 }
// Används för att öppna en Kampanjlänk i huvudfönstret
 function showInMainWin_CAMPAIGN(theUrl,counterName){
 showInMainWin_with_Counter(theUrl,counterName,"CAMPAIGN");
 }
 // Används för att öppna en Pushlänk i huvudfönstret
 function showInMainWin_PUSH(theUrl,counterName){
 showInMainWin_with_Counter(theUrl,counterName,"PUSH");
 }

// Används för att öppna en oklassificerad länk i huvudfönstret
 function showInMainWin_NOTYPE(theUrl,counterName){
 showInMainWin_with_Counter(theUrl,counterName,"NOTYPE");
 }
 // Används för att öppna en länk som ligger i fjärrkontrollen i huvudfönstret
 function showInMainWin_REMOTE(theUrl,counterName){
 showInMainWin_with_Counter(theUrl,counterName,"REMOTE");
 }
 function showInMainWin_REDIRECT(theUrl,counterName){
 showInMainWin_with_Counter(theUrl,counterName,"REDIRECT");
 }

 // Privat, ska ej användas. Endast för intern bruk!
  function showInMainWin_with_Counter(theUrl,counterName,type){
       var newURL = theUrl;
       var pad;

           pad = getPadding(newURL);

          if (type=="ONLINE"){
             newURL += pad + "IntLinkOnlineCName=" + counterName;
          }
          if (type=="CAMPAIGN"){
             newURL += pad + "IntLinkCampaignCName=" + counterName;
          }
          if (type=="PUSH"){
             newURL += pad + "IntLinkPushCName=" + counterName;
          }
          if (type=="NOTYPE"){
             newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
          }
           if (type=="REMOTE"){
             newURL += pad + "IntLinkRemoteCName=" + counterName;
          }
          if (type=="REDIRECT"){
             newURL += pad + "RedirectCName=" + counterName;
          }
         showInMainWin(newURL);
 }



// Öppnar angiven URL i befintligt fönster. Detta script är för Onlinelänkar.
function openURL_ONLINE(theUrl,counterName){
 openURL_with_Counter(theUrl,counterName,"ONLINE");
}
// Öppnar angiven URL i befintligt fönster. Detta script är för Kampanjlänkar.
function openURL_CAMPAIGN(theUrl,counterName){
 openURL_with_Counter(theUrl,counterName,"CAMPAIGN");
}
// Öppnar angiven URL i befintligt fönster. Detta script är för pushar.
function openURL_PUSH(theUrl,counterName){
 openURL_with_Counter(theUrl,counterName,"PUSH");
}
// Öppnar angiven URL i befintligt fönster. Detta script är för länkar som ej kan klassificeras.
function openURL_NOTYPE(theUrl,counterName){
 openURL_with_Counter(theUrl,counterName,"NOTYPE");
}
// Öppnar angiven URL i befintligt fönster. Detta script är för länkar som ligger i fjärrkontrollen.
function openURL_REMOTE(theUrl,counterName){
 openURL_with_Counter(theUrl,counterName,"REMOTE");
}

// Privat, ska ej användas. Endast för intern bruk!
function openURL_with_Counter(theUrl,counterName,type){
         var newURL = theUrl;
         var pad;

           pad = getPadding(newURL);

          if (type=="ONLINE"){
             newURL += pad + "IntLinkOnlineCName=" + counterName;
          }
          if (type=="CAMPAIGN"){
             newURL += pad + "IntLinkCampaignCName=" + counterName;
          }
          if (type=="PUSH"){
             newURL += pad + "IntLinkPushCName=" + counterName;
          }
          if (type=="NOTYPE"){
             newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
          }
            if (type=="REMOTE"){
             newURL += pad + "IntLinkRemoteCName=" + counterName;
          }
         window.location = newURL;
}


function closeAndShowInMainWin_ONLINE(theUrl,counterName){
   closeAndShowInMainWin_with_Counter(theUrl, counterName, "ONLINE");
}
function closeAndShowInMainWin_CAMPAIGN(theUrl,counterName){
   closeAndShowInMainWin_with_Counter(theUrl, counterName, "CAMPAIGN");
}
function closeAndShowInMainWin_PUSH(theUrl,counterName){
closeAndShowInMainWin_with_Counter(theUrl, counterName, "PUSH");

}
function closeAndShowInMainWin_NOTYPE(theUrl,counterName){
closeAndShowInMainWin_with_Counter(theUrl, counterName, "NOTYPE");

}
function closeAndShowInMainWin_REMOTE(theUrl,counterName){
closeAndShowInMainWin_with_Counter(theUrl, counterName, "REMOTE");

}
function closeAndShowInMainWin_REDIRECT(theUrl,counterName){
closeAndShowInMainWin_with_Counter(theUrl, counterName, "REDIRECT");

}
function closeAndShowInMainWin_with_Counter(theUrl,counterName,type){
    var newURL = theUrl;
    var pad;

    pad = getPadding(newURL);

    if (type=="ONLINE"){
          newURL += pad + "IntLinkOnlineCName=" + counterName;
    }
    if (type=="CAMPAIGN"){
        newURL += pad + "IntLinkCampaignCName=" + counterName;
    }
    if (type=="PUSH"){
        newURL += pad + "IntLinkPushCName=" + counterName;
    }
    if (type=="NOTYPE"){
        newURL += pad + "IntLinkNOCATEGORYCName=" + counterName;
    }
    if (type=="REMOTE"){
        newURL += pad + "IntLinkRemoteCName=" + counterName;
    }
    if (type=="REDIRECT"){
        newURL += pad + "RedirectCName=" + counterName;
    }
    closeAndShowInMainWin(newURL);

}



// Används för att mäte redirectsidor.
function redirectToPage(theUrl, counterName){
          var newURL = theUrl;
          var pad;

          pad = getPadding(newURL);

          newURL += pad + "RedirectCName=" + counterName;

          window.location = newURL;
 }


 // Används för att mäta länkar som ingår i kampanjmail
 function campaignMailRedirect(theUrl, counterName){
          var newURL = theUrl;
          var pad;

          pad = getPadding(newURL);

          newURL += pad + "CampaignMailCName=" + counterName;

          window.location = newURL;
 }
