//Cover init
var CbnList = new Array(null);
var Cbn     = new Array(null);

//Cover set
//1
Cbn[1] = new Cover("http://deli.susukino-h.com/linkchecker/gchecker.php?ref=TOP最上部&url=http://www.exclusive-club.jp/","【札幌で最高レベルの女性　エクスクルーシブクラブ】");
Cbn[1].addCover("/bannerStyle/img/exclusiveclub-cover2.jpg");
//2
//Cbn[2] = new Cover("http://deli.susukino-h.com/linkchecker/gchecker.php?ref=TOP最上部&url=http://www.renbo.jp/","【20代〜30代の清楚な美女　恋慕グループ】"); 
//Cbn[2].addCover("/bannerStyle/img/renbo-cover.jpg");
//3
Cbn[2] = new Cover("http://deli.susukino-h.com/linkchecker/gchecker.php?ref=TOP最上部&url=http://www.jewel-net.info/","【この上質を越えたヘルスは、いまだ存在しない。　ジュエル】"); 
Cbn[2].addCover("/bannerStyle/img/jewel_cover.jpg");
//4
Cbn[3] = new Cover("http://deli.susukino-h.com/linkchecker/gchecker.php?ref=TOP最上部&url=http://hokkaido.0930-69.com/content.php","【待ち合わせ専門店　奥様鉄道69】"); 
Cbn[3].addCover("/bannerStyle/img/0930-69_cover.jpg");
//5
Cbn[4] = new Cover("http://deli.susukino-h.com/linkchecker/gchecker.php?ref=TOP最上部&url=http://www.e-selection.in/top.html","【なぜ札幌で“完全会員制”なのか？プライベートでの誰にも邪魔をされず「密室」で二人の関係を築き上げて・・・】"); 
Cbn[4].addCover("/bannerStyle/img/selection-cover01.jpg");
Cbn[4].addCover("/bannerStyle/img/selection-cover02.jpg");
Cbn[4].addCover("/bannerStyle/img/selection-cover03.jpg");
Cbn[4].addCover("/bannerStyle/img/selection-cover04.jpg");
Cbn[4].addCover("/bannerStyle/img/selection-cover05.jpg");


//Cover object
function Cover(url, msg, img){
	this.url = url;
	this.msg = msg;
	this.img = new Array();

	//no message
	if(!this.msg){
		this.msg = false;
	}

	//additional Cover
	function addCover(img){
		var p = this.img.length;

		this.img[p] = new String(img);
	}
	
	//get Cover imag
	function getCover(){
		var p = 0;
	
		if(this.img.length > 1){
			p = Math.floor((this.img.length) * Math.random());
		}

		return this.img[p];
	}
	
	//image initializ	
	function setImages(img){
		var imageType = typeof(img);
	
		if (imageType == 'undefined'){
	    return false;
		} else if(imageType == 'string'){
	    this.setCover(img);
		} else {
	    for(var i=0;i<img.length;i++){
	      this.setCover(img[i]);
			}
		}
	}
	
	//prototype
	Cover.prototype.setImages      = setImages;
	Cover.prototype.addCover      = addCover;
	Cover.prototype.getCover      = getCover;

	this.setImages(img);

	return this;
}


//get Cover image
function outCover(){
	var img;
	var p;
	var b;

	p = false;

	if(CbnList.length >= Cbn.length){
		return false;
	}

	while(!p){
		//get random number
		p = Math.floor((Cbn.length) * Math.random());

		//check userd number
		for(var i = 1;i < CbnList.length;i++){
			if(CbnList[i] == p.toString()){ 
				p = false;
			}
		}
	}

	//out Cover
	CbnList[CbnList.length] = p.toString();
	b = Cbn[ p ];

	img  = "<a href='" + b.url + "' target='_blank'><img src='" + b.getCover() + "' border='0' alt='" + b.msg + "'></a>";
	if(b.msg){
		img += "";
	}

	document.write(img);
}

