// 입력값 특수문자 체크
function checkSpecialChars(str) {
    var specialChars = "\\><\'\"@#$%*+&-^;!=_?()|\\\'\\\"";
    var fl_exist = false;
    var inpStr = str;
   
    for(i = 0; i < inpStr.length; i++) {
        tmpStr = inpStr.charAt(i);
        if(specialChars.indexOf(tmpStr) != -1) {
            alert("검색어에 유효하지 않는 문자(\\><\'\"@#$%*+&-^;!=_?()|\\\'\\\")가 포함되어 있습니다.");
            fl_exist = true;
            break;
        }
    }
    
    return fl_exist;
}


function trim(str) {
    value = str.replace(/^\s+/, "").replace(/\s+$/, "");
    return value;
}


function open_win(win_name, src, width, height, scrollbar, menubar)
{
    open_window = window.open(src, win_name,
            'width='+width+',height='+height+',marginwidth=0, marginheight=0,'+
            'status=no,resizable=0,scrollbars='+scrollbar+',menubar='+menubar);
    open_window.focus();
    return open_window;
}


/*
모달 팝업을 띄운다.(단일 파라미터)
*/
function ShowPopup(htmlUrl, paramValue, popupWidth, popupHeight) {
var chkVersion = "";
if($.browser.msie){    // IE
	//alert($.browser.version);
    if($.browser.version == "8.0"){
        chkVersion = "IE 7.0";
        popupWidth = popupWidth;
        popupHeight = popupHeight;             // IE8
    }else if($.browser.version == "7.0"){
        chkVersion = "IE 7.0";
        popupWidth = popupWidth+2;
        popupHeight = popupHeight+3;             // IE7
    }else{
        chkVersion = "IE 6.0";
        popupWidth = popupWidth+20;
        popupHeight = popupHeight+30;
    }
}else if($.browser.mozilla){           // FF
    popupWidth = popupWidth+17;
    popupHeight = popupHeight+20;
}else if($.browser.safari){           // safari, crome
    popupWidth = popupWidth+17;
    popupHeight = popupHeight;
}

//alert(chkVersion+","+popupWidth+" , "+popupHeight);

var feat = "dialogHeight:" + popupHeight + "px;dialogWidth:" + popupWidth + "px;center:yes;edge:raised;help:no;resizable:no;scroll:yes;status:no;";

var param = new Array();

param[0] = window;
param[1] = paramValue;
return window.showModalDialog(htmlUrl, param, feat);
}




//이미지 온오프 처리
function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function blockStart(){
	jQuery.blockUI({
	    message: jQuery('<img src="/common/images/ajax-loader.gif" />')
	    ,css: {border: 'none', backgroundColor: 'transparent'}
	    ,overlayCSS: {
	    backgroundColor:'#AAA',
	    opacity: '0.3'
	    }
	   
	});
}

function blockEnd(){
	$.unblockUI();
	$(".blockUI").fadeOut("slow"); 
}

