function DisUserFacec(intFaceId,strFieldName)
{
	objFieldName = eval(strFieldName);
	objFieldName.focus(); 
	document.selection.createRange().text = "[FACE]" + intFaceId + "[/FACE]";
		
}


function UserLogin()
	{
		intError = 0;
		if(trim(document.UserLoginForm.UserName.value)=="")
			{
				intError = 1;
				alert("用户名不能为空");
				document.UserLoginForm.UserName.focus();
			}
		if(trim(document.UserLoginForm.Password.value)=="")
			{
				intError = 1;
				alert("密码不能为空");
				document.UserLoginForm.Password.focus();
			}
			
		if(intError==0)
			{
				document.UserLoginForm.submit();
			}	

	}
	
function trim(str)
{
	return  str.replace(/(^\s*)|(\s*$)/g, ""); 
}	



function SetProdKindOption(intProdKindId){


var bz=0;
var j=0;
var intSelected = 0
tlistobj=document.all.prodkind;
tlistobj.length=0;
if(intProdKindId==-1)
	{
		tlistobj.options[0]=new Option("全部",-1,-1);
		bz = 1;
		}

for(i=0;i<intArrayLength;i++)
{
	if(ProdKindDeep[i]>1)
		{
			break;
		}
	else
		{
			tlistobj.options[bz]=new Option(ProdKindName[i],ProdKindId[i],ProdKindId[i]);
			if(intProdKindId==ProdKindId[i])
				{
					intSelected = bz;
				}
			bz++;
			for(j=i+1;j<intArrayLength;j++)
				{
					if(ProdKindId[i]==ProdPartId[j])
						{
							tlistobj.options[bz]=new Option('--' + ProdKindName[j],ProdKindId[j],ProdKindId[j]);
							if(intProdKindId==ProdKindId[j])
								{
									intSelected = bz;
								}							
							bz++;
							for(n=j+1;n<intArrayLength;n++)
								{
									if(ProdKindId[j]==ProdPartId[n])
										{
											tlistobj.options[bz]=new Option('----' + ProdKindName[n],ProdKindId[n],ProdKindId[n]);																		
											if(intProdKindId==ProdKindId[n])
												{
													intSelected = bz;
												}											
											bz++;
										}	
								}
						}	
				}			
		}		

		
}
tlistobj.options[intSelected].selected=true;		

}

//生成产品分类的下拉菜单
function SetProdKindOptionByFormName(intProdKindId,strFormName){


var bz=0;
var j=0;
var intSelected = 0
eval('tlistobj=document.' + strFormName + '.prodkind');
//alert('tlistobj=document.' + strFormName + '.prodkind');
//alert(tlistobj.name);
tlistobj.length=0;
if(intProdKindId==-1)
	{
		tlistobj.options[0]=new Option("全部",-1,-1);
		bz = 1;
		}

for(i=0;i<intArrayLength;i++)
{
	if(ProdKindDeep[i]>1)
		{
			break;
		}
	else
		{
			tlistobj.options[bz]=new Option(ProdKindName[i],ProdKindId[i],ProdKindId[i]);
			if(intProdKindId==ProdKindId[i])
				{
					intSelected = bz;
				}
			bz++;
			for(j=i+1;j<intArrayLength;j++)
				{
					if(ProdKindId[i]==ProdPartId[j])
						{
							tlistobj.options[bz]=new Option('--' + ProdKindName[j],ProdKindId[j],ProdKindId[j]);
							if(intProdKindId==ProdKindId[j])
								{
									intSelected = bz;
								}							
							bz++;
							for(n=j+1;n<intArrayLength;n++)
								{
									if(ProdKindId[j]==ProdPartId[n])
										{
											tlistobj.options[bz]=new Option('----' + ProdKindName[n],ProdKindId[n],ProdKindId[n]);																		
											if(intProdKindId==ProdKindId[n])
												{
													intSelected = bz;
												}											
											bz++;
										}	
								}
						}	
				}			
		}		

		
}
tlistobj.options[intSelected].selected=true;		

}


//收藏产品
  function FavoriteProd(intProdNo)
  	{
  		  		
  		if(intProdNo*1 <=0 || isNaN(intProdNo))
  			{
  				alert("商品ID号错误!");  
  				intError = 1;			
  			}
  		if(intUserId*1 <=0 || isNaN(intUserId))
  			{
  				alert("请您先登录再收藏商品!"); 
  				intError = 1;  				
  			}	
  		if(intError == 0)	  	
  			{
  				window.location.href='FavoriteProd.Asp?ProdNo=' + intProdNo;
  			}
  			
  	}
  	
