var calendarCount = 0;

function newCalendar2(inputName) {
	eval("calendar"+ calendarCount + "= new dynCalendar('calendar" + calendarCount + "', 'inputDate2', '/images/', null, '" + inputName + "');");
	calendarCount += 1;
	
}
function newCalendar(inputName) {
	eval("calendar"+ calendarCount + "= new dynCalendar('calendar" + calendarCount + "', 'inputDate', '/images/', null, '" + inputName + "');");
	calendarCount += 1;
	
}
function newCalendar3(inputName) {
	eval("calendar"+ calendarCount + "= new dynCalendar('calendar" + calendarCount + "', 'inputDate3', '/images/', null, '" + inputName + "');");
	calendarCount += 1;
	
}
function newCalendar4(inputName) {
	eval("calendar"+ calendarCount + "= new dynCalendar('calendar" + calendarCount + "', 'inputDate4', '/images/', null, '" + inputName + "');");
	calendarCount += 1;
	
}
function sureIt(){
	if(confirm("您是否确认一定要删除该成员呢？")){return true;}else{return false;}
	}

function inputDate2(date, month, year, inputName)
{
	var chacktime=new Date();
	
     if(year<chacktime.getYear()){
		 year=chacktime.getYear();
    }
	  if(month<chacktime.getMonth()+1 && chacktime.getYear()>=year){
		  month=chacktime.getMonth()+1;
	}
	  if(date<chacktime.getDate() && chacktime.getYear()>=year && chacktime.getMonth()+1>=month){
		  date=chacktime.getDate();
	}
     if (String(month).length == 1)
	{
		month = '0' + month;
	}

	if (String(date).length == 1)
	{
		date = '0' + date;
	}
	if( year==chacktime.getYear() && month==chacktime.getMonth()+1  && date==chacktime.getDate()){
		<!--alert("您选择的是当日礼物\n请注意当日礼物订购流程\n以便礼物能按时到达");-->
	}
	document.getElementsByName(inputName)[0].value = year + '-' + month + '-' + date;	
}
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function saveMail(){
	document.addMaillist.submit();
}
function   EnterRedirect2(Obj)
{
    if(event.keyCode==13)
	{
        if(chickEmail()==true)
		{
		   saveMail();
		}
		 else
		 {
			 return false;
		 }
	}
}


function chickEmail(){

var email=document.addMaillist.email.value;

var invalidChars = ";,:{}[]|*%$#!()`<>?";
 
 for (i=0; i< invalidChars.length; i++){

var  badChar = invalidChars.charAt(i) ;
  if (email.indexOf(badChar,0) > -1){
	  alert("不可以有非法字符 !");
   return false;
   }
  }

var atPos = email.indexOf("@",1);
 if (atPos == -1){
	 alert("这 不 是 正 确 的 e-mail address! 请 再 输 入 一 次 !");
   return false;
  }
 if (email.indexOf("@", atPos+1) != -1) {
	 alert("这 不 是 正 确 的 e-mail address! 请 再 输 入 一 次 !");
   return false;
  }

var periodPos = email.indexOf(".",atPos)
 if(periodPos == -1){
	 alert("这 不 是 正 确 的 e-mail address! 请 再 输 入 一 次 !");
    return false;
     }

 if ( atPos +2 > periodPos) {
	 alert("这 不 是 正 确 的 e-mail address! 请 再 输 入 一 次 !");
   return false;
  }

 if ( periodPos +3 > email.length){
	 alert("这 不 是 正 确 的 e-mail address! 请 再 输 入 一 次 !");
   return false;
 }
 alert("邮件订阅申请成功！");
 return true;
}





function inputDate(date, month, year, inputName)
{
	var chacktime=new Date();
	
      if(year<chacktime.getYear()){
		 year=chacktime.getYear();
    }
	  if(month<chacktime.getMonth()+1 && chacktime.getYear()>=year){
		  month=chacktime.getMonth()+1;
	}
	  if(date<chacktime.getDate() && chacktime.getYear()>=year && chacktime.getMonth()+1>=month){
		  date=chacktime.getDate();
	}
     if (String(month).length == 1)
	{
		month = '0' + month;
	}

	if (String(date).length == 1)
	{
		date = '0' + date;
	}
	
	document.getElementsByName(inputName)[0].value = year + '-' + month + '-' + date;	
}
function   EnterRedirect44(Obj)
{
    if(event.keyCode==13){
		
        document.AccountForm.submit();
        }
}
function inputDate3(date, month, year, inputName)
{
	
      
     if (String(month).length == 1)
	{
		month = '0' + month;
	}

	if (String(date).length == 1)
	{
		date = '0' + date;
	}
	
	document.getElementsByName(inputName)[0].value = year + '-' + month + '-' + date;	
}
function inputDate4(date, month, year, inputName)
{
	
      
     if (String(month).length == 1)
	{
		month = '0' + month;
	}
	
	document.getElementById(inputName).value = year + '-' + month;	
}
