<!--
/**
 * Ryucom Internet Service JavaScript
 *
 * @author		Osamu Sumi
 * @copyright		Ryucom Co,.Ltd.
 * @since		Version 1.0
 */

// ------------------------------------------------------------------------

/**
 * Page Onload Action
 *
 * @return	void
 */
window.onload = function() {
	document.getElementById('cpsubmit').innerHTML = '<button onClick="onCPSubmit();">ログイン</button>';

	if (document.getElementById('cpusername') != null) {
		textblur(document.getElementById('cpusername'));
	}
	if (document.getElementById('cppassword') != null) {
		textblur(document.getElementById('cppassword'));
	}
	if (document.getElementById('searchtext') != null) {
		textblur(document.getElementById('searchtext'));
	}
	if (document.getElementById('favorite') != null) {
		document.getElementById('favorite').innerHTML = htmlAddFavorite();
	}
}

// ------------------------------------------------------------------------

/**************************************************************************
 * Control Panel Section
 */

/**
 * Action Form onSubmit
 *
 * @param	object	Form Object
 * @return	void
 */
function onSubmit( form ) {
	form.submit();
}

/**
 * RIS Control Panel Login
 *
 * @return	boolean
 */
function onCPSubmit() { 
	document.getElementById("cpmsg").innerHTML = '<img src="/image/rev02/indicator.gif" width="16" height="16" style="vertical-align: middle; margin-right: 0.5em;" /><span style="color: #999999">ログイン中...</span><img src="https://cpanel.ryucom.ne.jp/" width="0" height="0" />';
	setTimeout("FormCPSubmit();",2000);
	return false;
}

function FormCPSubmit() { 
	document.forms['cpfm'].submit();
}

// ------------------------------------------------------------------------

/**************************************************************************
 * Text tag Section
 */

/**
 * Action input text tag for onblur / onfocus
 *
 * @param	string	Form input Object
 * @return	void
 */
function textblur( input ) {
	if (input.value == '') {
		input.style.backgroundImage = 'url(/image/rev02/' + input.id + '.gif)';
		input.style.backgroundRepeat = 'no-repeat';
	} else {
		input.style.backgroundImage = 'none';
	}
}

function textfocus( input ) {
	input.style.backgroundImage = 'none';
}

// ------------------------------------------------------------------------

/**************************************************************************
 * Favorite Section
 */

/**
 * Action Add Favorite
 *
 * @return	string	innerHTML String
 */

function htmlAddFavorite() {
	result = '';
	if (navigator.userAgent.indexOf("MSIE") > -1) {
		result = '<a href="javascript:void(0);" onclick="window.external.AddFavorite(\'http://www.ryucom.ne.jp\',\'リウコムインターネットサービス\');"><img src="/image/rev02/favorite.gif" alt="" width="16" height="16" />お気に入りに登録</a>';
	} else if (navigator.userAgent.indexOf("Firefox") > -1) {
		result = '<a href="javascript:void(0);" onclick="window.sidebar.addPanel(\'リウコムインターネットサービス\',\'http://www.ryucom.ne.jp\',\'\');"><img src="/image/rev02/favorite.gif" alt="" width="16" height="16" />ブックマークに登録</a>';
	} else if (navigator.userAgent.indexOf("Opera") > -1) {
		result = '<a href="http://www.ryucom.ne.jp" rel="sidebar" title="リウコムインターネットサービス"><img src="/image/rev02/favorite.gif" alt="" width="16" height="16" />ブックマークに登録</a>';   
	} else {
		result = '';
	}
	return result;
}
// ------------------------------------------------------------------------

// -->
