<!--
var alertForEmpty = "The fields with asterisk are required.";
var alertForEmpty_CN = "*标注的为必需填写的选项。";

var alertForEmailFormat = "Email's format is invalid.";
var alertForEmailFormat_CN = "电子邮件地址格式不正确。";


function checkFormMailingList( form , alertLanguage )
{
	if(isEmpty(form.email.value, 1, alertLanguage))
	{
		return false;
	}
	if(/@/.test(form.email.value))
	{
		return true;
	}
	else
	{	
		if(alertLanguage == 0)
		{
			alert(alertForEmailFormat_CN);
		}
		else
		{
			alert(alertForEmailFormat);
		}
		return false;
	}
}
function checkFormContact( form, alertLanguage )
{
	if(isEmpty(form.lastname.value, 1, alertLanguage))
	{
		return false;
	}
	if(isEmpty(form.firstname.value, 1, alertLanguage))
	{
		return false;
	}
	if(isEmpty(form.email.value, 1, alertLanguage))
	{
		return false;
	}
	if(isEmpty(form.tel.value, 1, alertLanguage))
	{
		return false;
	}
	if(isEmpty(form.subject.value, 1, alertLanguage))
	{
		return false;
	}
	if(isEmpty(form.content.value, 1, alertLanguage))
	{
		return false;
	}
	if(/@/.test(form.email.value))
	{
		return true;
	}
	else
	{	
		if(alertLanguage == 0)
		{
			alert(alertForEmailFormat_CN);
		}
		else
		{
			alert(alertForEmailFormat);
		}
		return false;
	}
}

function isEmpty( tmpString, needAlert, alertLanguage )//alertLanguage 0 is CN, 1 is EN
{
	if(tmpString.length == 0)
	{
		if( needAlert )
		{
			if(alertLanguage == 0)
			{
				alert(alertForEmpty_CN);
			}
			else
			{
				alert(alertForEmpty);
			}
		}
		return true;
	}
	tmpString = trim( tmpString );
	if(tmpString.length == 0)
	{
		if( needAlert )
		{
			if(alertLanguage == 0)
			{
				alert(alertForEmpty_CN);
			}
			else
			{
				alert(alertForEmpty);
			}
		}
		return true;
	}
	else
	{		
		return false;
	}
}

function trim(str)
{
	if(!str || typeof str != 'string')
    {
        return false;
    }
    return str.replace(/^[\s]+/, '').replace(/[\s]+$/, '').replace(/[\s]{2,}/, ' ');
}

function mouseout( ele ){
	//ele.className = 'iesix';	
	ele.style.backgroundColor="#a1a1a1";
}

function mouseover( ele ){
	//ele.className = 'iesixhover';
	ele.style.backgroundColor="#919191";
}

function sendPrev( wind ){
	if(wind.opener != null && typeof(wind.opener) != "unknown" && typeof(wind.opener) != "undefined"){
		if(typeof(wind.opener.document) != "unknown" && typeof(wind.opener.document) != "undefined"){
			if(typeof(wind.opener.document.getElementById('sendMail')) != "unknown" && typeof(wind.opener.document.getElementById('sendMail')) != "undefined"){
				wind.opener.document.getElementById('sendMail').click();
				windowClose( wind );
				return true;
			}
		}
	}
	wind.document.getElementById('sendInPrevId').submit();
}

function windowClose( wind ){
	wind.open('', '_top'); 
	wind.top.close();
}

function nextcode( obj, next ) {
	var id = Math.random();
	if(next) id += '&uns=1';
	obj.src = '/image.php?id=' + id;
}

function changecard( id, src ) {
	var obj = document.getElementById(id);
	if(obj) {
		obj.src = src;
		//var obj2 = document.getElementById(id+'_input');
		//if(obj2) obj2.value = src;
	}
}

function getsrc( id ) {
	var obj = document.getElementById(id);
	if(obj) {
		return obj.src;
	}
}
