//ÇÃ·¡½ÃÃâ·Â
function getFlash(id,url,w,h,t,bg){
	var flashOut='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width='+w+' height='+h+' id='+id+'>';
	flashOut+='<param name="movie" value='+url+' />';
	flashOut+='<param name="wmode" value='+t+' />';
	flashOut+='<param name="bgcolor" value='+bg+' />';
	flashOut+='<param name="allowScriptAccess" value="sameDomain" />';
	flashOut+='<param name="quality" value="high" />';
	flashOut+='<param name="menu" value="false" />';
	flashOut+='<embed src='+url+' width='+w+' height='+h+' name='+id+' wmode='+t+' bgcolor='+bg+' swLiveConnect="true" allowScriptAccess="sameDomain" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	flashOut+='</embed>';
	flashOut+='</object>';

	document.write(flashOut);
}


//¿À¸¥ÂÊ ¸¶¿ì½º »ç¿ë±ÝÁö
document.oncontextmenu=function(){
 //alert('¿À¸¥ÂÊ ¸¶¿ì½º »ç¿ë±ÝÁö');
 //return false;
}


// ÆäÀÌÁö focus blur
function bluring(){
	if (event.srcElement!=null) {
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}
}
document.onfocusin=bluring;

// ¿ÞÂÊ¸Þ´º ¹è°æÀÌ¹ÌÁö ±ô¹Ú°Å¸² ¹æÁö
try {
 document.execCommand("BackgroundImageCache",false,true);
} catch(e) {}