//加入购物车  	
  	
  function AddBuyCar(intProdNo,intCanBuy)
  	{
  		var intError = 0;
  		  		
  		if(intProdNo*1 <=0 || isNaN(intProdNo))
  			{
  				alert("商品ID号错误!");  
  				intError = 1;			
  			}

  		if(intCanBuy != 1 )
  			{
  				alert("对不起，此商品暂时缺货!");  
  				intError = 1;			
  			}  			
	
  		if(intError == 0)	  	
  			{
  				window.location.href='BuyCar.Asp?SkipBuyCar=1&ProdNo=' + intProdNo;
  			}
  			
  	}
  	

function FunSubAddMM()
{
	var intError = 0;
	if(intError == 0)
	{	
		if(document.UserRegForm.UserRealName.value=='')
		{
			alert('真实姓名未填写!');
			document.UserRegForm.UserRealName.focus();
			intError = 1;
		}
	}	
	
	if(intError == 0)
	{
		if(document.UserRegForm.UserName.value=='')
		{
			alert('登录名未填写!');
			document.UserRegForm.UserName.focus();
			intError = 1;
		}	
	}	

	
	if(intError == 0)
	{
		if(document.UserRegForm.Password.value=='')
		{
			alert('密码未填写!');
			document.UserRegForm.Password.focus();
			intError = 1;
		}	
	}
	
	if(intError == 0)
	{
		if(document.UserRegForm.Password.value != document.UserRegForm.Password1.value)
		{
			alert('两次密码不一致！');
			document.UserRegForm.Password.focus();
			intError = 1;
		}	
	}	

	
	if(intError == 0)
	{
		if(document.UserRegForm.EMAIL.value=='')
		{
			alert('Email未填写');
			document.UserRegForm.EMAIL.focus();
			intError = 1;
		}	
	}

	/*if(intError == 0)
	{
		if(document.UserRegForm.Idiograph.value.length>500)
		{
			alert('签名内容过长!');
			document.UserRegForm.Idiograph.focus();
			intError = 1;
		}	
	}

	
	var strLikeVal = '';
	for(i=0;i<document.UserRegForm.LikeCheck.length;i++)
	{
		if(document.UserRegForm.LikeCheck[i].checked)
			{
				if(strLikeVal=='')
					{
						strLikeVal = document.UserRegForm.LikeCheck[i].value;						
					}
				else	
					{
						strLikeVal = strLikeVal + ',' + document.UserRegForm.LikeCheck[i].value;						
					}
			}
	}
	
	document.UserRegForm.Like.value = strLikeVal;*/
	
	if(intError == 0)
	{
		document.UserRegForm.submit();

	}														
}


function CancelOrder(Orderid)
{
	alert(Orderid);
	if (window.confirm("真的要取消订单?"))
	{
		//alert (Orderid);
		document.CancelOrder.CancelOrderid.value=Orderid;
		document.CancelOrder.CancleOrderZt.value='1';
		//alert (document.CancelOrder.CancelOrderid.value);
		//document.CancelOrder.onsubmit
		document.CancelOrder.submit();
		//window.location.href="default.asp";
	} 
}  	

//登录时按下回车键执行登录操作
function HotLoginKey()
{
	if(event.keyCode==13)
		{
      			document.UserLoginForm.submit();
      		}
}

//收藏商品
function AddFavoriteProd(intFavProdNo)
{	
	if(intUserId*1<=0)
		{
			document.UserLoginForm.LoginUserName.focus();
			alert("请您先登录!");
			}
	else
		{		
			window.location.href='/FavoriteProd.Asp?ProdNo=' + intFavProdNo;
		}	
}

function ProdPoint(intFavProdNo)
{	
	document.Prod_PointForm.submit();	
}


