﻿function check(dd,mystr1,mystr2)
//自动调整图片大小
{
	var imgwidth;
	var imgheight;
	imgwidth=mystr1;
	imgheight=mystr2;
	if (dd.width>imgwidth && dd.height>imgheight){
		if (dd.width/dd.height>imgwidth/imgheight){
			dd.width=imgwidth;
		}
		else
		{
			dd.height=imgheight
		}
	}
	else if(dd.width>imgwidth){
		dd.width=imgwidth
	}
	else if(dd.height>imgheight){
		dd.height=imgheight
	}
}

ie = (document.all)? true:false
if (ie){
function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.form1.submit();}}
}

function submitonce(theform){
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById){
		//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++){
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
			//disable em
			tempobj.disabled=true
		}
	}
}

function PageNav(vPageNo){
	var Nav="";

	Nav+=vPageNo+' / '+PUB_PageCount+' 页&nbsp;&nbsp;'

	if (vPageNo-4<1){
		var RootPage=1;
	}
	else{
		var RootPage=vPageNo-4;
	}
	if (vPageNo+4>PUB_PageCount){
		var EndPage=PUB_PageCount;
	}
	else{
		var EndPage=vPageNo+4;
	}

	if (vPageNo==1){
		Nav+='<font color=888888 face=webdings>9</font> <font color=888888 face=webdings>7</font> '
	}
	else{
		Nav+='<a href=\"javascript:ShowContentList('+1+')\" title=\"首页\"><font face=webdings>9</font></a> '
		if (RootPage==1){
			Nav+='<a href="javascript:ShowContentList('+(vPageNo-1)+')" title="上一页"><font face=webdings>9</font></a> '
		}
		else{
			Nav+='<a href="javascript:ShowContentList('+(vPageNo-1)+')" title="上一页"><font face=webdings>9</font></a>..'
		}
	}

	for (i=RootPage;i<=EndPage;i++){
		if (i==vPageNo){
			Nav+='<font color=red>['+i+']</font> '
		}
		else{
			Nav+='<a href="javascript:ShowContentList('+i+')">['+i+']</a> '
		}
	}

	if (vPageNo==PUB_PageCount){
		Nav+=' <font color=888888 face=webdings>8</font> <font color=888888 face=webdings>:</font>'
	}
	else{
		if (EndPage==PUB_PageCount){
			Nav+='<a href="javascript:ShowContentList('+(vPageNo+1)+')" title="下一页"><font face=webdings>8</font></a> '
		}
		else{
			Nav+='..<a href="javascript:ShowContentList('+(vPageNo+1)+')" title="下一页"><font face=webdings>8</font></a> '
		}
		Nav+='<a href="javascript:ShowContentList('+PUB_PageCount+')" title="尾页"><font face=webdings>:</font></a>'
	}

	return Nav;
}

function ShowContentList(vPage,ShowTypes){
	var StarId=(vPage-1)*PUB_PageSize;
	var Tmp,TmpStr;
	TmpStr="";

	if ((StarId+PUB_PageSize)-1>(RCount-1)){
		var EndId=RCount-1;
	}
	else{
		var EndId=(StarId+PUB_PageSize)-1;
	}

	for (i=StarId;i<=EndId;i++){
		Tmp=ReviewList[i].split("||");
		TmpStr+='<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">';
		if (ShowTypes==0)
		{
			TmpStr+='<tr>';
			TmpStr+='<td colspan="4" height="1" bgcolor="efefef"></td>';
			TmpStr+='</tr>';
			TmpStr+='<tr height="22" bgcolor="efefef">';
			TmpStr+='<td width="10%" align="right">发言人:</td>';
			TmpStr+='<td width="40%" align="left">&nbsp;'+Tmp[0]+'</td>';
			TmpStr+='<td width="10%" align="right">发言时间:</td>';
			TmpStr+='<td width="40%" align="left">&nbsp;'+Tmp[1]+'</td>';
			TmpStr+='</tr>';
			TmpStr+='<tr height="22">';
			TmpStr+='<td align="right" valign="top">内容:</td>';
			TmpStr+='<td colspan="3">'+Tmp[2]+'</td>';
			TmpStr+='</tr>';
			TmpStr+='<tr height="5">';
			TmpStr+='<td colspan="4"></td>';
			TmpStr+='</tr>';
		}
		else{
			TmpStr+='<tr height="22">';
			TmpStr+='<td width="10%" align="left" valign="top">'+Tmp[0]+'</td>';
			TmpStr+='<td width="30%" align="left" valign="top">'+Tmp[1]+'</td>';
			TmpStr+='<td>'+Tmp[2].substring(0,70)+'</td>';
			TmpStr+='</tr>';
			TmpStr+='<tr height="1">';
			TmpStr+='<td colspan="3" bgcolor="efefef"></td>';
			TmpStr+='</tr>';
		}
		TmpStr+='</table>';
	}

	TmpStr+='<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">';
	TmpStr+='<tr height="25">';
	TmpStr+='<td width="100%" align="right">'+PageNav(vPage)+'&nbsp;</td>';
	TmpStr+='</tr>';
	TmpStr+='</table>';

	CommentList.innerHTML=TmpStr;
}

function submit_vote(vote_id){
//&='+document.vote_"&j&".vote.value
	var vote_form=eval("document.vote_" + vote_id);

	var target_url='vote.asp?votetype='+vote_form.votetype.value;
	target_url+='&voteid='+vote_form.voteid.value;
	target_url+='&vote=';

	for (var i=0;i<vote_form.vote.length ; i++)
	{
		if (vote_form.votetype.value==0)
		{
			if (vote_form.vote[i].checked==true)
			{
				target_url+=vote_form.vote[i].value+',';
			}
		}
		else{
			if (vote_form.vote[i].checked==true)
			{
				target_url+=vote_form.vote[i].value+',';
			}
		}
	}
	target_url=target_url.substring(0,target_url.length-1);

	return target_url;
}