
// Menu
function InitMenu(menu)
{
    if (!document.all || !document.getElementById) return;
	navRoot = document.getElementById(menu);
	for (i=0; navRoot && i<navRoot.childNodes.length; i++) 
	{
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") 
		{
			node.onmouseover=function() {	this.className+=" over";	}
			node.onmouseout=function() 	{	this.className=this.className.replace(" over", "");	}
		}
	}
}

//Initialize
function Initialize()
{
    InitMenu("menu");
    InitMenu("submenu");
    InitMenu("leftmenu");
    InitMenu("leftmenu1");
    InitMenu("leftmenu2");
    
	var url = new String(window.location);
	var strFile = url.substr(url.indexOf(".com/") + 5);
	if (strFile.indexOf("#")!=-1) strFile = strFile.substr(0, strFile.indexOf("#"));
	if(!strFile) strFile = "index.htm";    
    var strSite = "http://www.aamailsoft.com/";
	var link = document.getElementById("idlink");
	if (link) link.href = strSite + strFile;    
}

window.onload=Initialize;

//Write current year
function Year()
{
	var today = new Date();
	document.write(today.getFullYear());
}

// H2Title
function H2Title(idObject, nWidth, nTopMargin, nBottomMargin)
{
    var subfolder = false;
    var url = new String(window.location);
    
    if (url.indexOf("/smtp-server/")!=-1 ||
        url.indexOf("/mail-server/")!=-1 ||
        url.indexOf("/file-sharing/")!=-1)
    {
        subfolder = true;
     }

    var obj = document.getElementById(idObject);
    if (!obj) return;
    var strText = obj.innerHTML;
    
    if (nWidth==-1) nWidth=250;
    if (nTopMargin==-1) nTopMargin=10;
    if (nBottomMargin==-1) nBottomMargin = 8;
    
    var strHtml = "";
    strHtml += ("<table width=" + nWidth + " border=0 cellspacing=0 cellpadding=0>");
    strHtml += ("<tr><td height=" + nTopMargin + ">");
  	strHtml += ("<tr><td>"); 
    strHtml += ("  <table width=100%% border=0 cellpadding=0 cellspacing=1>");
    strHtml += ("  <tr><td valign='bottom'>" + strText);
    strHtml += ("  <tr><td height=3>");
    strHtml += ("  </table>");
    strHtml += ("  <tr><td>"); 
    strHtml += ("    <table width=100% border=0 cellspacing=0 cellpadding=0>");
    strHtml += ("    <tr><td width=120>");
    strHtml += ("              <table width=100%% border=0 cellpadding=0 cellspacing=0>");
    strHtml += ("              <tr>"); 
    strHtml += ("                  <td width=27><img src='images/tit_img1.gif' width=27 height=3></td>");
    strHtml += ("                  <td bgcolor=#0496D2><img src='images/tit_img3.gif'></td>");
    strHtml += ("                  <td width=67><img src='images/tit_img2.gif' width=67 height=3></td>");
    strHtml += ("              </table>");
    strHtml += ("        <td background='images/tit_imgbg.gif'><img src='images/tit_imgbg.gif' width=1 height=3></td>");
    strHtml += ("    </table>");
    strHtml += ("<tr><td height=" + nBottomMargin + ">");
    strHtml += ("</table>");   

    if (subfolder) 
    {
        strHtml = strHtml.replace("images/tit_imgbg.gif", "../images/tit_imgbg.gif"); 
        strHtml = strHtml.replace("images/tit_img1.gif", "../images/tit_img1.gif"); 
        strHtml = strHtml.replace("images/tit_img2.gif", "../images/tit_img2.gif"); 
        strHtml = strHtml.replace("images/tit_img3.gif", "../images/tit_img3.gif"); 
    }
    obj.innerHTML = strHtml;
}

function submitQuestion()
{
	var form = document.forms[0];
	if (form.nickname.value.length<=1)
	{
		alert("Please input your name!");
		form.nickname.focus();
		return;
	}
	if (form.email.value.length<=1 ||
		form.email.value.indexOf('@')==-1)
	{
		alert("Please input your email address!");
		form.email.focus();
		return;
	}
	if (form.note.value.length<=16)
	{
		alert("Please input valid question content!");
		form.note.focus();
		return;
	}
	form.submit();
}
