function ruselinkurl()
{
	if(document.myform.uselinkurl.checked==true)
	{
		document.myform.linkurl.disabled=false;
		article.style.display='none';
	}else{
		document.myform.linkurl.disabled=true;
		article.style.display='';
	}
}
// 表单提交检测
function doCheck()
{
    var oEditor = FCKeditorAPI.GetInstance('message');
	$('message').value = oEditor.GetXHTML(true);
	var cidval = $('cid').value ;
	var cidArray = new Array();
	cidArray = cidval.split("-");
	if (parseInt(cidArray[1])==1)
	{
		alert('指定的栏目不允许添加文章！只允许在其子栏目中添加文章。');
		ShowTabs(0);
		$('cid').focus();
		return false;
	}
	if (document.myform.title.value=="") 
	{
		alert("请输入标题！");
		ShowTabs(0);
		$('title').focus();
		return false;
	}
	if (parseInt(get_is_link())==1)
	{
		if(document.myform.linkurl.value=="")
		{
			alert("请输入链接地址！");
			ShowTabs(0);
			$('linkurl').focus();
			return false;
		}
	}
	if(false == qmeCms.extend.checkItem()){
		return false;
	}
	$('submit').disabled = true;
	$('divProcessing').style.display="";
	qmeCms.dialogView.form('操作提示','', {width:400})
	return true;
}
function get_is_link()
{
	var mytype = document.myform.is_link;
	for (i=0; i<mytype.length; ++i)
	{
		if(mytype[i].checked)
		{
			return mytype[i].value ;
		}
	}
}


function showopen(type)
{
	if(type==0)
	{
		try
		{
			var obj = $('menus').cells;
			for(var i=3; i<obj.length-1; i++)
			{
				obj[i].style.display = '';
			}
		}catch(e){};
		$('linkurl').disabled = true ;
		$('message_value').style.display='';
	}
	else
	{
		try
		{
			var obj = $('menus').cells;
			for(var i=3; i<obj.length-1; i++)
			{
				obj[i].style.display = 'none';
			}
		}catch(e){};
		$('linkurl').disabled = false ;
		$('message_value').style.display='none';
	}
}

function doChange(objText, objDrop)
{
	if (!objDrop) return;
	var str = objText.value;
	if (!str) return;
	var arr = str.split("|");
	objDrop.length=1;
	for (var i=0; i<arr.length; i++)
	{
		objDrop.options[i+1] = new Option(arr[i].substring(arr[i].lastIndexOf('/')+1), arr[i]);
	}
	document.myform.thumb.value = arr[0];
	objDrop.options[1].selected = true ;
}
function addPic(pic)
{
	var pic = config.url + pic[0].replace(config.url, '')
	document.myform.thumb.value = pic;
	var obj = $("myDrop3");
	var len = obj.options.length;
	obj.options.add(new Option(pic.substring(pic.lastIndexOf('/')+1), pic));
	obj.options[len].selected=true;
}
function mypic(){
	var x = $("myDrop3");
	var pic = x.options[x.selectedIndex].value ;
	if( !pic==""){
		document.myform.thumb.value =  pic;
	}else{
		document.myform.thumb.value =  '';
	}
}

function showMypic()
{
	var pic = document.myform.thumb.value ;
	var s_Ext=pic.substring(pic.lastIndexOf(".")).toLowerCase();
	switch(s_Ext){
		case ".jpeg":
		case ".jpg":
		case ".gif":
		case ".png":
		case ".bmp":
		break ;
	}
}

function delpic()
{
	document.myform.thumb.value = "";
}

function pageChange()
{
	var p = $("pageType");
	if( p.options[p.selectedIndex].value==2)
	{
		$("page2").style.display="";
	}else{
		$("page2").style.display="none";
	}
}

function setNextPage()
{
	if( $('message_value').style.display == 'none') return false;
	 var oEditor = FCKeditorAPI.GetInstance('message');
	 if (oEditor.EditMode==FCK_EDITMODE_WYSIWYG){ 
		oEditor.InsertHtml('[nextpage]');
	 }
	 return false;
}
function showReason( status)
{
	parseInt(status) == 2 ? $('reason').style.display='' :  $('reason').style.display='none'; 		
}
function toHeightB()
{
	$('message___Frame').style.height = (parseInt($('message___Frame').style.height)+50)+'px';
	return false;
}
function toHeightS()
{
	if(parseInt($('message___Frame').style.height) <= 200) return false;
	$('message___Frame').style.height = (parseInt($('message___Frame').style.height)-50)+'px';
	return false;
}