//************************************************************
//로그인 팝업창
//************************************************************
var win = null;
function OpenLogin(goURL, name, w, h, scroll) {
  
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2 - 35;
  var settings ='height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += 'scrollbars=' + scroll + ',';
  settings += 'resizable=no';
  win = window.open(goURL, name, settings);
  if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
   }
 }


 //************************************************************
//로그인 팝업창 새로 작성
//************************************************************

function OpenLoginChk(goURL) {
  var w=500;
  var h=450;
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2 - 35;
  var settings ='height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += 'scrollbars=no,';
  settings += 'resizable=no';
  win = window.open(goURL, 'open_login', settings);
  if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
   }
 }

//************************************************************
//새창 가운데로...
//************************************************************
var win= null;
function OpenCenterBrowser(goURL, name, w, h, scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2 - 35;
  var settings ='height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += 'scrollbars=' + scroll + ',';
  settings += 'resizable=no';

  win = window.open(goURL, name, settings);
  if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
   }
 }
//************************************************************
// 사진 가운데 정렬
//************************************************************
function OpenWinCneter(url,w,h,winName)	{
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  wint = wint - 28;
  var settings ='height='+h+',';
  settings += 'width='+w+',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += 'scrollbars=no,';
  settings += 'resizable=no,';
  settings += 'status=yes';
  win = window.open(url, winName, settings);

  if (parseInt(navigator.appVersion) >= 4) win.window.focus();
}
//************************************************************
// 모달 창
//************************************************************
function OpenModal(url, w,h, winName) {
  var winl = ((screen.width - (w+9))) / 2;
  var wint = 56;
	
	var str="dialogWidth:"+w+"px;";
	str = str + "dialogHeight:"+h+"px;"; 
	str = str + "dialogLeft:"+winl+"px;"; 
	str = str + "dialogTop:"+wint+"px;"; 
	str = str + "resizable:no; help:no; status:yes; scroll:no; center:no;";

	window.showModalDialog(url, winName, str);	
}	

//================================================================
//== 함수명	: OpenWinScroll(goUrl,wid,hei)
//== 처  리	: 새창 열기(스크롤바 있음)
//== 리  턴	: 
//================================================================
function OpenWinScroll(goUrl,wid,hei){
	widthleft = ((screen.width-682)/2);
	heighttop = ((screen.height-(screen.height-200))/2);
	Status = "toolbar=no,menubar=no,resizable=yes,scrollbars=yes,left=widthleft top=heighttop,width=" + wid +",height=" + hei;
	win = window.open(goUrl,"NewWin",Status);
}
//================================================================
//== 함수명	: OpenWin(goUrl,wid,hei)
//== 처  리	: 새창 열기(스크롤바없음)
//== 리  턴	: 
//================================================================
function OpenWin(goUrl,wid,hei){
	Status = "toolbar=no,menubar=no,resizable=no,scrollbars=no,left=200 top=10,width=" + wid +",height=" + hei;
	win = window.open(goUrl,"NewWin",Status);
} 
//================================================================
//== 함수명	: OpenWinHidden(goUrl,wid,hei)
//== 처  리	: 새창 열기(스크롤바없음), 화면상에 안보임.
//== 리  턴	: 
//================================================================
function OpenWinHidden(goUrl,wid,hei){
	Status = "toolbar=no,menubar=no,resizable=no,scrollbars=no,left=10000 top=10000,width=1,height=1";
	win = window.open(goUrl,"NewWin",Status);
} 
//================================================================
//== 함수명	: pop_win_view(img)
//== 처  리	: 팝업 풀 스크린.
//== 리  턴	: 
//================================================================

var pop_img_view = null;
function pop_win_view(img){
  img_conf1= new Image();
  img_conf1.src=(img);
  pop_view_conf(img);
}

