﻿function ResizeImage(ImgD)
{ 
	var image=new Image(); 
	image.src=ImgD.src;
	if(ImgD.parentNode.style.width!="")
		pw = parseInt(ImgD.parentNode.style.width);
	else
		pw = ImgD.parentNode.offsetWidth;
		
	if(ImgD.parentNode.style.height!="")
		ph = parseInt(ImgD.parentNode.style.height);
	else
		ph = ImgD.parentNode.offsetHeight;
	
	if(image.width>0 && image.height>0)
	{
		if(image.width>pw*0.95)
		{ 
			ImgD.width=pw*0.95;
		}
	}
	
	if(image.height>0 && image.height>0)
	{
		if(image.height>ph*0.95)
		{ 
			ImgD.height=ph*0.95;
		} 
	} 
} 

/*SwitchArea*/
function SwcAr( POjbID, ViewID, MaxID )
{
	try
	{
		for( var i=1; i<=MaxID; i++ )
		{
			document.getElementById(POjbID+"Div"+i).style.display = "none";
			document.getElementById(POjbID+i).className="nov";
		}
		document.getElementById(POjbID+"Div"+ViewID).style.display = "";
		document.getElementById(POjbID+ViewID).className="inv";
	}
	catch(err)
	{}
}

function showSubClassList( listTableId )
{
	if ( document.getElementById(listTableId).style.display == "" )
	{
		document.getElementById(listTableId).style.display = "none";
	}
	else
	{
		document.getElementById(listTableId).style.display = "";
	}
}

if (parent.frames.length > 0) {
parent.location.href = location.href;
}
function help(){
window.open("help.htm","","width=440,height=480,top=30,left=180,resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function login_onsubmit() {
if (document.form1.pwd.value=="")
	{
	  alert("请您设定一个新的密码！")
	  document.form1.pwd.focus()
	  return false
	 }
else if(document.form1.cpwd.value=="")
	{
	  alert("请确认密码！")
	  document.form1.cpwd.focus()
	  return false
	 }
}

if (parent.frames.length > 0) {
parent.location.href = location.href;
}

function form1_onsubmit() {
if (document.form1.uID.value=="")
	{
	  alert("请设定您的登陆名。")
	  document.form1.uID.focus()
	  return false
	 }
else if(document.form1.pwd.value=="")
	{
	  alert("请设定一个登陆密码。")
	  document.form1.pwd.focus()
	  return false
	 }
else if(document.form1.cpwd.value=="")
	{
	  alert("请填验证密码。")
	  document.form1.cpwd.focus()
	  return false
	 }
else if(document.form1.question.value=="")
	{
	  alert("请设定密码提示问题。")
	  document.form1.question.focus()
	  return false
	 }
else if(document.form1.answer.value=="")
	{
	  alert("请设定密码提示答案。")
	  document.form1.answer.focus()
	  return false
	 }
else if(document.form1.rname.value=="")
	{
	  alert("请填写您的真实姓名。")
	  document.form1.rname.focus()
	  return false
	 }
else if(document.form1.email.value=="")
	{
	  alert("请填写您的E-Mail地址。")
	  document.form1.email.focus()
	  return false
	 }
}


function check()
{
var webnamlg=regform.webName.value.lenght;
var webname=regform.webName.value;
var strwaddr=regform.webAddress.value;
var webcls=regform.webClass.value;
var webgrade=regform.webGrade.value;
var webdes=regform.webContent.value;

if (webname=="")
 {
   alert("请输入网站名称!");
   regform.webName.focus();
   return false;
  }
else if ((strwaddr=="")||(strwaddr=="http://"))
  {
    alert("请输入网址!");
	regform.webAddress.focus();
	return false;
  }
else if (webcls==0)
  {
    alert("请选择网站类型!");
	regform.webClass.focus();
	return false;
  }
else if (webgrade==0)
  {
    alert("请选择网站级别!");
	regform.webGrade.focus();
	return false;
  }
else if (webdes=="")
  {
    alert("请输入简短的网站描述!");
	regform.webContent.focus();
	return false;
  }
else return true
}

function openInfoWindow( theUrl )
{
	showModalDialog( theUrl,"","dialogHeight:400px; dialogWidth:520px;status:no;" );
}

function RepSubmit()
{
  if(CmmtForm.cmmt.value.length==0)
  {
    alert("请输入评论内容！");
	return false;
  }
  return CmmtForm.submit();
}

function ChgColor(colValue)
{
	document.getElementById('arCont').style.color=colValue;
}
function ChgFontSize(sizeValue)
{
	document.getElementById('arCont').style.fontSize=sizeValue+"px";
	document.getElementById('fontsize').value=sizeValue;
}
function AddSize(sizeValue)
{
	preSize = parseInt(document.getElementById('fontsize').value);
	document.getElementById('arCont').style.fontSize=preSize+sizeValue+"px";
	document.getElementById('fontsize').value=preSize+sizeValue;
}
function SubSize(sizeValue)
{
	preSize = parseInt(document.getElementById('fontsize').value);
	document.getElementById('arCont').style.fontSize=preSize-sizeValue+"px";
	document.getElementById('fontsize').value=preSize-sizeValue;
}

