//mouse ----------------->
function click(){ 	if ((event.button==2) || (event.button==3)) return false; }
document.onmousedown=click

// total moving ------------>
function move_url(url,target,width,height,msg)
{
	if(target=="self"){ document.location.href=url; }
	else if(target=="confirm")
	{	
		flag = confirm(msg);
		if(flag==true){ document.location.href=url; }
	}
	else if (target=="blank") {
       window.open(url, 'win1');
	}
	else if(target=="popup"){
		window.open(url, 'win1', "toolbar=no,resizable=no,scrollbars=yes,location=no,resize=no,menubar=no,directories=no,copyhistory=0, width=" + width + ", height=" + height);
	}
}

function go_win(url,root,w,h) {
	w = eval(w) ;
	h = eval (h);
	win=window.open(url,root,'width='+w+',height='+h+',resizable=yes,scrollbars=yes,status=0');
}

function go_win2(url,root,w,h) {
	w = eval(w) ;
	h = eval (h);
	win=window.open(url,root,'width='+w+',height='+h+',resizable=no,scrollbars=no,status=0');
}

function showhide(what){
	var obj = document.getElementById(what);
	if (obj.style.display=='none'){ obj.style.display='block'; }
	else{ obj.style.display='none'; }

	parentResizeIframe();
}

function checkSrhForm()
{
	if(!document.SpSrhForm.keyword.value){
		alert("검색어를 입력하세요");
		document.SpSrhForm.keyword.focus();
		return false;
	}
}

// iframe 관련
function parentViewPage(url,cid){
	var reUrl = url+"&cfuid="+cid;
	parent.document.getElementById('cafe_main').contentWindow.location.href= reUrl;
}

function parent2ViewPage(url,cid){
	var reUrl = url+"&cfuid="+cid;
	parent.parent.document.getElementById('cafe_main').contentWindow.location.href= reUrl;
}

function cafeRedirectPage(url,cfuid){
	var reUrl = url+"?cfuid="+cfuid;
	document.getElementById('cafe_main').contentWindow.location.href= reUrl;
}

function cafeViewPage(url,cid){
	var reUrl = url+"&cfuid="+cid;	
	document.getElementById('cafe_main').contentWindow.location.href= reUrl;
}

function resizeFrame(iframeObj)
{
  var innerBody = iframeObj.contentWindow.document.body;
  var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
  var innerWidth = 780;//innerBody.scrollWidth; + (innerBody.offsetWidth - innerBody.clientWidth);
  
  iframeObj.style.height = innerHeight + 5;
  iframeObj.style.width = innerWidth;
  
  this.scrollTo(1,1);
}

function parentResizeIframe()
{
	sfheight = document.body.scrollHeight;
	self.resizeTo(780 , sfheight + 10);
}

function parentParentResizeIframe()
{
	var cafebbsObj = document.body;
	var cafebbsWidth = cafebbsObj.offsetWidth;
	var cafebbsHeight = cafebbsObj.scrollHeight;
	self.resizeTo(cafebbsWidth,cafebbsHeight + 10);
	
	var cafemianObj = parent.parent.document.getElementById('cafe_main').contentWindow;
	var cafemianObjHeight = cafemianObj.document.body.scrollHeight;
	cafemianObj.resizeTo(780,cafemianObjHeight + 10);
}

function select_goto_byselect(sel, targetstr)
{ //셀렉트 메뉴 선택시 바로 이동하기
  var index = sel.selectedIndex;
  if (sel.options[index].value != '') {
     if (targetstr == 'blank') {
       window.open(sel.options[index].value, 'win1');
     } else {
       var frameobj;
       if (targetstr == '') targetstr = 'self';
       if ((frameobj = eval(targetstr)) != null)
         frameobj.location = sel.options[index].value;
     }
  }
}
