/*---------------------------------------------------------------------------------------------
                                      JAVASCRIPT CODE                                          
  ---------------------------------------------------------------------------------------------
	function name						| description				| use process
  ---------------------------------------------------------------------------------------------
	viewFlash()							| ÇÃ·¡½Ã Ãâ·Â					| ÇÃ·¡½Ã Ãâ·Â
  ---------------------------------------------------------------------------------------------*/



// ÇÃ·¡½Ã Ãâ·Â
function viewFlash(src, width, height)
{
	document.write ("<embed src='" + src + "' quality='high' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' wmode='transparent'></embed>");
}


// ÇÃ·¡½Ã Ãâ·Â
function viewFlash_ad(src, width, height)
{
	document.write ("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + width + "' height='" + height + "'><param name='movie' value='" + src + "'><param name='play' value='true'><param name='loop' value='true'><param name='quality' value='high'><param name='wmode' value='transparent'><embed width='" + width + "' height='" + height + "' src='" + src + "' play='true' loop='true' quality='high' pluginspage='https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' wmode='transparent'></embed></object>");
}

function viewFlash_tv3(flv_file, width, height, table, idxno){ //flv_file : ÆÄÀÏÄÚµå¸í
	//var url= hostip + hostpath +" /";
	var ucc="";
	ucc+='<EMBED name=player pluginspage=http://www.macromedia.com/go/getflashplayer align=middle ';
	ucc+='src="http://ucc.dtnews24.com/flvplayer.swf?url=ucc.dtnews24.com/&id='+table+'&no='+idxno+'&file='+flv_file+'"';
	ucc+=' width='+width+' height='+height+' type=application/x-shockwave-flash allowFullScreen="true" allowScriptAccess="always" quality="high" id="websafe" name="websafe" align="middle" allowScriptAccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer"/>';
	document.write(ucc);
}

// tv ¿µ»ó º¸±â ±âº»
function viewFlash_tv2(flv_file, width, height, table, idxno){ //flv_file : ÆÄÀÏÄÚµå¸í
	//var flv_file="ÆÄÀÏÄÚµå¸í"; // .flv ¸¦ Á¦¿ÜÇÑ °ª(ex, 123456)
	//var hostip = window.location.host;
	//var hostpath = window.location.pathname;
	//flv_file=flv_file.replace("http://","");
	//hostpath = hostpath.substring(0,hostpath.lastIndexOf("/")+1);
	//var url= hostip + hostpath +"win32/";
	var url = "ucc.dtnews24.com/";

	var ucc="";
	ucc+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'">';
	//ucc+='<param name="movie" value="http://ucc.dtnews24.com/flvplayer.swf?url='+url+'&id='+table+'&no='+idxno+'&lev=B35743C8-E51323C8-420F0B08-38C99DB&file='+flv_file+'&showdigits=true&showfsbutton=true"/>';
	ucc+='<param name="movie" value="http://www.dtnews24.com/tv/ucc_player.php/url='+url+'&id='+table+'&no='+idxno+'&lev=B35743C8-E51323C8-420F0B08-38C99DB&file='+flv_file+'&showdigits=true&showfsbutton=true"/><param name="allowFullScreen" value="true"/>';
	ucc+='</object><br>';

	document.write(ucc);
}

// ¸ÞÀÎ ÀÛÀº ¿µ»óº¸±â
function viewFlash_tv_sm(flv_file, width, height, table, idxno){ //flv_file : ÆÄÀÏÄÚµå¸í
	var url = "ucc.dtnews24.com/";

	var ucc="";
	ucc+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'">';
	ucc+='<param name="movie" value="http://www.dtnews24.com/tv/ucc_player_sm.php/url='+url+'&id='+table+'&no='+idxno+'&lev=B35743C8-E51323C8-420F0B08-38C99DB&file='+flv_file+'&showdigits=true&showfsbutton=true"/><param name="allowFullScreen" value="true"/>';
	ucc+='</object><br>';

	document.write(ucc);
}

// ÇÁ¸®¿¡±× µ¿¿µ»ó
function viewFlashVod(src, width, height)
{
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+width+"' height='"+height+"' id='FLVPlayer' align='top'><param name='allowScriptAccess' value='always' /><param name='bgcolor' value='#000000' /><param name='allowFullScreen' value='true' /><param name='movie' value='"+src+"' /><param name='quality' value='high' /><embed src='"+src+"' quality='high' bgcolor='#000000' width='"+width+"' height='"+height+"' name='FLVPlayer' align='top' allowScriptAccess='always' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>");
}

// ÇÃ·¡½Ã Ãâ·Â
function adViewFlash(src, width, height, ids)
{
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + width + "' height='" + height + "' id='"+ids+"'><param name='movie' value='" + src + "'><param name='play' value='true'><param name='loop' value='true'><param name='quality' value='high'><param name='wmode' value='transparent'><embed width='" + width + "' height='" + height + "' src='" + src + "' play='true' loop='true' quality='high' pluginspage='https://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent' name='"+ids+"'></embed></object>");
}

// ÆË¾÷¶ç¿ò (ÇÃ·¡½Ã¿¡¼­ È£Ãâ ÇÊ¿äÇÒ °æ¿ì)
function popupWindow(url,w,h){ 
	window.open(url,"flashPOP","widht="+w+",height="+h);
}

