function vf_chg_main_img(obj, max_width, max_height){
		var img = new Image();
		img.src = obj;
		var width = img.width;
		var height = img.height;

		if(width > 0 && height > 0){

				if(width > height && width > max_width){  
						height = Math.round(height / (width / max_width));
						width = max_width;  

						if(height >= max_height){
								height = max_height;
						}

				} 
				else if(width < height && height > max_height){   
						width = Math.round(width / (height / max_height));
						height = max_height;  

						if(width >= max_width){
								width = max_width;
						}

				}  

				document.getElementById("main_img").innerHTML = "<img src="+obj+" width="+width+" height="+height+" style=\"cursor:pointer\" onclick=\"view_img(this.src);\" />";
		}
		else{
				setTimeout("vf_chg_main_img('"+obj+"', '"+max_width+"', '"+max_height+"')", 100);
		}

}

function view_img(obj){
		var img = new Image();
		img.src = obj;
		var x = img.width;
		var y = img.height;

		if(x > 0 && y > 0){

				if(x >= 1024 || y >= 768){
						window.open("/common/view_img.asp?img="+escape(obj), "view", "scrollbars=yes,toolbar=no,status=no,width="+(x + 17)+",height="+y+",resizable=no,menubar=no,top=0,left=0");
				}
				else{
						window.open("/common/view_img.asp?img="+escape(obj), "view", "scrollbars=no,toolbar=no,status=no,width="+x+",height="+y+",resizable=no,menubar=no,top=0,left=0");
				}

		}
		else{
				setTimeout("view_img('"+obj+"')", 100);
		}

}

// ½ºÅ©·Ñ¹Ù ¾øÀ½
function open_window(filepath, target, w, h){ 
		var width = screen.width;
		var height = screen.height;
		var w2 = (width - w) / 2; 
		var h2 = (height - h) / 2; 

		window.open(filepath, target, "toolbar=no,menubar=no,scrollbars=no,resizable=no,width="+w+",height="+h+",left="+w2+",top="+h2);
}

// ½ºÅ©·Ñ¹Ù ÀÖÀ½
function open_window2(filepath, target, w, h){ 
		var width = screen.width;
		var height = screen.height;
		var w2 = (width - w) / 2; 
		var h2 = (height - h) / 2; 

		window.open(filepath, target, "toolbar=no,menubar=no,scrollbars=yes,resizable=no,width="+w+",height="+h+",left="+w2+",top="+h2);
}

// ½ºÅ©·Ñ¹Ù ¾øÀ½
function open_window3(filepath, target, w, h){ 
		window.open(filepath, target, "toolbar=no,menubar=no,scrollbars=no,resizable=no,width="+w+",height="+h+",left=0,top=0");
}

// ½ºÅ©·Ñ¹Ù ÀÖÀ½
function open_window4(filepath, target, w, h){ 
		window.open(filepath, target, "toolbar=no,menubar=no,scrollbars=yes,resizable=no,width="+w+",height="+h+",left=0,top=0");
}

function reorderit(sort_field){
		var form = document.frm_reorder;
		var st_flag = form.st_flag.value;
		var tmp_st_flag = st_flag.split("|");  
		var st_flag = tmp_st_flag[0];   
		var st_flag2 = tmp_st_flag[1];

    if(sort_field == st_flag && st_flag2 == "asc"){
        var st_flag = sort_field + "|desc";
    }
    else if(sort_field == st_flag && st_flag2 == "desc"){
        var st_flag = sort_field + "|asc";
    }
    else{
        var st_flag = sort_field + "|desc";
    }

    form.st_flag.value = st_flag;
    form.submit();
}

function img_error(obj, w, h){
		obj.src = "/common/images/board/no_image.gif";
		obj.width = w;
		obj.height = h;
}

function border_on(obj, color){  
   obj.style.borderWidth = 2;
   obj.style.borderLeftColor = color;
   obj.style.borderRightColor = color;
   obj.style.borderTopColor = color;
   obj.style.borderBottomColor = color;
}

function chg_border_out(obj, color){  
   obj.style.borderLeftColor = color;
   obj.style.borderRightColor = color;
   obj.style.borderTopColor = color;
   obj.style.borderBottomColor = color;
}

//ÇÃ·¹½¬ ½ÇÇà
/*
function exec_swf(filepath, w, h){ 
		var strHTML = "";

		strHTML += "<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='"+w+"' height='"+h+"'>";
		strHTML += "  <param name=movie value='"+filepath+"'>"
		strHTML += "  <param name='wmode' value='transparent'>"
		strHTML += "  <param name='view' value='false'>"
		strHTML += "  <embed src='"+filepath+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+w+"' height='"+h+"'></embed>"
		strHTML += "</object>"

		document.writeln(strHTML);
}
*/

var exec_swf = function(url, replaceEl, width, height, wmode, objId){

		try{

				if(document.write && document.getElementById){

						if(wmode == false) wmode = "window";
						if(objId == false) objId = "flashObject";

						var replaceEl = document.getElementById(replaceEl);
						var replaceElContent = replaceEl.innerHTML;

						var objectStr = ''+
						'<!--[if IE]>' +
						'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+objId+'">' +
						'<![endif] -->' +
						'<!--[if !IE]> <-->' +
						'<object type="application/x-shockwave-flash" data="'+url+'" width="'+width+'" height="'+height+'" id="'+objId+'">' +
						'<!--><![endif]-->' +
						'<param name="movie" value="'+url+'" />' +
						'<param name="wmode" value="'+wmode+'" />' +
						replaceElContent +
						'</object>';

						replaceEl.innerHTML = objectStr;
				}

		}

		catch (e){return false;}
}

//½ÇÇà ¿¹ <script type="text/javascript">exec_swf("/flash/main_visual.swf", "visual", "980", "398", "transparent", "visualObject");</script><noscript></noscript>



