//翻页的跳转
function goToTheUrl(TheSelect){
	location.href = TheSelect.value;
}

//表单验证
function CkGuestBook(theForm){
	if(theForm.name.value==''){
		alert("请输入姓名");
		theForm.name.focus();
		return false;
	}
	if(theForm.gongshi.value==''){
		alert("公司名不能为空");
		theForm.gongshi.focus();
		return false;
	}
	if(theForm.tel.value.length!=11){
		alert("请输入正确的11位电话号码");
		theForm.tel.focus();
		return false;
	}
	var tel = /^[0-9]+.?[0-9]*$/;
	if(!tel.test(theForm.tel.value)){
		alert("电话号码为纯数字");
		theForm.tel.focus();
		return false;
	}
	
	var email = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
	if(!email.test(theForm.email.value)){
		alert("请输入正确邮箱");
		theForm.email.focus();
		return false;
	}
	if(theForm.addr.value==''){
		alert("地址不能为空");
		theForm.addr.focus();
		return false;
	}
	if(theForm.content.value==''){
		alert("留言不能为空");
		theForm.content.focus();
		return false;
	}
	
	
}

//限制内容图片大小
function resize(o,w) {
	if (o.width>w) {
	o.style.width=w+'px';
	o.style.height='auto';
	}
}

//加入收藏(调用addfavorite();)
function addfavorite(){
	try {
		window.external.addFavorite(window.location.href, document.title);
	} 
	catch (e) {
		try {
			window.sidebar.addPanel(document.title, window.location.href, "");
		} 
		catch (e) {
			alert('请使用按键 Ctrl+d，收藏网址')
		}
	}
}

//设为首页(调用setHome(this,window.location);)
function setHome(obj, vrl){
	try {
		obj.style.behavior = 'url(#default#homepage)';
		obj.setHomePage(vrl);
	} 
	catch (e) {
	
		try {
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage', vrl);
		} 
		catch (e) {
			alert("此操作被浏览器拒绝！\n请手动设为首页。");
		}	
	}
}

//显示动画
function showFlash(flashWIDTH, flashHEIGHT, flashURL){
	if (flashURL.indexOf("?") != -1) {
		flashURL += '&rad=' + Math.random();
	}
	else {
		flashURL += '?rad=' + Math.random();
	}
	document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" WIDTH=' + flashWIDTH + ' HEIGHT=' + flashHEIGHT + '>');
	document.writeln('<PARAM NAME=movie VALUE="' + flashURL + '">');
	document.writeln('<PARAM NAME=wmode VALUE=transparent>');
	document.writeln('<PARAM NAME=loop VALUE=true>');
	document.writeln('<PARAM NAME=quality VALUE=high>');
	document.writeln('<EMBED src="' + flashURL + '" loop=true wmode=transparent quality=high swLiveConnect=FALSE WIDTH=' + flashWIDTH + ' HEIGHT=' + flashHEIGHT + ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>');
	document.writeln('</OBJECT>');
}

//搜索
function SearchList(txtId, defaultvalue){
	var thetxt = document.getElementById(txtId);
	if (thetxt.value == "" || thetxt.value == defaultvalue) {
		alert(defaultvalue);
		thetxt.focus();
		return;
	}
	location.href = "News_Search.php?tag=Search&thetxt=" + encodeURIComponent(thetxt.value);
}