//»õ·Î°íÄ§ ÇÒ¶§¸¶´Ù ·£´ýÀ¸·Î ¹Ù²î´Â ¹è³Ê(ÇÃ·¡½¬, ÀÌ¹ÌÁö °¡´É)
function Rand_Banner(Banner)
{	

	var cnt = eval(Banner+".length");;
	var newImg = new Image(); 	
	var ran = Math.round(Math.random()*(cnt-1));



	for(i=0; i<cnt; i++){

		if(ran==i){

			src = eval(Banner+"["+i+"][0]");
			width = eval(Banner+"["+i+"][1]");
			height = eval(Banner+"["+i+"][2]");
			gubn = eval(Banner+"["+i+"][3]");


			if(gubn=="IMG"){


				newImg.src = src; 			
				width = newImg.width;
				height = newImg.height;
				document.write('<img src=\"' + src + '\" width=') 
				document.write(width + ' height=' + height + ' '); 
				document.write('border=0><br>'); 


			}else{				

  				viewFlash(src,width,height);

			}


		}		
	}



}




//·£´ýÇÏ°Ô ÃÊÁöÁ¤´ë·Î Ãâ·ÂµÇ¾îÁö´Â ¹è³Ê (ÇÃ·¡½¬, ÀÌ¹ÌÁö °¡´É)

var aImsi=new Array();
var aRand=new Array();

function uniqueNum(cnt){ //¼ýÀÚ Áßº¹ ¾ÈµÇ°Ô ·£´ýÀ¸·Î »Ì±â

	for(i=0;i<=cnt-1;i++){
		aImsi[i]=Math.random()+'-'+i;
	}
	aImsi = aImsi.sort();
	for(i=0;i<cnt;i++){
		tmp=aImsi[i].split("-");
		aRand[i]=tmp[1];
	}
}


function hide_layer(lname){
	document.getElementById(lname).style.visibility='hidden';
}

function show_layer(lname){
	document.getElementById(lname).style.visibility='visible';
}




var newImg = new Image(); 	
var viewFlag = 0;
var delaytime = 0;
var cnt = 0;
var Banner;
var ii = 0; 
function BannerTime(Bn)
{
	
	Banner = Bn;
	cnt = eval(Banner+".length");
	uniqueNum(cnt);
	var su = 0;	
	//alert(aRand);
	for(i=0; i<cnt; i++)
	{
		idx = aRand[i];
		src = eval(Banner+"["+idx+"][0]");
		width = eval(Banner+"["+idx+"][1]");
		height = eval(Banner+"["+idx+"][2]");
		url = eval(Banner+"["+idx+"][4]");
		target = eval(Banner+"["+idx+"][5]");
		su++;
		document.write("<div id='ad"+su+"' style='position:absolute; z-index:1;  visibility:hidden;'>"); //width:390px; height:300px; 
		
		if(url == "") {
			viewFlash(src, width, height);
		}else{
			newImg.src = src; 			
			width = newImg.width;
			height = newImg.height;
			document.write('<a href=\"'+url+'\" target=\"'+target+'\"><img src=\"' + src + '\" width=');
			document.write(width + ' height=' + height + ' '); 
			document.write('border=0></a><br>'); 
		}

		document.write("</div>");		
	}

	Timerand();
}




var newImg = new Image(); 	
var viewFlag = 0;
var delaytime = 0;
var cnt = 0;
var Banner;
var ii = 0; 
function BannerTime2(Bn)
{
	
	Banner = Bn;
	cnt = eval(Banner+".length");
	uniqueNum(cnt);
	var su = 0;	
	//alert(aRand);
	for(i=0; i<cnt; i++)
	{
		idx = aRand[i];
		src = eval(Banner+"["+idx+"][0]");
		width = eval(Banner+"["+idx+"][1]");
		height = eval(Banner+"["+idx+"][2]");
		url = eval(Banner+"["+idx+"][4]");
		target = eval(Banner+"["+idx+"][5]");
		type = eval(Banner+"["+idx+"][6]");
		su++;
		document.write("<div id='ad"+su+"' style='position:absolute; z-index:1;  visibility:hidden;'>"); //width:390px; height:300px; 
		
		if(type == "flash") {	 // ÇÃ·¡½¬ÀÏ¶§
			viewFlash_ad(src, width, height);
		} else {		// ÀÌ¹ÌÁöÀÏ¶§
			if(url == "") {	
				newImg.src = src; 			
				width = newImg.width;
				height = newImg.height;
				document.write('<img src=\"' + src + '\" width=');
				document.write(width + ' height=' + height + ' '); 
				document.write('border=0><br>'); 
			} else {
				newImg.src = src; 			
				width = newImg.width;
				height = newImg.height;
				document.write('<a href=\"'+url+'\" target=\"'+target+'\"><img src=\"' + src + '\" width=');
				document.write(width + ' height=' + height + ' '); 
				document.write('border=0></a><br>'); 
			}
		}

		document.write("</div>");		
	}

	Timerand();
}



function Timerand(){


	for(i=1; i<=cnt; i++){
		if(viewFlag == i-1){
			show_layer('ad'+i);
			for(j=1; j<=cnt; j++){
				if(j == i) continue;
				hide_layer('ad'+j);
			}//j


			delaytime = eval(Banner+"["+aRand[ii]+"][3]");
			
			if(cnt-1 == ii) ii = 0;
			else			ii++;

		}
	}//i

	
	viewFlag++;

	if(viewFlag == cnt) viewFlag = 0;

	setTimeout('Timerand()',delaytime);



/*
	if(viewFlag == 0){			
		show_layer('ad1');
		hide_layer('ad2');
		hide_layer('ad3');
		delaytime = eval("Banner5[0][3]");

	}else if(viewFlag == 1){
		show_layer('ad2');
		hide_layer('ad1');
		hide_layer('ad3');
		delaytime = eval("Banner5[1][3]");

	}else if(viewFlag == 2){
		show_layer('ad3');
		hide_layer('ad1');
		hide_layer('ad2');
		delaytime = eval("Banner5[2][3]");
	}

	 viewFlag++;

	 if(viewFlag == cnt) viewFlag = 0;
	 setTimeout('Timerand()',delaytime);
*/

}

