var din = {
	src: '/swf/fonts/dincondensedc.swf',
	ratios: [9, 1.27, 14, 1.19, 15, 1.16, 23, 1.15, 26, 1.12, 27, 1.13, 37, 1.12, 40, 1.1, 43, 1.11, 50, 1.1, 51, 1.11, 71, 1.1, 76, 1.09, 78, 1.1, 1.09]
};

sIFR.activate(din);

sIFR.replace(din, {
	selector: 'ul.designFilters li a span span',
	css: [
		'.sIFR-root { font-size: 19px; color: #FFFFFF; text-transform: uppercase; cursor: pointer; }'
	],
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content h3.comments',
	css: [
		'.sIFR-root { font-size: 35px; leading: -5px; display: block; float: left; }',
		'.count { color: #ffbd31; }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content h2:not(.no-sifr, .invert, .big-uppercase)',
	css: [
		'.sIFR-root { font-size: 45px; leading: -5px; display: block; float: left; }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content h2.invert',
	css: [
		'.sIFR-root { font-size: 60px; leading: -15px; letter-spacing: -4; color: #ffffff; }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content h2.big-uppercase',
	css: [
		'.sIFR-root { font-size: 60px; leading: -15px; letter-spacing: -4; text-transform: uppercase; }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content h3.myOrder',
	css: [
		'.sIFR-root { font-size: 16px }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content sup.sifr',
	css: [
		'.sIFR-root { font-size: 30px; letter-spacing: -2; }',
		'a { color: #ffbd31 }'
	],
	wmode: 'transparent'
});

/*
 * 		'sup { font-size: 50%; display: inline; }',
 *		'sup a { color: #32affe; }'
 */

sIFR.replace(din, {
	selector: '#content h3.profile-header',
	css: [
		'.sIFR-root { font-size: 30px }'
	],
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content h4.profile-header',
	css: [
		'.sIFR-root { font-size: 25px }'
	],
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content h3.sifr',
	css: [
		'.sIFR-root { font-size: 22px }'
	],
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content .stuff h3',
	renderheight: 45,
	css: [
		'.sIFR-root { font-size: 45px; text-transform: uppercase; letter-spacing: -2; leading: -10px }',
		'.sIFR-root a { color: #000000; text-decoration: none }',
		'.sIFR-root a:hover { color: #000000 }'
	],
	fitExactly: true,
	tuneWidth: 8,
	tuneHeight: -8,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '.b-price',
	css: [
		'.sIFR-root { leading: -5px; }',
		'.b-price-cost { font-size: 50px; letter-spacing: -3; color: #32affe; }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '.b-part-price',
	css: [
		'.sIFR-root { letter-spacing: -1; leading: -2px; }',
		'.b-part-price-cost { font-size: 30px; letter-spacing: -2; }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content .stuff h4',
	css: [
		'.sIFR-root { font-size: 36px; letter-spacing: -2; color: #32affe; }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content .stuff p a.size',
	css: [
		'.sIFR-root { font-size: 24px; letter-spacing: 0; }',
		'.male { color: #0072bc }',
		'.female { color: #ed008c }'
	],
	wmode: 'transparent',
	tuneHeight: -5
});

sIFR.replace(din, {
	selector: '#content h1.sifr',
	css: [
		'.sIFR-root { font-size: 35px; letter-spacing: -2; color: #000000; text-transform: uppercase }'
	],
	tuneHeight: -5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#content h1.sifrBig',
	css: [
		'.sIFR-root { font-size: 45px; letter-spacing: -2; color: #000000; text-transform: uppercase; leading: -12; }'
	],
	tuneHeight: 5,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '.s-ready-to-buy',
	css: [
		'.sIFR-root { font-size: 16px; leading: -14; letter-spacing: 0; color: #848484; text-transform: uppercase; }',
		'.s-ready-to-buy-count { font-size: 100px; letter-spacing: -5; color: #fd0000 }',
		'.s-not-ready-to-buy-count { font-size: 100px; letter-spacing: -5; color: #000000 }'
	],
	tuneHeight: -10,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '.s-price',
	css: [
		'.sIFR-root { font-size: 70px; letter-spacing: -5; color: #32affe }',
		'.s-price-currency { font-size: 45px; letter-spacing: -2 }'
	],
	wmode: 'transparent'
});


sIFR.replace(din, {
	selector: '#content .design-conception-header',
	css: [
		'.sIFR-root { font-size: 50px; text-transform: uppercase; letter-spacing: -3; }'
	],
	tuneHeight: -40,
	wmode: 'transparent'
});

sIFR.replace(din, {
	selector: '#zoom-image-link .zoom',
	css: [
		'.sIFR-root { font-size: 24px; text-transform: uppercase; text-decoration: underline; text-align: center; color: #fefefe; cursor: pointer; }'
	],
	wmode: 'transparent',
	onRelease: function()
		{
			showPhotosModal()
		}
});

sIFR.replace(din, {
	selector: '#zoom-image-link .count',
	css: [
		'.sIFR-root { font-size: 16px; text-transform: uppercase; color: #fefefe; cursor: pointer; }'
	],
	wmode: 'transparent',
	onRelease: function()
		{
			showPhotosModal()
		}
});

function showPhotosModal(){
	if( $('.choose-zoom-image').length )
		tb_show(null, '/?TB_inline&height=700&width=570&inlineId=modal-choosePhotos&modal=true&showHandler=resizeModalByContent()', null)
	else
		tb_show(null, '/?TB_inline&height=700&width=570&inlineId=modal-storePhotos&modal=true&showHandler=resizeModalByContent()', null)
}

/*
sIFR.replace(din, {
	selector: '#account .amount',
	css: [
		'.sIFR-root { font-size: 20px; color: #FFFFFF }'
	],
	tuneHeight: -14,
	wmode: 'transparent'
});
*/

// код ниже применяет sifr для заголовка модального окна
var sifrTimer
var sifrTimer2

$(document).ready(
	function()
	{
		setModalSifrTimer()
		setModalSifrTimer2()
	}
)

function refreshSifr()
{
	if ( $('#modal h1.sifr').length == 0 )
	{
		clearTimeout(sifrTimer)
	}
	else
	{
		if ( $('#modal h1.sifr').attr('class').indexOf('sIFR-replaced') == -1 )
		{
			sIFR.replace(din, {
				selector: '#modal h1.sifr',
				css: [
					'.sIFR-root { font-size: 45px }'
				],
				tuneHeight: 0,
				wmode: 'transparent'
			})
			setModalSifrTimer()
		}
		else
		{
			$(window).focus()
		}
	}
}

function refreshSifr2()
{
	if ( $('#modal h1.sifr-error').length == 0 )
	{
		clearTimeout(sifrTimer2)
	}
	else
	{
		if ( $('#modal h1.sifr-error').attr('class').indexOf('sIFR-replaced') == -1 )
		{
			sIFR.replace(din, {
				selector: '#modal h1.sifr-error',
				css: [
					'.sIFR-root { font-size: 45px; color: #FF0000 }'
				],
				tuneHeight: 0,
				wmode: 'transparent'
			})
			setModalSifrTimer2()
		}
		else
		{
			$(window).focus()
		}
	}
}

function setModalSifrTimer2()
{
	sifrTimer2 = setTimeout(
		function()
		{
			refreshSifr2()
		},
		50
	)
}

function setModalSifrTimer()
{
	sifrTimer = setTimeout(
		function()
		{
			refreshSifr()
		},
		50
	)
}

/*
sIFR.replace(din, {
	selector: '#modal h1.sifr',
	css: [
		'.sIFR-root { font-size: 45px }'
	],
	tuneHeight: 0,
	wmode: 'transparent'
})
*/
/*
sIFR.replace(din, {
	selector: '#modal h1.sifr-error',
	css: [
		'.sIFR-root { font-size: 45px; color: #FF0000 }'
	],
	tuneHeight: 0,
	wmode: 'transparent'
})
*/