function pop_view_conf(img){
  if((img_conf1.width!=0)&&(img_conf1.height!=0)){
    pop_view_img(img);
  } else {
    funzione="pop_view_conf('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}

function pop_view_img(img){
    if(pop_img_view != null) {
      if(!pop_img_view.closed) { pop_img_view.close(); }
    }
  pop_width=img_conf1.width+20;
  pop_height=img_conf1.height+20;
  str_img="width="+pop_width+",height="+pop_height;
  pop_img_view=window.open(img,"pop_img_open",str_img);
  pop_img_view.focus();
  return;
}
//************************************************************
//포토갤러리 명소
//************************************************************
 var win= null;

function OpenDetailView(goURL, name, w, h, scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2 - 35;
  //var wint = 30;
  
  var settings = 'width=' + w + ',';
  settings += 'height=' + h + ',';
 //settings += 'top=' + wint + ',';
 //settings += 'left=' + winl + ',';
  settings += 'scrollbars=' + scroll + ',';
  settings += 'resizable=no';

  win = window.open(goURL, name, settings);
  if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
   }
 }

	//================================================================
	//== 함수명	: showgalleryTemp(goUrl,wid,hei)
	//== 처  리	: 포토갤러리 오픈 창
	//== 리  턴	: 
	//================================================================

	function showgalleryTemp(goUrl,wid,hei){
		OpenDetailView(goUrl,'gallery',wid, hei, 1);
	}

	//================================================================
	//== 함수명	: showgallery(goUrl,name,wid,hei)
	//== 처  리	: 포토갤러리 오픈 창
	//== 리  턴	: 
	//================================================================

	function showgallery(goUrl,name,wid,hei){
		OpenDetailView(goUrl,name,wid, hei, 0);
	}

	//================================================================
	//== 함수명	: showgallerynom(goUrl,name,settings)
	//== 처  리	: 포토갤러리 일반 오픈 창
	//== 리  턴	: 
	//================================================================

	function showgallerynom(goUrl,name,settings){
		window.open(goUrl, name, settings);
	}

	//================================================================
	//== 함수명	: OpenPhotoView(d_code, c_num, cate_code, att_num, pic_num)
	//== 처  리	: 오프너에서 사진만 보는 페이지
	//== 리  턴	: 
	//================================================================

  function OpenPhotoView(path, caption, d_name, c_name, ca_name, att_name) {
  	var p_url;
  	p_url = "/openWin/photo/zoomPic.asp?path="+path+"&caption="+caption+"&d_name="+d_name+"&c_name="+c_name+"&ca_name="+ca_name+"&att_name="+att_name;
    OpenDetailView(p_url,'ga_view',650, 650, '0');
  } 

	//================================================================
	//== 함수명	: getImgHeight(w, orgW, orgH)
	//== 처  리	: 특정 사이즈에 맞는 적당한 높이값 구하기
	//== 리  턴	: 
	//================================================================

	function getImgHeight(w, orgW, orgH) {
		
		var x = (orgH*w)/orgW;
	
		return x;
	}

	//================================================================
	//== 함수명	: getImgWidth(w, orgW, orgH)
	//== 처  리	: 특정 높이에 맞는 적당한 넓이값 구하기
	//== 리  턴	: 
	//================================================================

	function getImgWidth(h, orgW, orgH) {
		
		var x = (orgW*h)/orgH;
	
		return x;
	}


	//================================================================
	//== 함수명	: chgOrgPicVal(val, hidFrm)
	//== 처  리	: 작은이미지 원이미지 풀패스 리턴을 위해 히든 폼값으로 세팅
	//== 리  턴	: 
	//================================================================

	function chgOrgPicVal(val, obj) {
		obj.value=val;
	}


 var win= null;

function OpenWindowFrame(goURL, name, w, h, scroll, w_left, w_top) {
	
  var winl, wint;
  /*
	if (w_left > 0) winl=w_left;
	else winl = (screen.width - w) / 2;
	
	if (w_top > 0) wint=w_top;
	else wint = (screen.height - h) / 2 -35;
*/
	winl = ((screen.width - w) / 2) - 6;
	wint = ((screen.height - h) / 2 -35) + 12;
  
  var settings ='height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += 'scrollbars=' + scroll + ',';
  settings += 'resizable=no';

  win = window.open(goURL, name, settings);
  if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
   }
 }



 function OpenPicView(view_flag, path, caption, d_code, d_name, c_num, c_name, ca_code, ca_name, att_num, att_name, w , t) {
	var p_url;
	p_url = "/openWin/photo/zoom_pic.asp?view_flag="+view_flag+"&path="+path+"&caption="+caption+"&d_code="+d_code+"&d_name="+d_name+"&c_num="+c_num+"&c_name="+c_name+"&ca_code="+ca_code+"&ca_name="+ca_name+"&att_num="+att_num+"&att_name="+att_name;
  OpenWindowFrame(p_url,'ga_view',650, 650, 'no',  w, t);
}


	function changeImgBorder(obj,chk) {
		if (chk==1) {
			obj.style.borderColor='#0E92F8';
		} 
		else if (chk==0) {
			obj.style.borderColor='#D0CECE';
		}
	}

var win= null;
function OpenCenterBrowser(goURL, name, w, h, scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2 - 35;
  var settings ='height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += 'scrollbars=' + scroll + ',';
  settings += 'resizable=no';

  win = window.open(goURL, name, settings);
  if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
   }
 }
//*********************************************************************
// 함수명 : phot_win_view(obj)
// 처리 : 이미지 사이즈맞게 새창이 자동으로 조절/이미지클릭시 Close
// 리턴 : 
//*********************************************************************
function photo_win_view(img){
  img_conf1= new Image();
  img_conf1.src=(img);
  phot_view_conf(img);

}

