/* F5 - 20110207 
function noEvent(e){
   if(e.keyCode == 116 || e.which == 116) {
      e.keyCode = 2;
      return false;
   }else if(e.ctrlKey&& (e.keyCode==78 || e.keyCode == 82)) {
      return false;
   }
}
document.onkeydown = noEvent;
*/

// 문자열 체크, 가입폼등에서 사용
function beAllowStr(str, allowStr) {
    var i;
    var ch;
    for (i=0;i<str.length;i++) {
        ch = str.charAt(i);
        if (allowStr.indexOf(ch) < 0) {
            return false;
        }
    }
    return true;
}

// IE 에서 indexOf 사용을 위해 20100322
if (!Array.indexOf) {
  Array.prototype.indexOf = function (obj, start) {
    for (var i = (start || 0); i < this.length; i++) {
      if (this[i] == obj) {
        return i;
      }
    }
    return -1;	// 없을경우 -1 반환 - 표준
  }
}//

function Confirm_yesorno(msg,url) {
  var Message = msg;
  if(confirm(Message)=='1') {
    location.href = url;
  }
}
function Confirm_yesorno_popup(msg,url) {
  var Message = msg;
  if(confirm(Message)=='1') {
    window.open(url, "", 'top=1,left=1,width=1,height=1,status=no,scrollbars=no,fullscreen=no,toolbar=0,location=0,directories=0,status=1,menubar=0,resizable=yes');
  }
}

function move_url(url) { 
  location.href = url;
} 

function move_url_popup(url) { 
  window.open(url,"","");
} 

function profileWindow(url) {
  var window_left = (screen.width-700)/2;
  var window_top = (screen.height-500)/2;
  window.open(url, "", 'width=900,height=550,status=no,scrollbars=yes,fullscreen=no,toolbar=no,location=0,directories=0,status=1,menubar=no,resizable=yes,top=' + window_top + ',left=' + window_left + '');

}

function window_small(url) {
  var window_left = (screen.width-400)/2;
  var window_top = (screen.height-600)/2;
  window.open(url, "", 'width=10,height=10,status=no,scrollbars=yes,fullscreen=no,toolbar=no,location=0,directories=0,status=1,menubar=no,resizable=yes,top=' + window_top + ',left=' + window_left + '');

}

function Window_StreamingPlayer(ref) {
  var window_left = (screen.width-800)/2;
  var window_top = (screen.height-600)/2;
  window.open(ref,"StreamingPlayer",'width=480,height=500,status=no,scrollbars=no,top=' + window_top + ',left=' + window_left + '');
}

function messageWindow(ref) {
  var window_left = (screen.width-700)/2;
  var window_top = (screen.height-500)/2;
  window.open(ref,"",'width=400,height=400,status=no,scrollbars=yes,top=' + window_top + ',left=' + window_left + '');
}


function NotHan2(frmvalue, msg) {

	a=0;
	b=0;
	var data = frmvalue.value;		
	var alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';	
	var numeric = '1234567890';
	var text = alpha + numeric;	
	for (var i=0;i<data.length;i++) {
		if (text.indexOf(data.substring(i,i+1))<=-1) break;		
	}	
	if (i!=data.length) { a=1; }
	
	
	var numberis = '0123456789';	
	var data = frmvalue.value;	
	for (i=0; i<data.length; i++) 	if ( numberis.indexOf(data.substring(i,i+1))<0) {	break ;}
	if ( i !=data.length ) {	b=1;	}		
	
	if (a==1&& b==1) return false;
	else { alert(msg); frmvalue.select(); return true; }
}


/* 091015 미리보기 Div 처리용 (기존 footer 존재) by migo */
  function drs(text, title) { dts(1,text); }

  function nd() {
    if ( cnt >= 1 ) { sw = 0 };
    if ( sw == 0 ) { snow = 0; hideObject(over); }
    else { cnt++; }
  }

  function dts(d,text) {
    txt = "<TABLE WIDTH=100 STYLE=\"border:1 #e9e9e9 solid\" CELLPADDING=5 CELLSPACING=0 BORDER=0><TR><TD BGCOLOR=#ffffff><FONT COLOR=#555555>"+text+"</FONT></TD></TR></TABLE>"
    layerWrite(txt);
    dir = d;
    disp();
  }

  function disp() {
    if (snow == 0) {
      if (dir == 2) { moveTo(over,x+offsetx-(width/2),y+offsety); } // Center
      if (dir == 1) { moveTo(over,x+offsetx,y+offsety); } 					// Right
      if (dir == 0) { moveTo(over,x-offsetx-width,y+offsety); } 		// Left
      showObject(over);
      snow = 1;
    }
  }

  function mouseMove(e) {
    x=(jQuery.browser.msie ? event.x	+ document.body.scrollLeft+10 : e.pageX + 10);				// 091015 by migo - 브라우저별 조치
    y=(jQuery.browser.msie ? event.y + document.body.scrollTop 		: e.pageY + 10);
    if (x+width-document.body.scrollLeft > document.body.clientWidth) 	x=x-width-25;
    if (y+height-document.body.scrollTop > document.body.clientHeight) 	y=y-height;

    if (snow) {
      if (dir == 2) { moveTo(over,x+offsetx-(width/2),y+offsety); } // Center
      if (dir == 1) { moveTo(over,x+offsetx,y+offsety); } 					// Right
      if (dir == 0) { moveTo(over,x-offsetx-width,y+offsety); } 		// Left
    }
  }

  function cClick() { hideObject(over); sw=0; }
  function layerWrite(txt) { document.all["overDiv"].innerHTML = txt }
  function showObject(obj) { obj.visibility = "visible" }
  function hideObject(obj) { obj.visibility = "hidden" }
  function moveTo(obj,xL,yL) { obj.left = xL; obj.top = yL; }

/* by migo */
// 
// 변수 반환 - trim, 한글 decode 및 null 값 체크
function getVar($var) {
	if($var != null || $var != undefined) {
		return $.trim(unescape(decodeURI($var)));
	} else {
		return "";
	}
}// func

// ajax - 한글 전달시
function ajax_txt_encode($var) {
	$var = getVar($var);
	//if($var == "") { alert("값이 조"); retunr; }
	return escape(encodeURI($var));
} // func

// ajax - 한글 받는 경우
function ajax_txt_decode($var) {
	$var = getVar($var);
	return unescape(decodeURI($var));
}// func

// 100106 by migo - user_photo 치환
var userPhotoBaseUrl_100 = "http://hiphopplaya2.codns.com/img/user_photo/100/";			// user_photo 위치
var userPhotoBaseUrl_original = "http://hiphopplaya2.codns.com/img/user_photo/";			// user_photo 위치
var userPhotoBaseImg = "http://hiphopplaya.com/images/user_photo_empty.gif";	// 기본 이미지

