jQuery.noConflict();
/*
var masterFeatureList1 = [];

masterFeatureList1[0] = ['Thinking of You','/images/tempCardThumb.jpg','Some text here about this featured item that will help you make informed decisions.'];
masterFeatureList1[1] = ['Birthday Cool','/images/Snoopy--Joe-Cool--Maxi-Posters-331290.jpg','Some text here about this featured item that will help you make informed decisions.'];
masterFeatureList1[2] = ['Get Well Soon','/images/cool.jpg','Some text here about this featured item that will help you make informed decisions.'];
masterFeatureList1[3] = ['Wish You Were Here','/images/B_CoolStarArtistConcept-sm.preview.jpg','Some text here about this featured item that will help you make informed decisions.'];
*/
var masterFeatureList2 = [];

masterFeatureList2[0] = ['','/images/featureAdvert_giftCard.png'];
masterFeatureList2[1] = ['Target','/giftCardImages/TargetGiftCard.jpg'];
masterFeatureList2[2] = ['BedBathBeyond','/giftCardImages/bed_bath_beyond.jpg'];
masterFeatureList2[3] = ['BedBathBeyond','/giftCardImages/best_buy_gift_card_large.jpg'];
masterFeatureList2[4] = ['BedBathBeyond','/giftCardImages/darden_gift_card.jpg'];
masterFeatureList2[5] = ['BedBathBeyond','/giftCardImages/GCard_ENG_4.jpg'];
masterFeatureList2[6] = ['BedBathBeyond','/giftCardImages/gift-card-th.jpg'];
masterFeatureList2[7] = ['BedBathBeyond','/giftCardImages/itunes-card.jpg'];
masterFeatureList2[8] = ['BedBathBeyond','/giftCardImages/macys-gift-cards2.jpg'];
masterFeatureList2[9] = ['Toys-R-Us','/giftCardImages/toys-r-us-logo.jpg'];

var startPos = 380;
var midPos = 0;
var endPos = -380;
var imgCount = 0;
var slideObj1;

function slidePanelIn() {
	t2 = new Tween(slideObj1.style,'left',Tween.strongEaseOut,startPos,midPos,1,'px');
	t2.onMotionFinished = function() {
		setTimeout(slidePanelOut,5000);
	};
	t2.start();
}

function slidePanelOut() {
	t1 = new Tween(slideObj1.style,'left',Tween.strongOut,midPos,endPos,0.3,'px');
	t1.onMotionFinished = function() {
		
		var cardThumbChange = masterFeatureList1[imgCount][1];
		
		$('slideMe1_img').src = cardThumbChange;
		$('slideMe1_a').innerHTML = "<a href='prodDetails.cfm?ItemID=" + masterFeatureList1[imgCount][4] + "'>" + $('slideMe1_img').parentNode.innerHTML + "</a>";
		$('featureImgObj').style.backgroundImage = "url(/images/cardBacking.png)";
		$('featureTitleObj').innerHTML = masterFeatureList1[imgCount][0];
		$('featureTextObj').innerHTML = masterFeatureList1[imgCount][2];
		setTimeout(slidePanelIn,250);
		
		if(imgCount == masterFeatureList1.length-1) {
			imgCount = 0;
		} else {
			imgCount = imgCount + 1;
		}
		
	};
	t1.start();
}

var headlineObj;
var headlineCount = 0;
var headlineTimeout;
//var headlineList1 = ['No need to wait in line','No need to buy stamps','Never miss an occassion','Schedule the entire year at one time','A Real Card not an E Card','Save Time and Money'];
var headlineList1 = ['Real Paper Cards','Every Card only $3.95 including postage','Pick Your Card','Personalize Your Card','Add A Gift ','We Send Your Card'];
function runHeadlineFadeIn() {
	var startOpacity = 0;
	var endOpacity = 100;
	var duration = 1;
	var opacityTweenIn = new OpacityTween(headlineObj,Tween.strongEaseIn,startOpacity,endOpacity,duration);
	opacityTweenIn.onMotionFinished = function(){
		headlineTimeout = setTimeout(runHeadlineFadeOut,4000);
		//alert( 'onMotionFinished' )
	};
	opacityTweenIn.start();
}
function runHeadlineFadeOut() {
	var startOpacity = 100;
	var endOpacity = 0;
	var duration = 1;
	var opacityTweenOut = new OpacityTween(headlineObj,Tween.strongEaseIn,startOpacity,endOpacity,duration);
	opacityTweenOut.onMotionFinished = function() {
		headlineTimeout = setTimeout(runHeadlineFadeIn,100);
		if(headlineCount <= headlineList1.length - 2) {
			headlineCount = headlineCount + 1;
		} else {
			headlineCount = 0;
		}
		headlineObj.innerHTML = headlineList1[headlineCount];
		//alert( 'onMotionFinished' )
	};
	opacityTweenOut.start();
}
function fadeHeadlines() {
	
	headlineObj = $('headlineObj');
	headlineObj.innerHTML = headlineList1[0];
	
	//headlineObjArray = $('headlines').getElementsByTagName('h1');
	//console.log(headlineObjArray[0].id);
	headlineTimeout = setTimeout(runHeadlineFadeIn,0);
}


var imgNumCount = 3;

function init() {
	
	fadeHeadlines();
	
	/*setInterval(function(){ 
		
		if(imgNumCount == 3) {
			imgNumCount = 2;
			jQuery('#homeMenu').removeClass = 'homeMenu';
			jQuery('#homeMenu').addClass = 'homeMenuDark';
		} else {
			imgNumCount = 3;
			jQuery('#homeMenu').removeClass = 'homeMenuDark';
			jQuery('#homeMenu').addClass = 'homeMenu';
		}
		jQuery('#homePhotos').fadeOut(750,function(){
			jQuery('#homePhotos').css({backgroundImage:'url("/images/homeMainPhoto' + imgNumCount + '.jpg")'});
			jQuery('#homePhotos').fadeIn(750);
		});
		
	},5000);*/
	
	var currentPage = location.href;
	var homePage = currentPage.search('home.cfm');
	if(homePage > 0) {
		slideObj1 = $('slideMe1');
		//setTimeout(slidePanelOut,2000);
		slidePanelOut();
	}
}

window.onload = init;