function phot_win_view(obj){
  img = obj.src
  img_conf1= new Image();
  
  img_conf1.src=(img);
  phot_view_conf(img);
}
function phot_view_conf(img){
  
  if((img_conf1.width!=0)&&(img_conf1.height!=0)){
	phot_view_img(img);
  } else{
    funzione="phot_view_conf('"+img+"')";
	//alert(funzione);
	intervallo=setTimeout(funzione,20);
  }
}
var phot_img_view = null;

function phot_view_img(img){

  if(phot_img_view != null) {
    if(!phot_img_view.closed) { 
    phot_img_view.close(); 
    }
  }

	phot_width=parseInt(img_conf1.width)+20;
	phot_height=parseInt(img_conf1.height)+20;

//-------------------------------------------------------------------------------------------	
	//str_img="width="+phot_width+",height=600 ,top=10,left=10,scrollbars=YES, resizable=no";
	//str_img="width="+phot_width+",height="+phot_height+" ,top=10,left=10";
	
	//width

	var openImgCapt="";
	
	if(document.getElementsByName('captionSpan').length > 0) {
		 openImgCapt = document.getElementById('captionSpan').innerHTML;
	}

	var maxWidth  = 800;
	var maxHeight = 720;
	var addCaptionHeight = 0;
	
	if (openImgCapt!=="") addCaptionHeight = 30


	if(phot_width < maxWidth) tmp_width = "width="+(phot_width+2);
	else tmp_width = "width="+(maxWidth+2);

	//height
	if(phot_height < maxHeight) tmp_height = "height="+(phot_height+addCaptionHeight+2);
	else tmp_height = "height="+(maxHeight+addCaptionHeight+2);
				
	str_img = tmp_width +","+ tmp_height + " ,top=10,left=10,scrollbars=YES, resizable=no";
	//alert(str_img);
//--------------------------------------------------------------------------------------------

	phot_img_view=window.open("about:blank","",str_img);
	phot_img_view.document.open();   // document.open() 
	phot_img_view.document.writeln("<html>");
	phot_img_view.document.writeln("<head>");
	
	if (openImgCapt=="") {
		phot_img_view.document.writeln("<title>여행, 그 이상 - 레 바캉스 </title>");
	} else {
		phot_img_view.document.writeln("<title>"+openImgCapt+"</title>");
	}
		
	phot_img_view.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
	phot_img_view.document.writeln("<meta http-equiv='imagetoolbar' content='no'>");
	var start="<";
	phot_img_view.document.writeln("<script language='javascript'>");
	phot_img_view.document.writeln("function click() {");
	phot_img_view.document.writeln("if ((event.button==1) || (event.button==2))  {");
	phot_img_view.document.writeln("top.close();");
	phot_img_view.document.writeln("      }");
	phot_img_view.document.writeln("}");
//	phot_img_view.document.writeln("document.getElemtnById('test').onmousedown=click");
	phot_img_view.document.writeln(start+"/script>");
	phot_img_view.document.writeln("</head>");
	phot_img_view.document.writeln("<body LEFTMARGIN=2 TOPMARGIN=2 MARGINWIDTH=2 MARGINHEIGHT=2 >");
	phot_img_view.document.writeln("<center>");
	phot_img_view.document.writeln("<img  onClick='self.close();' src="+ img +" border='0' style='cursor:hand'>") // 소스 테스트 부분

	if (openImgCapt!=="") phot_img_view.document.writeln("<br><font size=2><b>"+openImgCapt+"</font></b></br>");

	phot_img_view.document.writeln("</center>");
	phot_img_view.document.writeln("</body></html>");
	phot_img_view.document.close();  // 반드시 document.close() 닫아주어야 함

	phot_img_view.document.oncontextmenu = new Function("return false");
	phot_img_view.document.onselectstart = new Function("return false");
	phot_img_view.document.ondragstart   = new Function("return false");

	phot_img_view.focus();
	return;
}


var tourPopWin=null;
// 여행상품 팝업
function tourProdPopup(tour_prod_numb, tour_fromDate, tour_saleCode) {

// 컨텐츠 서버 세팅	
	var link= '/special/default.asp?prodNumb='+tour_prod_numb;
	if(arguments.length > 1) link += '&fromDate='+tour_fromDate+'&saleCode='+tour_saleCode;

	var w = 990;
	var h = 620;
	var scroll = "no";
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2 - 35;
  var settings ='height=' + h + ',';

  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += 'scrollbars=' + scroll + ',';
  settings += 'resizable=no';
  
	if (tourPopWin != null)  { tourPopWin.location.href=link; } 
	else { var tourPopWin = window.open(link, 'specialPopTest', settings); }

  if (parseInt(navigator.appVersion) >= 4) { tourPopWin.window.focus(); }
}


