function checkForm(form) {
	if (form.yeara.value == "") {
		alert("请输入新郎生日年份");
		form.yeara.focus();
		return false;
	}
	if (!isInt(form.yeara.value)) {
		alert("出生年份应在1910-1999");
		form.yeara.focus();
		return false;
	}
	if (form.yeara.value < 10 || form.yeara.value > 99) {
		alert("出生年份应在1910-1999");
		form.yeara.focus();
		return false;
	}
	if (form.montha.value == "0") {
		alert("请选择新郎生日月份（阳历）");
		return false;
	}
	if (form.daya.value == "0") {
		alert("请选择新郎生日日期（阳历）");
		return false;
	}
	if (form.yearb.value == "") {
		alert("请输入新娘生日年份");
		form.yearb.focus();
		return false;
	}
	if (!isInt(form.yearb.value)) {
		alert("出生年份应在1910-1999");
		form.yearb.focus();
		return false;
	}
	if (form.yearb.value < 10 || form.yearb.value > 99) {
		alert("出生年份应在1910-1999");
		form.yearb.focus();
		return false;
	}
	if (form.monthb.value == "0") {
		alert("请选择新娘生日月份（阳历）");
		return false;
	}
	if (form.dayb.value == "0") {
		alert("请选择新娘生日日期（阳历）");
		return false;
	}
	if (form.monthc.value == "0") {
		alert("请选择择日月份（阳历）");
		return false;
	}
	form.submit();
	return true;
}

function isInt(n){
	var i = parseInt(n * 1);
	if (i == NaN){
		return false;
	}
	if (i != n){
		return false;
	}
	return true;
}

function hexEncode(data){
	var b16_digits = '0123456789abcdef';
	var b16_map = new Array();
	for (var i=0; i<256; i++) {
		b16_map[i] = b16_digits.charAt(i >> 4) + b16_digits.charAt(i & 15);
	}
	
	var result = new Array();
	for (var i=0; i<data.length; i++) {
		result[i] = b16_map[data.charCodeAt(i)];
	}
	
	return result.join('');
}

//Decodes Hex(base16) formated data
function hexDecode(data){
	var b16_digits = '0123456789abcdef';
	var b16_map = new Array();
	for (var i=0; i<256; i++) {
		b16_map[b16_digits.charAt(i >> 4) + b16_digits.charAt(i & 15)] = String.fromCharCode(i);
	}
	if (!data.match(/^[a-f0-9]*$/i)) return false;// return false if input data is not a valid Hex string
	
	if (data.length % 2) data = '0'+data;
		
	var result = new Array();
	var j=0;
	for (var i=0; i<data.length; i+=2) {
		result[j++] = b16_map[data.substr(i,2)];
	}

	return result.join('');
}

function compile(code)
{ 
var c=String.fromCharCode(code.charCodeAt(0)+code.length);
for(var i=1;i<code.length;i++)
alert(escape(c));
}

function uncompile(code)
{
code=unescape(code);
var c=String.fromCharCode(code.charCodeAt(0)-code.length);
for(var i=1;i<code.length;i++)
return c;
}