function fob(n, d) 
{ 
   var p,i,x;if(!d) d=document; 
   if((p=n.indexOf("?"))>0&&parent.frames.length)  
   { 
       d=parent.frames[n.substring(p+1)].document; 
       n=n.substring(0,p); 
   } 
   if(!(x=d[n])&&d.all)  
   x=d.all[n]; 
   for (i=0;!x&&i<d.forms.length;i++)  
   x=d.forms[i][n]; 
   for(i=0;!x&&d.layers&&i<d.layers.length;i++)  
   x=fob(n,d.layers[i].document);  
   return x; 
}  
function checkdate(inpar) 
{ 
 var flag=true;  
 getdate=fob(inpar).value; 
 
 
 if (getdate.search(/^[0-9]{4}-(0[1-9]|[1-9]|1[1-2])-((0[1-9]|[1-9])|1[0-9]|2[0-9]|3[0-1])$/)==-1) // 判断输入格式时候正确 
 { 
   flag=false; 
 } 
 else 
 { 
   var year=getdate.substr(0,getdate.indexOf('-'))  // 获得年 
   // 下面操作获得月份 
   var transition_month=getdate.substr(0,getdate.lastIndexOf('-'));  
   var month=transition_month.substr(transition_month.lastIndexOf('-')+1,transition_month.length); 
   if (month.indexOf('0')==0) 
   { 
      month=month.substr(1,month.length); 
   } 
   // 下面操作获得日期 
   var day=getdate.substr(getdate.lastIndexOf('-')+1,getdate.length); 
   if (day.indexOf('0')==0) 
   { 
      day=day.substr(1,day.length); 
   } 
   flag=true; 
 } 
 if ((month==4 || month==6 || month==9 || month==11) && (day>30)) // 4,6,9,11月份日期不能超过30 
 {  
     flag=false;  
 } 
 if (month==2)  // 判断2月份 
 { 
   if (LeapYear(year)) 
   { 
      if (day>29 || day<1){ flag=false; } 
   } 
   else 
   { 
      if (day>28 || day<1){flag=false; } 
   } 
} 
else 
{ 
   flag=true; 
} 

if (flag==false) 
{ 
   //alert("您输入的日期不合法!"); 
   return false; 
} 
} 



function checktime(inpar) 
{ 
 var flag=true;  
 getdate=fob(inpar).value; 
 if  (getdate.search(/^[0-9]{4}-(0[1-9]|[1-9]|1[1-2])-((0[1-9]|[1-9])|1[0-9]|2 [0-9]|3[0-1]) ((0[1-9]|[1-9])|1[0-9]|2[0-4]):((0[1-9]|[1-9])|[1-5][0-9]): ((0[1-9]|[1-9])|[1-5][0-9])$/)==-1) // 判断输入格式时候正确 
 { 
   flag=false; 
 } 
 else 
 { 
   var year=getdate.substr(0,getdate.indexOf('-'))  // 获得年 
   // 下面操作获得月份 
   var transition_month=getdate.substr(0,getdate.lastIndexOf(' '));  
   transition_month=getdate.substr(0,getdate.lastIndexOf('-'));  
   var month=transition_month.substr(transition_month.lastIndexOf('-')+1,transition_month.length); 
   if (month.indexOf('0')==0) 
   { 
      month=month.substr(1,month.length); 
   } 
   // 下面操作获得日期 
   var transition_day=getdate.substr(0,getdate.lastIndexOf(' '));  
   var day=transition_day.substr(transition_day.lastIndexOf('-')+1,transition_day.length); 
   if (day.indexOf('0')==0) 
   { 
      day=day.substr(1,day.length); 
   } 
   flag=true; 
 } 
 if ((month==4 || month==6 || month==9 || month==11) && (day>30)) // 4,6,9,11月份日期不能超过30 
 {  
     flag=false;  
 } 
 if (month==2)  // 判断2月份 
 { 
   if (LeapYear(year)) 
   { 
      if (day>29 || day<1){ flag=false; } 
   } 
   else 
   { 
      if (day>28 || day<1){flag=false; } 
   } 
} 
else 
{ 
   flag=true; 
} 

if (flag==false) 
{ 
   alert("您输入的日期不合法!"); 
   return false; 
} 
} 

//判断是否闰年 
//参数      intYear 代表年份的值 
//return   true: 是闰年   false: 不是闰年 
function LeapYear(intYear) { 
   if (intYear % 100 == 0) { 
      if (intYear % 400 == 0) { return true; } 
   } 
   else { 
      if ((intYear % 4) == 0) { return true; } 
   } 
   return false; 
}  

//计算日期所差天数

   function  DateDiff(sDate1,  sDate2){    //sDate1和sDate2是2002-12-18格式  
       var  aDate,  oDate1,  oDate2,  iDays  
       aDate  =  sDate1.split("-")  
       oDate1  =  new  Date(aDate[1]  +  '-'  +  aDate[2]  +  '-'  +  aDate[0])    //转换为12-18-2002格式  
       aDate  =  sDate2.split("-")  
       oDate2  =  new  Date(aDate[1]  +  '-'  +  aDate[2]  +  '-'  +  aDate[0])  
       iDays  =  parseInt(Math.abs(oDate1  -  oDate2)  /  1000  /  60  /  60  /24)    //把相差的毫秒数转换为天数  
       return  iDays  
   }
   
