function init()
{    
        randomizer = new RandomImageGenerator();                        

        randomizer.addImage(
                    '/profile/EFF/',
                    'img/partner_logos/EFF-logo.gif',
                    'Electronic Frontier Foundation'
                    ); 

        randomizer.addImage(
                    '/profile/snilaw/',
                    'img/partner_logos/sni-logo.gif',
                    'Schatz Nobel Izard, P.C.'
                    );

        randomizer.addImage(
                    '/profile/CATO/',
                    'img/partner_logos/cato-logo.gif',
                    'Cato Institute'
                    );

        randomizer.addImage(
                    '/profile/MBVLaw/',
                    'img/partner_logos/mbv-logo.gif',
                    'MBV Law LLP'
                    ); 

        randomizer.addImage(
                    ' /profile/MintzLevinEmploymentLaborBenefitsGroup/',
                    'img/partner_logos/mintz-logo.gif',
                    'Mintz, Levin, Cohn, Ferris, Glovsky and Popeo'
                    );


		randomizer.addImage(
					'/profile/LanePowell/',
					'img/partner_logos/lane-logo.gif',
					'Lane Powell PC'
					);
					
        randomizer.addRandomImages();
} 

function initProfileSearchImg()
{
		
		randomizer = new RandomImageGenerator();
		
		
		randomizer.addImage( 
			'/profile/EFF/',
			'../img/partner_logos_cont/EFF-logo.gif',
			'Electronic Frontier Foundation'
		);

		randomizer.addImage(
			'/profile/snilaw/',
			'../img/partner_logos_cont/sni-logo.gif',
			'Schatz Nobel Izard, P.C.'
		);

		randomizer.addImage(
			'/profile/CATO/',
			'../img/partner_logos_cont/cato-logo.gif',
			'Cato Institute'
		);

		randomizer.addImage(
			'/profile/MBVLaw/',
			'../img/partner_logos_cont/mbv-logo.gif',
			'MBV Law LLP'
		);

		randomizer.addImage(
			'/profile/MintzLevinEmploymentLaborBenefitsGroup/',
			'../img/partner_logos_cont/mintz-logo.gif',
			'Mintz, Levin, Cohn, Ferris, Glovsky and Popeo'
		);


		randomizer.addImage(
			'../profile/LanePowell/',
			'../img/partner_logos_cont/lane-logo.gif',
			'Lane Powell PC'
		);
		
		randomizer.addRandomImages();
}



function addImage(url, src, description) { 
	var image = new ImageObject(url, src, description);
	this.images.push(image);
}

function addRandomImages()
{
	for (var i=0; i<this.imagePlaceHolders.length; i++)
	{
		this.imageContainer.appendChild(this.getRandomImage());
	}
	for (var i=0; i<this.imagePlaceHolders.length; i++)
	{
		this.imageContainer.removeChild(this.imagePlaceHolders[i]);
	}
}

function getRandomImage()
{
	var imageIndex = Math.floor(Math.random()*this.images.length); //grab a random image
	var image = this.images[imageIndex];
	var imageElement = document.createElement('img');
	imageElement.src = image.src;
	imageElement.alt = image.description;

	var anchorElement = document.createElement('a');
	anchorElement.href = image.linkUrl;
	anchorElement.appendChild(imageElement);

	this.images.splice(imageIndex,1);

	return anchorElement
}

function RandomImageGenerator(){
	
	this.images = [];
	this.imageContainer = document.getElementById('partnerLogos');
	this.imagePlaceHolders = getElementsByClass('randomImage', this.imageContainer, 'div');
	this.addImage = addImage;
	this.addRandomImages = addRandomImages;
	this.getRandomImage = getRandomImage;
}

function ImageObject(linkUrl, src, description) {
	this.linkUrl = linkUrl;
	this.src = src;
	this.description = description;
}

function getElementsByClass( searchClass, domNode, tagName) {
	if (domNode == null) domNode = document;
	if (tagName == null) tagName = '*';
	var el = new Array();
	var tags = domNode.getElementsByTagName(tagName);
	var tcl = " "+searchClass+" ";
	for(i=0,j=0; i<tags.length; i++) {
		var test = " " + tags[i].className + " ";
		if (test.indexOf(tcl) != -1)
			el[j++] = tags[i];
	}
	return el;
}