// JavaScript Document
//Created By Chen 2005-10-20
function resizeImage(image,width,height)
{
var img = new Image;
img.src = image.src;
var w = img.width;
var h = img.height;
if(w>width && w>h){
	image.width=width;
	image.height = parseInt(h*(width/w));
	}
if(h>height && h>w){
	image.width = parseInt(w*(height/h));
	image.height = height;
	}
}
function Resume(ii) {
	window.open("resume.asp?position="+ii);
}
function popimgwin(imgurl){
if(!imgurl || imgurl==""){
alert("参数丢失。");
return false;
}
var img = new Image
img.src = imgurl
height = img.height
width = img.width
var str = "location=0,status=no scrollbars=0 width="
str += width + " height="
str += height
var newwin = window.open(img.src,'',str)
newwin.document.body.style.margin=0;
newwin.moveTo((screen.width-width)/2,(screen.height-height)/2);
return false;
}

function showBig(url){
	if(!url || url==""){
		alert("没有可查看的大图片。");
		return false;
	}
popimgwin(url);
}

function viewOrder(oid){
	if(!oid || oid=="")return false;
window.open("../user/orderofind.asp?Form_Id="+oid,"myorder","height=550,width=600,left=200,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
//========Modified By Chen 2005-4-5================
//========Begin!
function check(form) {
   var input=form.getElementsByTagName("input")
	for(i=0;i<input.length;i++)
		if(input[i].value==""&&input[i].mustFill){
			var info = input[i].info;
			if(!info || info == "")info="带*号的是必须填写的。";
			alert("对不起，您没有填写完必要的表单信息。\n\n"+info);
			if(!input[i].disabled)
			input[i].focus();
			return false;
		}
	var input1=form.getElementsByTagName("textarea")
	for(i=0;i<input1.length;i++)
		if(input1[i].value==""&&input1[i].mustFill){
			var info = input1[i].info;
			if(!info || info == "")info="带*号的是必须填写的。";
			alert("对不起，您没有填写完必要的表单信息。\n\n"+info);
			if(!input1[i].disabled)
			input1[i].focus();
			return false;
		}
	
	if(!verifyAddress(input["Email"].value)){
		alert("请填写正确的EMail地址。");
		input["Email"].focus();
		return false;
	}
doSubmit(form);
return true;
}

function verifyAddress(m_value) 
{ 
var email = m_value; 
//var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 
var pattern = /^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
flag = pattern.test(email); 
if(flag) 
return true; 
return false; 
}
//=====End.
function showPro(proid){
	window.open("netshow1.asp?id=" + proid);
}
function viewAll(index){
	window.location.href = "join.asp?id="+index;
}
function eshop(id) { 
	window.open("../user/Eshop.asp?cpbm="+id,"eshop","height=400,width=640,left=200,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function eshopNotUser(id) { 
	window.open("../NotUser/Eshop.asp?cpbm="+id,"eshop","height=400,width=640,left=200,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function openWin(url,winname,width,height,scrollbars)
{
var sb=0;
if(scrollbars)sb = scrollbars;
var newwin = window.open(url,winname,'toolbar=0,location=0,status=0,menubar=0,scrollbars='+sb+',resizable=0,width='+width+',height='+height);
newwin.moveTo((screen.width-width)/2,(screen.height-height)/2);
return false;
}

function popimgwin1(imgurl){
if(!imgurl || imgurl==""){
alert("请先上传图片。");
return false;
}
var img = new Image
img.src = imgurl
height = img.height
width = img.width
var str = "location=0,status=no scrollbars=0 width="
str += width + " height="
str += height
var newwin = window.open(img.src,'',str)
newwin.document.body.style.margin=0;
newwin.moveTo((screen.width-width)/2,(screen.height-height)/2);
return false;
}
