/*图片播放*/
var home_imgs='';
var home_links='';
var home_titles='';
function home_picture(){
	 var focus_width=260;
	 var focus_height=187;
	 var text_height=18;
	 var swf_height = focus_height+text_height;

	 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	 document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
	 document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	 document.write('<param name="FlashVars" value="pics='+home_imgs+'&links='+home_links+'&texts='+home_titles+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	 document.write('<embed src="images/focus.swf" wmode="opaque" FlashVars="pics='+home_imgs+'&links='+home_links+'&texts='+home_titles+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  document.write('</object>');
}

/**
*	注册表单检测
*/

function checkRegForm(f){
	if(f.user_account.value.length<3||f.user_account.value.length>10){
		alert('账号只能在 3-10 位之间!');
		f.user_account.focus();
		return false;
	}
	if(f.user_pwd.value.length<6){
		alert('密码不能少于 6 位!');
		f.user_pwd.focus();
		return false;
	}
	if(f.user_pwd2.value!=f.user_pwd.value){
		alert('输入的两次密码不一致!');
		f.user_pwd.focus();
		return false;
	}
	if(f.user_question.value.length<4){
		alert('密码提示问题不能少于4位!');
		f.user_question.focus();
		return false;
	}
	if(f.user_answer.value.length<4||f.user_answer.value==f.user_question.value){
		alert('密码提示答案不能少于4位，且不能与密码提示问题一致!');
		f.user_answer.focus();
		return false;
	}
	if(f.user_name.value.length<2||f.user_name.value.length>4){
		alert('请输入您的真实姓名!');
		f.user_name.focus();
		return false;
	}
	checksub();
}

function checkLoginForm(f){
	if(f.user_account.value==''){
		alert('请输入用户名！');
		f.user_account.focus();
		return false;
	}
	if(f.user_pwd.value==''){
		alert('请输入密码！');
		f.user_pwd.focus();
		return false;
	}
	if(f.user_verficCode.value.length!=4){
		alert('请输入验证码！');
		f.user_verficCode.value='';
		f.user_verficCode.focus();
		return false;
	}
}

/**************
**
** 天气预报**
**
**************/

function weather(){
	document.write('<iframe src="http://weather.cn.yahoo.com/cframe.html" width="240" height="50" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="265" allowTransparency="true"></iframe>');
}

/*********************************************************/
/*
Date.prototype.isLeapYear 判断闰年   
Date.prototype.Format 日期格式化   
Date.prototype.DateAdd 日期计算   
Date.prototype.DateDiff 比较日期差   
Date.prototype.toString 日期转字符串   
Date.prototype.toArray 日期分割为数组   
Date.prototype.DatePart 取日期的部分信息   
Date.prototype.MaxDayOfDate 取日期所在月的最大天数   
Date.prototype.WeekNumOfYear 判断日期所在年的第几周   
StringToDate 字符串转日期型   
IsValidDate 验证日期有效性   
CheckDateTime 完整日期<SPAN class=hilite2>时间</SPAN>检查   
daysBetween 日期天数差    
*/
//时间处理
//---------------------------------------------------    
// 判断闰年    
//---------------------------------------------------    
Date.prototype.isLeapYear = function()       
{       
return (0==this.getYear()%4&&((this.getYear()%100!=0)||(this.getYear()%400==0)));       
}       
  
//---------------------------------------------------    
// 日期格式化    
// 格式 YYYY/yyyy/YY/yy 表示年份    
// MM/M 月份    
// W/w 星期    
// dd/DD/d/D 日期    
// hh/HH/h/H <SPAN class=hilite2>时间</SPAN>    
// mm/m 分钟    
// ss/SS/s/S 秒    
//---------------------------------------------------    
Date.prototype.Format = function(formatStr)       
{       
var str = formatStr;       
var Week = ['日','一','二','三','四','五','六'];      
  
     str=str.replace(/yyyy|YYYY/,this.getFullYear());       
     str=str.replace(/yy|YY/,(this.getYear() % 100)>9?(this.getYear() % 100).toString():'0' + (this.getYear() % 100));       
  
     str=str.replace(/MM/,this.getMonth()>9?this.getMonth().toString():'0' + this.getMonth());       
     str=str.replace(/M/g,this.getMonth());       
  
     str=str.replace(/w|W/g,Week[this.getDay()]);       
  
     str=str.replace(/dd|DD/,this.getDate()>9?this.getDate().toString():'0' + this.getDate());       
     str=str.replace(/d|D/g,this.getDate());       
  
     str=str.replace(/hh|HH/,this.getHours()>9?this.getHours().toString():'0' + this.getHours());       
     str=str.replace(/h|H/g,this.getHours());       
     str=str.replace(/mm/,this.getMinutes()>9?this.getMinutes().toString():'0' + this.getMinutes());       
     str=str.replace(/m/g,this.getMinutes());       
  
     str=str.replace(/ss|SS/,this.getSeconds()>9?this.getSeconds().toString():'0' + this.getSeconds());       
     str=str.replace(/s|S/g,this.getSeconds());       
  
return str;       
}       
  
//+---------------------------------------------------    
//| 求两个<SPAN class=hilite2>时间</SPAN>的天数差 日期格式为 YYYY-MM-dd    
//+---------------------------------------------------    
function daysBetween(DateOne,DateTwo)      
{       
var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ('-'));      
var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ('-')+1);      
var OneYear = DateOne.substring(0,DateOne.indexOf ('-'));      
  
var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ('-'));      
var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ('-')+1);      
var TwoYear = DateTwo.substring(0,DateTwo.indexOf ('-'));      
  
