var make="<button onclick='winClose();');' class='button' onmouseover=this.className='buttonH' onmouseout=this.className='button'>确 定</button>"
var cancel="<button onclick='javascript:breaked=true;winClose();');' class='button' onmouseover=this.className='buttonH' onmouseout=this.className='button'>取 消</button>"
/*标签显示*/
function showTab(num,listID,contentID,more){
	var tabList,tab;
	tabList = $(listID).getElementsByTagName("ul");
	tab = $(contentID).getElementsByTagName("ul");
	for(var i=0;i<tabList.length;i++) {
		tabList[i].className="tabN";
		tabList[i].getElementsByTagName("li")[2].className="tabRL";
		tab[i].style.display="none";
	}
	tabList[num].className="tabH";
	tab[num].style.display="block";
	if(num==0){num=tabList.length}
	tabList[num-1].getElementsByTagName("li")[2].className="tabR";
	tabList[tabList.length-1].getElementsByTagName("li")[2].className="tabR";
	if(more !=null){$(listID).parentNode.getElementsByTagName("div")[0].getElementsByTagName("ul")[0].getElementsByTagName("li")[1].getElementsByTagName("a")[0].setAttribute("href",more);}
}

//图片按比例缩放
var flag=false;
function DrawImage(ImgD){
var image=new Image();
var iwidth = 230; //定义允许图片宽度
var iheight = 280; //定义允许图片高度
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
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;
}
}
}
//图片按比例缩放2
function ReSizeimg(ImgD,iwidth,iheight) { 
     var image=new Image(); 
     image.src=ImgD.src; 
     if(image.width>0 && image.height>0){ 
        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; 
            } 
　　　　　ImgD.style.cursor= "pointer"; //改变鼠标指针 
    } 
}

/*check*/
function checkAll(form){
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.Name != 'chkAll'&&e.disabled==false)
		e.checked = form.chkAll.checked;
	}
}
function unCheckAll(form){
	if( $(form).chkAll.checked ){
		$(form).chkAll.checked = $(form).chkAll.checked&0;
	}
}
function $(id){return document.getElementById(id);}
function anysale(links){return;}

//验证表单validator
String.prototype.trim = function(){
    return this.replace(/(^[\s]*)|([\s]*$)/g, "");
}
function isNumber(num){  //数字检查
    if( /^[0-9.]+$/.test( num ))
		return true;
	else return false;
}
function isEmail(email){  //邮件地址检查
    return ( /^[^@]+@[^@]+\.[^@]+$/.test(email) && email.length<128 );
}
function isMobile( mobile ){  //手机号码检查
    return /^13\d{9}$/.test( mobile ) | /^15\d{9}$/.test( mobile );
}
function loadImg(image,imgsrc){ 
	var x = $(image);
	if(!x || !x.value) return; 
	var patn = /\.jpg$|\.jpeg$|\.gif$/i;  
	if(patn.test(x.value)){ 
		var y = $(imgsrc);
		y.src = 'file://localhost/' + x.value;
	}else{
		alert("您选择的似乎不是图像文件。");
	}
}

//得到form数据
function getForm(form) {      
	returnString = "";      
	formElements = document.forms[form].elements;      
	var first = true;     
//	alert(formElements.length);
	for (var i=0;i<formElements.length;i++) {      
		var e = formElements[i];
	//	alert(e.name);
		if(e.name == null || e.name==""){
			continue;
		}
	  
		if(e.type=="checkbox" || e.type == "radio"){      
			if(e.checked){//判断是否被选中      
				if(first == true){
					first = false;
					returnString += e.name + "=" + encodeURIComponent(e.value);      
				}else{      
					returnString += "&" + e.name + "=" + encodeURIComponent(e.value);      
				}
			}//判断选框结束
		}else if(e.type=="select-one"){
			e.value=e.options[e.selectedIndex].value;
			if(first == true){
				first = false;
				returnString += e.name + "=" + encodeURIComponent(e.value);      
			}else{      
				returnString += "&" + e.name + "=" + encodeURIComponent(e.value);      
			}//判断select-one结束
		}else if (e.type=="select-multiple"){
			for (var n=0;n<e.length;n++) {
				var op=e.options[n];
				if (op.selected) {
					if(first == true){
						first = false;
						returnString += e.name + "=" + encodeURIComponent(op.value);      
					}else{      
						returnString += "&" + e.name + "=" + encodeURIComponent(op.value);      
					}
				}
			}//判断select-multiple结束
		}else{
			if(first == true){
				first = false;
				returnString += e.name + "=" + encodeURIComponent(e.value);      
			}else{
				returnString += "&" + e.name + "=" + encodeURIComponent(e.value);      
			}
		}////判断类型结束
		
    }//循环结束
    return returnString;
}

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
function checktalkform()
{
 if(document.talkform.writer.value.length>10)
  {
    document.talkform.writer.focus();
    alert("您的网名不能超过10个字！");
    return false;
  }
 if(document.talkform.writer.value.length<2)
  {
    document.talkform.writer.focus();
    alert("您的网名不能低于2个字！");
    return false;
  }
 if(checkspace(document.talkform.content.value))
  {
    document.talkform.content.focus();
    alert("评论内容不能为空！");
    return false;
  }
  if(document.talkform.content.value.length>100)
  {
    document.talkform.content.focus();
    alert("评论内容不能超过100个字符！");
    return false;
  }
  return true;
}
function hidecom(){
obj=document.getElementById("floatcom");
obj.style.display='none';
}
lastScrollY=0;
function heartBeat()
{
diffY=document.body.scrollTop;
percent=1*(diffY-lastScrollY);
if(percent>0) percent = Math.ceil(percent);
else percent=Math.floor(percent);
document.all.floatcom.style.pixelTop+=percent;
lastScrollY=lastScrollY+percent;
}
window.setInterval("heartBeat()",1);