
function loadimg(imglist){
	data = new Array(imglist);
	preload = new Array();
	for(i=0; i<data.length; i++)
	{
		preload[i] = new Image();
		preload[i].src = data[i];
	}
}

function imgON(file,name) {document[name].src = file;}
function imgOFF(file,name) {document[name].src = file;}

function winop(page,w,h){
window.open(page,"openwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+w+",height="+h)
}

function winop_sc(page,w,h){
window.open(page,"openwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+w+",height="+h)
}

function winop_bc(page,w,h){
window.open(page,"openwin","toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+w+",height="+h)
}

//---配達先用チェックボックスにチェック
function SetCheck()
{	
	document.form2.teiki_check.checked=true;
}

//---フォームのテキスト部分が空ではなければ上を起動
function Check(fname)
{	
	if (document.form2[fname].value != ""){
		SetCheck();
	}
}

function Change_cart(fname){
	document[fname].submit();
}

function Change(fname){

	// 2007-01-17 modified by t-sho
	//if(document[fname].teiki[1].selected){
	//winop('products/plan.cfm',510,650);
	//}

	document[fname].submit();
}
//------------------------------------------------------------------//
// プランを変更したときのみ、プラン用ポップアップを表示
//------------------------------------------------------------------//
function changePlanPopup(fname){
	if(document[fname].teiki[1].selected){
		winop('products/plan.cfm',480,670);
	}
	document[fname].submit();
}
// 2007-12-21 added top
function changePlanPopup2nd(fname){
	if(document[fname].teiki[1].selected){
		winop('products/plan_2nd.cfm',480,510);
	}
	document[fname].submit();
}
// 2007-12-21 add end ----//
function changePlanPopup_2nd(fname){

	if(document[fname].teiki[1].selected){
		//2007-02-14 modified
		//winop('../products/plan_2nd.cfm',510,560);
		winop('../products/plan_2nd.cfm',480,510);
	}
	document[fname].submit();
}
function changePlanPopup_cart(fname){
	document[fname].submit();
}
//------------------------------------------------------------------//
//------------------------------------------------------------------//

//---フォームの住所読み込み
function zip(fname){

	//document[fname].action = "order_tri.cfm";	20070919 MOD
	document[fname].action = "order_tri.cfm#INPUT1";
	document[fname].zipcheck.value = "住所読込";

	document[fname].submit();
}

function sub_zip(fname){

	document[fname].action = "order_tri2.cfm";
	document[fname].sub_zipcheck.value = "住所読込";

	document[fname].submit();
}

//---フォームの住所読み込み
function zip_o(fname){

	document[fname].action = "order.cfm";
	document[fname].zipcheck.value = "住所読込";

	document[fname].submit();
}

function sub_zip_o(fname){

	document[fname].action = "order2.cfm";
	document[fname].sub_zipcheck.value = "住所読込";

	document[fname].submit();
}

function popUp(url) {sealWin=window.open(url,"win",'toolbar=0,location=1,directories=0,status=1,menubar=1, scrollbars=1,resizable=1,width=500,height=450');self.name = "mainWin"; }


//---フォーム送り先切り替え
function chorder(cre){
	if(form2.haiso[1].checked){
		document.form2.action = "order2.cfm";
	}
	else{
		if (cre == 0){
		document.form2.action = "order_check.cfm";
		}
		else if(cre == 1) {
		document.form2.action = "order_cre.cfm";	
		}
	}
}
//---フォーム送り先切り替え
function chorder2(hai){
	if (hai == 0){
		if (form2.type[1].checked){
		document.form2.action = "order_cre.cfm";
		}
		else {
		document.form2.action = "order_check.cfm";
		}
	}
	else if(hai == 1) {
	document.form2.action = "order2.cfm";	
	}
}



//---フォーム送り先切り替え-初回
function chordertri(cre){	
	if(form2.haiso[1].checked){
		document.form2.action = "order_tri2.cfm";
	}
	else{
		if (cre == 0){
			document.form2.action = "order_check_tri.cfm";
		}
		else if(cre == 1) {
			document.form2.action = "order_cre.cfm";	
		}
	}
}
//---フォーム送り先切り替え-初回
function chordertri2(hai){
	if (hai == 0){
		if(form2.type[1].checked){
			document.form2.action = "order_cre.cfm";
		}
		else{
			document.form2.action = "order_check_tri.cfm";
		}
	}
	else if(hai == 1) {
		document.form2.action = "order_tri2.cfm";	
	}
}



//---フォーム送り先切り替え
function chsubmit(){

	if(document.form2.haiso[1].checked == true){
		document.form2.action = "order2.cfm";
	}
	else{
		if (document.form2.type[0].checked == true){
		document.form2.action = "order_check.cfm";
		}
		else if (document.form2.type[1].checked == true){
		document.form2.action = "order_cre.cfm";	
		}
	}
	return true;
}
//---フォーム送り先切り替え-初回
function chsubmittri(){
	
	if(document.form2.haiso[1].checked == true){
		document.form2.action = "order_tri2.cfm";
	}
	else{
		if (document.form2.type[0].checked == true){
			document.form2.action = "order_check_tri.cfm";
		}
		else if (document.form2.type[1].checked == true){
			document.form2.action = "order_cre.cfm";	
		}
	}
	
	return true;
}

//---フォーム送り先切り替え-初回（プラン確認追加） 20070912 ADD
function chsubmittri2(){
 
 if(document.form_c1.teiki.value == 0){
	document.form2.action = "order_plan.cfm";
	return true;
 }
 
 if(document.form2.haiso[1].checked == true){
	document.form2.action = "order_tri2.cfm";
	return true;
 }
 
 if (document.form2.type[0].checked == true){
	document.form2.action = "order_check_tri.cfm";
	return true;
 }
 
 if (document.form2.type[1].checked == true){
	document.form2.action = "order_cre.cfm"; 
	return true;
 }
 
	return false;
}

function sicle(fname){
	document.form2.TM_TERM.value = formk.kikan.options[formk.kikan.selectedIndex].value;
}

function q2_on() {
		document.form2.q2.disabled = false;
		document.form2.q3.disabled = true;
		document.form2.q3.selectedIndex = 0;
}
function q3_on() {
		document.form2.q2.disabled = true;
		document.form2.q2.value = "";	
		document.form2.q3.disabled = false;
}

function OnTVButtonClick(magazineListId, tvradioTextBoxId) {
		
		var magazineList = document.getElementById(magazineListId);
		var tvradioTextBox = document.getElementById(tvradioTextBoxId);

		tvradioTextBox.disabled = false;
		magazineList.disabled = true;
		magazineList.selectedIndex = 0;
}
function OnMagazineButtonClick(magazineListId, tvradioTextBoxId) {

		var magazineList = document.getElementById(magazineListId);
		var tvradioTextBox = document.getElementById(tvradioTextBoxId);

		tvradioTextBox.disabled = true;
	tvradioTextBox.value = "";	
		magazineList.disabled = false;
}

// TVCM・通販番組リストボックス、雑誌リストボックスを非活性化させる。
function QuestionnaireClear(tvcmId,magazineListId,tvSpanId,magazineSpanId)
{
		var tvcmList = document.getElementById(tvcmId);
		var magazineList = document.getElementById(magazineListId);
		var tvSpan = document.getElementById(tvSpanId);
		var magazineSpan = document.getElementById(magazineSpanId);
		
		tvcmList.disabled = true;
		tvcmList.selectedIndex = 0;
		magazineList.disabled = true;
		magazineList.selectedIndex = 0;
		tvSpan.style.display = "none";
		magazineSpan.style.display = "none";
}


// TVCM・通販番組リストボックスを活性化させ、雑誌リストボックスを非活性化させる。
function EnableTvCmSelectControl(tvcmId,magazineListId,tvSpanId,magazineSpanId)
{
		var tvcmList = document.getElementById(tvcmId);
		var magazineList = document.getElementById(magazineListId);
		var tvSpan = document.getElementById(tvSpanId);
		var magazineSpan = document.getElementById(magazineSpanId);
		
		tvcmList.disabled = false;
		magazineList.disabled = true;
		magazineList.selectedIndex = 0;
		tvSpan.style.display = ""
		magazineSpan.style.display = "none";
}

// 雑誌リストボックスを活性化させ、TVCM・通販番組リストボックスを非活性化させる。
function EnableMagazineSelectControl(tvcmId,magazineListId,tvSpanId,magazineSpanId)
{
		var tvcmList = document.getElementById(tvcmId);
		var magazineList = document.getElementById(magazineListId);
		var tvSpan = document.getElementById(tvSpanId);
		var magazineSpan = document.getElementById(magazineSpanId);
		
		tvcmList.disabled = true;
		tvcmList.selectedIndex = 0;
		magazineList.disabled = false;
		tvSpan.style.display = "none";
		magazineSpan.style.display = "";
}

//---フォームの住所読み込み
function zip_2nd(fname){

	document[fname].action = "order_tri.cfm";
	document[fname].zipcheck.value = "住所読込";

	document[fname].submit();
}


function Change_2nd(fname){

	// 2007-01-17 modified by t-sho
	//if(document[fname].teiki[1].selected){
	//winop('../products/plan_2nd.cfm',510,560);
	//}

	document[fname].submit();
}

//---プランパターン分析用クッキー生成
function planPattern(value1){
	document.cookie = "PL_PATTERN=" + value1 + ";path=/;"
}


//---会員TOPページ購入
function orderMember(NumberDropDownListID,url,type){
		
	num = $get(NumberDropDownListID)[$get(NumberDropDownListID).selectedIndex].text;
	
		url = url+"?id="+num;
		
		if(type != 0)
	{
			url = url + "&type="+type;
	}
		
		window.location.href = url;
		
		return false;
		
}

function $get(id)
{
		return document.getElementById(id);
}

function keyDown(nextID,buttonID,evt1)	 
{	 
		if(event.keyCode == 13)
		{	 
				if(nextID == buttonID)
				{
						$get(buttonID).focus();
						$get(buttonID).click();
						return false;
				}
				
				else{
						$get(buttonID).focus();
						$get(buttonID).click();
						return false;
				}
				
		}
}


function make(evt)
{
		if (evt.keyCode == 13) { 
			 
		if(event)
		{
				event.returnValue = false;
		}
		else{
				var newEvent = document.createEvent("KeyEvents");
				newEvent.initKeyEvent("keypress", true, true, document.defaultView, evt.ctrlKey, evt.altKey, evt.shiftKey, evt.metaKey, 0) ;
				evt.preventDefault();
				evt.target.dispatchEvent(newEvent);
				}
		}
}