function CompanyShowMessage(FormName)
{
	document.forms[FormName].action = "/allapp/ShowMessage.asp";
	document.forms[FormName].submit();
	return 1;
}

function GoClass_Page(theForm, otype, num, Totnum)
{
  var nstart, nend, pnum;
  switch (otype)
  {
  	case 1:
  		document.forms[theForm].elements["SStart"].value = "1";
		nend = num;
		document.forms[theForm].elements["SEnd"].value = nend.toString();
		break;
	case 2:
  		nstart = parseInt(document.forms[theForm].elements["SStart"].value) - num;
		document.forms[theForm].elements["SStart"].value = nstart.toString();
		nend = nstart + num - 1;
		document.forms[theForm].elements["SEnd"].value = nend.toString();
		break;
	case 3:
  		nstart = parseInt(document.forms[theForm].elements["SStart"].value) + num;
		document.forms[theForm].elements["SStart"].value = nstart.toString();
		nend = nstart + num - 1;
		document.forms[theForm].elements["SEnd"].value = nend.toString();
		break;
	case 4:
		pnum = parseInt(Totnum / num);
		nstart = pnum * num;
  		document.forms[theForm].elements["SStart"].value = nstart.toString();
		nend = nstart + num - 1;
		document.forms[theForm].elements["SEnd"].value = nend.toString();
		break;
 }
 document.forms[theForm].submit()
}

function changetxttohtml(txt){
	while (txt.indexOf("\r\n")!=-1){
		txt=txt.replace("\r\n","<br>")
	}
	while (txt.indexOf(" ")!=-1){
		txt=txt.replace(" ","&nbsp;")
	}
	return txt
}

function changehtmltotxt(txt){
	while (txt.indexOf("<br>")!=-1){
		txt=txt.replace("<br>", "\r\n")
	}
	while (txt.indexOf("&nbsp;")!=-1){
		txt=txt.replace("&nbsp;"," ")
	}
	return txt
}

//独立元素
function gowhere(pagetype, cTitle, cName, cFile)
{
	//文字
	if (pagetype==1)
	{
		gogo="/run/edittext.asp?TITLE=" + cTitle + "&CFILE=" + cFile + "&CNAME=" + cName
		window.open(gogo,"TEXT","width=400,height=250")
		return;
	}
	
	//图形
	if (pagetype==2)
	{
		gogo="/run/editpic.asp?TITLE=" + cTitle + "&CFILE=" + cFile + "&CNAME=" + cName
		window.open(gogo,"PIC","width=350,height=250,scrollbars=1")
		return;
	}	
}

//循环元素
function gowhere2(pagetype, cName, cNum, cFile)
{
	//gowhere2(1, 'TIDE_INFO_MODIFY_NEWS_LOOP', '2', 'D:\\21qy_main\\company\\test\\GSXW.HTM')
	//新增
	if (pagetype==1)
	{
		gogo="/run/addloop.asp?CNUM=" + cNum + "&CNAME=" + cName + "&CFILE=" + cFile
		window.open(gogo,"LOOP","width=500,height=300,scrollbars=1")
		return;
	}	

	//删除
	if (pagetype==2)
	{
		gogo="/run/deleteloop.asp?CNUM=" + cNum + "&CNAME=" + cName + "&CFILE=" + cFile
		window.open(gogo,"LOOP","width=100,height=75")
		return;
	}	

	//修改
	if (pagetype==3)
	{
		gogo="/run/editloop.asp?CNAME=" + cName + "&CNUM=" + cNum + "&CFILE=" + cFile
		window.open(gogo,"LOOP","width=500,height=350,scrollbars=1")
		return;
	}	
	
}

//循环元素中的独立元素
function gowhere3(pagetype, cNum, cTitle, cContent, cName, cFile)
{
	//图形
	if (pagetype==2)
	{
		gogo="/run/editlooppic.asp?CNUMBER=" + cNum + "&TITLE=" + cTitle + "&CFILE=" + cFile + "&CNAME=" + cName
		window.open(gogo,"PIC","width=350,height=250,scrollbars=1")
		return;
	}	
}



