﻿function ObjSelected(obj,value) {
	for(i=0;i<obj.options.length;i++){
		if (obj.options[i].value==value) {
			obj.options[i].selected = true;
		}
	}
}

function reloadprodimg(obj)	{
	if(obj.height>115){obj.height=115};
	if(obj.width>150){obj.width=150};
}

function reloadprodimgindex(obj)	{
	if(obj.height>100){obj.height=100};
	if(obj.width>100){obj.width=100};
}

function is_number(str){
	exp=/[^0-9()-]/g;
	if(str.search(exp) != -1)
	{
		return false;
	}
	return true;
}
function FormCheckCN() {
	if (document.getElementById("LinkMan").value=='') {
		alert('请填写你的大名');
		document.getElementById("LinkMan").focus();
		return false;
	}
	if (document.getElementById("City").value=='') {
		alert('请填写所在城市');
		document.getElementById("City").focus();
		return false;
	}
//	if (document.getElementById("CompanyName").value=='') {
//		alert('请填写公司名称');
//		document.getElementById("CompanyName").focus();
//		return false;
//	}
//	if (document.getElementById("Sex").value=='') {
//		alert('请填写性别');
//		document.getElementById("Sex").focus();
//		return false;
//	}
//	if (document.getElementById("Address").value=='') {
//		alert('请填写联系方式');
//		document.getElementById("Address").focus();
//		return false;
//	}
	if (document.getElementById("Tel").value=='') {
		alert('请填写电话');
		document.getElementById("Tel").focus();
		return false;
	}
	if (document.getElementById("Title").value=='') {
		alert('请填写标题');
		document.getElementById("Title").focus();
		return false;
	}
	if (document.getElementById("Code").value=='') {
		alert('请填写验证码');
		document.getElementById("Code").focus();
		return false;
	} else {
			if(!is_number(document.getElementById("Code").value)){
			alert("验证码只能为数字！");
			document.getElementById("Code").focus();
			return false;
		}
	}
	if (document.getElementById("Content").value=='') {
		alert('请填写反馈内容');
		document.getElementById("Content").focus();
		return false;
	}
}
function FormCheckEN() {
	if (document.getElementById("LinkMan").value=='') {
		alert('Please Input Your Name!');
		document.getElementById("LinkMan").focus();
		return false;
	}
//	if (document.getElementById("Sex").value=='') {
//		alert('Please Input Your Sex!');
//		document.getElementById("Sex").focus();
//		return false;
//	}
	if (document.getElementById("City").value=='') {
		alert('Please Input The City!');
		document.getElementById("City").focus();
		return false;
	}
	if (document.getElementById("Tel").value=='') {
		alert('Please Input Your Telephone Number!');
		document.getElementById("Tel").focus();
		return false;
	}
	if (document.getElementById("Title").value=='') {
		alert('Please Input The Subject!');
		document.getElementById("Title").focus();
		return false;
	}
	if (document.getElementById("Code").value=='') {
		alert('Please Input The Code!');
		document.getElementById("Code").focus();
		return false;
	} else {
			if(!is_number(document.getElementById("Code").value)){
			alert("The Code Must Be Number Format!");
			document.getElementById("Code").focus();
			return false;
		}
	}
	if (document.getElementById("Content").value=='') {
		alert('Please Input The Content!');
		document.getElementById("Content").focus();
		return false;
	}
}

function OpenPhotoWin(url) {
		makeNewWindow(url)
//      var width = 460;
//      var height = 600;
//		var left = parseInt((screen.availWidth/2) - (width/2));//屏幕居中
//      var top = parseInt((screen.availHeight/2) - (height/2));
//		window.open(url,'welcome','height=600,width=460,top='+top+',left='+left+',toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')
}
var newWindow;//定义一个窗口，有利于窗口间的通讯
function makeNewWindow(url) {
   if (!newWindow || newWindow.closed) {
        var width = 460;
        var height = 600;
        var left = parseInt((screen.availWidth/2) - (width/2));//屏幕居中
        var top = parseInt((screen.availHeight/2) - (height/2));
        var windowFeatures = "width=" + width + ",height=" + height + ",status,scrollbars=yes,resizable=no,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
        newWindow = window.open(url, "subWind", windowFeatures);
    } else {
        // window is already open, so bring it to the front
        newWindow.focus();
    }
}
