var SearchExample = {

	initialize : function(	
		oLink,
		oInput,
		aExamples,
		oBoardLoader
		) {
		
		this.oLink = oLink;
		this.oInput = oInput;
		this.aExamples = aExamples;
		this.oBoardLoader = oBoardLoader;
		this.iCurrentExample = 0;

		var oThis = this;

		this.oLink.onclick = function() {
	
			oThis.get(true);
		
			return false;
	
		};				
		
		this.get();
		
	},
		
	get : function(bUpdateInput) {
	
		if(bUpdateInput) {
		
			this.oInput.value = this.aExamples[this.iCurrentExample].label;
		
			this.oInput.focus();
			
		}
	
		var iNewExample = 0;
	
		do {
			iNewExample = Math.ceil(Math.random() * (this.aExamples.length - 1));
		}
		while(iNewExample == this.iCurrentExample);
		
		this.iCurrentExample = iNewExample;
		
		this.oLink.href = this.aExamples[this.iCurrentExample].href;
		this.oLink.innerHTML = this.aExamples[this.iCurrentExample].label;
		
		if(bUpdateInput) {					
		
			this.oBoardLoader.process();
			
		}
	
	}

}