// JavaScript Document

(function($) {
// body id
//	$(function() {
//		var page = '';
//		if (/^http:\/\/[^\/]+\/$/.test(window.location.href)) {
//			page = 'index';
//		} else {
//			page = (window.location.href).replace(/^http.+\/([^\/]+)\.shtml$/, '$1');
//		}
//		$('body').attr('id', page);
//	});
	$(function() {
		var page = '';
		if (/^http:\/\/([^\/]+\/)+$/.test(window.location.href)) {
			page = 'index';
		} else {
			page = (window.location.href).replace(/^http.+\/(?:[^\/]+\/)*([^\/]+)\.shtml$/, '$1');
		}
		$('body').attr('class', page);
	});
// end body id


// tabs
//	$(document).ready(function(){
//		$("#example > ul").tabs();
//	});
	$(document).ready(function(){
		$("#menu > ul").tabs({
			fxFade: true,
			fxSpeed: 'slow',
			select: function(event, ui) {
				var $this = $(this);
				if ($this.hasClass('tabs-3more')) {
					$('li', $this).each(function(idx, li) {
						var $li = $(li);
						$li.removeClass('tabs-no-selected');
						// ui.index - selected (zero-based) index of tabs
						if (idx < ui.index && idx + 1 == ui.index) {
							// next <li> element is about to set as "selected"
							$li.addClass('tabs-no-selected');
						} else if (idx > ui.index && idx - 1 > ui.index) {
							// prev-previous (or earlier) <li> element is about to set as "selected"
							$li.addClass('tabs-no-selected');
						}
					});
				}
			}
		});
		$("#menu > ul.tabs-3more").tabs('select', 1);
		$("#menu > ul.tabs-3more").tabs('select', 0);
	});
// end tabs

// png fix
	$(document).ready(function(){ 
		$(document).pngFix(); 
	}); 
// end png fix



// clickdown
	$(document).ready(function($) {
		$('a.clickdown').each(function() {
			var $this = $(this);
			var index = $this.attr('id').match(/(\d+)$/, '');
			var number = parseInt(index[1]);
			$this.click(function() {
				$('#slickbox' + number).slideToggle(400);
				$this.toggleClass('opened').blur();
				return false;
			});
		});
	});
// end clickdown

// tooltip
$(document).ready(function(){
  $('a.nosifr').tooltip({
	track: true,
	delay: 100,
	showBody: '::',
	showURL: false,
	opacity: 0.85,
	bodyHandler: function() {
//<div class="tooltop-head"></div><div class="tooltop-cost"></div><div class="tooltop-cost-mo"></div><div class="tooltop-head"></div><div class="tooltop-cost"></div><div class="tooltop-cost-mo"></div>
        var data = $.metadata.get(this);
        return '<div class="tooltop-head">' + data.title1 + '</div><div class="tooltop-cost-mo">' + data.cost1mo + '</div><div class="tooltop-head">' + data.title3 + '</div><div class="tooltop-cost-mo">' + data.cost3mo + '</div><div class="tooltop-head">' + data.title12 + '</div><div class="tooltop-cost-mo">' + data.cost12mo + '</div><div class="tooltop-head">' + data.title24 + '</div><div class="tooltop-cost-mo">' + data.cost24mo + '</div><div class="tooltop-head">' + data.title36 + '</div><div class="tooltop-cost-mo">' + data.cost36mo + '</div>';
    }
  });
});
// end tooltip

})(jQuery);


