Browser=(navigator.appName=="Netscape") ? false : true ;
request=Browser ? new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
colorKey="";
//upload--------------------------------------------------------------------------------
function form_upfilePop(){
	p=window.open('/img/upfile.php','me','width=480 height=480');
}
function form_upfileAdd(t){
	tmp=document.getElementById("upfileList");
	opt=new Option(t,t);
	tmp.options.add(opt);
	for(i=0,str="",j=tmp.options.length;i<j;i++)str+=tmp.options[i].value+"|";
	document.getElementById("upfile").value=str;
}
function form_upfileDel(){
	tmp=document.getElementById("upfileList");
	for(i=0,j=tmp.options.length;i<j;i++)
		if(tmp.options[i]!=null&&tmp.options[i].selected==true)tmp.options[i]=null;
	for(i=0,str="",j=tmp.options.length;i<j;i++)str+=tmp.options[i].value+"|";
	document.getElementById("upfile").value=str;
}

function isSpace(_s){
	if(_s.search(/\s/)!=-1)return true;
	return false;
}
function isSep(_s){
	if(_s.search(/,/)!=-1)return true;
	return false;
}
function isEmail(_s){
	if(isSpace(_s))return false;
	if(isSep(_s))return false;
	regExp=/(\S+)@(\S+)[.](\S+)*/i;
	if(!regExp.test(_s))return false;
	return true;
}
function isEmail2(_s){
	if(isSpace(_s))return false;
	if(isSep(_s))return false;
	regExp=/(\S+)[.](\S+)*/i;
	if(!regExp.test(_s))return false;
	return true;
}
function isHangul(s){
	for(var i=0,j=s.length;i<j;i++){
		if(s.charCodeAt(i)!=32&&(s.charCodeAt(i)<44032||s.charCodeAt(i)>55203))return false;
	}
	return true;
}
function isNum(s){
	for(var i=0,j=s.length;i<j;i++)
		if(s.charCodeAt(i)<48||s.charCodeAt(i)>57)return false;
	return true;
}
function isAlpha(s){
	for(var i=0,j=s.length;i<j;i++)
		if(s.charCodeAt(i)<65||s.charCodeAt(i)>122)return false;
	return true;
}

//util--------------------------------------------------------------------------------
function removeSpace(s){
	return s.replace(/\s/,"");
}
function trim(s){
	return s.replace(/^\s*/,"").replace(/\s*$/,"");
}
function dw(str){
	document.write(str);
}
function error(n){
	alert(errorArr[n]);
}


function vodPlay(src,auto,w,h){
	html = '';
	html += '<object name="vodpalyer" WIDTH="'+w+'" HEIGHT="'+h+'" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"';	
	html += ' style="filter: gray()" ';
	html += ' CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
	html += ' STANDBY="Loading Microsoft Windows Media Player components..." TYPE="application/x-oleobject">';
	html += ' <PARAM NAME="AutoStart" VALUE="'+auto+'" >';
	html += ' <PARAM NAME="Filename" VALUE="'+src+'" >';
	html += ' </object> ';
	document.write(html);
}
function aodPlay(src,auto){
	html = '';
	html += '<object name="palyers" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"';	
	html += ' style="filter: gray()" ';
	html += ' CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,32,701" ';
	html += ' STANDBY="Loading Microsoft Windows Media Player components..." TYPE="application/x-oleobject">';
	html += ' <PARAM NAME="AutoStart" VALUE="'+auto+'" >';
	html += ' <PARAM NAME="Filename" VALUE="'+src+'" >';
	html += ' <PARAM NAME="AutoSize" VALUE="ture">';
	html += ' <PARAM NAME="AnimationAtStart" VALUE="True">';
	html += ' <PARAM NAME="ClickToPlay" VALUE="True">';
	html += ' <PARAM NAME="Volume" VALUE="-1">';
	html += ' <PARAM NAME="PlayCount" VALUE="1">';
	html += ' <PARAM NAME="SendOpenStateChangeEvents" VALUE="True">';
	html += ' <PARAM NAME="SendPlayStateChangeEvents" VALUE="True"> ';
	html += ' <PARAM NAME="DisplayMode" VALUE="0">';
	html += ' <PARAM NAME="DisplaySize" VALUE="0">';
	html += ' <PARAM NAME="Enabled" VALUE="True">';
	html += ' <PARAM NAME="EnableContextMenu" VALUE="False">';
	html += ' <PARAM NAME="EnablePositionControls" VALUE="False">';
	html += ' <PARAM NAME="EnableFullScreenControls" VALUE="True">';
	html += ' <PARAM NAME="EnableTracker" VALUE="True">';
	html += ' <PARAM NAME="ShowStatusBar" VALUE="True">';
	html += ' <PARAM NAME="ShowDisplay" VALUE="False">';
	html += ' <PARAM NAME="ShowCaptioning" VALUE="False">';
	html += ' <PARAM NAME="ShowControls" VALUE="True">';
	html += ' <PARAM NAME="ShowAudioControls" VALUE="True">';
	html += ' <PARAM NAME="ShowDisplay" VALUE="True">';
	html += ' <PARAM NAME="ShowGotoBar" VALUE="False">';
	html += ' <PARAM NAME="ShowPositionControls" VALUE="True">';
	html += ' <PARAM NAME="ShowTracker" VALUE="True">';
	html += ' <PARAM NAME="WindowlessVideo" VALUE="False">';
	html += ' <PARAM NAME="TransparentAtStart" VALUE="False">';
	html += ' </object> ';
	document.write(html);
}

