/**
 * FIX IE6 IMAGE FLICKER PROBLEM
 *
 */
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

var LGPop = {
	
	init: function() {
		
		var __me = this;
		
		// Cufon
		Cufon.replace('div.wizard h1, div.wizard h2, div.slideshow h1', { fontFamily: 'Bryant Pro Regular' });
		Cufon.replace('div.wizard.step1 p.instructions strong, div.wizard a.button span, div.wizard div.cropped span', { fontFamily: 'Bryant Pro Bold' });
		
		__me.fileBrowser();
		
		
		$('div.wizard a.button').each(function() {
			var height = parseInt((46 - $('span', this).height()) / 2);
			$('span', this).css('marginTop', height + 'px');
		});
		
		// Hide scrollbars if browser frame is greater than page width.
		__me.browserWindowResize();
		
		$(window).resize(function() { __me.browserWindowResize(); });
		
	},
	
	browserWindowResize: function() {
		
		var currWidth = $(window).width();

		if(currWidth >= $('#page').width()) {
			$('html, body').addClass('hide');
			
		} else {
			$('html, body').removeClass('hide');
		}
	
	},
	
	
	fileBrowser: function() {
		
		var currLang = $('html').attr('lang');
		
		$('div.filebrowser').append('<div class="browse"><input value="" /><img src="/_images/btn_' + currLang + '_browe_122w_32h.gif" /></div>');
		
		var uploadElem = $('div.filebrowser input.file');
		var fakeElem = $('div.filebrowser div.browse input');
		
	
		$(uploadElem).mouseout(function() {
			$(fakeElem).val($(this).val());
		});
		
		$(uploadElem).change(function() {
			$(fakeElem).val($(this).val());
		});
	}
	
}