function detailTab( disp, nodisp )
{
	var tempS = '' + document.location;
	tempS = tempS.replace( '#detail', '' );
	var tempAr = tempS.split( '/' );
	tempAr.shift();
	tempAr.shift();
	tempAr.shift();
	for( var cnt = 0; cnt < tempAr.length; cnt++ )
	{
		if ( tempAr[cnt].indexOf( '.html' ) > 0 )
		{
			var tt = tempAr[cnt].split( '.' );
			tt[0] += '_' + disp;
			tempAr[cnt] = tt.join('.');
		}
	}
	tempS = '/' + tempAr.join( '/' );


	Element.toggle(disp);
	Element.toggle(nodisp);

	if( typeof urchinTracker == 'function' )
	{
		urchinTracker( tempS );
	}
}

function detailInitBook()
{
	if( $('tabContainer02') )
        {
        	Element.show( 'tabContainer02' );
        }
        else
        {
                for( var cnt = 1; cnt < 4; cnt++ )
                {
                        if( cnt != 2 && $('tabContainer0' + cnt ) )
                        {
                                Element.show( 'tabContainer0' + cnt );
                                break;
                        }
                 }
        }
}

function detailInit()
{
	for( var cnt = 1; cnt < 4; cnt++ )
	{
		if( $('tabContainer0') + cnt )
		{
			Element.show( 'tabContainer0' + cnt );
			break;
		}
	}
}

function tog( tog )
{
	Element.toggle(tog);
}

function fclear()
{
	lS = document.getElementsByTagName( 'input' );
	$A(lS).each(
		function( obj )
		{
			if ( obj.type == 'radio' || obj.type == 'check' )
			{
				obj.checked = false;
			}
			else if ( obj.type == 'text' )
			{
				obj.value = '';
			}
		}
	);
	lS = document.getElementsByTagName( 'select' );
	$A(lS).each(
		function( obj )
		{
			obj.selectedIndex = 0;
		}
	);
	lS = document.getElementsByTagName( 'textarea' );
	$A(lS).each(
		function( obj )
		{
			obj.value = '';
		}
	);
}

var shopping =
{
	isbns: '',
	onq: '0',
	goCart: function( mode )
	{
		shopping.onq = mode;
		shopping.checker();
		if ( !( $('in2').value=shopping.isbns ) && mode == '1' )
		{
			alert( 'チェックされている商品がありません' );
			return;
		}
		$('form1').action = 'cart.html';
		$('form1').submit();
	},

	goComp: function()
	{
		shopping.onq = '1';
		shopping.checker();
		if ( !( $('in2').value=shopping.isbns ) )
		{
			alert( 'チェックされている商品がありません' );
			return;
		}
		$('form1').action = 'comparison.html';
		$('form1').submit();
	},

	checker: function()
	{
		shopping.isbns = '';
		inp = Form.getInputs( "form1", "checkbox" );
		$A(inp).each(
			function( obj )
			{
				if ( shopping.onq == '1' && !obj.checked )
				{
					return;
				}
				if ( shopping.isbns )
				{
					shopping.isbns +=  ';';
				}
				shopping.isbns +=  obj.name;
			}
		);
	}
}

var others =
{
	isbns: '',
	onq: '0',

	goComp: function( md )
	{
		var fm = '';
		if( md )
		{
			fm = '../shopping/comparison.html';
		}
		else
		{
			fm = 'hikaku.html';
		}
		others.onq = '1';
		others.checker();
		if ( !( $('in2').value=others.isbns ) )
		{
			alert( 'チェックされている商品がありません' );
			return;
		}
		$('sndform').action = fm;
		$('sndform').submit();
	},

	checker: function()
	{
		others.isbns = '';
		inp = Form.getInputs( 'sndform', "checkbox" );
		$A(inp).each(
			function( obj )
			{
				if ( others.onq == '1' && !obj.checked )
				{
					return;
				}
				if ( others.isbns )
				{
					others.isbns +=  ';';
				}
				others.isbns +=  obj.name;
			}
		);
	}
};
