﻿//分页快速跳转
function FP_jumpMenu(el,frm,sel)
{
	var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
	if(href!=="")
	{
	window.open(href);
	}
}

//改变新闻字体大小
function doZoom(size){
 document.getElementById("zoom").style.fontSize=size+"px";
}

//加入收藏夹
function bookmark(){
var title=document.title
var url=document.location.href
if (window.sidebar) window.sidebar.addPanel(title, url,"");
else if( window.opera && window.print ){
var mbm = document.createElement('a');
mbm.setAttribute('rel','sidebar');
mbm.setAttribute('href',url);
mbm.setAttribute('title',title);
mbm.click();}
else if( document.all ) window.external.AddFavorite( url, title);
}

//图片按比例缩放,可输入参数设定初始大小
function resizeimg(ImgD,iwidth,iheight) {
     var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0&&image.width>iwidth&&image.height>iheight)
	 {
        if(image.width/image.height>= iwidth/iheight)
		{
           if(image.width>iwidth){
               ImgD.width=iwidth;
               ImgD.height=(image.height*iwidth)/image.width;
           }else{
                  ImgD.width=image.width;
                  ImgD.height=image.height;
                }
               //ImgD.alt="宽×高:"+image.width+"×"+image.height;
        }
        else
		{
                if(image.height>iheight){
                       ImgD.height=iheight;
                       ImgD.width=(image.width*iheight)/image.height;
                }else{
                        ImgD.width=image.width;
                        ImgD.height=image.height;
                     }
                //ImgD.alt="宽×高:"+image.width+"×"+image.height;
         }
    }
}

//图片按比例缩放,可输入参数设定初始大小 

//重新加载验证码，这里必须加入随机数不然地址相同我发重新加载
function reloadcode()
{
	var CheckCode=document.getElementById('CheckCode');
	CheckCode.setAttribute('src','includeFile/getcode.asp?'+Math.random());
}


//检测空字符
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//检测空字符

function CheckEmail(email)
{
	var RegExpStr = /^([\w\_\-\.]{1,})(@)([\w\-\.]{1,})(\.)([a-zA-Z\.]{1,})$/;
	return RegExpStr.test(email);
}

//信息反馈
function infor_insert()
{
	if (checkspace(document.form.subject.value))
	{
		alert("請輸入合作事項");
		form.subject.focus();
		return false;
	}
	if (checkspace(document.form.name.value))
	{
		alert("請輸入您的姓名");
		form.name.focus();
		return false;
	}
	if (checkspace(document.form.email.value))
	{
		alert("請輸入電子郵箱");
		form.email.focus();
		return false;
	}
	if (!CheckEmail(document.form.email.value))
	{
		alert("請輸入正確的郵件地址");
		form.email.focus();
		return false;
	}
	if (checkspace(document.form.telphone.value))
	{
		alert("請輸入聯繫電話");
		form.telphone.focus();
		return false;
	}
	if (checkspace(document.form.content.value))
	{
		alert("請輸入內容備註");
		form.content.focus();
		return false;
	}
	if (checkspace(document.form.getcode.value))
	{
		alert("请按要求輸入驗證碼");
		form.getcode.focus();
		return false;
	}
	
}
