﻿// JavaScript Document
<!--

function re_load() { location.reload(); }

function click_return(cvar,ctype)
{
  var nvar='';
  switch (ctype)
  {
    case 1:
      nvar='提示信息！';
	  break;
    case 2:
      nvar=cvar;
	  break;
    default :
      nvar='您确定要'+cvar+'吗？\n\n执行该操作后将不可恢复！';
	  break;
  }
  var ctype=window.confirm(nvar);
  if (ctype) { return true; }
  return false;
}

//检测登录输入信息
function admin_login_chk()
{
  var username=document.admin_frm.username.value;
  var password=document.admin_frm.password.value;
  //var valcode=document.admin_frm.valcode.value;
  if (username=="" || username==null)
  {
    alert("对不起！\n\n请先输入登陆用户名！");
    document.admin_frm.username.focus();
    return false;
  }
  if (password=="" || password==null)
  {
    alert("对不起！\n\n请先输入登陆密码！");
    document.admin_frm.password.focus();
    return false;
  }
  /*
  if (valcode=="" || valcode==null)
  {
    alert("对不起！\n\n请先输入验证码！");
    document.admin_frm.valcode.focus();
    return false;
  }
  */
  //document.admin_frm.submit();
}

//检测搜索输入信息
function search_chk()
{
  var keywords=document.search_frm.keywords.value;
  if (keywords=="" || keywords==null || keywords=="请输入关键词")
  {
    alert("请输入要搜索的关键词！");
    document.search_frm.keywords.focus();
    return false;
  }
}

//改变显示的新对象颜色
function chg_thebgcolor(obj,newVal)
{
	if(document.getElementById(obj))
	{
		var theNewObj=document.getElementById(obj);
		theNewObj.style.background=newVal;
	}
}

/*
//选择图文模版写到图文编辑器
function sel_singletemp(editor_obj,the_html,use_type)
{
	var editorObj=window.frames[editor_obj];
	switch(use_type)
	{
		case 1:
			//追加至尾部的数据
			editorObj.appendHTML(the_html);
			break;
		case 2:
			//插入替换当前位置的数据
			editorObj.replaceHTML(the_html);
			break;
		default :
			//替换原有的数据
			editorObj.setHTML(the_html);
			break;
	}
}
*/

//选择图文模版写到图文编辑器
function sel_singletemp(editor_obj,html_obj,use_type)
{
	var the_html;
	//此处firefox会出现未定义（所以要多给iframe加属性name）
	var editorObj=window.frames[editor_obj];
	if(document.getElementById(html_obj))
	{
		var htmlObj=document.getElementById(html_obj);
		the_html=htmlObj.innerHTML;
	}
	else
	{
		the_html=html_obj;
	}
	//这语句会影响函数replaceHTML()功能
	//editorObj.setMode('CODE');
	switch(use_type)
	{
		case 1:
			//追加至尾部的数据
			editorObj.appendHTML(the_html);
			break;
		case 2:
			//插入替换当前位置的数据
			editorObj.replaceHTML(the_html);
			break;
		default :
			//替换原有的数据
			editorObj.setHTML(the_html);
			break;
	}
	editorObj.setMode('EDIT');
}

//改变指定对象的链接参数
function chg_theahref(this_obj,ahref_obj,the_url,url_str2)
{
	if(document.getElementById(ahref_obj))
	{
		var thea_obj=document.getElementById(ahref_obj);
		if(thea_obj.href && this_obj.value)
		{
			thea_obj.href=the_url + this_obj.value + url_str2;
		}
	}
}
//-->