/*   
function addDate(type,NumDay,dtDate){
   var date = new Date(dtDate)
 type = parseInt(type) //类型 
 lIntval = parseInt(NumDay)//间隔
  switch(type){
   case 6 ://年
  date.setYear(date.getYear() + lIntval)
  break;
 case 7 ://季度
  date.setMonth(date.getMonth() + (lIntval * 3) )
  break;
 case 5 ://月
  date.setMonth(date.getMonth() + lIntval)
  break;
 case 4 ://天
  date.setDate(date.getDate() + lIntval)
  break
 case 3 ://时
  date.setHours(date.getHours() + lIntval)
  break
 case 2 ://分
  date.setMinutes(date.getMinutes() + lIntval)
  break
 case 1 ://秒
  date.setSeconds(date.getSeconds() + lIntval)
  break;
 default:
    
  } 
 return date.getYear() +'-' +  (date.getMonth()+1) + '-' +date.getDate()+ ' '+ date.getHours()+':'+date.getMinutes()+':'+date.getSeconds()
  } 
   
*/   



function   isdate(strDate){   
        var   strSeparator   =   "-";   //日期分隔符   
        var   strDateArray;   
        var   intYear;   
        var   intMonth;   
        var   intDay;   
        var   boolLeapYear;   
          
        strDateArray   =   strDate.split(strSeparator);   
          
        if(strDateArray.length!=3)   return   false;   
          
        intYear   =   parseInt(strDateArray[0],10);   
        intMonth   =   parseInt(strDateArray[1],10);   
        intDay   =   parseInt(strDateArray[2],10);   
          
        if(isNaN(intYear)||isNaN(intMonth)||isNaN(intDay))   return   false;   
          
        if(intMonth>12||intMonth<1)   return   false;   
          
        if((intMonth==1||intMonth==3||intMonth==5||intMonth==7||intMonth==8||intMonth==10||intMonth==12)&&(intDay>31||intDay<1))   return   false;   
          
        if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&(intDay>30||intDay<1))   return   false;   
          
        if(intMonth==2){   
              if(intDay<1)   return   false;   
                
              boolLeapYear   =   false;   
              if((intYear%100)==0){   
                    if((intYear%400)==0)   boolLeapYear   =   true;   
              }   
              else{   
                    if((intYear%4)==0)   boolLeapYear   =   true;   
              }   
                
              if(boolLeapYear){   
                    if(intDay>29)   return   false;   
              }   
              else{   
                    if(intDay>28)   return   false;   
              }   
        }   
          
        //return   false;   
  } 


/*function IsEmail(strEmail) {
      var myReg = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;
      if(myReg.test(strEmail)) 
      	{
      		return true;
      	}
      else
      	{		
      	return false;
}
}*/


function isEmail(email) {
    invalidChars = " ~\'^\`\"*+=\\|][(){}$&!#%/:,;";

    // Check for null
    if (email == "") {
        return false;
    }

    // Check for invalid characters as defined above
    for (i=0; i<invalidChars.length; i++) {
        badChar = invalidChars.charAt(i);
        if (email.indexOf(badChar,0) > -1) {
            return false;
        }
    }
    lengthOfEmail = email.length;
    if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
        return false;
    }
    Pos = email.indexOf("@",1);
    if (email.charAt(Pos + 1) == ".") {
        return false;
    }
    while ((Pos < lengthOfEmail) && ( Pos != -1)) {
        Pos = email.indexOf(".",Pos);
        if (email.charAt(Pos + 1) == ".") {
            return false;
        }
        if (Pos != -1) {
            Pos++;
        }
    }

    // There must be at least one @ symbol
    atPos = email.indexOf("@",1);
    if (atPos == -1) {
        return false;
    }

    // But only ONE @ symbol
    if (email.indexOf("@",atPos+1) != -1) {
        return false;
    }

    // Also check for at least one period after the @ symbol
    periodPos = email.indexOf(".",atPos);
    if (periodPos == -1) {
        return false;
    }
    if (periodPos+3 > email.length) {
        return false;
    }
    return true;
}


