// namespace
var ha = {
	page: {},
	settings: {},
	strings: {},
	ui: {},
	util: {}
};

/* 
 * Home page 
 */
ha.page.home = {
	init: function(){
		ha.page.home.dialog();
		ha.page.home.submit();
		ha.page.home.cache();
	},
	
	dialog: function() {
		$j("#option0,#option1").qtip({ content: ha.strings.snippet01, position: {corner: {target: 'topRight', tooltip: 'bottomLeft'}}, style: 'snippet'});
		$j("#option2").qtip({ content: ha.strings.snippet2, position: {corner: {target: 'topRight', tooltip: 'bottomLeft'}}, style: 'snippet'});
		$j("#option3").qtip({ content: ha.strings.snippet3, position: {corner: {target: 'topRight', tooltip: 'bottomLeft'}}, style: 'snippet'});
		$j("#option4").qtip({ content: ha.strings.snippet4, position: {corner: {target: 'topRight', tooltip: 'bottomLeft'}}, style: 'snippet'});
		$j("#option5").qtip({ content: ha.strings.snippet5, position: {corner: {target: 'topRight', tooltip: 'bottomLeft'}}, style: 'snippet'});
	},
	
	submit: function(){
		$j('input#submit-btn').click(function(e){
			var url = "/registration";
			var args = "700:700:no";
			var title = "";
			
			$j("input.rg-option").each(function(i,el){
				if (el.checked && el.value == "gold") url = "/checkout";
			});

			ha.util.modalbox.show(title,url,args);
		});
	},
	
	cache: function(){
		regBox = new Image(); 
		regBox.src = "/resources/324/images/skin/registration-box.png";
	}
};

/*
 * Registration Confirmation
 */
ha.page.conf = {
	init: function(){
		//if (!jQuery.browser.msie) $j("#mb-iframe",top.document).css({height:"430px"});
		//else $j("#mb-iframe",top.document).css({height:"432px"});
		$j("#option1").qtip({ content: ha.strings.snippet0, position: {corner: {target: 'topLeft', tooltip: 'bottomLeft'}}, style: 'confSnippet'});
		$j("#option2").qtip({ content: ha.strings.snippet1, position: {corner: {target: 'topLeft', tooltip: 'bottomLeft'}}, style: 'confSnippet'});
		$j("#option3").qtip({ content: ha.strings.snippet2, position: {corner: {target: 'topLeft', tooltip: 'bottomLeft'}}, style: 'confSnippet'});
		$j("#option4").qtip({ content: ha.strings.snippet3, position: {corner: {target: 'topLeft', tooltip: 'bottomLeft'}}, style: 'confSnippet'});
		$j("#option5").qtip({ content: ha.strings.snippet4, position: {corner: {target: 'topLeft', tooltip: 'bottomLeft'}}, style: 'confSnippet'});
	}
};

$j(document).ready(function(){
	if ($j("body.checkout-error, body.home").length > 0){
		ha.util.modalbox.init();
	}
	if ($j("body.home").length > 0){
		ha.page.home.init();
	}
	if ($j("body.registration").length > 0 || $j("body.confirmation").length > 0){
		$j('.mb-inner #close-btn, #no-thx-lnk').click(function(){self.parent.ha.util.modalbox.remove();});
	}
	if ($j("body.confirmation").length > 0){
		ha.page.conf.init();
	}
});

