var personList = [
	{
		id: "personJockItch",
		image1: "images/home/personJockItch-trans.png",
		image2: "images/home/personJockItch-trans.png",
		link: "jock-itch.html",
		popUpContent: "Learn more about Jock Itch",
		callouts: [1, 7, 8]
	},
	{
		id: "personAthletesFoot",
		image1: "images/home/personAthletesFoot-trans.png",
		image2: "images/home/personAthletesFoot-trans.png",
		link: "athletes-foot.html",
		popUpContent: "Learn more about Athlete's Foot",
		callouts: [1, 7, 8]
	},
	{
		id: "personRingworm",
		image1: "images/home/personRingworm-trans.png",
		image2: "images/home/personRingworm-trans.png",
		link: "ringworm.html",
		popUpContent: "Learn more about Ringworm",
		callouts: [1, 7, 8]
	}
];

var calloutList = [
	{
		id: 1,
		name: "watchOurCommercial",
		image: "images/home/calloutWatchOurCommercial.gif",
		link: 'javascript:Lightview.show({href:"video/Regular_Guy.html",rel:"iframe",options:{width:740, height: 500}});'
	},
	{
		id: 2,
		name: "calloutFindYourCureJockItch",
		image: "images/home/calloutFindYourCureJockItch.gif",
		link: "products/index.html"
	},
	{
		id: 3,
		name: "calloutFindYourCureAthletesFoot",
		image: "images/home/calloutFindYourCureAthletesFoot.gif",
		link: "products/index.html"
	},
	{
		id: 4,
		name: "calloutFindYourCureRingworm",
		image: "images/home/calloutFindYourCureRingworm.gif",
		link: "products/lotrimin-af/RWCream.html"
	},
	{
		id: 5,
		name: "calloutSaveOnLotriminNow",
		image: "images/home/calloutSaveOnLotriminNow.gif",
		link: "/coupon-interstitial/index.html?couponId=lotrimin.com/Homepage/Athletesfoot"
	},
	{
		id: 6,
		name: "calloutSaveOnLotriminForRingwormNow",
		image: "images/home/calloutSaveOnLotriminForRingwormNow.gif",
		link: "/coupon-interstitial/index.html?couponId=lotrimin.com/Homepage/Ringworm"
	},
	{
		id: 7,
		name: "calloutFindYourCureAll",
		image: "images/home/calloutFindYourCureAll.png",
		link: "products/index.html"
	},
	{
		id: 8,
		name: "calloutGetCoupons",
		image: "images/home/calloutGetLotriminCoupons.png",
		link: "/coupon-interstitial/index.html?couponId=lotrimin.com/Homepage/Ringworm"
	}
];

var personContainerSelector = "#personContainer";
var calloutContainerSelector = "#calloutContainer";

function highlightPerson(personSelector) {
	//find this person in personList
	for (var i=0; i<personList.length; i++) {
		if (personList[i].id == jQuery(personSelector).attr("id")) {
			//highligt the person
			jQuery(personSelector).children("A").children("IMG").attr("src",personList[i].image2);
			
			//remove previous callouts
			jQuery(calloutContainerSelector).html("");
			
			// show new callouts
			for (var j=0; j<personList[i].callouts.length; j++) {
				for (var k=0; k<calloutList.length; k++) {
					if (calloutList[k].id == personList[i].callouts[j]) {
						jQuery(calloutContainerSelector).append("<div class='callout' id='callout"+(j+1)+"'><a href='"+calloutList[k].link+"'><img src='"+calloutList[k].image+"' alt='' /></a></div>");
					}
				}
			}
			
		}
	}
	
}

function lowlightPerson(personSelector) {
	for (var i=0; i<personList.length; i++) {
		if (personList[i].id == jQuery(personSelector).attr("id")) {
			jQuery(personSelector).children("A").children("IMG").attr("src",personList[i].image1);
		}
	}
}

function displayPlatform(personList) {
	for (var i=0; i<personList.length; i++) {
		jQuery(personContainerSelector).append("<div class='person' id='"+personList[i].id+"'><a href='"+personList[i].link+"'><img src='"+personList[i].image1+"' alt='' /></a></div>");
	}
	
	jQuery(personContainerSelector+"> .person").mouseover(function(){
		for (var i=0; i<personList.length; i++) {
			if (personList[i].id !== this.id) {
				//lowlightPerson(jQuery('#'+personList[i].id));
			}
		}
		//highlightPerson(this);
	});
}

jQuery(document).ready(function(){
	displayPlatform(personList);
	highlightPerson('#personAthletesFoot');
});
