//********************************************************************
//
//              Copyright (c) 2002-2007 MindLab GmbH
//                     All rights reserved.
//
//====================================================================
//
// Project    : Postbank
// Filename   : pb_tracking_js.js
//
//====================================================================
//
/**
 * @file
 * This script can be used to integrate Microsites, which are not on
 * on a tracked website, in a tracking environment. 
 *
 * @author   $Felix Engemann$
 * @version  $0.0.1$
 * @date     $31.08.2006$

 *@listofchanges cha adaption for postbank help-div 2007/09/07
 *@listofchanges cha adaption for postbank clientStat tracking Pixelhelp-div 2007/11/13
  *@listofchanges cha adaption for postbank clientStat tracking Pixelhelp-div 2007/11/16
 */
//
//********************************************************************



//==========================================================
// Browser Settings Link Parameter 
//==========================================================

function getBrowserStatParams () {
  
  //--------------------------------------------------------
  // variables for general settings
  //--------------------------------------------------------
  var javaOK    = "unknown";
  var cookiesOK = "unknown";
  var browsLang = "unknown";
  var availheight = screen.availHeight;
  var availwidth  = screen.availWidth;
  var colordepth  = screen.colorDepth + " bit";
  var height      = screen.height;
  var width       = screen.width;
  
  //--------------------------------------------------------
  // variables for plugins
  //--------------------------------------------------------
  var flashPlugin     = "-";
  var flashVersion    = "0";
  var directorPlugin  = "-";
  var wmplayerPlugin  = "-";
  var realplayerPlugin= "-";
  var quicktimePlugin = "-";
  var adobe_svgPlugin = "-";
  var adobe_pdfPlugin = "-";
  
  var agt =navigator.userAgent.toLowerCase();
  var ie  = (agt.indexOf("msie") != -1);
//accept only higher than MSIE 4
//otherwise the detectIE() function would not work
  if(ie){
  	ie  = (agt.indexOf("msie 4") == -1) && (agt.indexOf("msie 3") == -1);
  }
  
  var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
    
  //--------------------------------------------------------
  // Java and Cookies
  //--------------------------------------------------------
  if (navigator.javaEnabled()==true){javaOK="yes"}else{javaOK="no"}
  
  //--------------------------------------------------------
  //-- cookieEnabled only works in MSIE.
  //--------------------------------------------------------
  if ((navigator.cookieEnabled) && (navigator.cookieEnabled==true)) {cookiesOK="yes"} else {cookiesOK="no"}
  
  //--------------------------------------------------------
  // language
  //--------------------------------------------------------
  if (navigator.language)
    browsLang = navigator.language;
  
  //--------------------------------------------------------
  // Plugins
  // 
  // SVG and Quicktime are not certified Plugins and cause a warning
  // in MSIE 7. Because of this fact those two plugina are not detected.
  //--------------------------------------------------------
  if (ie && win) 
    {   
   
//		adobe_svgPlugin = detectIE("Adobe.SVGCtl");
        directorPlugin = detectIE("SWCtl.SWCtl.1");
        flashPlugin = detectIE("ShockwaveFlash.ShockwaveFlash.1");
        realplayerPlugin = detectIE("rmocx.RealPlayer G2 Control.1");
//		quicktimePlugin = detectIE("QuickTimeCheckObject.QuickTimeCheck.1");
        wmplayerPlugin = detectIE("MediaPlayer.MediaPlayer.1"); 
        adobe_pdfPlugin = detectIEAcrobat("Acrobat Reader");
//      detectIEFlashVersion("Shockwave Flash Version");
        
       
  } else {
  

        nse = ""; 
        for (var i=0;i<navigator.mimeTypes.length;i++) 
          nse += navigator.mimeTypes[i].type.toLowerCase();

//        adobe_svgPlugin = detectNS("image/svg-xml"); 
          directorPlugin = detectNS(nse, "application/x-director");
          flashPlugin = detectNS(nse, "application/x-shockwave-flash");
          realplayerPlugin = detectNS(nse, "audio/x-pn-realaudio-plugin");
//        quicktimePlugin = detectNS("video/quicktime");
          wmplayerPlugin = detectNS(nse, "application/x-mplayer2"); 
	      adobe_pdfPlugin = detectNS(nse, "application/pdf");
	      
//        detectNSFlashVersion("Flash Version");

  }
 
  	var strParams = 	"bs_java=" + javaOK 
  				+ 	"&nm_cookies=" + cookiesOK
  		  		+ 	"&nm_screen=" + width + "x" + height  		  		  		  		
  				+ 	"&nm_coldepth=" + colordepth
  				+	"&nm_plugin_flash=" + flashPlugin	
  				+ 	"&nm_plugin_director=" + directorPlugin
  				+ 	"&nm_plugin_wmplayer=" + wmplayerPlugin
  				+ 	"&nm_plugin_realplayer=" + realplayerPlugin
  				+ 	"&nm_plugin_acroread=" + adobe_pdfPlugin;

  return (strParams);

}


//==========================================================
// Acrobat
//==========================================================

function detectIEAcrobat(name){

   var acrobat=new Object();

 
   if (window.ActiveXObject)
   {
      for (x=2; x<10; x++)
      {
         try
         {
            oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
            if (oAcro)
            {
               return 'yes';
            }
         }
         catch(e) {}
      } 


      try
      {
         oAcro4=new ActiveXObject('PDF.PdfCtrl.1');
         if (oAcro4)
         {
            return 'yes';
         }
      }
      catch(e) {}

      try
      {
         oAcro7=new ActiveXObject('AcroPDF.PDF.1');
         if (oAcro7)
         {
            return 'yes';
         }
      }
      catch(e) {}


   }
		return 'no';
		
		
}





//==========================================================
// IE Plugins
//==========================================================

function detectIE(ClassID) { 

  try{
     new ActiveXObject(ClassID);
     return 'yes'; 
 
  }
  
  catch(e) {
  
 	 	return 'no';
 	 }   
}

//==========================================================
// Netscape and Firefox Plugins
//==========================================================

function detectNS(strMimetypes, ClassID) { 
  if (strMimetypes.indexOf(ClassID) != -1) 
    if (navigator.mimeTypes[ClassID].enabledPlugin != null) 
      return 'yes'; 
  return 'no';

}






//********************************************************************
//SENDING THE PIXELS
//********************************************************************

//This Pixel sends the information which Plugins are installed on the Browser of the User, ScreenSize and general Browsersettings.


function sendClientStatPixel(oPixel, oSession){

	var today = new Date();
	
	//SETTING
	var nSendDate = 21;
	
	if( today.getDate() == nSendDate){
		var strParamString = getBrowserStatParams(); 
		oPixel.addParameterString(strParamString);
		oPixel.addUrl( document.URL);	
		oPixel.sendPixel(oSession);
	}
}
//********************************************************************
//Pixel-Instanz anlegen
//********************************************************************
oNetMindClientStatPixel = new cPixel();

/*

//Send PartnerName as parameter?
if (SendPartnerName) 
{
  oNetMindPixel.addAffiliate(PartnerName);
}//end if (SendPartnerName)

//Send Url as parameter?
if (SendUrl)
{
  oNetMindPixel.addUrl(document.URL);
}//end if (SendUrl)



//Send referrer as parameter?
if (SendReferrer)
{
  oNetMindPixel.addReferrer(document.referrer);
}//end if (SendReferrer)
*/

oNetMindClientStatSession = new cSession();

sendClientStatPixel(oNetMindClientStatPixel, oNetMindClientStatSession);

//#########################################
//
// END CLIENTSTAT
//
//#########################################