// EMAIL SPAM TOOL

function e(e1,e2,e3,e4) {
	var ex,a,a2;
	a = e1+"@"+e2;
	a2 = ((e4 != null) && (e4 != '')) ? e4 : a;
	if ((e3 != null) &&(e3 != '')) ex="?"+e3; else ex="";
	document.write('<a href="mailto:'+a+ex+'">'+a2+'</a>')
}

// TAB STRIP

var activeTab = 1;

function openTab(tabId) {

// reset old tab and content

document.getElementById("tabLink"+activeTab).className = "tabLink";
document.getElementById("tabContent"+activeTab).className = "tabContent";

// set new tab and content

document.getElementById("tabLink"+tabId).className = "tabLinkActive";
document.getElementById("tabContent"+tabId).className = "tabContentActive";
activeTab = tabId;
}

// DHTML TOGGLE

function dropText(target_name, path)
{
    var target
    target = document.getElementById(target_name)
    if (target == null)
        return;
    if (target.style.visibility == 'hidden')
    {
        target.style.visibility = 'visible';
        target.style.display = 'block';
        if (path != null) document[target_name + 'Arrow'].src = path + 'dropArrowDown.gif';
    }
    else
    {
        target.style.visibility = 'hidden';
        target.style.display = 'none';
        if (path != null) document[target_name + 'Arrow'].src = path + 'dropArrowRight.gif';
    }
}

function clickclear(thisfield, defaulttext) {if (thisfield.value == defaulttext) {thisfield.value = "";	}}
function clickrecall(thisfield, defaulttext) {if (thisfield.value == "") {thisfield.value = defaulttext;}}


function uploadEnable(enableDiv,disableDiv)
{
	document.getElementById(enableDiv).style.display='inline';
	document.getElementById(disableDiv).style.display='none';
}


// FORM VALIDATION
function validateEmail(email_id)
{

   var reg = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
   var address = document.getElementById(email_id).value;
   if(reg.test(address) == false)
   {
	showError(email_id,0);
	return false;
   }
   else
   {
	showError(email_id,1);
	return true;
   }

}// end

function validateRegistrationForm(id)
{
	if (!document.getElementById(id).value)
	{
		showError(id,0);
		return false;
	} else {
		showError(id,1);
		return true;
	}

}// end


function showError(id,valid)
{

	if (!valid)
	{
		document.getElementById(id).style.background   ="#F8DBDB";
		document.getElementById(id).style.borderColor ="#E77776";
		document.getElementById(id+"Error").style.display = "block";
		scroll(0,0)
	  return false;
	}
	else
	{
		document.getElementById(id).style.background   ="#FFFFFF";
		document.getElementById(id).style.borderColor ="#D9D9D9";
		document.getElementById(id+"Error").style.display = "none";
		
	  return true;
	}

}// end