var cha=((Date.parse(OneMonth+'/'+OneDay+'/'+OneYear)- Date.parse(TwoMonth+'/'+TwoDay+'/'+TwoYear))/86400000);       
return Math.abs(cha);      
}      
  
  
//+---------------------------------------------------    
//| 日期计算    
//+---------------------------------------------------    
Date.prototype.DateAdd = function(strInterval, Number) {       
var dtTmp = this;      
switch (strInterval) {       
case 's' :return new Date(Date.parse(dtTmp) + (1000 * Number));      
case 'n' :return new Date(Date.parse(dtTmp) + (60000 * Number));      
case 'h' :return new Date(Date.parse(dtTmp) + (3600000 * Number));      
case 'd' :return new Date(Date.parse(dtTmp) + (86400000 * Number));      
case 'w' :return new Date(Date.parse(dtTmp) + ((86400000 * 7) * Number));      
case 'q' :return new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + Number*3, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());      
case 'm' :return new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + Number, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());      
case 'y' :return new Date((dtTmp.getFullYear() + Number), dtTmp.getMonth(), dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());      
     }      
}      
  
//+---------------------------------------------------    
//| 比较日期差 dtEnd 格式为日期型或者 有效日期格式字符串    
//+---------------------------------------------------    
Date.prototype.DateDiff = function(strInterval, dtEnd) {       
var dtStart = this;      
if (typeof dtEnd == 'string' )//如果是字符串转换为日期型    
     {       
         dtEnd = StringToDate(dtEnd);      
     }      
switch (strInterval) {       
case 's' :return parseInt((dtEnd - dtStart) / 1000);      
case 'n' :return parseInt((dtEnd - dtStart) / 60000);      
case 'h' :return parseInt((dtEnd - dtStart) / 3600000);      
case 'd' :return parseInt((dtEnd - dtStart) / 86400000);      
case 'w' :return parseInt((dtEnd - dtStart) / (86400000 * 7));      
case 'm' :return (dtEnd.getMonth()+1)+((dtEnd.getFullYear()-dtStart.getFullYear())*12) - (dtStart.getMonth()+1);      
case 'y' :return dtEnd.getFullYear() - dtStart.getFullYear();      
     }      
}      
  
//+---------------------------------------------------    
//| 日期输出字符串，重载了系统的toString方法    
//+---------------------------------------------------    
Date.prototype.toString = function(showWeek)      
{       
var myDate= this;      
var str = myDate.toLocaleDateString();      
if (showWeek)      
     {       
var Week = ['日','一','二','三','四','五','六'];      
         str += ' 星期' + Week[myDate.getDay()];      
     }      
return str;      
}    

//高考倒计时
function thisDate(){
	now=new Date();
	year=now.getYear();
	month=now.getMonth();
	day=now.getDate();
	document.write(year+'.'+(parseInt(month+1)<10?'0':'')+parseInt(month+1)+'.'+(day<10?'0':'')+day);
}
function countdown(){
	now=new Date();
	year=now.getYear();
	month=now.getMonth();
	day=now.getDate();
	count=0;
	word='';
	startDate=year+'-'+parseInt(month+1)+'-'+day+'';
	endDate=year+'-06-07';
	//
	if(month<5){
		word='距'+year+'年6月7日高考还有：';
		count=daysBetween(startDate,endDate);
	}
	else if(month==5 && day<10){
		word='高考进行中，祝同学们考出好成绩：';
		count=day;
	}
	else{
		word='距'+parseInt(year+1)+'年6月7日高考还有：';
		endDate=parseInt(year+1)+'-06-07';
		count=daysBetween(startDate,endDate);
	}
	str='<td width=58% style="padding-left:15px;color:#a1cee5">'+word+'</td><td width=22% align=center style="color:#a1cee5;font-size:17px;font-weight:bold">&nbsp;&nbsp;'+count+'</td><td width=20% align=center style="color:#a1cee5">天&nbsp;&nbsp;</td>';
	document.write(str);
}
