// ***************************************************
//
// OPEN＆CLOSEボタン動作速度処理
//
// ***************************************************

function add_toggle(elem){
 var target = elem.id+'_cont';
 Effect.BlindUp( target,{ duration:1.0 } );
 var func = function(){
  Effect.toggle( target,'blind',{ duration:1.0 } );
};
 Event.observe( elem,'click',func );
}
function init(){
 var elem = $('news1');
 add_toggle(elem);
}
Event.observe( window,'load',init );



// ***************************************************
//
// カウントダウン処理
//
// ***************************************************

millenium = new Date(2006,9,1)

function display() {
        today = new Date()
        days = Math.floor((millenium-today)/(24*60*60*1000))
        time1 = Math.floor(((millenium-today)%(24*60*60*1000))/(60*60*1000))
        time2 = Math.floor(((millenium-today)%(24*60*60*1000))/(60*1000))%60
        time3 = Math.floor(((millenium-today)%(24*60*60*1000))/1000)%60%60

        if((millenium - today) > 0){
                document.f.days.value = "2006年10月1日まで"+days+"日"+time1+"時間"+time2+"分"+time3+"秒"
        }else{
                document.f.days.value = "2006年10月1日になりました！"
        }
        tid = setTimeout('display()', 1000)
}



// ***************************************************
//
// サブウィンドウ表示処理
//
// ***************************************************


// ****************************************
//
// showMyAlert()
//
// ****************************************
	
	function showMyAlert() {
		Dialog.alert(
			"ここにお知らせ内容を記述して下さい！<br /><br />by CMS AGENT", 
			{
				windowParameters: {width:300, height:200},
				okLabel: "close", 
				ok:function(win) {return true;}
			}
		);
	}
	
	function showMyConfirm() {
		Dialog.confirm(
			"CMS AGENT Confirm", 
			{
				windowParameters: {width:300},
				okLabel: "close", 
				buttonClass: "myButtonClass",
				id: "myDialogId",
				cancel: function(win) {},
				ok: function(win) {return true;}
			}
		);
	}

// ****************************************
//
// showMyInfo()
//
// ****************************************
	
	function showMyInfo() {
		Dialog.info(
			"ここにお知らせ内容を記述して下さい！<br /><br />by CMS AGENT",
			{
				windowParameters: {width:300, height:200},
				showProgress: true
			}
		);

		var timeout = 10;

		setTimeout(infoTimeout, 1000);
		function infoTimeout() {
			timeout--;
			if (timeout >0) {
				Dialog.setInfoMessage("ここにお知らせ内容を記述して下さい！<br />表示時間を設定できるお知らせバージョンです。 残り " + timeout + " 秒で閉じます。<br /><br />by CMS AGENT");
				setTimeout(infoTimeout, 1000);
			} else {
				Dialog.closeInfo();
			}
		}
	}
	
// ****************************************
//
// showMyAjaxDialog()
//
// ****************************************
	
	function showMyAjaxDialog() {
		Dialog.alert(
			{
				url: "http://www.cocoonsite.com/car/ajaxdialog.html",
				options: {method: 'get'}
			}, 
			{
				windowParameters: {className: "alphacube", width:600, height:400},
				okLabel: "Close"
			}
		);
	}


// ***************************************************
//
// お気に入り登録処理
//
// ***************************************************

url = 'http://www.cocoonsite.com/car/';
name = '最高1359店舗！中古車一括無料査定の方法';
function bookMark() {
  window.external.addFavorite(url,name);
}