
var div = null;


function MailTempObj(Language)
{
	/*
	this.firstname=firstname;
	this.lastname=lastname;
	this.age=age;
	this.eyecolor=eyecolor;
	*/
	if (Language.toUpperCase()=='B5')
	{	// For Chinese error message
		this.Languages = 'b5';
		this.SubjectText = '認識更多有關';
		this.SubjectTextFinish = '資訊';
		this.BodyTextHead = '致好友:%0A%0A%0A%0A請瀏覽以下網址，認識更多有關 ';
		this.BodyText = '資訊%0A%0A';
		this.BodyEnd = '%0A%0A%0A%0A謝謝。';
	}else
	{	// For English error message
		this.Languages = 'e5';
		this.SubjectText = 'Know more about';
		this.SubjectTextFinish = '';
		this.BodyTextHead = 'Dear friends:%0A%0A%0A%0APlease visit the link below to learn more about ';
		this.BodyText = '%0A%0A';
		this.BodyEnd = '%0A%0A%0A%0AThank you.';
	}
	/*
		// For new use

	*/
}



function MailToFrineds(obj,IndexValue)
{

	var Requestlink = window.location.pathname.split('/');
	var Language = String(Requestlink[Requestlink.length-1]).substring(0,2);
	MailTemp = new MailTempObj(Language);
	var hostlink = window.location;


	var iframeEl = document.getElementById('ifrm');
	div = iframeEl ;

	if ( div.contentDocument ) { // DOM
        var form = div.contentDocument.getElementById('ifrmTest');
    } else if ( div.contentWindow ) { // IE win
        var form = div.contentWindow.document.getElementById('ifrmTest');
    }
    form.SubjectText.value = MailTemp.SubjectText + ' ' + obj + ' ' + MailTemp.SubjectTextFinish ; 
	form.action = 'MailTo.asp';

	var SharpIndex = String(hostlink).indexOf('#');
	if (SharpIndex>0)
	{	
		hostlink = String(hostlink).substring(0,SharpIndex);
	}
	form.BodyText.value = MailTemp.BodyTextHead + obj + MailTemp.BodyText + hostlink + '#' + IndexValue + '  ' + MailTemp.BodyEnd;
	
	//Submit the form;
	form.action1.click();

	//Close the page
	setTimeout('ReloadPage()',500);

}

function ReloadPage ()
{
	if (div!=null || div!='')
	{	
		div.src = 'Mailto.asp';
		div = null;
	}
}