// 즐겨찾기
function addFavorites(_title, _url) {
    var title = '환경을 생각하는 친환경&유기농 쇼핑몰 웰베이';
    var url = "http://www.welbay.co.kr";

    if(document.all) {
        // ie
        window.external.AddFavorite(url, title);
    } else if (window.sidebar) {
       // firefox
       window.sidebar.addPanel(title, url, "");
    } else if(window.opera && window.print) {
        // opera
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    } else {
        alert("지원하지 않는 브라우저입니다.");
    }
}

function generate_flash(file_, width_, height_){		
	var mstring="";
	
	mstring = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width_+'" height="'+height_+'" id="falsh_" align="middle"> \n';
	mstring += '<param name="allowScriptAccess" value="always" /> \n';
	mstring += '<param name="movie" value="'+file_+'" /> \n';
	mstring += '<param name="quality" value="high" /> \n';
	mstring += '<param name="wmode" value="Transparent" /> \n';
	mstring += '<param name="bgcolor" value="#ffffff" /> \n';
	mstring += '<embed src="'+file_+'" quality="high" bgcolor="#ffffff" width="'+width_+'" height="'+height_+'" name="flash_" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> \n';
	mstring += '</object> \n';
	
	document.write(mstring);
}

function readCookie(cookiename) 
{
  var Found = false;
 
  cookiedata = document.cookie; 
  if ( cookiedata.indexOf(cookiename) >= 0 ){ 
    Found = true;
  }
 
  return Found;
} 

function MainPopUpWindow(mypage, w, h, t, l, myname, scroll) {
	
	if(t == 0 && l == 0){
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
	}else{
		var winl = l;
		var wint = t;
	}
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',menubar=no,status=no,toolbar=no,resizable=yes'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function OnLoad()
{
        var y;

        // 프레임 에서 벗어나게 하는 함수입니다. 프레임에 넣으려면 삭제하세요

        if ( top.frames.length )
         //       top.location.href = self.location.href;

	try{
        // 페에지 로딩시 포지션
        if ( bNetscape4plus ) {
                document["scrollmenu"].top = top.pageYOffset + 100;
                document["scrollmenu"].visibility = "visible";
        }
        else if ( bExplorer4plus ) {
                scrollmenu.style.top = document.body.scrollTop + 100;
                scrollmenu.style.visibility = "visible";
        }

        always_pos();
    }catch(e){}
    
    
    return true;
}

function nextInput(frm, from, to) {
	var cur = document.all[from].value;
	var curSize = cur.length;
	var numFlag = onlyNumber(cur);

	if( !numFlag && curSize >= 1 && cur != "00" &&  cur != "000" ) {
		alert("숫자만 입력하세요.");
		document.all[from].value = "";
		document.all[from].focus();
		return false;
	}

	if( curSize == 6 )	{
		document.all[to].focus();
		return true;
	}

	return true;
}

function onlyNumber(loc) {
	var isNum = /[^0123456789]/; 
	if (isNum.test(loc)) {
		//alert("숫자가 아닙니다.\n\n0-9의 정수만 허용합니다.");
		return false;
	}
	return true;
}

