//アンケート関連
 function chooseOne(cb){   

     var obj = document.getElementsByName(cb.name);   
     var intro =document.getElementById("input0");
     for (i=0; i<obj.length; i++){   

         if (obj[i]!=cb) {
         	obj[i].checked = false;
         	document.getElementById("radio"+i).style.display = "none";
         	
         	intro.value=intro.defaultValue;
         	intro.style.color='#999';
         	getChkBox(document.getElementById("radio"+i),false);
         }else {
         	if(cb.checked){
         
         	document.getElementById("radio"+i).style.display = "";
         		
         	}else{
         	document.getElementById("radio"+i).style.display = "none";	
         	}
         	
         	
         	//document.getElementById("radio"+i).style.display = (document.getElementById("radio"+i).style.display=="")?"none":"";
         	
         }      
     } 
      
 }   
 
 function chooseMore(cb){   

     var obj = document.getElementsByName("enquete.interestServises");   
     for (i=0; i<obj.length; i++){   

         if (obj[i]!=cb) {
         
         }else {     	             	
         	document.getElementById("checkbox"+i).style.display = (document.getElementById("checkbox"+i).style.display=="")?"none":"";
         	getChkBox(document.getElementById("checkbox"+i),false)
         }    
     } 
      
 }   
 
 function setVisibility(obj,id){
	if (obj.checked) {
		document.getElementById(id).style.display="block"
	} else {
		document.getElementById(id).style.display="none"
		getChkBox(document.getElementById(id),false)
	}
}
 function getChkBox(obj,b){
	var children = obj.childNodes
	for (var i = 0, length = children.length; i < length; i++) {
		if(children[i].nodeName=="INPUT"){
			children[i].checked=b
			children[i].value=children[i].defaultValue
			children[i].style.color='#999'
		}
		getChkBox(children[i],b)
	}
}



$(function(){
	$("#teckExp input").click(function(){
		tarVal = $(this).attr("checked");
		tarClass = "cat"+$(this).attr("id").slice("-1")
		if(tarVal){
 			$("."+tarClass).attr("checked",true);
		}else{
			$("."+tarClass).attr("checked",false);
 		}
	})

});

//ログイン所属関連
$(function(){
	$("#sectionBox").focus(function(){
		$("#sectionRadio").attr("checked",false);
	})
	$("#sectionRadio").click(function(){
		$("#sectionBox").attr("value","");
	})
});

$(function(){
	$("#positionBox").focus(function(){
		$("#positionRadio").attr("checked",false);
	})
	$("#positionRadio").click(function(){
		$("#positionBox").attr("value","");
	})
});

this.clearJssesionId = function(){
	var naviUrl = new Array(
		"http://www.tokkyonavi.com/",
		"http://www.shohyonavi.com/",
		"http://www.tyosakunavi.com/"
	);
	
	$("a").each(function(){
		str = $(this).attr("href");
		str = str.replace(/;jsessionid.*/i, '');
		$(this).attr("href", str);
	});

	$("img").each(function(){
		str = $(this).attr("src");
		str = str.replace(/;jsessionid.*/i, '');
		$(this).attr("src", str);
	});
	
	$("form").each(function(){
		str = $(this).attr("action");
		str = str.replace(/;jsessionid.*/i, '');
		$(this).attr("action", str);
	});
	
	var robj = $("input[name='refer']");
	var ref = robj.val();
	for( var i = 0; i < naviUrl.length; i ++ ){
		if(ref.indexOf(naviUrl[i], 0) != -1 ){
			ref = naviUrl[i];
			robj.val(ref);
		}
	}
};

$(document).ready(function(){
	clearJssesionId();
});

//ログインのインプットにフォーカス

$(function(){
	$("#loginIdInputTd input").focus();
})