﻿var imgwidth=700;
function $(id){return document.getElementById(id);}
function show(o){document.getElementById(o).style.display="block";}
function hide(o){document.getElementById(o).style.display="none";}
function geturl(url,id){
var http=false;
$(id).innerHTML='<span class="loading">&nbsp;&nbsp;</span>';
if(window.XMLHttpRequest){http=new XMLHttpRequest();if(http.overrideMimeType){http.overrideMimeType('text/plain');}}else if(window.ActiveXObject){try{http=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http){alert('Cannot send an XMLHTTP request');return false;}
http.onreadystatechange=function(){if(http.readyState==4){$(id).innerHTML=http.responseText;}}
http.open("get", url, true);
http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
http.send(null);
}
function imgsize(){
	var img=document.getElementById("content").getElementsByTagName("img");
	for(var i=0; i<img.length;i++){
		if(img[i].width>imgwidth){img[i].width=imgwidth;img[i].style.width=imgwidth;img[i].title="View";img[i].style.cursor="pointer";img[i].border=0;img[i].onclick=function(e){window.open(this.src);}}
	}
}
	function check_empty(yield,alertstring){
		  if(yield==null) return true;
		  if(yield.value==""||yield.value==null)  {
			yield.focus();
			alert(alertstring+"不能为空！");
			return false;
		  }
		  return true;
		}
	function jiaoyan()
	{
		if (F1.act.value=="order")
		{
			if(isNaN(F1.num.value))
			{
				alert("订购数量不能为空且为数字！");
				F1.num.focus();
				return false;
			}
			if (F1.num.value<1)
			{
				alert("订购数量必须要大于0！");
				F1.num.focus();
				return false;
			}
		}
		//F1.webfrom.value=window.location;
		if(!check_empty(F1.GuestName,"姓名")) return false;
		if(!check_empty(F1.Phone,"联系电话")) return false;
		if(!check_empty(F1.Address,"联系地址")) return false;
		if(!check_empty(F1.Content,"留言内容")) return false;
	}