function insertFlash(elm, url, w, h) {
if (!document.getElementById(elm)) return;
var str = '';
str += '<object width="'+ w +'" height="'+ h +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
str += '<param name="movie" value="'+ url +'">';
str += '<param name="wmode" value="transparent">';
str += '<param name="quality" value="autohigh">';
str += '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" wmode="opaque" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
str += '</object>';
document.getElementById(elm).innerHTML = str;
}
function insertflash(elm, url, w, h) {
if (!document.getElementById(elm)) return;
var str = '';
str += '<object width="'+ w +'" height="'+ h +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
str += '<param name="movie" value="'+ url +'">';
str += '<param name="wmode" value="transparent">';
str += '<param name="quality" value="autohigh">';
str += '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" wmode="opaque" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
str += '</object>';
document.getElementById(elm).innerHTML = str;
}
function butong_net(obj,name)
{
var p = obj.parentNode.getElementsByTagName("td");
var p1 = getNames(name,"f","div");
for(i=0;i<p1.length;i++)
{
if(obj==p[i])
{
p[i].className = "s";
p1[i].className = "dis";
}
else
{
p[i].className = "";
p1[i].className = "undis";
}
}
}

function getNames(obj,name,tij)
{	
var p = document.getElementById(obj);
var plist = p.getElementsByTagName(tij);
var rlist = new Array();
for(i=0;i<plist.length;i++)
{
if(plist[i].getAttribute("name") == name)
{
rlist[rlist.length] = plist[i];
}
}
return rlist;
}
function resizepic(o)
{
var maxwidth=760;
var maxheight=800;
var a=new Image();
a.src=o.src
if(a.width > maxwidth)
{
o.style.width=maxwidth;
}
if (a.height> maxheight)
{
o.style.height=maxheight;
}
}
function bbimg(o)
{
var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;
}

var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}
function callServer(showadd,id,canshu) {
		var o = document.getElementById(showadd);
		o.innerHTML="<center>loading......</center>";

  if ((id == null) || (id == "")) return;
  var url = "/kuaixun/indexcanshu.asp?id=" + escape(id)+"&canshu="+escape(canshu);
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = function(){updatePage(o)};
  xmlHttp.send(null);  
}

function updatePage(o) {
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	o.innerHTML=response;
  }
}

function showedit(){
	newslistright.style.display = "none";
	zhicibottom.style.display = "none";
	newslistrightedit.style.display = "";
	callServer("newslistrightedit",1,0);
}
function pinglun(){
	newslistright.style.display = "none";
	zhicibottom.style.display = "none";
	newslistrightedit.style.display = "";
	callServer("newslistrightedit",2,0);
	writeFace('ubbf',18)
}
function noedit(){
	newslistright.style.display = "";
	zhicibottom.style.display = "";
	newslistrightedit.style.display = "none";
}

function changeindex(){
	newslistright.style.display = "none";
	zhicibottom.style.display = "none";
	newslistrightedit.style.display = "";
 var x =document.formx.indexzi.value;
	callServer("newslistrightedit",3,x);

}

function sendUbbCode()
{
	if (this && this.id && document && document.getElementById)
	{
		var tarea=document.getElementById('content');
		if (!tarea) tarea=document.getElementById('rcontent');
		if (!tarea) tarea=document.getElementById('econtent');
		if (!tarea) tarea=document.getElementById('abulletin');
		if (tarea)
		{
			if (tarea.selRange && typeof(tarea.selRange.text).toLowerCase()=='string')
				{
					tarea.selRange.text=this.id;
					if (tarea.selRange.scrollIntoView) tarea.selRange.scrollIntoView();
				}
			else
				{if (typeof(tarea.value).toLowerCase()=='string') tarea.value+=this.id;}
				
			if (tarea.focus) tarea.focus();
			if (tarea.form && tarea.form.ubb1 && (typeof(tarea.form.ubb1.checked)).toLowerCase()=='boolean')
			{
				if (!tarea.form.ubb1.checked) tarea.form.ubb1.checked=true;
			}
			else if (tarea.form && tarea.form.ubb2 && (typeof(tarea.form.ubb2.checked)).toLowerCase()=='boolean')
			{
				if (!tarea.form.ubb2.checked) tarea.form.ubb2.checked=true;
			}
				
		}
	}
}
function floatButton()
{
	if (this && this.style && typeof(this.style.borderColor).toLowerCase()=='string' && typeof(this.style.backgroundColor).toLowerCase()=='string')
	{
		this.style.borderColor='#FF0000';
		this.style.backgroundColor='#00FF00';
	}
}
function flatButton()
{
	if (this && this.style && typeof(this.style.borderColor).toLowerCase()=='string' && typeof(this.style.backgroundColor).toLowerCase()=='string')
	{
		this.style.borderColor='#00FF00';
		this.style.backgroundColor='';
	}
}
function biaoqing(){
callServer("ubbtoolbar",4,0)
}

