function viewImg(imgname) {
	window.open("/board/viewImg.php?imgname="+imgname,"viewImg","width=10,height=10,left=0,top=0,scrollbars=yes");
}

function downFile(filename) {
	window.open("/board/down.php?filename="+filename,"down","width=500,height=500,left=0,top=0,scrollbars=yes");
}

/*
function autoBlur(){ 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 
	document.body.focus(); 
} 
document.onfocusin=autoBlur;
*/

function flash(swf, width, height, flashvars, base, id)
{
    var strFlashTag = new String();
    if (navigator.appName.indexOf("Microsoft") != -1)
    {
        strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+id+'" ';
        strFlashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
        strFlashTag += 'width="' + width + '" height="' + height + '">';
        strFlashTag += '<param name="movie" value="' + swf + '"/>';
        strFlashTag += '<param name="flashvars" value="' + flashvars + '"/>';
        strFlashTag += '<param name="base" value="' + base + '"/>';
        strFlashTag += '<param name="quality" value="best"/>';
//      strFlashTag += '<param name="bgcolor" value="' + bgcolor + '"/>';  
        strFlashTag += '<param name="menu" value="false"/>';
//        strFlashTag += '<param name="salign" value="LT"/>';
        strFlashTag += '<param name="scale" value="noscale"/>';
        strFlashTag += '<param name="wmode" value="transparent"/>';
        strFlashTag += '<param name="allowScriptAccess" value="always"/>';
        strFlashTag += '</object>';
    }
    else
    {
        strFlashTag += '<embed id="'+id+'" src="' + swf + '" ';
        strFlashTag += 'quality="best" ';
//      strFlashTag += 'bgcolor="' + bgcolor + '" ';
        strFlashTag += 'width="' + width + '" ';
        strFlashTag += 'height="' + height + '" ';
        strFlashTag += 'base="' + base + '" ';
        strFlashTag += 'menu="false" ';
        strFlashTag += 'scale="noscale" ';
//        strFlashTag += 'salign="LT" ';
        strFlashTag += 'wmode="transparent" ';
        strFlashTag += 'allowScriptAccess="always" ';
        if(flashvars != null) {strFlashTag += 'flashvars="' + flashvars + '" '};
        strFlashTag += 'type="application/x-shockwave-flash" ';
        strFlashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
        strFlashTag += '</embed>';
    }
 document.write(strFlashTag);
}

function flashMovie(playswf, flashvars, image, width, height)
{
	//stretching=uniform, fill, exactfit, none
	//영상출력설정입니다. uniform은 기본값입니다.
	//fill은 비율에 상관없이 영상이 꽉 채워서 나오게 됩니다.
	//exactfit은 비율에 맞춰 영상을 출력합니다.
	//none은 전체화면을 하더라도 원본 크기대로 나옵니다.

    var strFlashTag = new String();
    if (navigator.appName.indexOf("Microsoft") != -1)
    {
        strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
        strFlashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
        strFlashTag += 'width="' + width + '" height="' + height + '" id="single1" name="single1">';
        strFlashTag += '<param name="movie" value="' +playswf+'"/>';
        strFlashTag += '<param name="flashvars" value="file='+flashvars+'&image='+image+'&stretching=exactfit&volume=100"/>';
        strFlashTag += '<param name="allowfullscreen" value="true" />';
        strFlashTag += '<param name="allowscriptaccess" value="">';
        strFlashTag += '<param name="wmode" value="transparent"/>';
        strFlashTag += '<param name="quality" value="best"/>';
        strFlashTag += '</object>';
    }
    else
    {
        strFlashTag += '<embed src="' + playswf + '?file=' + flashvars + '&image=' + image + '&stretching=exactfit&volume=100" ';
        strFlashTag += 'quality="best" ';
        strFlashTag += 'width="' + width + '" ';
        strFlashTag += 'height="' + height + '" ';
        strFlashTag += 'allowfullscreen="true" ';
        strFlashTag += 'allowscriptaccess="allow" ';
        strFlashTag += 'wmode="transparent" ';
        strFlashTag += 'type="application/x-shockwave-flash" ';
        strFlashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
        strFlashTag += '</embed>';
    }
 document.write(strFlashTag);
}

