//이미지 이사이즈
// start_check 와 end_check로 둘러싸인 부분만 리사이즈
//<img name="start_check" height="0" width="0"> 
//<img name="end_check" height="0" width="0">
//
function img_resize(width_size) {
	var obj=document.images;
	var maxwidth=width_size;
	for (i=0;i<obj.length;i++ ){
		if(obj[i].name=="start_check"){
			start_num=i+1;
		}
		else if(obj[i].name=="end_check"){
			end_num=i;
		}
	}
	for (i=start_num;i<end_num;i++){
		if (obj[i].width > maxwidth){
			//rate=(obj[i].width-maxwidth)/obj[i].width;
			obj[i].width =maxwidth;
			//obj[i].height=obj[i].height-Math.round(obj[i].height*rate);
		}
	}
}
function formSubmit(form){
	if(checkForm(form)){
		form.target='process_frame';
		return true;
	}
	else{
		return false;
	}
}
function confirmmsg(msg,url) {
		if (confirm(msg)){
			location.href=url;
		}
}	
function delPro(frm_str,idx_name,idx) {
		if (confirm("정말 삭제하시겠습니까?")){
			var frm=eval(frm_str);
			var form_element=eval(frm_str+"."+idx_name);
			form_element.value=idx;
			frm.target='process_frame';
			frm.submit();
		}
}

function basketPro(frm_str,idx_name,idx) {
		var frm=eval(frm_str);
		var form_element=eval(frm_str+"."+idx_name);
		form_element.value=idx;
		frm.target='process_frame';
		frm.submit();
		
}	

function fileDelPro(frm_str,idx_name,idx,file_num,num) {
		if (confirm("정말 삭제하시겠습니까?")){
			var frm=eval(frm_str);
			var form_element=eval(frm_str+"."+idx_name);
			var form_element2=eval(frm_str+"."+file_num);
			form_element.value=idx;
			form_element2.value=num;
			frm.target='process_frame';
			frm.submit();
		}
}	

function excelPrint(url,sql_str){
		location.href= url+"?sql_str="+sql_str;
}
//============================================================================ 
// 윈도우창 자동 리사이즈 
//============================================================================ 

function resize(){
	 var p_height, p_width;
	 p_width = document.images[0].width+40;
	 p_height = document.images[0].height+35;
	 if (p_width > 1024) p_width = 1024;
	 if (p_height > 768) p_height = 768;
	 fnResizePopup(p_width, p_height);
}
function fnResizePopup(nWidth, nHeight){
	 var strAgent = navigator.userAgent.toLowerCase();
	 var bIE = (strAgent.indexOf("msie") != -1);
	 var bXP = (strAgent.indexOf("nt 5.1") != -1);
	 var bIE7 = (strAgent.indexOf("msie 7.0") != -1);
	 var bSafari = (strAgent.indexOf("konqueror") != -1 || strAgent.indexOf("safari") != -1);
	 var bFirefox = (strAgent.indexOf("firefox")!= -1);
	 window.resizeTo(nWidth, nHeight + (bXP ? (bIE7 ? 40: 20) : 0));
}



//============================================================================ 
// 이미지 자동 리사이즈 
//============================================================================ 
function image_auto_resize(this_s,width,height){ 
 var ta_image = new Image(); 
 ta_image.src = this_s.src; 
  if(!width){this_s.removeAttribute('width'); 
  this_s.style.width='auto';} 
  else if(width < ta_image.width){ 
  this_s.width = width; 
  }else{ 
  this_s.width = ta_image.width; 
  } 
  if(!height){this_s.removeAttribute('height'); 
  this_s.style.height='auto';} 
  else if(height < ta_image.height){ 
  this_s.height = height; 
  }else{ 
  this_s.height = ta_image.height; 
  } 
} 
//-------------------------------------------------------------------------------------------------
function image_auto_resize_inarea(this_s,width,height,view){ 
//this_s안의 모든 이미지는 자동 리사이즈 된다. 
 //alert(this_s.childNodes.length); 
 if(!view){view=true;} 
 if(!this_s){return;} 
 if(this_s.nodeType!=1){return;} 
 for(var i=0,m=this_s.childNodes.length;i<m;i++){ 
  var ta = this_s.childNodes[i]; 
  
  if(ta.nodeName=='IMG'){ 
  //ta.style.border='1px solid #333333';  
  image_auto_resize(ta,width,height); 
  if(view){ 
    if(!ta.title){ta.title=ta.src;} 
    if(!ta.onclick){ 
    ta.style.cursor='pointer'; 
    ta.onclick=function(){js_image_view(this,1);} 
    } 
    if(!ta.onload) 
    ta.onload=function(){image_auto_resize(this,width,height);} 
    if(!ta.onmouseover)  
    ta.onmouseover=function(){image_auto_resize(this,width,height);} 
  } 
  } 
  if(ta.childNodes.length>0){ 
  image_auto_resize_inarea(ta,width,height); 
  } 
 } 
 return; 
} 






