﻿// JavaScript Document

//搜索文本框事件
function clearnDefaultKeyWord()
{
	document.all.txtKeyWord.value = "";
	document.all.txtKeyWord.style.color = "black";
}
function setDefaultKeyWord()
{
	if(document.all.txtKeyWord.value == "")
	{
		document.all.txtKeyWord.value = "请输入关键字，点击搜索";
		document.all.txtKeyWord.style.color = "#CCCCCC";
	}
}

//导航栏样式变化
function high(which2)
{
	clearInterval(time_id);
	which2.filters.alpha.opacity = 100;
}
function low(which2)
{
	theobject = which2;
	time_id = setInterval("highlightit(theobject)",50);
}
function highlightit(cur2)
{
	if (cur2.filters.alpha.opacity > 80)
		cur2.filters.alpha.opacity -= 10;
	else if (window.time_id)
		clearInterval(time_id);
}


//设置ID为"fontZoom"控件的文字大小
function fontZoom(size)
{
    document.getElementById('fontZoom').style.fontSize = size + 'px';
}

//打印
function printPage()
{
	if (window.print)
		window.print(); 
	else
	    alert('No printer driver in your PC'); 
}


//得到浏览器大小，包括滚动区域
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}