/*
文件名：四川省残疾人联合会  网站公共JavaScript文件
*/

//skyest---------------跳转菜单专用---------------
function keyselect(b){
 var a = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if(a==13){				
		if (b.options[b.selectedIndex].value!='#'){window.open(b.options[b.selectedIndex].value)}		
		}
	}
function clickselect(a){
	a.onchange=function(){
		if (this.options[this.selectedIndex].value!='#'){window.open(this.options[this.selectedIndex].value)}
		a.onchange="";
		}
	}
//使用方式<select id="select3" name="select"  onmousedown="clickselect(this)" onkeydown="keyselect(this)" />

//Scorpio---------------输入框控制---------------
var allInputText=new Array
var allInputTextValue=new Array;
function offsetInput(){
	var allInput=document.getElementsByTagName("input");
	var inputNumber=0;
	for(var i=0;i<allInput.length;i++){
		if(allInput[i].getAttribute("type")=="text"){
			allInputText[inputNumber]=allInput[i];
			allInputTextValue[inputNumber]=allInput[i].getAttribute("value");
			inputNumber++;
		}
	}
}
function clearInput(inputFlag){
	var thisInputValue;
	for(var i=0;i<allInputText.length;i++){
		if(allInputText[i]==inputFlag){
			thisInputValue=allInputTextValue[i];
		}
	}
	if(inputFlag.getAttribute("value")==thisInputValue){
		inputFlag.setAttribute("value","");
	}
}
function returnInput(inputFlag){
	var thisInputValue;
	for(var i=0;i<allInputText.length;i++){
		if(allInputText[i]==inputFlag){
			thisInputValue=allInputTextValue[i];
		}
	}
	if(inputFlag.getAttribute("value")==null||inputFlag.getAttribute("value")==""){
		inputFlag.setAttribute("value",thisInputValue);
	}
}
//实例：<input type="text" value="请输入值6" onfocus="clearInput(this)" onblur="returnInput(this)" />

//Scorpio---------------文本区域控制---------------
var TextAreaString;
var clearTextAreaCount = true;
function clearTextArea(textAreaFlag){
	if(clearTextAreaCount){
		TextAreaString = textAreaFlag.innerHTML;
		clearTextAreaCount = false;
	}
	if(textAreaFlag.innerHTML == TextAreaString){
		textAreaFlag.innerHTML = "";
	}
}
function returnTextArea(textAreaFlag){
	if(textAreaFlag.innerHTML == ""){
		textAreaFlag.innerHTML = TextAreaString;
	}
}

//Scorpio---------------二级列表页当前栏目样式选择---------------
var columnname;
function tagonchange(){
	if(columnname){
		var xx=document.getElementById("leftcolumn").getElementsByTagName("li");
		for(var i=0;i<xx.length;i++){
			if(xx[i].firstChild.innerHTML == columnname){
				xx[i].firstChild.className="onchange";
			}
		}
	}
}

//Scorpio---------------打印---------------
function printthispage(){
	window.print();
}

//Scorpio---------------字体大小改变---------------
function changefontsize(thisSize){
	if(thisSize == "big"){
		document.getElementById("mainpage").style.fontSize = "24px";
	}
	else if(thisSize == "medium"){
		document.getElementById("mainpage").style.fontSize = "18px";
	}
	else if(thisSize == "small"){
		document.getElementById("mainpage").style.fontSize = "12px";
	}
}
//Scorpio---------------加入收藏---------------
function bookmarkit(){
	window.external.addFavorite('http://www.xueyuna.com','四川省残疾人联合会')
}
//Scorpio---------------设为首页---------------
function setHomePage(){
	document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage('http://www.crazymusic.com');
}
//Scorpio---------------输出日期---------------
function writeDate(){
	var day,month,ampm,ampmhour,myweekday,year;
	mydate=new Date();
	myweekday=mydate.getDay();
	mymonth=mydate.getMonth()+1;
	myday= mydate.getDate();
	myyear= mydate.getYear();
	year=(myyear > 200) ? myyear : 1900 + myyear;
	if(myweekday == 0)
	weekday=" 星期日";
	else if(myweekday == 1)
	weekday=" 星期一";
	else if(myweekday == 2)
	weekday=" 星期二";
	else if(myweekday == 3)
	weekday=" 星期三";
	else if(myweekday == 4)
	weekday=" 星期四";
	else if(myweekday == 5)
	weekday=" 星期五";
	else if(myweekday == 6)
	weekday=" 星期六";
	document.write(year+"年"+mymonth+"月"+myday+"日"+" "+weekday);
}

//---------------搜索表单验证---------------
function searchchecking(){
	var searchtext = document.getElementById("searchtext").getAttribute("value");
	if(searchtext==null||searchtext=="请输入搜索关键字"){
		return false;
	}
}
//--------------- 头部导航背景 ---------------
function changenav(navid)
{
var	changeid=navid.id;

for(i=1;i<10;i++)
	{
		if(i!=changeid)
		{
			document.getElementById(i).style.backgroundImage="none";
		}
		document.getElementById("navid").style.backgroundImage="images/nav_b_08.jpg";
	}

}
