var _startShowMenu = 0;
var _firstMenu ='';
function ShowHeaderMenu(menu)
{
	if (_firstMenu=='' && menu!='') _firstMenu = menu;
	MouseOverMenu();
	DisplayAllElement('none');
	switch (menu)
	{
		case "home":
			DisplayElement('divHome','block');
			SetCalssElement('liHome','home-on');
		break;
		case "productos":
			DisplayElement('divProductos','block');		
			SetCalssElement('liProductos','productos-on');			
		break;
		case "servicios":
			DisplayElement('divServicios','block');		
			SetCalssElement('liServicios','servicios-on');			
		break;
		case "compania":
			DisplayElement('divCampania','block');		
			SetCalssElement('liCompania','compania-on');			
		break;
		case "clientes":
			DisplayElement('divClientes','block');		
			SetCalssElement('liClientes','clientes-on');			
		break;
		case "blog":
			DisplayElement('divBlog','block');		
			SetCalssElement('liBlog','blog-on');			
		break;
		case "ndwaytv":
			DisplayElement('divNDWtv','block');		
			SetCalssElement('liNDWAY','ndwaytv-on');			
		break;
		case "contacto":
			DisplayElement('divContacto','block');		
			SetCalssElement('liContacto','contacto-on');			
		break;		
	}
}
function DisplayAllElement(sDisplay)
{
	
	DisplayElement('divHome',sDisplay);
	SetCalssElement('liHome','home');
	DisplayElement('divProductos',sDisplay);
	SetCalssElement('liProductos','productos');
	DisplayElement('divServicios',sDisplay);
	SetCalssElement('liServicios','servicios');	
	DisplayElement('divCampania',sDisplay);
	SetCalssElement('liCompania','compania');	
	DisplayElement('divClientes',sDisplay);
	SetCalssElement('liClientes','clientes');	
	DisplayElement('divBlog',sDisplay);
	SetCalssElement('liBlog','blog');	
	DisplayElement('divNDWtv',sDisplay);
	SetCalssElement('liNDWAY','ndwaytv');	
	DisplayElement('divContacto',sDisplay);	
	SetCalssElement('liContacto','contacto');	
}
function DisplayElement(sIdElement,sDisplay)
{
	ob =document.getElementById(sIdElement);
	if (ob!=null) {ob.style.display = sDisplay;}
}
function SetCalssElement(sIdElement,sClassName)
{
	ob =document.getElementById(sIdElement);
	if (ob!=null) {ob.className = sClassName;}
}
function MouseOverMenu()
{
	_startShowMenu = 1;
}
function MouseOutMenu()
{
	_startShowMenu = 0;
	scriptFunction = " if (_startShowMenu==0) {DisplayAllElement('none'); ShowHeaderMenu('" + _firstMenu + "'); }";
	setTimeout(scriptFunction,1000)
}

function validateEMailFormat(sIdControl)
{
    var obj = document.getElementById(sIdControl);
    if (obj!=null)
        {return !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(obj.value));}
    else
        {return false;}
}
var entities=[
                ['&amp;','&'],
                ['&nbsp;',' '],
                ['&lt;','<'],
                ['&gt;','>']
             ];
function decodeHTML(sValue){
    var clean = sValue.replace(/<[^>]*>/g,"");
        
    for( var i=0, limit=entities.length; i < limit; ++i)
    {
        clean = clean.replace( new RegExp(entities[i][0],"ig"), entities[i][1]);
    }
    return clean;
}