// JavaScript Document

//***********默认设置定义.*********************
tPopWait = 15;	//停留tWait毫秒后显示提示。
tPopShow = 800;	//显示tShow毫秒后关闭提示
showPopStep = 20;
popOpacity = 95;

//***************内部变量定义*****************
sPop = null;
curShow = null;
tFadeOut = null;
tFadeIn = null;
tFadeWaiting = null;

document.write("<div id='divPopWin' style='position:absolute;z-index:1000;' class='CSS_TITLE1'></div>");
////////////////////////////////////////////////////////////////////////////////////////


function killErrors() {  //错误处理
return true; 
}

function setCaretAtEnd (field) { //自动选择文本框结尾
if (field.createTextRange) {
	var r = field.createTextRange();
	r.moveStart('character', field.value.length);
	r.collapse(); r.select();
} }

function formIni() //搜索框初始化
{
form4.searchkey.select();
document.images['heart'].src=options[selectedIndex].value;
//form2.verifycode.focus();
//form2.verifycode.select();
form2.memo.defaultValue='';
}

function formCheck() //表单内容检测
{
  if(form2.verifycode.value=='' || form2.qq.value==''  || form2.title.value=='' || form2.memo.value=='' )
  {
	  alert('任何内容可都不要为空呀.');
	  return false;
}else if(form2.qq.value.length<4){
	  alert('QQ号码好像没有小于4位的吧.');
	  return false;
	}
form2.Submit3.value='请稍候...';
form2.Submit3.disabled=true;
return true;

}

function shortcutKey()
{
if(event.keyCode==13 && event.ctrlKey){
	 if(form2.verifycode.value=='' || form2.qq.value==''  || form2.title.value=='' || form2.memo.value=='' )
  {
	  alert('任何内容可都不要为空呀.');
}else if(form2.qq.value.length<4){
	  alert('QQ号码好像没有小于4位的吧.');
	}else{
form2.Submit3.value='请稍候...';
form2.Submit3.disabled=true;
form2.submit();	
}
}
}
function onlyNum() //只能是数字检测 还可以是DEL SPACE TAB系统键
{
	if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105) || (event.keyCode==8)|| (event.keyCode==46)|| (event.keyCode==9)) )
event.returnValue=false;
}



//maxWord=50;
function checkInput(obj,maxWord) //留言簿字数检测
{

  if(obj.value.length>maxWord){
  obj.value=obj.value.substring(0,maxWord);
  remLen.innerText="字符超过" + maxWord + "个！";
  }else{
  remLen.innerText='剩'+ (maxWord-obj.value.length) + '个字可输入';
  }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0  分页下拉框
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
 
} 



function MM_openBrWindow(theURL,winName,features) { //v2.0 '注册用户窗口
  window.open(theURL,winName,features);
}





//////////////////////////////////////////////////////////////////////////滚动文本


//////////////////////////////////////////////////////////////////////////////////////////
function ShowPopWin()
{
	
	var o = event.srcElement;
	MouseX = event.x;
	MouseY = event.y;
	if (o.alt != null && o.alt != "")
	{
		o.dypop = o.alt;
		o.alt = ""
	};

    if (o.title != null && o.title != "")
	{
		o.dypop = o.title;
		o.title = ""
	};

	if (o.dypop != sPop) 
	{
		sPop = o.dypop;
		clearTimeout(curShow);
		clearTimeout(tFadeOut);
		clearTimeout(tFadeIn);
		clearTimeout(tFadeWaiting);	
		if (sPop == null || sPop == "") 
		{
			divPopWin.innerHTML = "";
			divPopWin.style.filter = "Alpha()";
			divPopWin.filters.Alpha.opacity = 0;	
		}
		else 
		{
			if (o.dyclass!=null) 
				popStyle = o.dyclass 
			else 
				popStyle = "CSS_TITLE1";
				curShow = setTimeout("ShowIt()",tPopWait);
			}
			
	}

}

function ShowIt()
{

	divPopWin.className = popStyle;
	divPopWin.innerHTML = sPop;
	popWidth = divPopWin.clientWidth;
	popHeight = divPopWin.clientHeight;

	if (MouseX + 12 + popWidth > document.body.clientWidth) 					popLeftAdjust=-popWidth-24
	else 
		popLeftAdjust = 0;

	if (MouseY + 12 + popHeight > document.body.clientHeight) 					popTopAdjust=-popHeight-24
	else 
		popTopAdjust = 0;

	divPopWin.style.left = MouseX+12+document.body.scrollLeft+popLeftAdjust;
	divPopWin.style.top = MouseY+12+document.body.scrollTop+popTopAdjust;
	divPopWin.style.filter = "Alpha(Opacity=0)";

	FadeOut();
}

function FadeOut()
{
	if (divPopWin.filters.Alpha.opacity < popOpacity) 
	{
		divPopWin.filters.Alpha.opacity+=showPopStep;
		tFadeOut = setTimeout("FadeOut()",1);
	}
	else {
		divPopWin.filters.Alpha.opacity = popOpacity;
		tFadeWaiting = setTimeout("FadeIn()",tPopShow);
	}
}

function FadeIn()
{
	if (divPopWin.filters.Alpha.opacity > 0) 
	{
		divPopWin.filters.Alpha.opacity-=1;
		tFadeIn = setTimeout("FadeIn()",1);
	}
}

document.onmouseover = ShowPopWin;
window.onerror = killErrors;  //错误处理
