/*                            _          
  ___  _ __  ___  __ ______ _(_)___  ___ 
 / _ \/ __ \/ _ \/ ___/ __ `/ /_  / / _ \
/  __/ / / /  __/ /  / /_/ / / / /_/  __/
\__/|_/ /_/\___/_/   \__, /_/ /___/\__/ 
  /^|                 \__/ (c) 2001-2007
Door: AG
Dank aan: MD

*/

function Collector() {
	
	this.screenInfo = '';
	this.browserVersion = '';
	this.system = '';
	this.browserName = '';
	this.referer = '';
	this.currentPage = '';
	this.flashVersion = '';
	
	this.initialise = function () {
		this.loadScreenInfo();
		this.loadSystemInfo();
		this.loadCurrentPage();
		this.loadReferer();

		this.loadFlashVersion();
//		alert('flasver');
//		return;
	}
	
	/** screensize information **/
	this.loadScreenInfo = function() {
		this.screenInfo = screen.width+'x'+screen.height;
	}
	
	/** system information **/
	this.loadSystemInfo = function() {
		
		this.system = "Unknown";
		this.browserVersion =  "Unknown";
		
		var agent = navigator.userAgent.toLowerCase();
		var BrowserVersieSplit;
		var SysteemSplit;
		
		if(agent.indexOf("msie") > 0 && agent.indexOf("opera") == -1) {
		   
		   BrowserVersieSplit = agent.split(';');
		   this.browserVersion = BrowserVersieSplit[1];
		
		   for (i=1; i <= BrowserVersieSplit.length - 1; i++) {
			   if(BrowserVersieSplit[i].indexOf("win") > 0 || BrowserVersieSplit[i].indexOf("mac") > 0) {
				 this.system = BrowserVersieSplit[i];
			   }
			if(this.system.lastIndexOf(")") > 0) this.system = this.system.substring(0,this.system.length -1); 
		   } 
		}
		if(agent.indexOf("mozilla") != -1 && agent.indexOf("compatible") == -1) {
		   BrowserVersieSplit = agent.split('/');
		   this.browserVersion = BrowserVersieSplit[1].substring(0,1);
			 
			  if(this.browserVersion > 4) {
				 // Hieronder de Safari en Mozilla detectie, om safari niet met Netscape 4 of lager te verwarren
					this.browserVersion = BrowserVersieSplit[3];
				
				 if(agent.indexOf("safari") != -1) {
					this.browserName = "Safari ";
				 } else if(agent.indexOf("netscape") != -1) {
					this.browserName = "NS ";
				 } else {
					this.browserName = "Moz ";
					Start = agent.indexOf("rv:") + 3;
					Stop = Start + 3;
					this.browserVersion = agent.substring(Start,Stop);
				 }
				 
				 SysteemSplit = agent.split(';');
				 this.system  = SysteemSplit[2];
			  } else {
				  this.browserName = "NS ";
				  this.browserVersion = BrowserVersieSplit[1].substring(0,3);
				  SysteemSplit = agent.split('(');
				  this.system = SysteemSplit[1].split(';');
				  this.system = this.system[0];
			  }
		   this.browserVersion = this.browserName + this.browserVersion;
		}
		
		if(agent.indexOf("opera") != -1) {
			 
		   Start = agent.indexOf("opera");
		   Stop = Start + 9;
		   this.browserVersion = agent.substring(Start,Stop);
		   
		   SysteemSplit = agent.split(';');
		
		   if(SysteemSplit[2]) {
			  this.system = SysteemSplit[2].split(')');
			  this.system = this.system[0];
		   } else {
			 SysteemSplit = agent.split('(');
			 if(SysteemSplit[1]) {
			   this.system = SysteemSplit[1].split(';');
			   this.system = this.system[0];
			 }
		   }
		   this.browserVersion = this.browserVersion.replace('/',' ');
		}		
		
	}
	
	/** referer information **/
	this.loadReferer = function() {
		this.referer = "DR/Unknown";
		
		if(top.document.referrer.length > 0) {  
			 this.referer = top.document.referrer;
		} 

	}
	
	/** current page **/
	this.loadCurrentPage = function() {
		this.currentPage = "Unknown";
		var page = window.location.pathname + window.location.search + window.location.hash;
		if( (page.charAt(0) == "\\") || (page.charAt(0) == "/") )
		{
			this.currentPage = page.substr(1);
		}

	}
	
	/** flash version **/
	this.loadFlashVersion = function() {
		return 0;
		var Plgins;
		var agent = navigator.userAgent.toLowerCase();
		if(agent.indexOf("msie") > 0 && agent.indexOf("mac") == -1) {
			var activeX = false;
			i = 15;
			
			while(activeX == false && i > 0) {
				i--;
				document.write('<SCRIPT LANGUAGE=VBScript\> \n');
				document.write('on error resume next \n');
				document.write('activeX = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'")))\n');
				document.write('<' + '/SCRIPT>');
			}
			this.flashVersion=i;
		} else if(agent.indexOf("compatible") == -1 || agent.indexOf("mac") != -1 && agent.indexOf("msie 4") == -1 && agent.indexOf("msie 3") == -1) {
			for (i=0; i < navigator.plugins.length; i++){
				if (navigator.plugins[i].description){
				Plgins = navigator.plugins[i].description.toLowerCase(); 
				   if(Plgins.indexOf('flash') != -1) {
					  FlashVer = navigator.plugins[i].description.split(' ');
					  this.flashVersion = FlashVer[2].substr(0,1);
				   }
				}
			 }
		} else {
		  this.flashVersion = 0;
		}
	}
}





