function openWin(fi,na,w,h) {
window.open(fi,na,"width="+w+",height="+h+",left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,favorites=no,resizable=yes");
};


function OpenMenu(id){
   document.getElementById( id ).style.visibility = 'visible';
}
function CloseMenu(id){
   document.getElementById( id ).style.visibility = 'hidden';
};


function ShowNowYear() {
   var now = new Date();
   var year = now.getFullYear();
   document.write(year);
};


function selJump(sel){
JumpUri = sel.options[sel.selectedIndex].value;
if(JumpUri != "" ) location.href = JumpUri;
};

function clickJump(targetName)
{
	obj = referObject(targetName);
	JumpUri = obj.options[obj.selectedIndex].value;
	if(JumpUri != "" ) location.href = JumpUri;
};

function CalcAllergy(targetName,totalName,twice)
{
	switch (arguments.length) { 
		case 3: twice = true; 
	}
	var i=1,total=0;
	var obj;
	while( obj = referObject(targetName+i) ){
		n = obj.selectedIndex;
		// 第三引数がある場合は2倍にする
		if(twice){
			total += parseInt( obj[n].value ) * 2;
		}else{
			total += parseInt( obj[n].value );
		}
		i++;
	}
	if( isNaN(total) ){
		alert('フレーバーまたはトッピングが選択されていません。');
	}else{
		if( obj = referObject(targetName+'Add') ) total += parseInt( obj.value );
		if( obj = referObject(totalName) ) obj.value = total;
	}
}


function CalcAllergyRegular(targetName,totalName)
{
	var i=1,total=0;
	var obj;
	while( obj = referObject(targetName+i) ){
		n = obj.selectedIndex;
		total += parseInt( obj[n].value );
		i++;
	}
	if( isNaN(total) ){
		alert('フレーバーまたはトッピングが選択されていません。');
	}else{
		total = parseInt( total*1.29 );
		if( obj = referObject(targetName+'Add') ) total += parseInt( obj.value );
		if( obj = referObject(totalName) ) obj.value = total;
	}
}



//===========================================================================
//	関数名　：referObject
//	関数概要：オブジェクトのIDからオブジェクトを探し、オブジェクトとして返す
// -------------------------------------------------------------------------
//	引数	：objName	- オブジェクトのName（文字列
//	戻り値	：オブジェクト or False  ※引数省略不可
//===========================================================================
function referObject(objName)
{
	// N6,Moz,IE5,IE6用
//	if (document.getElementById)
	if (document.getElementsByName)
	{		
		if (document.getElementsByName(objName))
		{
			var obj = document.getElementsByName(objName);
			if( obj.length > 1 )
			{
				return obj;
			} else {
				return obj[0];
			}
			
			return document.getElementsByName(objName)
		}
	}
	else if (document.all)
	{
		// N4用
		if (document.all(objName))
		{
			return document.all(objName);
		}
	}
	return false;
}


// ２重送信防止
var submitFlag = false;

function setSubmitFlag(id)
{
	if( submitFlag==false ){
		document.getElementById( id ).disabled = 'true';
		submitFlag == true;
		return true;
	}else{
		return false;
	}
}
