/* Browser check */
IS_DOM = (document.getElementById) ? true : false;

function toggleList()
{
	var theListItems = document.getElementById("penListUl").getElementsByTagName("LI");
	if (penListState == "off") {
		turnListOn(theListItems);
	} else {
		turnListOff(theListItems);
	}
}

function turnListOn(theListItems)
{
	for (var i = 0; i < theListItems.length; i++)
	{ 
		theListItems[i].style.display = "inline";
	}
	penListState = "on";
}

function turnListOff(theListItems)
{
	for (var i = 0; i < theListItems.length; i++)
	{ 
		theListItems[i].style.display = "none";
	}
	document.getElementById("firstOne").style.display = "inline";
	penListState = "off";
}

// JavaScript Document
// JavaScript Document
var address;
function displayEmail() { 
    var x = document.getElementsByTagName('span');

    for (var i=0;i<x.length;i++) {
        if (x[i].className == 'hiddenemail') {
			scanHiddenEmail(x[i])
                if ((x[i].innerHTML !== null) && (address !== null))
                x[i].innerHTML = '<a href=\'mailto:' + address + '\'>' + address + '</a>';
        }
		
		if (x[i].className == 'hiddenTitleEmail') {	
			scanHiddenEmail(x[i])
                if ((x[i].innerHTML !== null) && (address !== null))
  				         x[i].innerHTML = '<a href=\'mailto:' + address + '\'><img src=\'../../images/subpage-email.gif \' height= \'33\' /> </a>';
             
		}
        
        if (x[i].className == 'hiddenMenuEmail') {    
            scanHiddenEmail(x[i])
                if ((x[i].innerHTML !== null) && (address !== null))
                           x[i].innerHTML = '<a href=\'mailto:' + address + '\'><img src=\'images/subpage-email.gif \' height= \'33\' /> </a>';
             
        }
        
		if (x[i].className == 'hiddenMainPageEmail') {	
			scanHiddenEmail(x[i])
                if ((x[i].innerHTML !== null) && (address !== null))
  				         x[i].innerHTML = '<a href=\'mailto:' + address + '\'><img src=\'images/email.gif \' width=\'233\' height= \'27\' /> </a>';
             
		}
		
    }
}


function scanHiddenEmail(s) {
	var y = s.getElementsByTagName('span');
                for (var j=0;j<y.length;j++) {
                    if (y[j].className == 'name') {
                        if (y[j].innerHTML !== null)
                        address = y[j].innerHTML + '@';
                    }
                    if (y[j].className == 'domain') {
                        if (y[j].innerHTML !== null)
                        address = address + y[j].innerHTML + '.';
                    }
                    if (y[j].className == 'extension') {
                        if (y[j].innerHTML !== null)
                        address = address + y[j].innerHTML;
                    }
                 }
 return address;           
}
