function MainImage() {
var output;
var selectnum;
var randomlist;

randomlist = [


[ "http://www.salt-and-pepper.jp/files/2_10.jpg", "http://www.salt-and-pepper.jp/schedule/index.cgi?mode=view&no=573" ],




];

list = fncCheckList(randomlist);
selectnum = Math.floor(Math.random() * list.length);
if( list[selectnum][1] == ""){
output =
'<h1><img src="' + list[selectnum][0] + '"' +
' alt="SALT&amp;PEPPER ソルトアンドペッパー へようこそ"></h1>';
}else{
output = 
'<h1><a href="' + list[selectnum][1] + '">' +
'<img src="' + list[selectnum][0] + '"' +
' alt="SALT&amp;PEPPER ソルトアンドペッパー へようこそ"></a></h1>';
}
   document.write(output);
}


/**/
function fncCheckList( randomlist ){
list = new Array();
array = new Array();
var counter = 0;
/* データチェック */
for (i = 0; i < randomlist.length; i++) {
if(randomlist[i][0] == null){randomlist[i][0]="";}
if(randomlist[i][1] == null){randomlist[i][1]="";}
randomlist[i][0] = randomlist[i][0].replace(/^\s+|\s+$/g, "");
randomlist[i][1] = randomlist[i][1].replace(/^\s+|\s+$/g, "");
if(randomlist[i][0] != ""){counter = counter + 1;}
}
/* 配列初期化 */
for (i = 0; i < counter; i++) {
list[i] = ['', ''];
}
/* 変数格納 */
counter = 0;
for (i = 0; i < randomlist.length; i++) {
list[counter][0] = randomlist[i][0];
list[counter][1] = randomlist[i][1];
counter = counter + 1;
}

return list;
}

