//
//Sostiene el efecto hover al pasar al submenu css
//
menuHover = function(nav) {
var sfEls = document.getElementById(nav).getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++) {
  sfEls[i].onmouseover=function() {
	this.className+=" sfhover";
  }
  sfEls[i].onmouseout=function() {
	this.className=this.className.replace(new RegExp("\\s?sfhover\\b"), "");
  }
}

var listItem = document.getElementById(nav).getElementsByTagName('ul');
for(var i=0;i<listItem.length;i++) {
  listItem[i].onmouseover=function() {
	var changeStyle = this.parentNode.getElementsByTagName('a');
	changeStyle[0].className+=" active";
  }

  listItem[i].onmouseout=function() {
	var changeStyle = this.parentNode.getElementsByTagName('a');
	changeStyle[0].className=this.className.replace(new RegExp("\\s?active\\b"), "");
  }
}
}

function addEvent( obj, type, fn ) {
if ( obj.attachEvent ) {
  obj['e'+type+fn] = fn;
  obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
  obj.attachEvent( 'on'+type, obj[type+fn] );
} else
  obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
if ( obj.detachEvent ) {
obj.detachEvent( 'on'+type, obj[type+fn] );
obj[type+fn] = null;
} else
  obj.removeEventListener( type, fn, false );
}

addEvent(window, 'load', function () { menuHover('main'); });

//
//Muestra-oculta las capas del submenu
//
function abrirCerrar(pstrIdDiv){
if (document.getElementById(pstrIdDiv).className=="cerrado"){
document.getElementById(pstrIdDiv).className="abierto"
}else{
	document.getElementById(pstrIdDiv).className="cerrado"
}
}

//
//Ventana para project developer
//
var newwindow;
function projectMap(url)
{
	newwindow=window.open(url,'name','height=650,width=945');
	if (window.focus) {newwindow.focus()}
}

//
//Ventana para privacidad
//
var privacyw;
function privacyPop(url)
{
	privacyw=window.open(url,'name','height=620,width=740,scrollbars=yes');
	if (window.focus) {privacyw.focus()}
}

//
//Ventana para videos Youtube
//
var newwindow;
function watchVideo(url)
{
	newwindow=window.open(url,'name','height=344,width=425');
	if (window.focus) {newwindow.focus()}
}

//
//Ventana para cuestionario
//
var newwindow;
function questionario(url)
{
	newwindow=window.open(url,'name','height=720,width=740,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
