
var flag=false; 
function DrawImage(ImgD,kuan,gao){ 
var image=new Image(); 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= kuan/gao){ 
if(image.width>kuan){ 
ImgD.width=kuan; 
ImgD.height=(image.height*kuan)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
ImgD.alt=image.width+"x"+image.height; 
} 
else{ 
if(image.height>gao){ 
ImgD.height=gao; 
ImgD.width=(image.width*gao)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
ImgD.alt=image.width+"x"+image.height; 
} 
} 
} 
function is_number(str)
{
	exp=/[^0-9()-]/g;
	if(str.search(exp) != -1)
	{
		return false;
	}
	return true;
}
function is_email(str)
{ if((str.indexOf("@")==-1)||(str.indexOf(".")==-1))
{
	
	return false;
	}
	return true;
}

function CheckInput(){

	if(formbbs.name.value==''){
		alert("请填写您的留言昵称！");
		formbbs.name.focus();
		return false;
	}
	if(formbbs.name.value.length>30){
		alert("昵称不能超过30个字符！");
		formbbs.name.focus();
		return false;
	}

	if(formbbs.email.value!=''){
if(!is_email(document.formbbs.email.value)){
		alert("email格式不正确！");
		formbbs.email.focus();
		return false;
	}
	}
	if(formbbs.title.value==''){
		alert("请您填写留言标题！");
		formbbs.title.focus();
		return false;
	}
	if(formbbs.title.value.length>50){
		alert("留言标题不能超过50个字符！");
		formbbs.title.focus();
		return false;
	}

	if(formbbs.content.value==''){
		alert("您没有填写留言内容！");
		formbbs.content.focus();
		return false;
	}
	if(formbbs.content.value.length>500){
		alert("留言内容超过500个字符！");
		formbbs.content.focus();
		return false;
	}
	
	return true;
}
function getObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}

function AAP(){
   var content="<table width=100 border=0 cellpadding=5 cellspacing=1 bgcolor=#999999><tr><td align=left bgcolor=#FFFFFF><a href=javascript:DrawImg(1);><img src=icons/1.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(2);><img src=icons/2.gif width=20 height=20 border=0 bgcolor=#FFFFFF /></a><a href=javascript:DrawImg(3);><img src=icons/3.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(4);><img src=icons/4.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(5);><img src=icons/5.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(6);><img src=icons/6.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(7);><img src=ICONS/7.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(8);><img src=icons/8.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(9);><img src=icons/9.gif width=20 height=20 border=0 /></a><br><a href=javascript:DrawImg(10);><img src=icons/10.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(11);><img src=icons/11.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(12);><img src=icons/12.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(13);><img src=icons/13.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(14);><img src=icons/14.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(15);><img src=icons/15.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(16);><img src=icons/16.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(17);><img src=icons/17.gif width=20 height=20 border=0 /></a><a href=javascript:DrawImg(18);><img src=icons/18.gif width=20 height=20 border=0 /></a></td></tr></table>";
getObject('bb2s').style.visibility="visible";
getObject('bb2s').innerHTML=content;

}
function DrawImg(n){
getObject('bb2s').style.visibility="hidden";
formbbs.content.value=formbbs.content.value+'[icons]'+n+'[/icons]';

}