function SetOptionHiline(strHiLineName)
{
	objHiLineName = document.getElementById(strHiLineName);
	if(objHiLineName)
	{
		objHiLineName.className = "HiLine";
		//alert(objHiLineName.className);
	}

}

function GetCharLen(strChar)
{
s = strChar;
intLen = 0;	
for(i=0;i<s.length;i++)   
  {   
  if   (s.charCodeAt(i)>255)
  		   {   
                              //s.charCodeAt(i)为非ascii字符
                          intLen+=2;       
    
                    }else{   
                              //s.charCodeAt(i)为ascii字符   
    			intLen++;
                    }   
  } 
  return intLen;
}


function OpenLinkUrl(strLinkUrl)
{
	//alert(strLinkUrl);
	/*objLink = document.createElement("a");
	objLink.setAttribute("href","123.jpg");
	objLink.setAttribute("target","_blank");
	objLink.click();*/
	//window.onload = OpenLinkUrl;
	
	var   objLink=document.createElement("a");   
	objLink.id = "OpenLinkUrlByJs";
	objLink.href=strLinkUrl;   
	objLink.target="_blank";   
	objLink.style.dipaly="none";   
	document.body.appendChild(objLink);   
	objLink.click(); 		
	document.getElementById("OpenLinkUrlByJs").removeNode(true); 
}



/**/ /**/ /**/ /*   
**    ==================================================================================================  
**    类名：CLASS_MSN_MESSAGE  
**    功能：提供类似MSN消息框  
**    示例：  
    ---------------------------------------------------------------------------------------------------  
  
            var MSG = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示：","您有1封消息","今天请我吃饭哈");  
                MSG.show();  
  
    ---------------------------------------------------------------------------------------------------  
**    作者：ttyp  
**    邮件：ttyp@21cn.com  
**    日期：2005-3-18  
**    ==================================================================================================  
* */   
  
  
 /**/ /**/ /**/ /*   
 *    消息构造  
  */   
 function  CLASS_MSN_MESSAGE(id,width,height,caption,title,message,action,target)  {  
     this.id      =  id;  
     this.title   =  title;  
     this.caption =  caption;  
     this.message =  message;  
     this.target  =  target;  
     this.action  =  action;  
     this.width     =  width ? width: 200 ;  
     this.height  =  height ? height: 120 ;  
     this.timeout =   150 ;  
     this.speed     =   20 ; 
     this.step     =   1 ; 
     this.right     =  screen.width  - 1 ;  
     this.bottom  =  screen.height; 
     this.left     =   this.right  -   this.width; 
     this.top     =   this.bottom  -   this.height; 
     this.timer     =   0 ; 
     this.pause     =   false ;
     this.close     =   false ;
     this.autoHide     =   true ;
     this.messages  =   new  Object();
     this.index  =   0 ;
}   


  
CLASS_MSN_MESSAGE.prototype.addMessage  =   function (id,msg,title)  {
     var  item  =   new  CLASS_MESSAGE_ITEM(id, msg, title);
     this.messages[ this.index]  =  item;
     this.index  ++ ;
} 
  /**/ /**/ /**/ /*   
 *    隐藏消息方法  
  */   
CLASS_MSN_MESSAGE.prototype.hide  =   function ()  {  
     if ( this.onunload())  {  

         var  offset   =   this.height > this.bottom - this.top ? this.height: this.bottom - this.top; 
         var  me   =   this ;  
 
         if ( this.timer > 0 )  {   
            window.clearInterval(me.timer);  
        }   
 
         var  fun  =   function ()  {  
             if (me.pause == false || me.close)  {
                 var  x   =  me.left; 
                 var  y   =   0 ; 
                 var  width  =  me.width; 
                 var  height  =   0 ; 
                 if (me.offset > 0 )  { 
                    height  =  me.offset; 
                }  
     
                y   =  me.bottom  -  height; 
     
                 if (y >= me.bottom)  { 
                    window.clearInterval(me.timer);  
                    me.Pop.hide();  
                }   else    { 
                    me.offset  =  me.offset  -  me.step;  
                }  
                me.Pop.show(x,y,width,height);    
            }              
        }   
 
         this.timer  =  window.setInterval(fun, this.speed)      
    }   
}   
  
 /**/ /**/ /**/ /*   
 *    消息卸载事件，可以重写  
  */   
CLASS_MSN_MESSAGE.prototype.onunload  =   function ()   {  
     return   true ;  
}   
 /**/ /**/ /**/ /*   
 *    消息命令事件，要实现自己的连接，请重写它  
 *  
  */   
