var array_name = "";

function pushValue(nowId,pValue){
	document.getElementById(nowId).value = pValue;
}
function getValue(nowId){
	vstr = document.getElementById(nowId).value;
	return vstr;
}
function getOptValue(nowId){
	c = document.getElementById(nowId).getElementsByTagName('option');
	for(i=0;i<c.length;i++){
			chkC = c[i].selected;
			if(c[i].selected){
				unitNow = c[i].value;
			}
	}
	return unitNow;
}
function pushInhtml(nowId,phtml){
	document.getElementById(nowId).innerHTML = phtml;
}
function pushInputV(nowId,txt){
	document.getElementById(nowId).value = txt;
}
function pushWidth(nowId,nowW){
	nowW = nowW + "px";
	document.getElementById(nowId).style.width = nowW;
}
function strand (nl){
	n = Math.floor(Math.random()*nl);
	return n;
}
function dispElm(nowId){
	var dis = document.getElementById(nowId).style.display;
	if(dis =="block"){
		dis = "none";
	}
	else{
		dis = "block";
	}
	document.getElementById(nowId).style.display = dis;
}
function dispElm_bl(nowId){
	var nowElm = document.getElementById(nowId);
	nowElm.style.display = "block";
}
function dispElm_no(nowId){
	var nowElm = document.getElementById(nowId);
	nowElm.style.display = "none";
}
function chgImage(nowId,iName){
		var chImage = "url('./img/" + iName +"')";
		document.getElementById(nowId).style.backgroundImage = chImage;
}
function pushDataArray(ArrayName,d_length,data){
	if(ArrayName.length > d_length){
		ArrayName.unshift(data);
		ArrayName.pop();
	}
	else{
		ArrayName.unshift(data);
	}
}
function array_r(arrName){
	var str_array = "";
	for (var i=0; i<arrName.length; i++){
		str_array += arrName[i] + "<br>";
	}
	return str_array;
}
function setCookie(setName,setData,days) {
	var limit = new Date();
	limit.setTime(limit.getTime() + (days*1000*24*3600));
	var nowlimit = limit.toGMTString();
	var str = setName + escape(setData) + ";expires=" +  nowlimit;
	document.cookie = "";
	document.cookie = str;
}
function getCookie(setName) {
  var cData = "";
  var nowCookie = document.cookie+";";
  var str = nowCookie.indexOf(setName);
  if(str != -1) {
    var end = nowCookie.indexOf(";",str);
    cData = unescape(nowCookie.substring(str + setName.length, end));
  }
  return cData;
}
function chBgColor(id,color){
	document.getElementById(id).style.backgroundColor = color;
}
