// JavaScript Document

function toggle(id) {
     var state = document.getElementById(id).style.display;
	if (state == 'block') {
		document.getElementById(id).style.display = 'none';
	} else {
		document.getElementById(id).style.display = 'block';
	}
}

function onNav(id){
     clearAll();
     toggleOn( 'smenu_'+id );
}

function toggleOff(id){
     var item = document.getElementById(id);

     if(item)
          item.style.display = 'none';
}

function toggleOn(id){
     var item = document.getElementById(id);

     if(item){
          item.style.display = 'block';

          var cnt = document.getElementById('lnav-expansion-container');


          var browserName=navigator.appName;
          var browserVer=parseInt(navigator.appVersion);

          //alert( browserName+' '+ browserVer);

          if (browserName=="Microsoft Internet Explorer"){
               if (window.XMLHttpRequest) {

                    if(cnt){
                         cnt.style.marginTop = "-2px";
                    }

               }

          }

     }
}

function clearAll(){

     toggleOff('smenu_3');
     toggleOff('smenu_5');
     toggleOff('smenu_4');

     var cnt = document.getElementById('lnav-expansion-container');

     if(cnt){
          cnt.style.marginTop = "0px";
     }

     //toggleOff('products');
     //toggleOff('clients');

}


function goToOptValue(xselect){

     if(xselect){

          var dropdownIndex = xselect.selectedIndex;
          var dropdownValue = xselect[dropdownIndex].value;

          window.location = dropdownValue;
          //alert(dropdownValue);


     }

}

/**
 * web safe email mailto: link
 */
function semail(name, domain){

     var email_address = name+'@'+domain;
     document.write( '<a href="mailto:'+email_address+'">'+email_address+'</a>' );
}