CLASS_MSN_MESSAGE.prototype.oncommand  =   function ()  {  
      this.speed=1;	
      this.step=1000;
      this.close = true; 
      this.hide();
    window.open( this.action, this.target); 

  
}   
CLASS_MSN_MESSAGE.prototype.onlink  =   function (action)   {
      this.speed=1;	
      this.step=1000;
      this.close = true; 
      this.hide();	
    window.open(action,  this.target);
     //this.hide();
} 
  
 function  CLASS_MESSAGE_ITEM(link, msg, title)   {
     this.link  =  link;
     this.msg  =  msg;
     this.title  =  title;
} 
  /**/ /**/ /**/ /*   
 *    消息显示方法  
  */   
CLASS_MSN_MESSAGE.prototype.show  =   function ()  {  

     var  oPopup  =  window.createPopup();  // IE5.5+   
     
     this.Pop  =  oPopup;  
  
     var  w  =   this.width;  
     var  h  =   this.height;  
  
     var  str  =   " <DIV style='BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; BORDER-LEFT: #a6b4cf 1px solid; WIDTH:  "   +  w  +   " px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT:  "   +  h  +   " px; BACKGROUND-COLOR: #c9d3f3'> "   ;
        str  +=   " <TABLE style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#cfdef4 border=0> "   ;
        str  +=   " <TR> "   ;
        str  +=   " <TD style='FONT-SIZE: 12px;COLOR: #0f2c8c' width=30 height=24></TD> "  ; 
        str  +=   " <TD style='PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #1f336b; PADDING-TOP: 4px' vAlign=center width='100%'> "   +   this.caption  +   " </TD> "   ;
        str  +=   " <TD style='PADDING-RIGHT: 2px; PADDING-TOP: 2px' vAlign=center align=right width=19> "   ;
        str  +=   " <SPAN title=关闭 style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px' id='btSysClose' >×</SPAN></TD> "   ;
        str  +=   " </TR> "   ;
        str  +=   " <TR> "   ;
        str  +=   " <TD style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px' colSpan=3 height= "   +  (h - 28 )  +   " > "   ;
        str  +=   " <DIV style='BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 8px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%'> "   +   this.title.replace( " {size} " , this.index  >   0 ? this.index: 1 )  +   " <BR><BR> "  ; 
        str  +=   " <DIV style='WORD-BREAK: break-all' align=left> " ;
         if ( this.index  >   0 )   {
             for (i = 0 ;i < this.index;i ++ )   {
                 if ( typeof ( this.messages[i])  !=   " undefined")   {
                    str  +=   " <A href=' " + ( this.messages[i].link != null ? this.messages[i].link: this.action) + " ' hidefocus=true id='btCommand1' title=' " + this.messages[i].title + " '><FONT color=#ff0000> " +   this.messages[i].msg;
                    str  +=   " </FONT></A><br> " ;
                } 
            } 
            str  +=   " </DIV> " ;
        }   else 
            str  +=   " <A href='javascript:void(0)' hidefocus=true id='btCommand'><FONT color=#ff0000> "   + this.message + " </FONT></A></DIV> " ;
        str  +=   " </DIV> "   ;
        str  +=   " </TD> "   ;
        str  +=   " </TR> "   ;
        str  +=   " </TABLE> "   ;
        str  +=   " </DIV> "   ;
  
    oPopup.document.body.innerHTML  =  str; 
    
  
     this.offset   =   0 ; 
     var  me   =   this ;  

    oPopup.document.body.onmouseover  =   function ()  {me.pause = true ;} 
     oPopup.document.body.onmouseout  =   function ()  {me.pause = false ;} 
 
      var  fun  =   function ()  {  
         var  x   =  me.left; 
         var  y   =   0 ; 
         var  width     =  me.width; 
         var  height     =  me.height; 
 
             if (me.offset > me.height)  { 
                height  =  me.height; 
            }   else    { 
                height  =  me.offset; 
            }  
 
        y   =  me.bottom  -  me.offset; 
         if (y <= me.top)  { 
            me.timeout -- ; 
             if (me.timeout == 0 )  { 
                window.clearInterval(me.timer);  
                 if (me.autoHide)  {
                    me.hide(); 
                } 
            }  
        }   else    { 
            me.offset  =  me.offset  +  me.step; 
        }  
        me.Pop.show(x,y,width,height);    
 
    }   
  
     this.timer  =  window.setInterval(fun, this.speed)      
  
     
  
     var  btClose  =  oPopup.document.getElementById("btSysClose");  
  
    btClose.onclick  =   function ()  
    {  
        me.close  =   true ;
        me.hide();  
    } 
  
     var  btCommand  =  oPopup.document.getElementById("btCommand");  
     if (btCommand  !=   null )   {
    btCommand.onclick  =   function ()  {  
        me.oncommand();  
    }     
    }   else    {
         var  i, a;
      for (i = 0 ; (a  =  oPopup.document.getElementsByTagName("a")[i]); i ++ )   {
        a.onclick  =   function ()  {
            me.onlink( this );  
            } 
      } 
        
    } 
}   
 /**/ /**/ /**/ /*  
** 设置速度方法 
* */  
CLASS_MSN_MESSAGE.prototype.speed  =   function (s)  { 
     var  t  =   20 ; 
     try    { 
        t  =  praseInt(s); 
    }   catch (e)  {}  
     this.speed  =  t; 
}  
 /**/ /**/ /**/ /*  
** 设置步长方法 
* */  
CLASS_MSN_MESSAGE.prototype.step  =   function (s)  { 
     var  t  =   1 ; 
     try    { 
        t  =  praseInt(s); 
    }   catch (e)  {}  
     this.step  =  t; 
}  
  
