//按钮颜色变化
function button_effect(s)
{
	if ("INPUT"==event.srcElement.tagName)
		event.srcElement.className=s
}
//设置表格样式
function overtd(ftr){
	ftr.style.background="#99CCFF";
}
function outtd(ftr){
	ftr.style.background="#E6F2FF";
}
//去掉字符串的前后空格
function String.prototype.Trim()
{
  return this.replace(/(^\s*)|(\s*$)/g,"");
}
//显示日期
function f_showDateDialog(textobj){
	var ret = showModalDialog("/myjsp/pub/calendar.htm","","dialogWidth=194px;dialogHeight=208px;center:yes; status:no");
        if (ret+"" != "undefined"){
        	eval("document.form1."+textobj+".value = '" + ret +"'");
        }
}
//是否电子邮件地址
function isEmailId(str)
{
	/*****************************************************************
	Input   :  str
	purpose :  To validate for email
	output  :  valid email true/false
	*******************************************************************/
	var objRegExp  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;
	return objRegExp.test(str);
}
//是否IP地址
function isIpAddress(str)
{
	/***************************************************************
	input   : str
	purpose : To check the ip Address
	output  : returns true or false
	*****************************************************************/

	var ipAddress = str.split(".");
	if(ipAddress.length != 4)
	{
		return false;
	}
	for(i=0;i<ipAddress.length;i++)
	{
		if(isPositiveInteger(ipAddress[i]))
		{
			var temp = parseInt(ipAddress[i],10);
			if(temp > 255)
			{
				return false;
			}
		}
		else
		{
			return false;
		}

	}
	return true;
}

function setDdlIndex(objDdlList,ddlValueList){
	var arrDdlName;
	var arrDdlValue;
	var i;
	var j;
	arrDdlName=objDdlList.split("|");
	arrDdlValue=ddlValueList.split("|");
	if(arrDdlValue.length!=arrDdlName.length){
		window.alert("参数设置错误");
		return false;
	}
	j=arrDdlValue.length;
	for(i=0;i<j;i++){
		document.getElementById(arrDdlName[i]).value=arrDdlValue[i];
	}
}


function cancel(id){
		window.open("cancel.asp?lpid="+id,"","left=1000,top=1000")
}


function delpic(url)
{
	if(window.confirm("是否要删除图片"))
	{
	window.open(url,"asdf","left=1000,top=1000")
	}
}


function newwindow(url,fet)
{
	window.open(url,"新窗口",fet)
}


function ispic(id)
{
 if(document.getElementById(id).value!=""){
   if (document.getElementById(id).value.indexOf(".")>=0 && document.getElementById(id).value.indexOf(":")>=0	&& document.getElementById(id).value.indexOf("\\")>=0 )
   {
	 return 1   
    }
	else
		return 0
 }
 else
 	return 0
}