/* ▼テキストエリア幅 */
/* ------------------------------------------------------------------------- */
function resize_textarea(ev){
    //if (ev.keyCode != 13) return;
    var textarea = ev.target || ev.srcElement;
    var value = textarea.value;
    var lines = 3;
    for (var i = 0, l = value.length; i < l; i++){
        if (value.charAt(i) == '\n') lines++;
     }
     textarea.setAttribute("rows", lines);
     // window.status = lines;
}


/* ▼インプットなどカーソルあてると中身消えて、離すと元通り */
/* ------------------------------------------------------------------------- */
function onFocus(formName,elementName){
	var target = document.forms[formName].elements[elementName];
	if(target.value == target.defaultValue){
		target.value = "";
		target.style.color='#000000';
	}
}

function onBlur(formName,elementName){
	var target = document.forms[formName].elements[elementName];
	if(target.value == target.defaultValue || target.value == ""){
		target.value = target.defaultValue;
		target.style.color='#999999';
	}
}



/* ▼パスワードチェック(JQuery使用) */
/* ------------------------------------------------------------------------- */
jQuery(document).ready(function() {
    jQuery('.showPassword').click(function() {
        if(jQuery(this).is(':checked')) {
            var elements = jQuery('input.pw').get();
            for(var i = 0; i < elements.length; i++) {
                var input = document.createElement('input');
                input.type = 'text';
                input.name = elements[i].name;
                input.className = elements[i].className;
                input.value = elements[i].value;
                elements[i].parentNode.replaceChild(input, elements[i]);
            }
        }
        else {
            var elements = jQuery('input.pw').get();
            for(var i = 0; i < elements.length; i++) {
                var input = document.createElement('input');
                input.type = 'password';
                input.name = elements[i].name;
                input.className = elements[i].className;
                input.value = elements[i].value;
                elements[i].parentNode.replaceChild(input, elements[i]);
            }
        }
    });
})



/* ▼マウスオーバー

/* ------------------------------------------------------------------------- */

function smartRollover() {

	/* 画像用 */
	if(document.getElementsByTagName) {

		var images = document.getElementsByTagName("img");



		for(var i=0; i < images.length; i++) {

			if(images[i].getAttribute("src").match("_off."))

			{

				images[i].onmouseover = function() {

					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));

				}

				images[i].onmouseout = function() {

					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));

				}

			}

		}

	}

	/* インプット画像用 */
	if(document.getElementsByTagName) {

		var inputImages = document.getElementsByTagName("input");



		for(var i=0; i < inputImages.length; i++) {

			if(inputImages[i].getAttribute("src")){

				if(inputImages[i].getAttribute("src").match("_off."))

				{

					inputImages[i].onmouseover = function() {

						this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));

					}

					inputImages[i].onmouseout = function() {

						this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));

					}

				}

			}

		}


	}

}



if(window.addEventListener) {

	window.addEventListener("load", smartRollover, false);

}

else if(window.attachEvent) {

	window.attachEvent("onload", smartRollover);

}





/* ▼onload一括指定するトコここから(↑auto_kanaと干渉) */
/* ----------------------------------------------------- */

window.onload = function(){


}

/* ▼onload一括指定するトコここまで */
/* ----------------------------------------------------- */
