﻿
//플래시출력함수
/*
function getFlash(id,url,w,h,t,bg){
document.write("\
<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+">\
<param name='movie' value="+url+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='sameDomain' />\
<param name='quality' value='high' />\
<param name='menu' value='false' />\
<embed src="+url+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" swLiveConnect='true' allowScriptAccess='sameDomain' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}
*/

function getFlash(id,url,w,h,t){
	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="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+' swLiveConnect="true" allowScriptAccess="sameDomain" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	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;

//이미지 크기에 맞춰 창띄우기 
var imgObj = new Image();
function showImgWin(imgName) {
  imgObj.src = imgName;
  setTimeout("createImgWin(imgObj)", 100);
}
function createImgWin(imgObj) {
  if (! imgObj.complete) {
    setTimeout("createImgWin(imgObj)", 100);
    return;
  }
  imageWin = window.open("", "imageWin",
    "width=" + imgObj.width + ",height=" + imgObj.height);
  imageWin.document.write("<html><body style='margin:0'>");
  imageWin.document.write("<a href=javascript:window.close()><img src='" + imgObj.src + "' border=0></a>");
  imageWin.document.write("</body><html>");
  imageWin.document.title = imgObj.src;
}

//schedule
function toggle() { 
div2.style.top = event.y 
div2.style.left = event.x 

    if (div2.filters(0).status == 2) { 
        div2.filters(0).Stop(); 
    if (div2.style.visibility == "hidden") 
        div2.style.visibility = "visible"; 
    else 
        div2.style.visibility = "hidden"; 
        window.setTimeout("toggle()", 1); 
} 

  div2.filters(0).Apply(); 

  if (div2.style.visibility == "hidden") 
      div2.style.visibility = "visible"; 
  else 
      div2.style.visibility = "hidden"; 

      div2.filters(0).Play(); 
} 


function show(object) {
if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'visible';
else if (document.all) document.all[object].style.visibility = 'visible';
}
function hide(object) {
if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'hidden';
else if (document.all) document.all[object].style.visibility = 'hidden';
}

// inputbox 텍스트 들어가기
function 
    clrImg(obj){
        obj.style.backgroundImage="";obj.onkeydown=obj.onmousedown=null;
    }



//=============개발 추가

//팝업 화면 중앙에 띄우기
function Win_popPro(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=yes,menu=no';
win = window.open(newwin, null, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

//only 숫자만 입력 받기
function checkNumber(){
    var objEv = event.srcElement;
    var numPattern = /([^0-9])/;
    numPattern = objEv.value.match(numPattern);
    if(numPattern != null){
        alert("숫자만 입력해 주세요!");
        objEv.value="";
        objEv.focus();
        return false;
    }
}
//달력 레이어
function openmylayer(btn,layerid){
	var btnx=0;
	var btny=0;
	btn.style.cursor='pointer';
	var layer=document.getElementById(layerid);
	var xpos=getxpos(btn);
	var ypos=getypos(btn);
	layer.style.left=xpos+1;
	layer.style.top=ypos+btn.offsetHeight;
	layer.style.display='block';
	btn.onmouseout=function(){
		layer.style.display='none';
	}
	layer.onmouseover=function(){
		layer.style.display='block';
	}
	layer.onmouseout=function(){
		layer.style.display='none';
	}
	function getxpos(obj){
		if(obj.tagName != "BODY"){
			btnx += obj.offsetLeft;
			getxpos(obj.offsetParent);
		}
		return btnx;
	}
	function getypos(obj){
		if(obj.tagName != "BODY"){
			btny += obj.offsetTop;
			getypos(obj.offsetParent);
		}
		return btny;
	}
	btnx=0;
	btny=0;
}

/*
	이미지 파일 체크
	이미지 파일이 아니면 false
*/
function getFileImageCheck(filePath)
	{

		var lastIndex = -1;
		lastIndex = filePath.lastIndexOf('.');
		var extension = "";
		if ( lastIndex != -1 )
		{
			extension = filePath.substring( lastIndex+1, filePath.len );
		} else {
			extension = "";
		}
		
		extension=  extension.toLowerCase()  ;

		if( extension !="gif" && extension !="jpg" && extension !="jpeg" ){
			return false;		
		}
		else{
			return true;		
		}

		
	}
function delTextValue(obj,text){
	
	if( obj.value == text ){
		obj.value ="";
		
		}

}