// JavaScript Document

function checkDropListItem(obj,itemvalue)
{
	/*
	默认选中下拉列表框中的具有某个值的一项
	obj：下拉列表框对象
	itemvalue：该项值
	*/
	for(i=0;i<obj.options.length;i++)
	{
		if(obj.options[i].value==itemvalue)
		   obj.selectedIndex=i;
	}
}

function seladditem(thevalue,thetext,obj)
{
/*
添加值到下拉列表框
thevalue：值
thetext：显示文本
obj：下拉列表框对象
*/
var oOption = document.createElement("OPTION");
oOption.value=thevalue;
oOption.text=thetext;
obj.add(oOption);
}

function strToDropList(Liststr,obj)
{
   /*
   把图片列表串中的串转为下拉列表
   Liststr:要转换成下拉列表的字符串，用|分隔
   obj:下拉列表框对象
   */
   var nListstr
   nListstr = Liststr.split("|");
   for(i=1;i<nListstr.length;i++)
   {
	   seladditem(nListstr[i],nListstr[i],obj);
   }
}

function blRdoChecked(form,sDspStr)		//是否有选择记录
{
	//sDspStr:	CheckBox的name  局限于某一部分的CheckBox,不至于影响到其他的CheckBox
	
	var bl=false;
	items=form.all.tags("input");  //检查input输入
	for (i=0;i<items.length;i++)					
		if (items(i).type=="checkbox"&&items(i).name.toUpperCase()==sDspStr.toUpperCase())
			if (items(i).checked)bl=true;
	return bl;
}

function allRdoIDChecked(form,blRadioAllChecked,sDspStr)			//全选-取消函数
{
	//sDspStr:	CheckBox的name  局限于某一部分的CheckBox,不至于影响到其他的CheckBox
	
	items=form.all.tags("input");  		//取消
	if(blRadioAllChecked)
	{
		for (i=0;i<items.length;i++)
		if (items(i).type=="checkbox"&&items(i).name.toUpperCase()==sDspStr.toUpperCase())
				items(i).checked=false;
		return false;
	}
	else
	{
		for (i=0;i<items.length;i++)	//全选	
		if (items(i).type=="checkbox"&&items(i).name.toUpperCase()==sDspStr.toUpperCase())
				items(i).checked=true;
		return true;
	}
}


function openWin(W_name,url,W_top,W_left,W_height,Wwidth,fullscreen)
{
	/*
	打开新窗口
	W_name:窗口名称
	url:窗口地址
	fullscreen：1为全屏，0为不全屏
	*/
	switch(fullscreen){
	    case 0:
			if(W_name==""){
				window.open(url,"_blank","left="+W_left+", top="+W_top+",height="+W_height+", width="+Wwidth+", toolbar=no , menubar=no, scrollbars=no, resizable=no, location=no, status=no");
			}
			else{
				W_name=window.open(url,"_blank","left="+W_left+", top="+W_top+",height="+W_height+", width="+Wwidth+", toolbar=no , menubar=no, scrollbars=no, resizable=no, location=no, status=no");
			}
			break;
		case 1:
			if(W_name==""){
				window.open(url,"_blank","fullscreen=1");
			}
			else{
				W_name=window.open(url,"_blank","fullscreen=1");
			}
			break;
	}
}


function checkAllByName(ElementName,obj)
{
	/*
	利用复选框的Name属性来选择或取消同名的复选框
	ElementName:元素名称
	obj:主导复选框
	*/
	var items;
	items=document.getElementsByName(ElementName.toUpperCase());
	if(obj.checked==true)
		for(i=0;i<items.length;i++)
		{
			items[i].checked=true;
		}
	else
		for(i=0;i<items.length;i++)
		{
			items[i].checked=false
		}
}

function thezoom(obj,picwidth)
{
	//按比例调整图片
	//obj:图片id
	//picwidth:调整后的图片宽度
	var zoom;
	zoom=picwidth/obj.width;
        obj.height=obj.height*zoom;
	obj.width=picwidth;
	       
}
 
 
