try {

	document.execCommand('BackgroundImageCache', false, true);

} catch(e) {}



function PrintPage(){

	if(document.getElementById || document.layers){

		window.print();	

	}

}



/* form obj set */

function setCheckboxCheck(name, checkValue)

{

	var checkboxOBJ = document.getElementsByName(name);

		

	var i;

	for(i=0; i<checkboxOBJ.length; i++)

	{

		if(checkboxOBJ[i].value == checkValue)

		{		

			checkboxOBJ[i].checked = true;

			return;

		}

	}

}

function setRadioCheck(name, checkValue)

{

	var radio = document.getElementsByName(name);

	

	var i;

	for(i=0; i<radio.length; i++)

	{

		if(radio[i].value == checkValue)

		{		

			radio[i].checked = true;

			return;

		}

	}

}

function setCheckboxArrayCheck(name, checkValue)

{

	var checkboxOBJ = document.getElementsByName(name);	

	var i;

	

	for(i=0; i<checkboxOBJ.length; i++)

	{

		for (j=0; j<checkValue.length; j++)

		{

			if(checkboxOBJ[i].value == checkValue[j])

			{		

				checkboxOBJ[i].checked = true;

				break;

			}

		}

	}

}

function setSelectCheck(name, checkValue)

{

	var obj = document.getElementsByName(name); 

	if(obj == null ) return false;

	if(obj[0].options.length == null) return false;

	

	var i;

	for(i=0;i<obj[0].options.length;i++)

	{

		if(obj[0].options[i].value == checkValue)

		{		

			obj[0].options[i].selected = 'selected';

			return true;

		}

	}

	return false;

}

function setTextBoxValue(name, checkValue)

{

	var obj = document.getElementsByName(name); 

	obj[0].value = checkValue;

}

function setSelectCheckByNumber(name, number)

{

	var obj = document.getElementsByName(name); 

	obj[0].options[number].selected = true;

}

function getSelectNumber(name){

	var obj = document.getElementsByName(name);

	var selectNumber = 0;

	

	var i;

	for(i=0;i<obj[0].options.length;i++){

		if(obj[0].options[i].selected){

			selectNumber = i;

			break;

		}				

	}

	return selectNumber;

}

/* form obj set */



function openWindow(tagetSrc, wndName, width, height, wndStyle ){

	if(wndStyle == "")

	{

		wndStyle = 'resizable=yes,,menubar=no,scrollbars=auto,status=yes,toolbar=no';

	}

	window.open(tagetSrc, wndName,'width=' + width + ',height=' + height + ', ' + wndStyle,'replace=true');

}



function Keisan45(ValueA,Keta)

{

	Atai=1;

	for(i=0;i<Keta; i++)Atai=Atai*10;

	ValueA=Math.floor(Math.round(ValueA*Atai));

	ValueA/=Atai;

	return ValueA;

}



/* Worldwide */

function openWorldwideWindow(){

	openWindow('http://www.sumitomodrive.com/flashLessIntro.html', 'Worldwide', 680, 440);

}

/*
---------------------------------------------------------
	MAIN DRAPDOWN MENU
---------------------------------------------------------
*/
function initGlobal()
{  
	// トップページメインメニュー
	$(" #globalNavi li").hover(function(){  
        $(this).find('ul:first').css({visibility: "visible",display: "none"}).show();  
        },function(){  
        $(this).find('ul:first').css({visibility: "hidden"});  
    }); 

	$('#pickupTab .tabHeader ul li a').click(OnPickupTabClick);
	$('#pickupTab .tabHeader ul li a').eq(GetCookiePickupTabIndex()).click();
} 

/*
---------------------------------------------------------
	RightSide TAB
---------------------------------------------------------
*/
$(function(){
    $('#pickupTab').tabs({
    	selected: GetCookiePickupTabIndex()
	});
});

function OnPickupTabClick()
{	
	if($(this).hasClass('active'))
		return false;
	
	// すべてのタブのcssをリセット
	$('#pickupTab .tabHeader ul li a').removeClass('active');
	
	// これだけアクティブにする
	$(this).addClass('active');

	// cookie
	var index = $('#pickupTab .tabHeader ul li a').index(this);
	$.cookie('PickupTab', index, {expires:365, path: '/'});	
}

function GetCookiePickupTabIndex()
{
	var index = 0;
	if($.cookie('PickupTab')){
		index = $.cookie('PickupTab');
		if(index != 0 && index != 1)
			index = 0;
	}
	
	return index;	
}

/*
---------------------------------------------------------
	addLoadEvent
---------------------------------------------------------
*/
function addOnLoadEvent(handler) {
    jQuery.event.add(window, "load", handler);
}

/*
---------------------------------------------------------
	INIT
---------------------------------------------------------
*/
addOnLoadEvent(initGlobal);
