function getobj(id)
{
	return document.getElementById(id);
}
function getKeycode(e)
{
	return (!e?event.keyCode:e.which)
}

function copyClipboard(eId)
{
	var urlEle = document.getElementById(eId);

	if(urlEle != null)
	{
		window.clipboardData.setData("Text", urlEle.innerText);
	}
	else
	{
		window.clipboardData.setData("Text", eId);
	}
}
function ResizeWin(width, height,autoheight)
{
    if(!width)
    {
	width = document.body.clientWidth;
	alert('width : '+width);
    }
    if(!height)
    {
	height = document.body.clientHeight;
	if(!autoheight)
		alert('height : '+height);
    }

    if(!is_ie())
	height += 80;
    else
    {
	var version = get_IEversion();
	if(version > 6)
	    height += 80;
	else
	    height += 40;
    }


    self.resizeTo(width, height);
}
function is_ie()
{
	agent_name = navigator.userAgent.toLowerCase();
	return ((this.agent_name.indexOf("msie") != -1) && (this.agent_name.indexOf("opera") == -1));//브라우저 구분
}
function get_IEversion()
{
	return ScriptEngineMinorVersion();
}

function check_imgext(fileobj)
{
	var imgext = ['jpg', 'jpeg', 'png', 'gif', 'bmp'];
	var tmp = fileobj.value.split('.');
	var ext = tmp[tmp.length-1].toLowerCase();
	var flag = false;

	for(var i = 0 ; i < imgext.length ; i++)
	{
		if(ext == imgext[i])
		{
			flag = true;
			break;
		}
	}
	return flag;
}
function get_humansize(size)
{
	var size_array = ['Byte', 'KB', 'MB', 'GB', 'TB'];

	for (var i = 0; size > 1024; i++)
	{
		size /= 1024;
	}

	if (i == 0)
		return size + ' ' + size_array[i];
	else
	{
	  return (parseInt(parseFloat(size) * 100) / 100) + size_array[i];
	}
		//return sprintf("%f", size) + ' ' + size_array[i];
}
// 글자 수 제한
function textareacheck(aro_name,ari_max, dpboxid) // 텍스트박스, 제한글자수
{
   var ls_str     = aro_name.value; // 이벤트가 일어난 컨트롤의 value 값
   var li_str_len = ls_str.length;  // 전체길이

   // 변수초기화
   var li_max      = ari_max; // 제한할 글자수 크기
   var li_byte     = 0;  // 한글일경우는 2 그밗에는 1을 더함
   var li_len      = 0;  // substring하기 위해서 사용
   var ls_one_char = ""; // 한글자씩 검사한다
   var ls_str2     = ""; // 글자수를 초과하면 제한할수 글자전까지만 보여준다.

   for(i=0; i< li_str_len; i++)
   {
      // 한글자추출
      ls_one_char = ls_str.charAt(i);

      // 한글이면 2를 더한다.
      if (escape(ls_one_char).length > 4)
      {
         li_byte += 2;
      }
      // 그밗의 경우는 1을 더한다.
      else
      {
         li_byte++;
      }

      // 전체 크기가 li_max를 넘지않으면
      if(li_byte <= li_max)
      {
         li_len = i + 1;
      }
   }

   // 전체길이를 초과하면
   if(li_byte > li_max)
   {
      alert("내용은 한글 " + li_max/2 + "자 영문 " + li_max + "자 까지만 허용됩니다.");
      ls_str2 = ls_str.substr(0, li_len);
      aro_name.value = ls_str2;
	  aro_name.focus();
   }
   else if(dpboxid)
	{
	   var dpboxobj = getobj(dpboxid);
	   dpboxobj.innerHTML = li_byte;
	}
}
function check_radio(obj)
{
	for(var i = 0 ; i < obj.length ; i++)
	{
		if(obj[i].checked)
			return true;
	}
	return false;
}
function get_radio(obj)
{
	for(var i = 0 ; i < obj.length ; i++)
	{
		if(obj[i].checked)
			return obj[i].value;
	}
	return false;
}
function display_toggle(id)
{
    var obj = document.getElementById(id);
	if(!obj)
	{
		alert('id가 '+id+'인 개체가 없습니다');
		return;
	}

    obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
}

