/* -- product alternate views -- */

// swaps image src based on href value from standard link
function swapImg(theURL) {
	//find image
	var img = $("photo");
	if (!img) return false;
	
	// change img src
	img.src = theURL;
}

// sets active state for swapImg links
function swapImgActive(links, activeLink) {
	// remove 'on' classes from all links
	links.each(function(el) {
		el.removeClass('on');
	});

	// add 'on' class to active link
	activeLink.addClass('on');
}


// adds onclick handlers for swapImg() to product nav links
function initSwapImg() {
	var links = $$("#views a");
	
	links.each(function (el) {
		el.addEvent('click', function(e) {
			swapImg(this.href);
			swapImgActive(links, el);
			e = new Event(e).stop(); // cancel default link behavior
		});
	});	
}
window.addEvent('domready', initSwapImg);


/* -- configure sIFR -- */
var avantBook = { 
	src: '/swf/ITC-AvantGardeBook.swf'
	,ratios: [8, 1.3, 9, 1.22, 10, 1.25, 11, 1.22, 12, 1.2, 18, 1.19, 21, 1.15, 22, 1.16, 30, 1.15, 40, 1.14, 51, 1.13, 82, 1.12, 84, 1.11, 85, 1.12, 89, 1.11, 90, 1.12, 1.11]
	};
var avantMedium = { 
	src: '/swf/ITC-AvantGardeMedium.swf'
	,ratios: [8, 1.3, 9, 1.22, 10, 1.25, 11, 1.22, 12, 1.2, 18, 1.19, 21, 1.15, 22, 1.16, 30, 1.15, 40, 1.14, 51, 1.13, 82, 1.12, 84, 1.11, 85, 1.12, 89, 1.11, 90, 1.12, 1.11]
	};	
var avantDemi = { 
	src: '/swf/ITC-AvantGardeDemi.swf'
	,ratios: [8, 1.3, 9, 1.22, 10, 1.25, 11, 1.22, 12, 1.2, 18, 1.19, 21, 1.15, 22, 1.16, 30, 1.15, 40, 1.14, 51, 1.13, 82, 1.12, 84, 1.11, 85, 1.12, 89, 1.11, 90, 1.12, 1.11]
	};	

sIFR.activate(avantBook, avantMedium, avantDemi);
//sIFR.debug.ratios({ src: '/swf/ITC-Avant-Gard-Gothic-Book.swf', selector: '#intro p' });

sIFR.replace(avantBook, {
	selector: '.pedos #intro p'
    ,css: [
      '.sIFR-root { color: #038ec9; leading: 0; }'
    ]	
});
sIFR.replace(avantBook, {
	selector: '.chronos #intro p'
    ,css: [
      '.sIFR-root { color: #fdb813; leading: 0; }'
    ]	
});
sIFR.replace(avantBook, {
	selector: '.hrm #intro p'
    ,css: [
      '.sIFR-root { color: #adb537; leading: 0; }'
    ]	
});
sIFR.replace(avantBook, {
	selector: '#intro p'
    ,css: [
      '.sIFR-root { color: #e5402c; leading: 0; }'
    ]	
});
sIFR.replace(avantMedium, {
	selector: '.pedos ul.detail h2'
    ,css: [
      '.sIFR-root { leading: 0; }'
      ,'a:link { color: #038ec9; }'
      ,'a:hover { color: #038ec9; }'
    ]	
});
sIFR.replace(avantMedium, {
	selector: '.chronos ul.detail h2'
    ,css: [
      '.sIFR-root { leading: 0; }'
      ,'a:link { color: #fdb813; }'
      ,'a:hover { color: #fdb813; }'
    ]	
});
sIFR.replace(avantMedium, {
	selector: '.hrm ul.detail h2'
    ,css: [
      '.sIFR-root { leading: 0; }'
      ,'a:link { color: #adb537; }'
      ,'a:hover { color: #adb537; }'
    ]	
});
sIFR.replace(avantMedium, {
	selector: 'ul.detail h2'
    ,css: [
      '.sIFR-root { leading: 0; }'
      ,'a:link { color: #000000; }'
      ,'a:hover { color: #000000; }'
    ]	
});
sIFR.replace(avantDemi, {
	selector: '.pedos .product h1'
    ,css: [
      '.sIFR-root { color: #038ec9; leading: 0; }'
    ]	
});
sIFR.replace(avantDemi, {
	selector: '.chronos .product h1'
    ,css: [
      '.sIFR-root { color: #fdb813; leading: 0; }'
    ]	
});
sIFR.replace(avantDemi, {
	selector: '.hrm .product h1'
    ,css: [
      '.sIFR-root { color: #adb537; leading: 0; }'
    ]	
});
sIFR.replace(avantDemi, {
	selector: '.product h1'
    ,css: [
      '.sIFR-root { leading: 0; }'
    ]	
});