fldArr=new Array('userid','title','contents');
searchArr=new Array('NAME','SUBJECT','CONTENT');
function changeChk(tmp){
	searchForm.f.value=fldArr[tmp];
	for(var i=0,j=searchArr.length;i<j;i++){
		document.getElementById("chk"+i).innerHTML=tmp==i ? "+"+searchArr[i] : "-"+searchArr[i];
	}
}
function changeChk2(tmp){
	searchForm.f.value=fldArr[tmp];
	for(var i=1,j=searchArr.length;i<j;i++){
		document.getElementById("chk"+i).innerHTML=tmp==i ? "+"+searchArr[i] : "-"+searchArr[i];
	}
}


//editor--------------------------------------------------------------------------------
function editCommand(excute,values){
	if(!values){textFrame.execCommand(excute);
	}else{textFrame.execCommand(excute,"",values);
	}
}
function insertImage(f,i){
	textArea.value=textFrame.body.innerHTML;
	textArea.value+='<img src="/'+f+'/'+i+'">';
	textFrame.body.innerHTML=textArea.value;
}
function viewEditorMode(){
	document.getElementById('editorMode').innerHTML=isHTML ? 'HTML' : 'Design';
}
function toggleHTML(){
	if(!isHTML){
		isHTML=true;
		textArea.value=textFrame.body.innerHTML;
		textArea.style.display='block';
		document.getElementById('contentsFrame').style.display='none';
		viewEditorMode();
	}
}
function toggleDesign(){
	if(isHTML){
		isHTML=false;
		textFrame.body.innerHTML=textArea.value;
		textArea.style.display='none';
		document.getElementById('contentsFrame').style.display='block';
		viewEditorMode();
	}
}
function heditorSubmit(){
	if(!isHTML){
		textArea.value=textFrame.body.innerHTML;
	}
	return true;
}
function palette(t){
	tmpObj=document.getElementById('colorPalette');
	if(t=='c'){
		tmpObj.style.display='none';
		return;
	}
	tmpObj.style.display='block';
	if(t=='f'){
		tmpObj.style.left=foreLeft;
		tmpObj.style.top=foreTop;
		colorKey='ForeColor'
	}else{
		tmpObj.style.left=backLeft;
		tmpObj.style.top=backTop;
		colorKey='BackColor'
	}
}
function cPalette(){
	dw('<div id="colorPalette">'+
	'<img src="/admin/images/editorColor.gif" usemap="#palmap" class="block">'+
	'<map name="palmap">'+
	'<area href="javascript:editCommand(colorKey,\'#FFFFFF\');palette(\'c\')" coords="5,5,17,17">'+
	'<area href="javascript:editCommand(colorKey,\'#CCCCCC\');palette(\'c\')" coords="23,5,35,17">'+
	'<area href="javascript:editCommand(colorKey,\'#808080\');palette(\'c\')" coords="41,5,53,17">'+
	'<area href="javascript:editCommand(colorKey,\'#333333\');palette(\'c\')" coords="59,5,71,17">'+
	'<area href="javascript:editCommand(colorKey,\'#000000\');palette(\'c\')" coords="77,5,89,17">'+
	'<area href="javascript:editCommand(colorKey,\'#FFCC00\');palette(\'c\')" coords="5,23,17,35">'+
	'<area href="javascript:editCommand(colorKey,\'#FF6600\');palette(\'c\')" coords="23,23,35,35">'+
	'<area href="javascript:editCommand(colorKey,\'#FF0000\');palette(\'c\')" coords="41,23,53,35">'+
	'<area href="javascript:editCommand(colorKey,\'#660000\');palette(\'c\')" coords="59,23,71,35">'+
	'<area href="javascript:editCommand(colorKey,\'#663399\');palette(\'c\')" coords="77,23,89,35">'+
	'<area href="javascript:editCommand(colorKey,\'#66CCCC\');palette(\'c\')" coords="5,41,17,53">'+
	'<area href="javascript:editCommand(colorKey,\'#66CCFF\');palette(\'c\')" coords="23,41,35,53">'+
	'<area href="javascript:editCommand(colorKey,\'#6699CC\');palette(\'c\')" coords="41,41,53,53">'+
	'<area href="javascript:editCommand(colorKey,\'#0066CC\');palette(\'c\')" coords="59,41,71,53">'+
	'<area href="javascript:editCommand(colorKey,\'#003399\');palette(\'c\')" coords="77,41,89,53">'+
	'<area href="javascript:editCommand(colorKey,\'#CCFF99\');palette(\'c\')" coords="5,59,17,71">'+
	'<area href="javascript:editCommand(colorKey,\'#66CC66\');palette(\'c\')" coords="23,59,35,71">'+
	'<area href="javascript:editCommand(colorKey,\'#339933\');palette(\'c\')" coords="41,59,53,71">'+
	'<area href="javascript:editCommand(colorKey,\'#006600\');palette(\'c\')" coords="59,59,71,71">'+
	'<area href="javascript:editCommand(colorKey,\'#663300\');palette(\'c\')" coords="77,59,89,71">'+
	'<area href="javascript:palette(\'c\')" alt="link" coords="53,76,89,90">'+
	'</map>'+
	'</div>')
}