function submitSearch()
{
	if (document.frm_search.query.value == ''){
		alert("検索文字列を入力してください。");
		document.frm_search.query.focus();
		return false;
	}

	document.frm_search.submit();
	return false;
}

function resizeImage( aQuery, aMaxWidth, aMaxHeight ){

	for( var cnt=0; $(aQuery).length > cnt; cnt++ ) {
		var tmp_obj_jq = $(aQuery+":eq("+cnt+")");
		var tmp_obj = $(aQuery+":eq("+cnt+")")[0];

		if ( tmp_obj.width < tmp_obj.height & tmp_obj.width > aMaxWidth ) {
			tmp_obj.width = aMaxWidth;
		} else if (tmp_obj.height > aMaxHeight) {
			tmp_obj.height = aMaxHeight;
		} else if( tmp_obj.width < tmp_obj.height ){
			tmp_obj.width = aMaxWidth;
		} else {
			tmp_obj.height = aMaxHeight;
		}

		//tmp_obj_jq.css("visibility","visible");
	}
}

function resizeImageOnly( aObj, aMaxWidth, aMaxHeight ){
	if ( aObj.width < aObj.height & aObj.width > aMaxWidth ) {
		aObj.width = aMaxWidth;
	} else if (aObj.height > aMaxHeight) {
		aObj.height = aMaxHeight;
	} else if( aObj.width < aObj.height ){
		aObj.width = aMaxWidth;
	} else {
		aObj.height = aMaxHeight;
	}

	$(aObj).css("display","inline");
}

function resizeString( aQuery, aSize ){

	for( var cnt=0; $(aQuery).length > cnt; cnt++ ) {
		var tmp_obj_jq = $(aQuery+":eq("+cnt+")");
		var tmp_obj = $(aQuery+":eq("+cnt+")")[0];

		tmp_obj_jq.html( cutString( tmp_obj_jq.html(), aSize ));
	}
}

function cutString(str,num){
  len = 0;
  estr = escape(str);
  ostr = "";
  for(i=0;i<estr.length;i++){
    len++;
    ostr = ostr + estr.charAt(i);
    if(estr.charAt(i) == "%"){
      i++;
      ostr = ostr + estr.charAt(i);
      if(estr.charAt(i) == "u"){
        ostr = ostr + estr.charAt(i+1) + estr.charAt(i+2) + estr.charAt(i+3) + estr.charAt(i+4);
        i+=4;
        len++;
      }
    }
    if(len >= num-3){
      return unescape(ostr)+"...";
    }
  }
  return unescape(ostr);
}

