//屏蔽鼠标右键。
if (window.Event) 
	document.captureEvents(Event.MOUSEUP); 

function nocontextmenu() 
{
	event.cancelBubble = true
	event.returnValue = false;
	return false;
}

function norightclick(e) 
{
	if (window.Event) 
	{
		if (e.which == 2 || e.which == 3)
		return false;
	}
	else
		if (event.button == 2 || event.button == 3)
		{
			event.cancelBubble = true
			event.returnValue = false;
			return false;
		}
}

//document.oncontextmenu = nocontextmenu; 
//document.onmousedown = norightclick; 

//函数名：fucPWDchk
//功能介绍：检查是否含有非数字或字母
//参数说明：要检查的字符串
//返回值：0：含有 1：全部为数字或字母
function chkPWD(str)
{
  var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
  var ch;
  var i;
  var temp;
  
  for (i=0;i<=(str.length-1);i++)
  {
  
    ch = str.charAt(i);
    temp = strSource.indexOf(ch);
    if (temp==-1) 
    {
     return 0;
    }
  }
  if (strSource.indexOf(ch)==-1)
  {
    return 0;
  }
  else
  {
    return 1;
  } 
}
function raiseMenu(el) {
	if(el.tagName=="TD" || el.tagName=="IMG"){
		el.style.borderLeft = "1px buttonhighlight solid"
		el.style.borderTop = "1px buttonhighlight solid"
		el.style.borderRight = "1px buttonshadow solid"
		el.style.borderBottom = "1px buttonshadow solid"
		el.style.background = "buttonface"
	}		
}

function clearHighlight(el) {
	if (el==null) return
	if(el.tagName=="TD" || el.tagName=="IMG"){
		el.style.borderRight = "1px menu solid"
		el.style.borderBottom = "1px menu solid"
		el.style.borderTop = "1px menu solid"
		el.style.borderLeft = "1px menu solid" 
		el.style.background = "menu"
	}
}

function sinkMenu(el) {
	if(el.tagName=="TD" || el.tagName=="IMG"){
		el.style.borderRight = "1px buttonhighlight solid"
		el.style.borderBottom = "1px buttonhighlight solid"
		el.style.borderTop = "1px buttonshadow solid"
		el.style.borderLeft = "1px buttonshadow solid"
		el.style.background = "menu";
	}
}	

////判断是否整型
function isInt(value)
{
	var count1=0;
	for(index=0;index<value.length;index++)
		if ((value.charAt(index)<='9' && value.charAt(index)>='0') || value.charAt(index)=='.')count1++;
	if (value.length!=count1){
		return false;
	}
	return true;
}
function isIntNoPoint(value)
{
	var count1=0;
	for(index=0;index<value.length;index++)
		if ((value.charAt(index)<='9' && value.charAt(index)>='0') )count1++;
	if (value.length!=count1){
		return false;
	}
	return true;
}
////判断是否空值
function isNull(value)
{
	if(value==null || value=="")
		return true;
	else
		return false;
}
////////判断是否日期型
function isDate(sdate,separator)
{
	var aaa=new Array;
	aaa[0]="31";
	aaa[1]="28";
	aaa[2]="31";
	aaa[3]="30";
	aaa[4]="31";
	aaa[5]="30";
	aaa[6]="31";
	aaa[7]="31";
	aaa[8]="30";
	aaa[9]="31";
	aaa[10]="30";
	aaa[11]="31";

	var length1=sdate.length;
	var length2=separator.length;
	var year,month,day;

 	if(length1<8 || length1>10){return false;}
 
 	if (sdate.indexOf(separator)==-1){return false; }
 
 	var f1=sdate.indexOf(separator);
 
 	year=sdate.substring(0,f1);

 	if (year.length!=4)
 	{
 		return false;
    }
    else
    {
        for (var index=0;index<year.length;index++)
        {
            if (year.charAt(index)>'9'||year.charAt(index)<'0'){return false;}
        }
    }
	if (year*1%4==0 && year*1%100>0)
		aaa[1]="29";
	else if (year*1%4==0 && year*1%100==0)
		aaa[1]="29";
	else
		aaa[1]="28";

 	sdate=sdate.substring(sdate.indexOf(separator)+length2);
  
 	if (sdate.indexOf(separator)==-1){return false; }
 	
 	month=sdate.substring(0,sdate.indexOf(separator));
  
 	if (month.length>2)
 	{
 		return false;
    }
    else
    {
        for (var index=0;index<month.length;index++)
        {
            if (month.charAt(index)>'9'||month.charAt(index)<'0'){return false;}
        }
        
        if(month>12||month<1){return false;}
    }

 	sdate=sdate.substring(sdate.indexOf(separator)+length2);
 	if (sdate.indexOf(separator)!=-1){return false; }
 	day=sdate.substring(0);

	if (day.length>2)
	{
		return false;
    }
    else
    {
        for (var index=0;index<day.length;index++)
        {
        	if (day.charAt(index)>'9'||day.charAt(index)<'0'){return false;}
        }
        if (day>31||day<1){return false;}
    }
    if (day*1>aaa[month*1-1]*1)
    {
    	return false;
    }
	return true;
}

