//
function filtrate(str)
{
	var iu, iuu, regArray=new Array("","vip","admin","htx","hongtaixiang");
	iuu=regArray.length;
	for(iu=1;iu<=iuu;iu++)
	{
		if (str.indexOf(regArray[iu])!=-1)
		{
			errorstr=regArray[iu];
			return errorstr;
			return 1;
		}
	}
	return false;
}


/**/
function ContentSize(size)
{
	var obj=document.all.MainTable;
	obj.style.fontSize=size+"px";
}

/**/
function ImgEvent(obj)
{
	if (obj != undefined)
	{
		var imgArr = document.getElementById(obj).getElementsByTagName("img"); 
	}
	else
	{
		var imgArr = document.getElementsByTagName("img");
	}
	var imgs = imgArr.length; 
	for(var i=0;i<imgs;i++)
	{ 
		imgArr[i].style.cursor = "hand";//
		imgArr[i].onclick = function(){openwindow( this.src, "PIC", '', '')};
		imgArr[i].title = 'Click Open In New Windows';
		imgArr[i].onmousewheel = function(){return bbimg(this)};
		imgArr[i].onload= function(){ImgAutoSize(this,"180","120")};
	}
}

/**/
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 flag=false;
function ImgResize(ImgD)
{
	var image=new Image();
	var a = 600;
	image.src=ImgD.src;
	if(image.width>0 && image.height>0)
	{
		flag=true;
		if(image.width>=a)
		{
			ImgD.width=(a-30);
			ImgD.height=(image.height*(a-30))/image.width;
		}
		else
		{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
	}
}

/**/
function AllImgAutoSize(obj)
{
	if (obj != undefined)
	{
		var imgArr = document.getElementById(obj).getElementsByTagName("img"); 
	}
	else
	{
		var imgArr = document.getElementsByTagName("img");
	}
	var imgs = imgArr.length; 
	for(var i=0;i<imgs;i++)
	{ 
		imgArr[i].onload= function(){ImgAutoSize(this,"180","120")};
	}
}

/**/
function ImgAutoSize(pic,width,height)
{
	//
	var MaxW=width;	//
	var MaxH=height;	//
	var o=new Image();
	o.src=pic.src;
	var w=o.width;
	var h=o.height;
	var t;
	if (w>MaxW){t=MaxW;}else{t=w;}
	if ((h*t/w)>MaxH){pic.height=MaxH;pic.width=MaxH/h*w;}else{pic.width=t;pic.height=t/w*h;}
}

/**/
function openwindow( url, winName, width, height) 
{

	var img = new Image();
	img.src = url;
	width = img.width;
	height = img.height;
	//alert (width +'X'+ height)
	
	if(width>=screen.width)
	{
		width=screen.width-50;
		height=height/(img.width / width);
		//alert (width +'X'+ height)
	}
	//if(height>=screen.height)
	//{
		//height=screen.height;
		//width=(screen.height/height) * width;
	//}

	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	}
	theproperty= "width=" + width + "," 
	+ "height=" + height + "," 
	+ "location=0," 
	+ "menubar=0,"
	+ "resizable=1,"
	+ "scrollbars=0,"
	+ "status=0," 
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + "," //Netscape
	+ "screeny=" + yposition + "," //Netscape
	+ "left=" + xposition + "," //IE
	+ "top=" + yposition; //IE 
	//window.open( url,winName,theproperty );
	
	var newbody = "<body style='margin:0px'><img src='"+url+"' width='"+width+"' height='"+height+"'></body>"
	var newwin = window.open( url,winName,theproperty )
	newwin.document.write(newbody)
	newwin.document.close()
}

/**/
function ImgOpen(src)
{
	function resizeOpenWin()
	{
		var srcElem = event.srcElement
		if (document.resized) return
		window.setTimeout(function ()
		{
			window.resizeBy(srcElem.width-100, srcElem.height-100)
			
		},1)
		document.resized = true
	}
	var pic=new Image();
	pic.src=src
	var newbody = "<body style='margin:0px'><script>"+resizeOpenWin.toString()+"</"+"script><img src='"+src+"' onreadystatechange='resizeOpenWin()'></body>"
	var newwin = window.open("", "", "width=100, height=100, left="+(screen.width-pic.width)/2+",top="+(screen.height-pic.height)/2+",toolbar=no")
	newwin.document.write(newbody)
	newwin.document.close()
}