var selLayer=0; 

function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) 
	if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; 
	  img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; 
	 }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}

function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	if (selObj.options[selObj.selectedIndex].value!="") {
		//ºÎÅ·ÇÃ¶óÀÚÀÏ°æ¿ì ÆË¾÷
		if (selObj.options[selObj.selectedIndex].value=="http://www.sbsgolf.com/html/front/customer/faq/faq_10/faq_list.jsp"){
			url = "http://www.sbsgolf.com/html/front/customer/faq/faq_10/faq_list.jsp" ;
			window.open(url,'','width=548,height=400,scrollbars=yes') ;
		} else {
			eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		}
	  if (restore) selObj.selectedIndex=0;
	}
}

function resizeIframe(iframeObj) {
	try
	{
		var innerBody = iframeObj.contentWindow.document.body;

		innerBody.onkeydown = function() { resizeIframe (iframeObj ,1);oldEvent; };

		oldEvent = innerBody.onclick;
		innerBody.onclick = function(){ resizeIframe (iframeObj,1);oldEvent; };

		/*         ³ôÀÌ ´Ù½Ã¼³Á¤ */
		var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
		iframeObj.style.height = innerHeight;

		if( !arguments[1] )        /* Æ¯Á¤ ÀÌº¥Æ®·Î ÀÎÇÑ È£Ãâ½Ã ½ºÅ©·ÑÀ» ±×³É µÐ´Ù. */
				this.scrollTo(1,1);
	}
	catch (e)
	{
	}
}

function resizeFrame(name){
	try
	{
		var oBody = document.body;
		var oFrame = parent.document.all(name);
		var min_height = 320; //iframeÀÇ ÃÖ¼Ò³ôÀÌ(³Ê¹« ÀÛ¾ÆÁö´Â °É ¸·±âÀ§ÇÔ, ÇÈ¼¿´ÜÀ§, ÆíÁý°¡´É)
		var min_width = 465; //iframeÀÇ ÃÖ¼Ò³Êºñ
		var i_height = oFrame.scrollHeight + (oFrame.offsetHeight-oFrame.clientHeight);
		var i_width = oFrame.scrollWidth + (oFrame.offsetWidth-oFrame.clientWidth);

		if(i_height < min_height) i_height = min_height-40;
		if(i_width < min_width) i_width = min_width;
		oFrame.style.height = i_height;
	//	oFrame.style.width = i_width;

		parent.scrollTo(1,1); 
	}
	catch (e)
	{
	}

}

function addbookmark()
{
	bookmarkurl="http://www.sbsgolf.com/";
	bookmarktitle="SBS°ñÇÁ´åÄÄ";
	if (document.all)	window.external.AddFavorite(bookmarkurl,bookmarktitle);
}