function listallcheck(obj, listid)
{
	if(!listid)
		listid = 'list';

	var lists = document.getElementById(listid).getElementsByTagName('input');

	for(var i = 0 ; i < lists.length ; i++)
	{
		if(lists[i].type == 'checkbox')
			lists[i].checked = (obj == 'check')? true : (obj == 'uncheck')? false : obj.checked;
	}

}
function listallvalue(listid)
{
	if(!listid)
		listid = 'list';

	var lists = document.getElementById(listid).getElementsByTagName('input');
	var resultmsg = '';
	for(var i = 0 ; i < lists.length ; i++)
	{
		if(lists[i].type == 'checkbox' && lists[i].checked)
		{

			if(resultmsg)
				resultmsg += '|';
			resultmsg += lists[i].value;
		}
	}
	return resultmsg;
}

function check_string_length(str, min, max) { 	// 텍스트 길이 체크
	if (str.length < min || str.length > max) {
        return false;
    }
    return true;
}

function check_lowercase_number(str) { 			// 영문소문자/숫자 체크
	var pattern = /[a-z0-9]/;
	for (i = 0; i < str.length; i++) {
		if (pattern.test(str.charAt(i)) != true) {
			return false;
		}
	}
    return true;
}

function check_number(str) { 					// 숫자 체크
	var pattern = /[0-9]/;
	for (i = 0; i < str.length; i++) {
		if (pattern.test(str.charAt(i)) != true) {
			return false;
		}
	}
    return true;
}

//////////////////// cookie