function swf_wmode(src,w,h){
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="menu" value="false">';
	html += '<param name="swliveconnect" value="true">';
	html += '<param name="wmode" value="transparent">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'" height="'+h+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
	html += '<\/object>';
	document.write(html);
}
/*----------------------------------------------------
// 텍스트 입력폼 체크
----------------------------------------------------*/
function isEmpty(data,text) {
	if(trim(data.value).length<1) {
		alert(text);
		data.focus();
		return false;
	}
	return true;
}

function trim(str){ 
	//정규 표현식을 사용하여 화이트스페이스를 빈문자로 전환
	str = str.replace(/^\s*/,'').replace(/\s*$/, ''); 
	return str; //변환한 스트링을 리턴.
}  

//길이 체크
function CheckLen(name,minlen,maxlen,text) {
	if (trim(data.value).length < minlen) {
		alert(text);
		name.focus();
        return false;
	} else if (trim(data.value).length > maxlen)    {
		alert(text);
		name.focus();
        return false;
	}
    else
	return true;
}

//아이디체크
function CheckId(name,text) {
	var obj = trim(name.value);

    if(!/^[a-zA-Z0-9]{6,8}$/.test(obj)) {
        alert(text); 
		name.focus();
        return false;
    }
	return true;
}

//한글만입력
function ChkOnlyHan(name,text) {
	var obj = trim(name.value);

    if(/[^가-힝]$/.test(obj)) {
        alert(text); 
		name.focus();
        return false;
    }
	return true;
}

//숫자만 입력
function ChkOnlyNum(name,text) {
	var obj = trim(name.value);

    if(/[^0-9]$/.test(obj)) {
        alert(text); 
		name.focus();
        return false;
    }
	return true;
}

//주민번호 검사
function CheckPnum(jumin1,jumin2) {
	var jumin1 = jumin1.value;
	var jumin2 = jumin2.value;
	var jumin = jumin1 + jumin2;

	a = new Array(13);

	for (var i=0; i < 13; i++) {
		a[i] = parseInt(jumin.charAt(i));
	}

	var j = a[0]*2 + a[1]*3 + a[2]*4 + a[3]*5 + a[4]*6 + a[5]*7 + a[6]*8 + a[7]*9 + a[8]*2 + a[9]*3 + a[10]*4 + a[11]*5;
	var j = j % 11;
	var k = 11 - j;

	if (k > 9) {
		k = k % 10
	}

	if (k != a[12]){
	}else {
		return true;
	}
}

//이메일 검사
function EmailCheck(text){
    //ex) onBlur="EmailCheck(email)"
    atcnt = 0;      //@count
    atidx = 0;      //@index
    pocnt = 0;      //.count
    p1idx = 0;      //.first idx
    p2idx = 0;      //.last idx
    //flag = false;   //result

    for(i=0; i<text.value.length; i++){
        if(text.value.charAt(i) == "@"){
            ++atcnt;
            atidx = i;
        }

        if(text.value.charAt(i) == "."){
            ++pocnt;
            if(p1idx == 0){
                p1idx = i;  //처음 .를 만나는 위치값 1번만 저장
            }
            p2idx = i;
        }
    }

    if(text.value.length > 0 &&
        (text.value.length < 10 || atcnt != 1 || atidx < 4 || pocnt == 0 || pocnt > 3 ||
        ((p1idx > atidx) && p1idx-atidx < 3) ||
        ((p1idx < atidx) && atidx-p1idx < 3) || ((p1idx != p2idx) && p2idx-p1idx < 3))){
//        alert("("+text.value+") 잘못된 형식의 이메일 주소입니다.");
        text.select();
        text.focus;
        return false;
    }
    
    return true;
}


function ticketOpen(no,dt,tm) {
	window.open('http://www.sidance.org/booking_re/booking_start.php?no='+no+'&dt='+dt+'&tm='+tm,'tk','width=980, height=780, left=0; top=0, scrollbars=yes');
}

function myTicket() {
	window.open('http://www.sidance.org/booking_re/my_booking_lst.php','tk','width=980, height=780, left=0; top=0, scrollbars=yes');
}


