/* ------------------------------------------------------------
	
	filename:	function.js
	created:	071020
	update:		071214
	copyright:	(c)2008 Intelligentnet, Inc. All rights reserved.
	
------------------------------------------------------------ */

// ちらつき回避
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

$(function(){
	// h2の前に「このページの先頭へ」がある場合 */
	$("div#mainContents p.totop + h2").addClass("siblingB");//margin-top: 0;	   

	// 見出しの前にロケータがある場合
	$("div#mainContents div.locator h2:first-child").addClass("siblingA");//margin-top: 10px;
	$("div#mainContents div.locator h3:first-child").addClass("firstChild");//margin-top: 10px;
	$("div#mainContents div.locator h4:first-child").addClass("firstChild");//margin-top: 10px;
	$("div#mainContents div.locator + h2").addClass("siblingA");//margin-top: 10px;
	$("div#mainContents div.locator + h3").addClass("siblingA");//margin-top: 10px;
	$("div#mainContents div.locator + h4").addClass("siblingA");//margin-top: 10px;
	$("div#mainContents div.locator + div.locator h2").addClass("siblingC");//margin-top: 20px;

	// 見出し要素の後ろにカラムがある場合
	$("div#mainContents h2 + div.locator h3:first-child").addClass("siblingB");//margin-top: 0;

	// 見出しが連続する場合
	$("div#mainContents h2 + h3").addClass("siblingB");//margin-top: 0;
	$("div#mainContents h3 + h4").addClass("siblingB");//margin-top: 0;

	// firstChild
	$("div#platform dt:first-child").addClass("firstChild");
	$("div#platform dt:first-child + dd").addClass("firstChild");

	// lastChild
	$("div#platform p:last-child").addClass("lastChild");
	$("div#platform ul:last-child").addClass("lastChild");
	$("div#platform ol:last-child").addClass("lastChild");
	$("div#platform li:last-child").addClass("lastChild");
	$("div#platform dl:last-child").addClass("lastChild");
	$("div#platform dt:last-child").addClass("lastChild");
	$("div#platform dd:last-child").addClass("lastChild");
	$("div.inner > :last-child").addClass("directLastChild");

	$("div#mainContents p.symbol + ul").addClass("symbol");

	// その他
	$("div#mainContents p.lead + div.locator h2").addClass("siblingB");//margin-top: 0;

	//奇数、偶数を自動追加
	$('ul').each(function(){
		$(this).find('li:odd').addClass('even');
		$(this).find('li:even').addClass('odd');
	});
	$('table').each(function(){
		$(this).find('tr:odd').addClass('even');
		$(this).find('tr:even').addClass('odd');
	});

	//画像へ直リンクするとthickboxで表示(thickbox.js利用)
	tb_init('a[@href$=".jpg"], a[@href$=".gif"], a[@href$=".png"]');

	//プリント対応
	$('body:has()').each(function(){
		$(this).addClass('li:odd').addClass('even');
	});

	//プリント対応山森
	$('a[@href$=".gif"]').click(function(){
	$('div#platform').addClass('print');
	});

	//最新jQuery対応
	(function($) {
		$.dequeue = function( a , b ){
		return $(a).dequeue(b);
		};
	})( jQuery );
});
