/* title */
document.title = ":: 사단법인 흙살림 ::";


/* Top Butten */
function on_top(){
	window.scrollTo(0.0);
}

/* Pring Butten */
function on_print(){
	window.print();
}


/* 링크 선 */
function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring;


/* Url Control */
function url2(name){
	document.location.href = eval(name);
}

home = "/index.html";
join = "/main/member.php?mboard=memberboard&exe=regist_form";
login = "/sub/?sub=8&doc=2ooc=1";
sitemap = "/sub/?sub=5&doc=1ooc=1";
heuk_shop = "/shop/"; //

/* 흙살림소개 */
u11 = "/sub/?sub=1&doc=1&ooc=1"; //
u12 = "/sub/?sub=1&doc=2&ooc=1"; //
u13 = "/sub/?sub=1&doc=3&ooc=1"; //


/* 흙살림일 */
u21 = "/sub/?sub=2&doc=1&ooc=1"; //
u22 = "/sub/?sub=2&doc=2&ooc=1"; //
u23 = "/sub/?sub=2&doc=3&ooc=1"; //
u24 = "/sub/?sub=2&doc=4&ooc=1"; //
u25 = "/sub/?sub=2&doc=5&ooc=1"; //


/* 월간흙살림 */
//u31 = "/sub/?sub=3&doc=1&ooc=1"; //
u31 = "/webzine/"; //


/* 커뮤니티 */
u41 = "/sub/?sub=4&doc=1&ooc=1"; //
u42 = "/sub/?sub=4&doc=2&ooc=1"; //
u43 = "/sub/?sub=4&doc=3&ooc=1"; //


/* 사이트맵 */
u51 = "/sub/?sub=5&doc=1&ooc=1"; //
u52 = "/sub/?sub=5&doc=2&ooc=1"; //
u53 = "/sub/?sub=5&doc=3&ooc=1"; //
u54 = "/sub/?sub=5&doc=4&ooc=1"; //
u55 = "/sub/?sub=5&doc=5&ooc=1"; //


/* MEMBER SERVICE */
u81 = "/main/member.php?mboard=memberboard&exe=regist_form";  //회원가입
u82 = "/sub/?sub=8&doc=2"; //로그인
u83 = "/main/member.php?mboard=memberboard&exe=passwd_lose"; //비밀번호찾기

function gotoshop(){
	name = "/shop/";
	target = "_self";

	if(target == "_blank"){
		window.open(name);
	}else{
		location.href = name;
	}
}

function url(name) {
	if(name == null) {
		alert ('서비스준비중입니다');
		return;
	} else {
		location.href = eval(name);
	}
}


function popLogInOut(objid,setview){
	if(objid){

		var idlist=new Array("popup","joinform","findpw","findid","mypage","notice","qna","popup_notice");
		for(i=0;i<idlist.length;i++){
			document.getElementById(idlist[i]).style.display="none";
		}
		var framelist=new Array("loginframe","joinframe","findpwframe","findidframe","mypageframe","noticeframe","qnaframe","loginframe_notice");
		for(j=0;j<framelist.length;j++){
			document.getElementById(framelist[j]).src="";
		}


		if(setview){
			var browserW=top.document.body.clientWidth;

			if(objid=="popup"){
				objW=303;
				top.document.getElementById("loginframe").src="/main/main_login.php";
				top.document.getElementById("loginframe_notice").src="/main/main_login_notice.php";
			}else if(objid=="joinform"){
				objW=622;
				top.document.getElementById("joinframe").src="/main/join.html";
			}else if(objid=="findpw"){
				objW=622;
				top.document.getElementById("findpwframe").src="/main/findidpw.html?find=pw";
			}else if(objid=="findid"){
				objW=622;
				top.document.getElementById("findidframe").src="/main/findidpw.html?find=id";
			}else if(objid=="mypage"){
				objW=784;
				top.document.getElementById("mypageframe").src="/main/mypage.html";
			}else if(objid=="notice"){
				objW=520;
				top.document.getElementById("noticeframe").src="/main/notice.html";
			}else if(objid=="qna"){
				objW=520;
				top.document.getElementById("qnaframe").src="/main/qna.html";
			}

			centerP=(browserW/2)-(objW/2);
			if(objid=="popup"){
				centerP=centerP+325;
				centerP_notice=centerP-301;
			}
			if(objid=="notice" || objid=="qna") centerP=centerP+235;
			if(objid=="mypage") centerP=centerP+83;
			if(objid=="joinform") centerP=centerP+163;
			if(objid=="findpw" || objid=="findid") centerP=centerP+165;
			document.getElementById(objid).style.left=centerP+"px";
			document.getElementById(objid).style.display="block";
			if(objid=="popup"){
				document.getElementById(objid + "_notice").style.left=centerP_notice+"px";
				document.getElementById(objid + "_notice").style.display="block";
			}
		}else{
			document.getElementById(objid).style.display="none";
		}

	}

}


function OpenFromLogin(Url,Target,Xsize,Ysize,Scroll){
	newwinopen=window.open(Url,Target,'left=40,top=30,width='+Xsize+',height='+Ysize+',scrollbars='+Scroll+',resizable=1');
	newwinopen.focus();
}
// 새창 출력 공통 function
function OpenWin_smart(Url,Target,Xsize,Ysize,Scroll){
	smart_Browser=window.open(Url,Target,'left=40,top=30,width='+Xsize+',height='+Ysize+',scrollbars='+Scroll+',resizable=1');
	smart_Browser.focus();
}


// 팝업창
var popUpWin=0;

function popUpWindow(URLStr, left, top, width, height)
{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}



function mainbannerlink(blink,linktype){
	if(blink){
		if(linktype=="_self"){
			location.replace(blink);
		}else if(linktype=="_blank"){
			window.open(blink);
		}else if(linktype=="popnotice"){
			popUpWindow('/main/notice.html?viewno='+blink, 520, 200, 500, 600);
		}else if(linktype=="userpopup"){
			var bannerLinkArray=blink.split(",");
			popUpWindow(bannerLinkArray[0], bannerLinkArray[3], bannerLinkArray[4], bannerLinkArray[1], bannerLinkArray[2]);
		}else{
			location.replace(blink);
		}
	}
}


//숫자만 입력하고자 할 때 사용하는 함수, 활용 : onkeypress="onlyNumberCheck();"
function onlyNumberCheck(){
	if(event.keyCode < 48 || event.keyCode > 57) event.returnValue=false;
}
