

/* photo tray */

function photoTray(dir) {	 
if(photoTray != 0) {

	//move left
	if(dir != 0) {
		if(photoTrayCounter == 0) { $('photoLogosGroup2').style.left = photoTrayWidth }
		//reset the photo containers and the counter 
		if(photoTrayCounter == (photoTrayTotal-(photoTrayTotal*2))) { 
			$('photoLogosGroup1').style.left = '0px'; 
			$('photoLogosGroup2').style.left = photoTrayWidth;
			photoTrayCounter = 0}	
				photoTrayCounter = photoTrayCounter -1;
				Effect.MoveBy( 'photoLogosGroup1', 0, -115, { 
				beforeStart: function() { disablephotoTrayBtns(0); }, afterFinish: function() { disablephotoTrayBtns(1); }, duration:1} ); 
				Effect.MoveBy( 'photoLogosGroup2', 0, -115, {duration:1} );
							
		} else { 
		
		//move right
		if(photoTrayCounter == 0) { $('photoLogosGroup2').style.left = photoTrayWidthRight; }
		//reset the photo containers and the counter 
		if(photoTrayCounter == photoTrayTotal) { 
			$('photoLogosGroup1').style.left = '0px'; 
			$('photoLogosGroup2').style.left = photoTrayWidthRight;
			photoTrayCounter = 0}
				photoTrayCounter = photoTrayCounter +1;
				Effect.MoveBy( 'photoLogosGroup1', 0, 115, { 
				beforeStart: function() { disablephotoTrayBtns(0); }, afterFinish: function() { disablephotoTrayBtns(1); }, duration:1} ); 
				Effect.MoveBy( 'photoLogosGroup2', 0, 115, {duration:1} ); 
		}
	}
}	

//this function deactivates button while photo gallery is moving
function disablephotoTrayBtns(active) {	
	if(active == 0) { 
		$('next').onclick =  null;
		$('prev').onclick =  null;
	  }
	if(active == 1) { 
		$('next').onclick =  photoTray;
		$('prev').onclick =  new Function("photoTray("+0+")");
		}
}


/* make marthastewart.com your homepage */

function setMarthaAsHomePage(obj, url) {
	var browserName=navigator.appName; 

	// tracking
	var s=s_gi(s_account); 
	s.linkTrackVars='eVar1,prop8'; 
	s.linkTrackEvents='None'; 
	s.eVar1='homepage_bookmark'; 
	s.prop8='homepage_bookmark'; 
	s.tl(this,'o','Homepage Bookmark');

	// set home page, if possible
	if (browserName=="Microsoft Internet Explorer") {
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage('http://www.marthastewart.com');
	} else { 
		// can't set homepage with current browser - show instructions instead	
		openBrWindow(url,'setHomePageWindow','status=no,scrollbars=yes,width=550,height=600');
	}
}