//ÆË¾÷ È­¸é Áß¾Ó¿¡ ¶ç¿ì±â
function Win_pop(newwin,w,h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
if(w=='100%') w=window.availWidth;
winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=no,toolbars=no,status=no,menu=no';
win = window.open(newwin, null, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

//·¹ÀÌ¾î ¿Â¿ÀÇÁ
function layerOnOff(obj){
	var obj=document.getElementById(obj);
	if(obj.style.display=='none'){
		obj.style.display='block';
	}else if(obj.style.display=='block'){
		obj.style.display='none';
	}
}


function isValidateUpfile(filename){
	var ext = getFileExt(filename);
	if( ext !="EXE"){
		return  true;
	}
	else{
		return false;
	}
}

//ÅÇ
function tabchange(img,divid){
	var tabarea=img.parentNode;
	var imgs=tabarea.getElementsByTagName('img');
	var setimgsrc,setimgcheck,imgtype,newname,obj;

	//off image set
	for(var i=0; i<imgs.length; i++){
		setimgsrc=imgs[i].src.split("images/");
		setimgcheck=setimgsrc[setimgsrc.length-1].split(".");
		imgcheck=setimgcheck[0];
		obj=eval(document.getElementById(divid+(i+1)));
		if(img==imgs[i]){
			if(imgcheck.indexOf('on')==-1){
				img.src=img.src.replace(imgcheck,imgcheck+'on');
			}
			obj.style.display='block';
		}else{
			if(imgcheck.indexOf('on')!=-1){
				newname=imgcheck.replace('on','');
				imgs[i].src=imgs[i].src.replace(newname+'on',newname);
			}
			obj.style.display='none';
		}
	}

}

function isValidateImage(filename){
	var ext = getFileExt(filename);
	if( ext =="JPEG" || ext =="JPG" || ext =="GIF"  ){
		return true;
	}
	else{
		return false;
	}
}

function loginSendit()
{
	var form=document.loginForm;
	if(form.userid.value=="")
	{
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		form.userid.focus();
		return false;
	}
	else if(form.pwd.value=="")
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		form.pwd.focus();
		return false;
	}
	else
	{	
		if( form.secret.checked){
			form.action ="https://www.homenote.co.kr/login_ok.php";
		}
		else{
			form.action ="http://www.homenote.co.kr/login_ok.php";
		}
		return true;
	}
}


function writeLoginErr(){
	alert("¾²±â ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.\n\n·Î±×ÀÎ ÇØÁÖ½Ê½Ã¿À.");
	location.href="/login.php";
}
function writeErr(){
	alert("¾²±â ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.");
}
function readLoginErr(){
	alert("·Î±×ÀÎ ÈÄ ÀÌ¿ëÇØÁÖ½Ê½Ã¿À.\n\n·Î±×ÀÎ ÇØÁÖ½Ê½Ã¿À.");
	location.href="/login.php";
}
function readErr(){
	alert("·Î±×ÀÎ ÈÄ ÀÌ¿ëÇØÁÖ½Ê½Ã¿À.");
}

function msgLogin(){
	alert("·Î±×ÀÎ ÈÄ ÀÌ¿ëÇØÁÖ½Ê½Ã¿À.");
}

//ÇÃ·¡½ÃÃâ·Â
function getFlash(id,url,w,h,t,bg){
	var flashOut='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id='+id+'>';
	flashOut+='<param name="movie" value='+url+' />';
	flashOut+='<param name="wmode" value='+t+' />';
	flashOut+='<param name="bgcolor" value='+bg+' />';
	flashOut+='<param name="allowScriptAccess" value="sameDomain" />';
	flashOut+='<param name="quality" value="high" />';
	flashOut+='<param name="menu" value="true" />';
	flashOut+='<embed src='+url+' width='+w+' height='+h+' name='+id+' wmode='+t+' bgcolor='+bg+' swLiveConnect="true" allowScriptAccess="sameDomain" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	flashOut+='</embed>';
	flashOut+='</object>';

	document.write(flashOut);
}

//ÆäÀÌÁö focus blur
function bluring(){
	if (event.srcElement!=null) {
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}
}
document.onfocusin=bluring;


//·¹ÀÌ¾î º¯È¯
function layerChange(show,hide){
	for(var i in show)
		document.getElementById(show[i]).style.display='block';
	for(var i in hide)
		document.getElementById(hide[i]).style.display='none';
}

//°¡°èºÎ ¿ÀÇÂ
function openHomeBook(mode){
		/*
		var url = window.location+"";
	
		if( url.indexOf("www.homenote.co.kr") < 0 ){

			var a =window.open('http://www.homenote.co.kr/mybook/mybook.php?mode='+mode,'mybook','width=944 height=661 resizable=no scrollbars=no');			
		}
		else{
			var a =window.open('/mybook/mybook.php?mode='+mode,'mybook','width=944 height=661 resizable=no scrollbars=no');	
		}
		a.focus();	
		*/
		window.location="/bbs/mybook.php?mode="+mode;
}


//»çÁÖÆÈÀÚ
function goFortune(){
	window.location="/services/fortune.php";
	
}

//global °Ë»ö¿µ¿ª
function checkTopSearch(){
var frm = document.tsFrm;
	if( frm.searchstring.value ==""){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ½Ã¿À.");
		 frm.searchstring.focus();
		 return false;
	}
	else{
		frm.action="/etc/search_result.php";
		return true;
	}

}


//function openGuide(){

//		var a =window.open('/help_mybook/popGuide.html','Guide','width=600 height=783 resizable=no left=170 top=132 scrollbars=no');			
//		a.focus();
//}

function openGuide(){

		var a =window.open('/help_mybook/guide_p01.html','Guide','width=698 height=795 resizable=no left=170 top=132 scrollbars=no');			
		a.focus();
}

function getCookie(name) {
    var find_flag = false
    var start, end
    var i = 0

    while(i <= document.cookie.length) {
         start = i
         end = start + name.length

         if(document.cookie.substring(start, end) == name) {
             find_flag = true
             break
         }
         i++
    }

    if(find_flag == true) {
        start = end + 1
        end = document.cookie.indexOf(";", start)

        if(end < start)
            end = document.cookie.length

        return document.cookie.substring(start, end)
    }
    return ""
}

function setCookie( name, value, expiredays ) 
{ 
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
}


/* ===================================================================
 Function : onlyNumberInput()
 Return   :
 Usage   : ¼ýÀÚ¸¸ ÀÔ·Â °¡´É (onKeyDown ÀÌº¥Æ®)
=================================================================== */
function onlyNumberInput(){
 var code = window.event.keyCode;

 if  (code ==9 || (code > 32 && code < 48) || (code > 57 && code < 65) || (code > 90 && code < 97) || (code > 34 && code < 41) || (code > 47 && code < 58) || (code > 95 && code < 106) || code == 8 || code == 9 || code == 13 || code == 46){
  window.event.returnValue = true;
  return;
 }
 window.event.returnValue = false;
}


function ticket() {
	var win = window.open("/event/event_koex_travel_200902.php", "event_koex_travel_200902", "width=600,height=340,scrollbars=no");
	win.focus();
}

function briePopfView(layer) {
var obj = document.getElementById(layer);
if ( !obj.style.display || obj.style.display == "none" ) {
obj.style.display = "block";
}
else {
obj.style.display = "none";
}
}

function keyword_search(keyword) {
	if (keyword.replace(/ /g,"") != "") {
		window.open("http://search.homenote.co.kr/search/?keyword="+escape(keyword)+"&affiliate_id=homenote_web");
	}
}