function comm_open_notice(bltin_no, bd_no ){
	b_url ="/html/front/notice/notice_view.jsp?bltin_no="+bltin_no+"&bd_no="+bd_no ;
	window.open(b_url ,"", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=518,height=400');
}

function comm_open_list(bd_no){
	bd_url ="/html/front/notice/notice_list.jsp?bd_no="+bd_no ;
	window.open(bd_url,"", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=518,height=400');
}

function cookieVal(cookieName){
   thisCookie = document.cookie.split("; ");
   for(i=0; i<thisCookie.length; i++)  {
	    if(cookieName == thisCookie[i].split("=")[0])
	      return thisCookie[i].split("=")[1]
  }
 	 return "x"
}


/*
  sday : ÆË¾÷ ½ÃÀÛÀÏ(³â¿ùÀÏ½ÃºÐ)
  eday : ÆË¾÷ ¸¶°¨ÀÏ(³â¿ùÀÏ½ÃºÐ)
  cook_val : ´Ù½Ã¶ç¿ìÁö ¾Ê±â ÆË¾÷ °ª
  url : ÆË¾÷ URL (Àý´ë°æ·Î)
  pop_str  : ÆË¾÷ ¿É¼Ç
*/
function  popup_open( sday, eday, cook_val, url, pop_str ){
	var toDay = new Date();
	var edDay = new Date(eday.substring(0,4),eday.substring(4,6)-1,eday.substring(6,8),eday.substring(8,10),eday.substring(10,12));
	var stDay = new Date(sday.substring(0,4),sday.substring(4,6)-1,sday.substring(6,8),sday.substring(8,10),sday.substring(10,12));

	if(toDay >= stDay && toDay <= edDay ){
		//ÆË¾÷-----------------
		if(cookieVal(cook_val) != "1"){
			window.open( url, cook_val, pop_str );
		}
		//ÆË¾÷-----------------
	}
}
function vod_pop_up(mcode,catid, flag, file_name) {	window.open("/html/front/vod/vod_player_pop.jsp","","width=363,height=540,scrollbars=no,toolbar=no,menubar=no");
}

/* ±¤°í ³Ö±â */
function ad_func(tmp_adURL) {
	//adURL="http://ad.sbsgolf.com/RealMedia/ads/adstream_jx.ads/sbsgolf/mylinker@x01";
	var adURL = "http://ad.sbsgolf.com/RealMedia/ads/adstream_jx.ads/" +tmp_adURL;
	adURL = adURL.replace(/@/,"/1"+((String)(Math.random())).substring(2,11)+"@");
	document.write("<SCR"+"IPT LANG"+"USAGE='JAVAS"+"CRIPT1.1' SRC='"+adURL+"'></SCR"+"IPT>");
}
// ±¤°í Æ÷Áö¼Ç String  ex) sbsgolf/main@Top Çü½Ä
var adTxt=""; 

function view_flash(SwfSource, BannerTag, fWidth, fHeight, Swfname, SwfFlag ){
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0' width='"+fWidth+"' height='"+fHeight+"' id="+Swfname+"><PARAM NAME=wmode VALUE="+SwfFlag+"><param name=movie value='"+SwfSource+"'><param name='quality' value='high'><PARAM NAME=bgcolor VALUE=#FFFFFF><embed src='"+SwfSource+"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'  type='application/x-shockwave-flash'  width='"+fWidth+"' height='"+fHeight+"'  name='"+Swfname+"'></embed></object> ");
}

//ÄÁÅÙÃ÷ÀÌ¿ë°¡ÀÌµå_ºñ±â³ÊÁÂÃø¸Þ´º
function tg_leftmenu(flash_file,pg,spg){
	view_flash("http://img.sbsgolf.com/www/front/target_guide/"+flash_file+".swf?pg="+pg+"&spg="+spg, "", "180", "300", "" , "transparent" ) 
}

/*swfÆÄÀÏ*/
function swf(src,w,h){
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="http://img.sbsgolf.com/www/front/target_guide/'+src+'">';
	html += '<param name="quality" value="best">';
	html += '<param name="wmode" value="transparent">';
	html += '<PARAM NAME="allowScriptAccess" VALUE="always">';
	html += '<embed src="http://img.sbsgolf.com/www/front/target_guide/'+src+'" quality=best width="'+w+'" height="'+h+'" quality="best" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"  allowScriptAccess="always"><\/embed>';
	html += '<\/object>';
	document.write(html);
}

//¸ÞÀÎ »ó´Ü ¹è³Ê
var main_banner = new Array();

//¼­ºê »ó´Ü ¹è³Ê
var sub_banner = new Array();

//·£´ø¹è³Ê °ü·Ã function ½ÃÀÛ------------------------------------
function topshowBanner(n) {
	var item;
    item = n.split(",");
    switch (item[0]) {
        case "0":
            document.write("<a href='"+item[4]+"' target="+item[1]+"><img src='"+item[2]+"' border=0 ></a>");
        break;
        case "1":
            document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="170" height="53">');
            document.write('<param name="movie" value="'+item[1]+'"><param name="quality" value="high">');
            document.write('<embed src="'+item[1]+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="170" height="53" style="margin:1"></embed></object>');
        break;
        default:
        break;
    }
}
// ¹è³Ê Ç¥½ÃÇÏ±â
function topdisplayBanner(n, col) {
    for(var i=0;i<n.length;i++) {
        topshowBanner(n[i]);
        if(i%col==(col-1)) document.write("<br/>");
    }
}
// ¹è³Ê¼¯±â
function topbannerShuffle(n, count){
    // ¹è³Ê µÚ¼¯¾î¼­, box ¹è¿­¿¡ ³Ö±â
    var box = new Array();
    var idx = 0;
    var len = n.length;
    // ¹è³Êµ¥ÀÌÅÍº¸´Ù Ç¥½Ã°¹¼ö°¡ ¸¹À» °æ¿ì ÃÖ´ë°ªÀ¸·Î ÇÑÁ¤
    if(count>len) count=len;
    // ¹è³Ê µÚ¼¯±â
    for(var i=0; i<count; i++) {
        idx = Math.floor(Math.random()*(len-i));
        box[i] = n[idx];
        for(var j=idx; j<len-1-i; j++){
            n[j] = n[j+1];
        }
    }
    topdisplayBanner(box, 1);
}
//·£´ø¹è³Ê °ü·Ã function ³¡------------------------------------


//Äü¸Þ´º µî·Ï
function insertMenu(menuUrl, menuTit){
	closeQuick();
	var frmQuick = document.frmQuick;
	frmQuick.MENU_MODE.value ="insert";
	frmQuick.MENU_URL.value =menuUrl;
	frmQuick.MENU_DESC.value =menuTit;
	frmQuick.submit();
}
//Äü¸Å´º º¸ÀÌ±â
function showQuick() {
	document.domain ="sbsgolf.com";

	Iobj = document.getElementById("iframe_quick") ;
	
	divObj = document.getElementById("my_qiuck_show") ;
	divObj.style.width = 445;
	Iobj.width=163;
	Iobj.height=10;
	iframe_quick.location.href="http://www.sbsgolf.com/html/include/main/_main_quick.jsp";

	resizeIframe(Iobj);
	divObj.style.display = 'block';

}
function showQuickSub() {
	document.domain ="sbsgolf.com";
	Iobj = document.getElementById("iframe_quick") ;
	
	divObj = document.getElementById("my_qiuck_show") ;
	divObj.style.width = 958;
	Iobj.width=163;
	Iobj.height=10;
	iframe_quick.location.href="http://www.sbsgolf.com/html/include/main/_main_quick.jsp";

	resizeIframe(Iobj);
	divObj.style.display = 'block';

}


//Äü¸Å´º ¼û±â±â
function closeQuick() {
	Iobj = document.getElementById("iframe_quick") ;
	
	divObj = document.getElementById("my_qiuck_show");
//		iframe_quick.location.href="" ;
	Iobj.width=0;
//		divObj.style.display = 'hidden';
	divObj.style.width = 0;
}
