function flash_contents(file,width,height){
	document.writeln("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='"+width+"' HEIGHT='"+height+"' id='contents' ALIGN=''>");
	document.writeln("<PARAM NAME=movie value='"+file+"' />");
	document.writeln("<PARAM NAME=quality VALUE=high>");
	document.writeln("<PARAM NAME=bgcolor VALUE=#FFFFFF>");
	document.writeln("<PARAM NAME=menu VALUE=false>");
	document.writeln("<PARAM NAME=wmode VALUE=transparent> ");
	document.writeln("<embed src='"+file+"' quality='high' bgcolor='#FFFFFF' width='"+width+"' height='"+height+"' name='contents' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.writeln("</OBJECT>");
}

function flash_contents2(file,width,height){;
	document.writeln("<embed id='fContents' src='" + File + "' width='" + width + "' height='" + Height + "' menu='false' quality='high' bgcolor='#FFFFFF' swLiveConnect=true type='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></embed>");
}
//<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="518" height="187">
//                        <param name=movie value="tour_main.swf">
//                        <param name=quality value=high>
//                        <embed src="tour_main.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="518" height="187">
//                        </embed> 
//                      </object>
                 
function scroller() {

	this.name = "scroller";
	this.item = new Array();
	this.itemcount = 0;
	this.itemoffset = 0;
	this.currentspeed = 0;
	this.scrollspeed = 50;
	this.pausedelay = 1000;
	this.pausemouseover = false;
	this.stop = 0;
	this.height = 100;
	this.heightGap = 0;
	this.width = 100;
	this.stopHeight=0;
	//this.count=0;
	this.count=0;
	this.flag=true;
	this.position="absolute";
	this.item_position="absolute";	
	this.id = 0;           // scrollÀÇ ÇöÀç À§Ä¡
	this.discount = 0;   // ¸î°³ÀÇ ¾ÆÀÌÅÛÀ¸·Î ±¸¼ºµÇ¾î ÀÖ´ÂÁö ¾Ë±â À§ÇÑ item °¹¼ö

	this.add = function () {
		var text = arguments[0];
		this.item[this.itemcount] = text;
		this.itemcount = this.itemcount + 1;
	};

	this.start = function () {
		this.display();
		this.currentspeed = this.scrollspeed;
		var idx = Math.floor(Math.random()*this.discount);

		this.id = idx;
		//alert(idx);
	
		obj = document.getElementById(this.name+'item'+idx).style;
		obj.display='block';
		this.count++;
		setTimeout(this.name+'.scroll()',this.currentspeed);
	};

	this.movenext = function () {

		//alert(this.discount);

		if (this.discount == 0){

				if (this.id == 0){
					this.id = 1;
					obj = document.getElementById(this.name+'item1').style;
					obj.display='block';
					obj1 = document.getElementById(this.name+'item0').style;
					obj1.display='none';
				}else{
					this.id = 0;
					obj = document.getElementById(this.name+'item0').style;
					obj.display='block';
					obj1 = document.getElementById(this.name+'item1').style;
					obj1.display='none';
				}

		}else{

				for (var i = 0; i < this.discount ; i++ ){
					obj = document.getElementById(this.name+'item' + i).style;
					obj.display='none';
				}

				if (this.id == this.discount -1){
					this.id = 0;
					obj1 = document.getElementById(this.name+'item0').style;
					obj1.display='block';
				}else{
					var j = ++this.id;
					//alert(j);
					obj1 = document.getElementById(this.name+'item' + j ).style;					
					obj1.display='block';
				}
		}
	};

	this.display = function () {
		document.write('<div id="'+this.name+'" style="height:'+this.height+';width:'+this.width+';position:'+this.position+';overflow:hidden;" OnMouseOver="'+this.name+'.onmouseover();" OnMouseOut="'+this.name+'.onmouseout();">');
		for(var i = 0; i < this.itemcount; i++) {
			document.write('<div id="'+this.name+'item'+i+'"style="left:0px; width:'+this.width+';position:'+this.item_position+'; display:none; ">');
			document.write(this.item[i]);
			document.write('</div>');
		}
		document.write('</div>');
	};


	this.scroll = function () {
		this.currentspeed = this.scrollspeed;
		if ( !this.stop ) {
			this.imageChange();
		}
		window.setTimeout(this.name+".scroll()",this.currentspeed);
	};


	this.imageChange = function ()
	{
		for (k = 0; k < this.itemcount; k++) {
			obj = document.getElementById(this.name+'item'+k).style;
			if (this.count % this.itemcount == k) {
				obj.display = 'block';
			} else {
				obj.display = 'none';
			}
		}
		this.count++;
	};

	this.onmouseover = function ()
	{
		if ( this.pausemouseover ) {
			this.stop = 1;
		}
	};

	this.onmouseout = function ()
	{
		if ( this.pausemouseover ) {
			this.stop = 0;
		}
	};

	this.up = function ()
	{
		var i;
		this.stop++;

		if ( this.itemcount <= this.itemoffset )
			this.itemoffset = this.itemoffset % this.itemcount;

		for (i = 0; i < this.itemcount; i++) {
			obj = document.getElementById(this.name+'item'+i).style;
			if ( obj.display == "block" ) {this.itemoffset = i+1;obj.display="none";}
		}
		if (this.itemoffset < this.itemcount) {
			obj = document.getElementById(this.name+'item'+this.itemoffset).style;
			obj.display = "block";
		} else {
			obj = document.getElementById(this.name+'item0').style;
			obj.display = "block";
		}
		window.setTimeout(this.name + ".stop--;",this.pausedelay);
		//this.stop--;
	};



}
