(function($j) {

	Code.registerNamespace('Website');

	Website.Core = Code.Class.extend({

		_bindLeModalEvent: function() {
			var self = this;

			$j('.js-enter-comp').click(function(event) {
				var $myTarget = $j(event.target);
				if ($myTarget.is('a')) {
					self._showLeModal();
				}
				return false;
			});
		},

		_initPopupWindows: function() {

			var self = this;

			var width = 980;
			var height = 850;
			var leftPosition = (screen.width) ? (screen.width - width) / 2 : 100;
			var topPosition = (screen.height) ? (screen.height - height) / 2 : 100;

			settings = 'width=' + width + ',height=' + height + ',top=' + topPosition + ',left=' + leftPosition +
									',scrollbars=no,location=no,directories=no,status=0,menubar=no,toolbar=no,resizable=no';

			$j('a.js-popup').click(function() {
				window.open($j(this).attr('href'), '', settings);
				return false;
			});

		},

		_showLeModal: function() {

			var self = this;
			$j('object','#ContentPrimary').hide();

			$.leModal.show({
				clickBackgroundToHide: true,
				overlayOpacity: 0.7,
				overlayBackground: 'black',
				modalTopAdjustment: 150,
				showAnimationSpeed: 'fast',
				modalWinBackground: 'none',
				setContentCallBack: function(jModalWin) {
				jModalWin.html('<div><iframe margin="0" frameborder="0" ALLOWTRANSPARENCY="true" width="434" height="454" src="ajax-entry.htm" scrolling=no /></div>');
				}
			});
		},

		_closeLeModal: function() {
			$j.leModal.hide();
			$j('object','#ContentPrimary').show();
		},

		_initExternalLinks: function() {

			$j('a.js-external').click(function() {
				window.open($j(this).attr('href'));
				return false;
			});

		},

		onReady: function() {

			var self = this
			self._bindLeModalEvent();
			self._initExternalLinks();
			self._initPopupWindows();

		}

	});

	Website.Core = new Website.Core();

	$j().ready(function() {
		Website.Core.onReady();
	});


})(jQuery);	