function getCookie( name )
{
    var nameOfcookie = name + "=";
    var x = 0;
    while ( x <= document.cookie.length )
    {
            var y = (x+nameOfcookie.length);
            if ( document.cookie.substring( x, y ) == nameOfcookie ) {
                    if ( (endOfcookie=document.cookie.indexOf( ";", y )) == -1 )
                            endOfcookie = document.cookie.length;
                    return unescape( document.cookie.substring( y, endOfcookie ) );
            }
            x = document.cookie.indexOf( " ", x ) + 1;
            if ( x == 0 )
                    break;
    }
    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 delCookie( cookieName )
 {
  var expireDate = new Date();

  //어제 날짜를 쿠키 소멸 날짜로 설정한다.
  expireDate.setDate( expireDate.getDate() - 1 );
  document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
 }






// example
//
//  onClick="setCookie('hamt', 'ok', '1')"

//  if ( getCookie( "hamt" ) != "ok" )
//        window.open('/popup.htm', 'mainpopup', 'width=400 height=644');
//
////////////////// end cookie





//////////// Image Resize & viewer start
// by hamt
var HamtResizeImg = function(objName, maxwidth, clickflag)
{
	this.objName = objName;
	this.idlist = [];
	this.maxwidth = maxwidth;
	this.clickflag = clickflag;

	this.Add = function(id)
	{
		this.idlist[this.idlist.length] = id;
	}
	this.Run = function()
	{
		for(var j = 0 ; j < this.idlist.length ; j++)
		{
			var id = this.idlist[j];

			var imgs = document.getElementById(id).getElementsByTagName('IMG');

			for(var i = 0; i < imgs.length; i++)
			{


					var w = imgs[i].width;
					var scrollflag = false;
					if(w > screen.width)
					{
						w = screen.width;
						scrollflag = true;
					}
					var h = imgs[i].height;
					if(h > screen.height)
					{
						h = screen.height;
						scrollflag = true;
					}
					if(this.clickflag)
					{
						var clickevent = "function(){"+this.objName+".view_pic(document.getElementById('"+id+"').getElementsByTagName('IMG')["+i+"], "+w+", "+h+", "+scrollflag+");}";

						//clickevent = 'alert(1);';
						if(imgs[i].attachEvent)
						{

							eval("document.getElementById('"+id+"').getElementsByTagName('IMG')["+i+"].attachEvent('onclick', "+clickevent+");");
						}
						else
						{
							eval("document.getElementById('"+id+"').getElementsByTagName('IMG')["+i+"].addEventListener('click', "+clickevent+", false);");
						}
						imgs[i].style.cursor = 'pointer';
					}

				 if(imgs[i].width <= this.maxwidth)
					continue;


				imgs[i].height = Math.round(imgs[i].height * this.maxwidth / imgs[i].width);
				imgs[i].width = this.maxwidth;
			}
		}
	}

//	this.view_pic = function(imgobj, w, h, scroll)
//	{
//
//		var picwin = window.open('', 'viewpic', 'width='+w+' height='+h+' scrollbars="auto"');
//		picwin.document.write("<head><title>원본 이미지</title></head><body style='margin:0px;padding:0px;'><img src='"+imgobj.src+"' onclick='self.close()' style='cursor:pointer;' /></body>");
//		if(scroll)
//			picwin.document.body.scroll = "auto";
//	}
}
// 사용예 :
//   var areaResize = new HamtResizeImg('areaResize', 500, true);//변수명, 최대넓이, 클릭하여 이미지 크게보기 bool
//	 areaResize.Add('contentarea');
//	 <script>
//    window.onload = function(){areaResize.Run();}
//	 </script>
//////////////// Image Resize & viewer end










/*********************************************************
제작자 : 함트 2008. 11. 14

파라메타 설명
 objName : 생성한 개체 명
layerid : 액션을 부여할 레이어 id
xy : x 또는 y. 가로 액션을 줄 경우 x, 세로 엑션을 줄 경우 y입력.
     x정의시 인라인 스타일로 width가 명시되어야 함. ( <div style='width:300px;'>)
     y정의시 인라인 스타일로 height가 명시되어야 함. ( <div style='height:300px;'>)
[remain] : 안줘도 됨. 줄 경우 숨길때 준 숫자만큼의 픽셀을 남겨둠


<script>
var la = new LayerAction('la', 'lmenu', 'x');
//var la = new LayerAction('la', 'lmenu', 'y');
//var la = new LayerAction('la', 'lmenu', 'xy');
</script>
************************************************************/
var LayerAction = function(objName, layerid, xy, remain)//개체명, 리사이즈될 레이어 ID, 수직:x or 수평:y
{

	this.objName = objName;
	this.obj = document.getElementById(layerid);
	this.obj.style.overflow = 'hidden';
	this.xy = xy;

	this.oriwidth = this.obj.style.width.split('px')[0];
	if(!this.oriwidth)
		this.oriwidth = this.obj.offsetWidth;

	this.oriheight = this.obj.style.height.split('px')[0];
	if(!this.oriheight)
		this.oriheight = this.obj.offsetHeight;



	this.tan = 0.8;
	this.speed = 10;

	if(!remain)
		remain = 1;
	this.remain = remain;//손잡이를위해 남겨놓을 픽셀 수

	if(this.xy == 'x')
		this.obj.style.width = this.remain+'px';
	else if(this.xy == 'y')
		this.obj.style.height = this.remain+'px';
	else if(this.xy == 'xy')
	{
		this.obj.style.width = this.remain+'px';
		this.obj.style.height = this.remain+'px';
	}
	this.prexmode = 'dec';
	this.xmode = 'stop';
	this.preymode = 'dec';
	this.ymode = 'stop';





	this.bg = document.createElement('div');
	this.bg.style.position='absolute';
	this.bg.style.left = '0px';
	this.bg.style.top = '0px';


	this.bg.style.width = '100%';
	this.bg.style.height = '100%';

	this.bg.style.display = 'none';
	this.bg.style.top = '0px';
	this.bg.style.background = "#000";
	this.bg.style.opacity = (50/100);
	this.bg.style.MozOpacity = (50/100);
	this.bg.style.KhtmlOpacity = (50/100);
	this.bg.style.filter = 'alpha(opacity=50)';

	//document.getElementsByTagName('body')[0].insertBefore(this.bg,document.getElementsByTagName('body')[0].firstChild);


	this.reset_size = function()
	{
		this.obj.overflow = '';
		this.obj.style.width = '';
		this.obj.style.height = '';

		this.oriwidth = this.obj.style.width.split('px')[0];
		if(!this.oriwidth)
			this.oriwidth = this.obj.offsetWidth;

		this.oriheight = this.obj.style.height.split('px')[0];
		if(!this.oriheight)
			this.oriheight = this.obj.offsetHeight;

		this.obj.overflow = 'hidden';
		this.obj.style.width = this.oriwidth+'px';
		this.obj.style.height = this.oriheight+'px';

	}
	this.toggle = function()
	{
		var mode = (this.xy == 'x')? this.prexmode : this.preymode;
		//(this.xy == 'y') ? this.preymode : (this.prexmode == 'stop')? this.preymode : this.prexmode;

		switch(mode)
		{
			case 'inc' :
				this.hidden();
				break;
			case 'dec' :
				this.view();
				break;
		}
	}
	this.hidden = function()
	{
		this.bg.style.display = 'none';

		if(this.xy == 'x')
		{
			this.xmode = 'dec';
			this.hiddenX();
		}
		if(this.xy == 'y')
		{
			this.ymode = 'dec';
			this.hiddenY();
		}
		if(this.xy == 'xy')
		{
			this.xmode = 'dec';
			this.ymode = 'dec';
			this.hiddenX();
			this.hiddenY();
		}
	}
	this.view = function()
	{
		this.bg.style.display = 'block';


		if(this.xy == 'x')
		{
			this.xmode = 'inc';
			this.viewX();
		}
		if(this.xy == 'y')
		{
			this.ymode = 'inc';
			this.viewY();
		}
		if(this.xy == 'xy')
		{
			this.xmode = 'inc';
			this.ymode = 'inc';
			this.viewX();
			this.viewY();
		}
	}
////////// private
	this.hiddenX = function()
	{
		if(this.xmode != 'dec')
			return;

		var w = this.obj.style.width.split('px')[0];


		w *= this.tan;
		w = parseInt(w);
		if(w > this.remain)//동작중
		{
			this.obj.style.width = w+'px';
			setTimeout(this.objName+'.hiddenX()', this.speed);
			return;
		}
		else
		{
			//alert('end');
			this.obj.style.width = this.remain+'px';
			this.xmode = 'stop';
			this.prexmode = 'dec';
		}
	}
	this.hiddenY = function()
	{
		if(!this.remain)
			this.remain = 1;
		//alert(this.ymode);
		if(this.ymode != 'dec')
			return;

		var h = this.obj.style.height.split('px')[0];


		h *= this.tan;
		h = parseInt(h);
		//alert(h);
		if(h > this.remain)//동작중
		{
			this.obj.style.height = h+'px';
			setTimeout(this.objName+'.hiddenY()', this.speed);
			return;
		}
		else
		{
			this.obj.style.height = this.remain+'px';
			this.ymode = 'stop';
			this.preymode = 'dec';
		}
	}
	this.viewX = function(prew)
	{
		//alert('view x xmode = '+this.xmode);
		if(this.xmode != 'inc')
			return;

		var w = this.obj.style.width.split('px')[0];
		if(!w)
			w = 1;

		w = parseInt(w) + (this.oriwidth - w) * (1-this.tan);
		w = parseInt(w);

		//alert('prew : '+prew+', w : '+w);

		if(w != prew && w < this.oriwidth)//동작중
		{

			this.obj.style.width = w+'px';
			setTimeout(this.objName+'.viewX('+w+')', this.speed);
			return;
		}
		else
		{
			//alert('end');
			this.obj.style.width = this.oriwidth+'px';
			this.xmode = 'stop';
			this.prexmode = 'inc';
		}
	}
	this.viewY = function(preh)
	{

		if(this.ymode != 'inc')
			return;

		var h = this.obj.style.height.split('px')[0];
		if(!h)
			h = 1;

		h = this.oriheight - (this.oriheight-h) * this.tan;
		h = parseInt(h);
		//alert(preh+', '+h);
		if(h != preh &&h < this.oriheight)//동작중
		{
			this.obj.style.height = h+'px';
			setTimeout(this.objName+'.viewY('+h+')', this.speed);
			return;
		}
		else
		{
			//alert('end');
			this.obj.style.height = this.oriheight+'px';
			this.ymode = 'stop';
			this.preymode = 'inc';
		}
	}
}

function addEvent(obj, type, fn)
{
	if (obj.addEventListener)
	obj.addEventListener(type, fn, false);
	else if (obj.attachEvent)
	{
		obj.attachEvent("on"+type, fn);
	}
}





////////////////// php style func
function trim(string)
{
	string = ltrim(string);
	string = rtrim(string);
	return string;
}
function ltrim(string)
{
	var flag = false;
	var result = '';
	for(var i = 0 ; i < string.length ; i++)
	{
		if(string.charAt(i) != ' ')
			flag = true;
		if(flag)
			result += string.charAt(i);
	}
	return result;
}
function rtrim(string)
{
	var flag = false;
	var result = '';
	for(var i = string.length-1 ; i >= 0 ; i--)
	{
		if(string.charAt(i) != ' ')
			flag = true;
		if(flag)
			result = string.charAt(i)+result;
	}
	return result;
}
function in_array(key ,arr)
{
	for(var i = 0 ; i < arr.length ; i++)
	{
		if(arr[i] == key)
			return true;
	}
	return false;
}
function explode(cut, str, arrlen)
{
	var temp = str.split(cut);

	var result = [];

	for(var i = 0 ; i < temp.length ; i++)
	{
		if(arrlen && arrlen < i)
		{
			result[result.length-1] += cut + temp[i];
		}
		else
		{
			result[result.length] = temp[i];
		}
	}
	return result;
}
function implode(connstr, arr)
{
	var result = '';
	for (var i = 0; i < arr.length ; i++ )
	{
		if(result)
			result += connstr;
		result += arr[i];
	}
	return result;
}
function str_replace(oldstr, newstr, allstr, arrlen)
{
	var temp = explode(oldstr, allstr, arrlen);
	return implode(newstr, temp);
}
function nl2br(str)
{
	str = str_replace("\r", '', str);
	str = str_replace("\n", "<br>\n", str);
	return str;
}

function removeComma(str)
{
	//str = str_replace("'", "\\\'", str);
	//str = str_replace("""", "<br>\n", str);
	//return str;
}


function get_between(left, right, str)
{
	var temp = str.split(left);
	var result = [];

	for(var i = 1 ; i < temp.length ; i++)
	{
		result[result.length] = temp[i].split(right)[0];
	}
	return result;
}
function strip_tags(str)
{
	var ret = '';
	var strs = str.split('<');

	ret = strs[0];

	for(var i = 1 ; i < strs.length ; i++)
		ret += strs[i].split('>')[1];
	return ret;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Common JavaScript Function

function window_open(url, name, width, height, scrollbars) {
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;

    var features = "left=" + left + ", top=" + top + ", width=" + width + ", height=" + height + ", scrollbars=" + scrollbars;
    window.open(url, name, features);
}

function window_close() {
	self.close();
}

function top_location(url) {
    top.location.href = url;
}

function check_string_length(str, min, max) { 	// 텍스트 길이 체크
	if (str.length < min || str.length > max) {
        return false;
    }
    return true;
}

function check_lowercase_number(str) { 			// 영문소문자/숫자 체크
	var pattern = /[a-z0-9]/;
	for (i = 0; i < str.length; i++) {
		if (pattern.test(str.charAt(i)) != true) {
			return false;
		}
	}
    return true;
}

function check_number(str) { 					// 숫자 체크
	var pattern = /[0-9]/;
	for (i = 0; i < str.length; i++) {
		if (pattern.test(str.charAt(i)) != true) {
			return false;
		}
	}
    return true;
}

function check_registno(registno1, registno2) {                     // 주민번호 유효성 체크
    var yy = registno1.substr(0, 2);            // 년
    var mm = registno1.substr(2, 2);            // 월
    var dd = registno1.substr(4, 2);            // 일
    var gender = registno2.substr(0, 1);        // 성별

    // 앞자리 체크
    if (registno1 == "") {
        return false;
    }
    if (registno1.length != 6) {
        return false;
    }
    for (i = 0; i < registno1.length; i++) {
		if (registno1.charAt(i) < "0" || registno1.charAt(i) > "9") {
			return false;
		}
	}

	// 뒷자리 체크
	if (registno2 == "") {
        return false;
    }
    if (registno2.length != 7) {
        return false;
    }
    for (i = 0; i < registno2.length; i++) {
		if (registno2.charAt(i) < "0" || registno2.charAt(i) > "9") {
			return false;
		}
	}

	// 앞자리 년월일 형식
	if (yy < "00" || yy > "99" || mm < "01" || mm > "12" || dd < "01" || dd > "31") {
	    return false;
	}

	// 성별체크
	if (gender < "1" || gender > "4") {
	    return false;
	}

	// 세기(century)별 날짜 유효성 체크
	if (gender == "1" || gender == "2") {
	    cc = "19";
	}
    else {
        cc = "20";
    }

    // if (check_date(parseInt(cc+yy), parseInt(mm), parseInt(dd)) == false) {
    //     return false;
    // }

    // check digit
    n = 2;
    sum = 0;

    for (i = 0; i < registno1.length; i++) {
        sum += parseInt(registno1.substr(i, 1)) * n++;
    }
    for (i = 0; i < registno2.length - 1; i++) {
        sum += parseInt(registno2.substr(i, 1)) * n++;
        if (n == 10) {
            n = 2;
        }
    }

    c = 11 - (sum % 11);
    if (c == 11) {
        c = 1;
    }
    if (c == 10) {
        c = 0;
    }

    if (c != parseInt(registno2.substr(6, 1))) {
        return false;
    }
    else {
        return true;
    }
}

function check_businessno(businessno) {								// 사업자등록번호 유효성 체크
    var a = new Array;
    var b = new Array(1,3,7,1,3,7,1,3,5);
    var sum = 0;

    if (businessno == "") {
        return false;
    }
    if (businessno.length != 10) {
        return false;
    }
    for (i = 0; i < businessno.length; i++) {
		if (businessno.charAt(i) < "0" || businessno.charAt(i) > "9") {
			return false;
		}
	}

	for (i = 0; i < 10; i++) {
		a[i] = businessno.substr(i, 1);
	}
	for (i = 0; i < 9; i++) {
		sum += (a[i] * b[i]);
	}

	sum += ((a[8] * 5) / 10);
	y = (sum - (sum % 1)) % 10;

    if (y == 0) {
    	z = 0;
    }
    else {
        z = 10 - y;
    }

    if (z != a[9]) {
        return false;
    }
    else {
    	return true;
    }
}

function flashWrite(url,w,h,id,bg,vars,win){

	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	document.write(flashStr);
}

// right scroll image
function firstClass(elID,tagName) {
	try{
		var el = document.getElementById(elID).getElementsByTagName(tagName);
		el.item(0).className = el.item(0).className + " first";
	}catch(E){}
}


function initMoving(target, topPosition, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;

	obj.initTop = topPosition;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";

	obj.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 0;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 500;
		}
	}

	obj.move = setInterval ( function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}

//oauth login
function twitter_login(){
	window.open("/global/twitteroauth/redirect.php", "twitter_pop");
}

//oauth logout
function twitter_logout(){
	document.location.href = "/global/twitteroauth/clearsessions.php";
}