/////////////select Multiple add////
function selectadd(select1,select2)
{
	var count1=0,count2=0,selindex=-1;
	var length1=select2.options.length;
	for (i=0;i<select1.options.length;i++)
	{
		if(select1.options[i].selected)
		{
			selindex=i;
			count1=0;
			for (j=0;j<length1;j++)
				if (select2.options[j].value==select1.options[i].value)count1++;
			if (count1==0)
			{
				select2.options[length1+count2] = new Option(select1.options[i].text,select1.options[i].value);
				count2++;
			}
		}
	}		
	if (selindex<select1.options.length && select1.options.length>0)
	{
		for (i=0;i<select1.options.length;i++)
		{
			if (i==selindex+1)
				select1.options[i].selected=true;
			else
				select1.options[i].selected=false;
		}
		if (selindex==select1.options.length-1)
			select1.options[0].selected=true;
	}
}
/////////////select Multiple del////
function selectdel(select)
{
	var length=select.options.length;
	var sele_text=new Array;
	var sele_value=new Array;
	var count2=0;
	for(i=0;i<length;i++)
	{
		if(select.options[i].selected)
		{}
		else
		{
			sele_text[count2]=select.options[i].text;
			sele_value[count2]=select.options[i].value;
			count2++;
		}
	}
	select.options.length=0;
	for(i=0;i<count2;i++)
	{
		select.options[i] = new Option(sele_text[i],sele_value[i]);
	}
	if (count2>0)
	{
		select.options[count2-1].selected=true;
	}
}
//////////////////////
/////////////////////////////////写Cookie(可以存数组)///////////////////////////////////////////////////
function setCookie1(key, value) {
	document.cookie = key + "=" + escape(value);
}

function getCookie1(key) {
	if (document.cookie.length) {
		var cookies = ' ' + document.cookie;
		var start = cookies.indexOf(' ' + key + '=');
		if (start == -1) { return null; }
		var end = cookies.indexOf(";", start);
		if (end == -1) { end = cookies.length; }
		end -= start;
		var cookie = cookies.substr(start,end);
		return unescape(cookie.substr(cookie.indexOf('=') + 1, cookie.length - cookie.indexOf('=') + 1));
	}
	else { return null; }
}

function setCookieArray(key,value1) {
	var len=value1.length;
	setCookie1("rowscount",len);
	for (i=0;i<len;i++){
		setCookie1(key+i,value1[i]);
	}
}

function getCookieArray(key) {
	var cookiearray=new Array;
	var len=getCookie1("rowscount");
	for(i=0;i<len;i++){
		cookiearray[i]=getCookie1(key+i);
	}
	return cookiearray;
}
/////////////////////////////////写Cookie(可以存数组)///////////////////////////////////////////////////
