/**
* This function is used to contral a div to folder or unfolder.
* param: event, target
* return: null
* author: glzone
* date: 2008-12-15
*/
function ctrlList(ev,tar) {
	var ev = ev || window.event;
	var obj = ev.target || ev.srcElement;
	
	if(obj.tagName == 'IMG') {
		if(obj.src.indexOf('up')>-1) {
			obj.src = '/images/css1/dot_down.jpg';
			obj.title = '展开';
			doCtrl(tar);
		}else {
			obj.src = '/images/css1/dot_up.jpg';
			obj.title = '收起';
			doCtrl(tar,'block');
		}
		var self = ctrlList;
		obj.onclick = function() { self.call(this,ev,tar); };
	}
	function doCtrl(es,active) {
		if(typeof es == 'string') $(tar).style.display = active || 'none';
		else for(var i=0;i<es.length;i++) $(es[i]).style.display = active || 'none';
	}
}

//判断图片大小
var flag=false;
function DrawImage(ImgD)
{
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		flag=true;
	if(image.width/image.height>= 540/720){
		if(image.width>540){
			ImgD.width=540;
			ImgD.height=(image.height*540)/image.width;
		}else{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
		ImgD.alt=image.width+"x"+image.height;
	}
	else{
		if(image.height>720){
			ImgD.height=720;
			ImgD.width=(image.width*720)/image.height;
		}else{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
		ImgD.alt=image.width+"x"+image.height;
		}
	}
}