CLASS_MSN_MESSAGE.prototype.rect  =   function (left,right,top,bottom)  { 
     try    { 
         this.left         =  left     != null ? left: this.right - this.width; 
         this.right         =  right     != null ? right: this.left  + this.width; 
         this.bottom         =  bottom != null ? (bottom > screen.height ? screen.height:bottom):screen.height; 
         this.top         =  top     != null ? top: this.bottom  -   this.height; 
    }   catch (e)  {}  
}  


/*
 var  MSG1  =   new  CLASS_MSN_MESSAGE( " aa " , 200 , 120 , " 短消息提示： " , " 您有{size}封消息 " , "" , " http://www.163.com " , " _blank");  
MSG1.addMessage( " http://localhost/docroot/login?id=1 " , " aaa " , " bbae");
MSG1.addMessage( " http://localhost/docroot/login?id=2 " , " bbb " , " aeifj");
    MSG1.rect( null , null , null ,screen.height - 50 ); 
    MSG1.speed     =   10 ; 
    MSG1.step     =   5 ; 
   
     // alert(MSG1.top);  
     MSG1.show();  
     
*/     


//设定页面元素是否可用。传入对象，可用值。false为可用true为不可用
function SetElementStatus(objElement,bolStatus)
{
	objElement.disabled=bolStatus;
}


//用JSON数组填充下拉框，传入Select对象，数组名,下拉框显示内容，下拉框值
//例:SetSelectValByJSON(objLibOne,MyLibOneJSONArray.LibOneArray,'LibOneName','LibOneId');
function SetSelectValByJSON(objSelect,arrJSON,strValName,strValValue)
{
	clearOptions(objSelect);
	var intSelectJ=0;
	var intSelectI=0;
	for(intSelectI=0;intSelectI<arrJSON.length-1;intSelectI++)
	{
		objSelect.options[intSelectJ]=new Option(eval('arrJSON[' + intSelectJ + '].' + strValName),eval('arrJSON[' + intSelectJ + '].' + strValValue),eval('arrJSON[' + intSelectJ + '].' + strValValue));
		intSelectJ++;
	}	
}


//用JSON数组填充下拉框，传入Select对象，数组名,下拉框显示内容，下拉框值,检查哪个字段值，检查的值，默认的TITLE
//例:SetSelectValByJSON(objLibOne,MyLibOneJSONArray.LibOneArray,'LibOneName','LibOneId','LibOneId',1,"请选择");
function SetSelectCheckValByJSON(objSelect,arrJSON,strValName,strValValue,strCheckName,intCheckVal,strDefauleTitle)
{
	clearOptions(objSelect);
	var intSelectJ=0;
	
	var intSelectI=0;
	if(strDefauleTitle != "")
	{
		objSelect.options[0]=new Option(strDefauleTitle,-1,-1);
		intSelectJ++;
	}	
	
	for(intSelectI=0;intSelectI<arrJSON.length-1;intSelectI++)
	{
		if(eval('arrJSON[' + intSelectI + '].' + strCheckName) + "" == intCheckVal + "")
		{
			objSelect.options[intSelectJ]=new Option(eval('arrJSON[' + intSelectI + '].' + strValName),eval('arrJSON[' + intSelectI + '].' + strValValue),eval('arrJSON[' + intSelectI + '].' + strValValue));
			intSelectJ++;
		}
	}	
	
	if(intSelectJ == 0)
	{
		objSelect.options[0]=new Option(strDefauleTitle,-1,-1);
	}
}