function writeFace(divname,z)
{
	var o = document.getElementById(divname)
o.innerHTML = "<center><img src=/images/loading.gif></center>";

var x = '' ;
   	for(i = 1; i <= z; i++){
        x = x + '<img name="ubbface" id="[face'+i+']" alt="[face'+i+']" src="../images/smallface/'+i+'.gif" class="smallface"  />';
    }

//document.write (x);

o.innerHTML = x
runok();
}
function runok(){
if (document && document.getElementsByName)
{
	var faces=document.getElementsByName('ubbface');
	if (faces && faces.length && faces.length>0)
	{
		for(i=0;i<=faces.length-1;i++)
		{
			faces[i].onmouseover=floatButton;
			faces[i].onmouseout=flatButton;
			faces[i].onclick=sendUbbCode;
		}
	}

}
}

function adlogin(){
 var x =document.form1x.login_name.value;
 var y =document.form1x.password.value;
 var z =document.form1x.yanzheng.value;
callServer('adminlogin',6,x+'#'+y+'#'+z);

}
function FontZoom(size) 
{ 
var obj; 
obj=document.getElementById("neirong"); 
obj.style.fontSize=size; 
//obj.style.color="#ff0000"; 
} 

function showDetail() { 
//背景
  var bgObj=document.getElementById("bgDiv");
  bgObj.style.width = document.body.offsetWidth + "px";
  bgObj.style.height = screen.height + "px";

//定义窗口
  var msgObj=document.getElementById("msgDiv");
  msgObj.style.marginTop = -350 +  document.documentElement.scrollTop + "px";
//关闭
  document.getElementById("msgShut").onclick = function(){
  bgObj.style.display = msgObj.style.display = "none";
  }
  msgObj.style.display = bgObj.style.display = "block";
}
function callf(userid){
showDetail() ;
callServerGz("msgDetail",1,userid)
}

function callServerGz(showadd,id,canshu) {
		var o = document.getElementById(showadd);
		o.innerHTML="<br><br><br><center><img src=/images/loading.gif></center>";

  if ((id == null) || (id == "")) return;
  var url = "/gzbcx/gzcanshu.asp?id=" + escape(id)+"&canshu="+escape(canshu);
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = function(){updatePage(o)};
  xmlHttp.send(null);  
}
function writlp(lpname,lpid,zy,x6){
	document.formx.lpname.value = lpname;
	document.formx.lpid.value = lpid;
	document.formx.zy.value = zy;
	document.formx.x6.value = x6;
document.getElementById('lp').innerHTML = lpname;

}
function substzf(showadd){

var x1 =document.formx.x1.value;
 var x2 =document.formx.zy.value;
 var x3 =document.formx.myname.value;
 var x4 =document.formx.lpname.value;
 var x5 =document.formx.lpid.value;
 var x6 =document.formx.x6.value;
 if (x2=="") {
alert ("请写上您的赠言 ！")
return false
}
 if (x3=="") {
alert ("请写上您的名字！")
return false
}
 if (x6=="") {
alert ("请选择一件礼品！")
return false
}

callServerGz("msgDetail",2,x1+"#"+x2+"#"+x3+"#"+x4+"#"+x5+"#"+x6);

}
function showspan(spanname){
	var o = document.getElementById(spanname);
	o.style.display = "";
}
function hiddenspan(spanname){
	var o = document.getElementById(spanname);
	o.style.display = "none";
}
function butOnClick() { 
if (event.keyCode == 13) { 
adlogin()
	return false; 
} 
} 
function tourl(url){
window.location.href=url
}
function openurl(url){
window.open (url)  
}
function initEcAd() {
document.all.shoucang.style.posTop = -400;
document.all.shoucang.style.visibility = 'visible'
MoveLeftLayer('shoucang');
}
function MoveLeftLayer(layerName) {
var x = 10;
var y = 200;// 左侧广告距离页首高度
var diff = (document.body.scrollTop + y - document.all.shoucang.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = parseInt(y)");
eval("document.all." + layerName + ".style.posRight  = x");
setTimeout("MoveLeftLayer('shoucang');", 20);
}
document.write ('<div class=shoucang id=shoucang><a href=javascript:; onclick=addmy("' + location.href +'") class=class>收藏到个人中心</a></div>');
initEcAd();
function addmy(url){
	callServer('shoucang',8,url);
	}
function userpl(){
		 var x1 =document.getElementById("t2").innerText
	 if (x1=="") {
	alert ("请输入评论内容！")
		document.getElementById("t2").focus();
	return false
	 }
	 var x2 =document.getElementById("pinglunname").value;
	 if (x2=="") {
	alert ("请输入姓名！")
		document.getElementById("pinglunname").focus();
	return false
	 }
	 var x0 =document.getElementById("newsid").value;
	 var x3 =document.getElementById("webtitle").value;
	newpinglun.style.display = "block";
	callServer("newpinglun",9,x0+ "#" + x1 + "#" +x2+ "#" +x3);
	userpinglun.style.display = "none";
	userpinglunok.style.display = "block";
}
 function maxtxt(){
var maxl=140//总长
   var s=document.getElementById("t2").value.length ;
   if(s>maxl)document.getElementById("t2").value=document.getElementById("t2").value.substr(0,maxl-1)
   else document.getElementById("t2count").innerHTML="一共录入："+s+"/"+maxl+" 字符"
}

