	
	// 카테고리 검색용 URL이동
	function gourl_catsearch( catobj ) {
		var qstr = location.search;
		var cate_start = qstr.indexOf('cate=');
		var cate_old = qstr.substr( cate_start, 9 );
		var cate_new = 'cate=' + catobj.value;
		qstr = qstr.replace( cate_old, cate_new );

		location.href = 'catlist.php' + qstr;
	}


	// 카테고리 리스트용 URL이동
	function gourl_catlist(cate) {
		location.href = 'catlist.php?cate=' + cate;
	}
	
	//플래시 호출
	function watch(item) {
		location.href = '/video.php?ctt_id='+ item.PID;
	}

	// 문자열 자르기 함수
	String.prototype.cut = function(len) {
        var str = this, s = 0;
        for (var i=0; i<str.length; i++) {
                s += (str.charCodeAt(i) > 128) ? 2 : 1;
                if (s > len) return str.substring(0,i) + "...";
        }
        return str;
	}
	Ext.onReady( function() {
		if ( Ext.fly('iSquareScope') ) {
			var queryStringObject = _global.getQuery();
			var qos = (Ext.isEmpty(queryStringObject['qos'])) ? '' : ','+ queryStringObject['qos'];
			
			SquareScope.render( 'iSquareScope', {} );
			SquareScope.load({
				q : queryStringObject['q'] || '',
				cate : queryStringObject['cate'],
				//modify by rhio.kim 20100122
				qos : 'kind:3' + qos
			});
		} else {
			TStateProvider.create();
			TStateProvider.setup("*");
	
			/* item.PID : Content Primary Key
			 * 		item.OPID : Content Original ID
			 * 		item.TITLE : Content Title
			 * 		item.PCNT : Content Preview Count
			 * 		item.RTIME : Content Runtime
			 * 		item.THUMBINDEX : Content Preview Index at click on flash interface
			 */
			pp = new TPreviewPanel({isPanelFixed:true});
		}
	});

	function bluring() {
		if( event.srcElement.tagName == 'A' || event.srcElement.tagName == 'IMG' ) document.body.focus();
	}
	document.onfocusin = bluring;


	// 영상설명 더보기/줄이기 토글
	function toggle_desc() {
		if( document.getElementById('tblockdesc1').style.display == '' ) {
			document.getElementById('tblockdesc1').style.display = 'none';
			document.getElementById('tblockdesc2').style.display = '';
		}
		else {
			document.getElementById('tblockdesc1').style.display = '';
			document.getElementById('tblockdesc2').style.display = 'none';
		}
	}

	// 영상댓글 iFrame 크기를 내용에 맞게 보정
	function fixCommentSize() {
		//cmmtContainer.height = cmmtFrame.document.body.scrollHeight;
		//cmmtContainer.width = cmmtFrame.document.body.scrollWidth;
		document.all.cmmtContainer.height = window.top.cmmtFrame.document.body.scrollHeight;
		//document.all.cmmtContainer.width = cmmtFrame.document.body.scrollWidth;
	}


	// 즐겨찾기 추가 : safari, chrome 은 작동하지 않음
	function addFavorite_tvreport() {
		var title = '방송전문 인터넷미디어 TVREPORT';
		var url = 'http://www.tvreport.co.kr';
	 
		if (window.sidebar) { // firefox
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // ie
			a=window.external.AddFavorite(url, title);
		}

		return false;
	}
