
function Banner(imagepath, hreference, showsecond) //constructor 
{ 
  //constant data 
  this.hreference = hreference;
  this.id = -1;
  this.second = showsecond;
  this.imagepath = imagepath;
}

function gBanner(imagepath, hreference, showsecond){
  banner = new Banner(imagepath, hreference, showsecond);
  
  banner.id = nEntries;
  indexOfEntries[nEntries] = banner;
  nEntries++;
  return banner;
} 
 
function gLnk(target, linkData){
  fullLink = '';
  
  switch(target){
  	case 0:
  		fullLink = '"'+linkData+'" target="this"';
  		break;
  	case 1:
  		fullLink = '"'+linkData+'"';
  		break;
  	case 2:
  		fullLink = '"http://'+linkData+'" target="_top"';
  		break;
  	case 3:
  		fullLink = '"'+linkData+'" target="_blank"';
  		break;
  	default:
  		fullLink = '';
  		break;
  }
  return fullLink;
}

function initRunBanner(){
	nowShowIndex = Math.floor(Math.random()*nEntries);
	changeBanner();
}

function changeBanner(){
	nowShowIndex++;
	if(nowShowIndex >= nEntries){
		nowShowIndex = 0;
	}
	strHTML = '<img src="'+picPath+indexOfEntries[nowShowIndex].imagepath+'" width="'+picWidth+'" height="'+picHeight+'" border="0">';
	if(indexOfEntries[nowShowIndex].hreference != ''){
		strHTML = '<a href='+indexOfEntries[nowShowIndex].hreference+'>'+strHTML+'</a>';
	}
	BannerArea.innerHTML = strHTML;
	setTimeout("changeBanner()",indexOfEntries[nowShowIndex].second*1000);
}
// Global variables 
// **************** 
 
indexOfEntries = new Array;
nEntries = 0;
nowShowIndex = 0;
picWidth = 389;
picHeight = 170;
picPath = '/1/uploadimage/Banner/';