인기검색어 10개중 5개 랜덤 추출하여 노출한다.
===========================================================================================
var arrKwd = new Array();
function randomKwd(_size) {
var random_no = Math.floor(Math.random() * _size);
var isNotValid = true;
if ( _size >= 5 && arrKwd.length < 5 ) {
for ( var i=0; i < arrKwd.length; i++ ) {
if ( arrKwd[i] == _arrSupKwd[random_no] ) {
isNotValid = false;
}
}
if ( isNotValid ) {
arrKwd.push(_arrSupKwd[random_no]);
} else {
randomKwd(_size);
}
}
}
for ( var i=0; i < 5; i++ ) {
randomKwd(_arrSupKwd.length);
}
var innerSearchText = "";
for ( var i=0; i < arrKwd.length; i++ ) {
var _class = "";
if ( i == 4 ) {
_class = "class=\"lst_m\"";
}
innerSearchText += '<a href="javascript:goStatMainKwd(\'' + arrKwd[i] + '\', ' + (i+1)+ ' ,\'BMB020' + (i+1) + '\');" ' + _class + '>' + arrKwd[i].substring(0,6) + '</a>';
}
document.write(innerSearchText);