function HeroElement(id, imgurl, action, isExternal) {
    this.id = id;
	this.imgurl = imgurl;
	this.action = action;
	this.isExternal = isExternal;
}

var GMC_HERO_ELEM = new HeroElement(4,"hero-math-sierra.png", "/whatis?tabId=0", false);
var BUICK_HERO_ELEM = new HeroElement(4,"hero-math-enclave.png", "/whatis?tabId=0", false);
var CHEVY_HERO_ELEM = new HeroElement(4,"hero-math-malibu.png", "/whatis?tabId=0", false);


function heroClick(id) {

 var omni =  new OmnitureWrapper().clear().channel("Home").campaign(getQueryParam('s_cid'));
 omni.linkTrackEvents("None");
 
 if (id == 0)  {
 	omni.linkTrackVars('prop8,eVar8');
 	omni.sprop(8, "Hero APR");
 	omni.evar(8, "Hero APR");
 }else if (id == 1)  {
 	omni.linkTrackVars('prop8,eVar8');
 	omni.sprop(8, "Hero APR");
 	omni.evar(8, "Hero APR");
 } else if (id == 2)  {
 	omni.linkTrackVars('prop6,eVar6');
 	omni.sprop(6, "Hero 12|12");
 	omni.evar(6, "Hero 12|12");
 }else if (id == 3)  {
 	omni.linkTrackVars('prop5,eVar5');
 	omni.sprop(5, "Hero Means to Me");
 	omni.evar(5, "Hero Means to Me");
 }else if (id == 4)  {
 	omni.linkTrackVars('prop7,eVar7');
 	omni.sprop(7, "Hero BIV");
 	omni.evar(7, "Hero BIV");
 }
 omni.trackCustomLinkOnly(new Object(),'GM CERTIFIED | HOMEPAGE',null);
 
 
 if (HeroElements[id].isExternal == false) {
	 window.location.href = HeroElements[id].action; 	
 } else {
 	 window.open(HeroElements[id].action);
 }	 
}

var HeroElements = new Array();
function initHeroElements(baseHREF) {

	HeroElements[0] = new HeroElement(0,"hero-apr-impala.png", baseHREF + "/offers?tabId=2&warrTab=0", false);
	HeroElements[1] = new HeroElement(1, "hero-apr-g6.png",baseHREF + "/offers?tabId=3", false);
	HeroElements[2] = new HeroElement(2,"hero-12-12.png", baseHREF + "/whatis?tabId=1&warrTab=0", false);
	HeroElements[3] = new HeroElement(3, "hero-whatis.png",baseHREF + "/whatis?tabId=5", false);

	if (GMCERTIFIED.REFERRER.isChevy()) {
		HeroElements[4] = CHEVY_HERO_ELEM;
	} else if (GMCERTIFIED.REFERRER.isGMC()) {
		HeroElements[4] = GMC_HERO_ELEM;
	}else if (GMCERTIFIED.REFERRER.isBuick()) {
		HeroElements[4] = BUICK_HERO_ELEM;
	} else {
		HeroElements[4] = CHEVY_HERO_ELEM;
	}		
	return HeroElements;
}