//用JSON数组填充下拉框，并显示默认项。传入Select对象，数组名,下拉框显示内容，下拉框值,检查哪个字段值，检查的值，默认的TITLE,默认的TITLE值
//例:SetSelectValByJSON(objLibOne,MyLibOneJSONArray.LibOneArray,'LibOneName','LibOneId','LibOneId',1,"请选择");
function SetSelectCheckValByJSONByTitle(objSelect,arrJSON,strValName,strValValue,strCheckName,intCheckVal,strDefauleTitle,strDefauleTitleVal)
{
	clearOptions(objSelect);
	var intSelectJ=0;
	var intSelectI=0;
	var intChecked = 0;
	
	if(strDefauleTitle != "")
	{
		objSelect.options[0]=new Option(strDefauleTitle,strDefauleTitleVal,strDefauleTitleVal);
		intSelectJ++;
	}	
	
	for(intSelectI=0;intSelectI<arrJSON.length-1;intSelectI++)
	{
		
		objSelect.options[intSelectJ]=new Option(eval('arrJSON[' + intSelectI + '].' + strValName),eval('arrJSON[' + intSelectI + '].' + strValValue),eval('arrJSON[' + intSelectI + '].' + strValValue));
		intSelectJ++;
	}	
	

	
	SetSelected(objSelect,intCheckVal);
}

function clearOptions(sel)
{   
  //清除某个Select的全部Option   
  var   selLen=sel.length;   
  for(i=0;i<selLen;i++)
  	{   
  		sel.remove(0);               
	}   
}	


//选中Select栏中项，传入对象、Value值
function SetSelected(objSelect,strSelectValue)
{
  
  for(i=0;i<objSelect.length;i++)
  {  	
  	//alert(objSelect.options[i].value);
  	if(objSelect.options[i].value + '' == strSelectValue + '')
  	{  	  			
  		objSelect.options[i].selected = true;	  		
  	}
  }	

}	


function checkDateF(inString)
{
    inString = inString.replace('-','/');	
    inString = inString.replace('-','/');    
    var tempDate;
    var a=new Date(inString);
    var y=a.getFullYear();
    var m=a.getMonth()+1;
    var d=a.getDate();
    var myday=y + "/" + m + "/" + d
    if (myday!=inString)
    {
    //alert  "请为"+ fieldName +"输入一有效日期(yyyy/m/d/)。"; 
    return false;     
    }
    return true; 
}

//合并表格列。传入表格id,从第几列开始，到第几列结束。会把相同内容合并
//Demo mergCol('TableRepost,0,1')	//合并第一列
function mergCol(tableId, fCol, eCol)
{
    var oTable = document.getElementById(tableId);
    if (!oTable) 
	{
        return;
    }
    var oTBody = oTable.tBodies[0];
    var oRows = oTBody.rows;
    if (oRows.length == 0) 
    {
        return;
    }
    for (var j = fCol; j <= eCol; j++) 
    {
        var oRow = oRows[0];
        var rowspan = 1;
        for (var i = 1; i < oRows.length; i++) 
	{
            var oNextRow = oRows[i];
            if (oRow.cells[j].innerHTML == oNextRow.cells[j].innerHTML) 
		{
                rowspan++;
                oRow.cells[j].merg = rowspan;
                oNextRow.cells[j].merg = -1;
            }
            else 
		{
                oRow = oNextRow;
                rowspan = 1
            }
        }
    }
    
    for (var i = oRows.length - 1; i >= 0; i--) 
{
        for (var j = eCol; j >= fCol; j--) 
{
            var oRow = oRows[i];
            if (oRow.cells[j].merg == -1) 
{
                oRow.cells[j].parentNode.removeChild(oRow.cells[j]);
            }
            else 
                if (oRow.cells[j].merg > 0) 
{
                    oRow.cells[j].rowSpan = oRow.cells[j].merg;
                }
        }
    }
    
}

function formatNum(intformatNumV)
{
    var intformatNumT = parseFloat(intformatNumV);
    var tempConvert = intformatNumT.toLocaleString();
    if (tempConvert.charAt(0) == "."){ 
         tempConvert = 0+tempConvert;
    }
    return tempConvert;
}
