<!--

// Navigation
// --------------------------------------------------------------------------

window.onload = MD_TopNav_AssignEvents;

function MD_TopNav_LiEvent(src, act) {

	if(act == 1) {
		var thisTopLnk = src.getElementsByTagName("a");
		if(thisTopLnk != null && thisTopLnk != "undefined") {
			thisTopLnk[0].className = 'page-header-topnav-a-hovered';
		}
	}

	if(act == 2) {
		var thisTopLnk = src.getElementsByTagName("a");
		if(thisTopLnk != null && thisTopLnk != "undefined") {
			thisTopLnk[0].className = 'topnav_boton';
		}	
	}

}

function MD_TopNav_AssignEvents() {

	if (document.getElementById && document.all) {
	
		var topnavNodes;
		var topnavNode;
		topnavNodes = document.getElementById('page-header-topnav');
			
		for (i=0;i<topnavNodes.childNodes.length; i++) {
				
			topnavNode = topnavNodes.childNodes[i];

			if (topnavNode.nodeName == "LI") {

				topnavNode.onmouseover = function() {
					this.className += " over";	

					var thisTopLnk = this.getElementsByTagName("a");
					if(thisTopLnk != null && thisTopLnk != "undefined") {
						thisTopLnk[0].className = 'page-header-topnav-a-hovered';
					}

				}
				
				topnavNode.onmouseout = function() {				
					this.className = this.className.replace(" over", "");	
					
					var thisTopLnk = this.getElementsByTagName("a");
					if(thisTopLnk != null && thisTopLnk != "undefined") {
						thisTopLnk[0].className = '';
					}					

					
				}
				
			}
			
		}
		
	}
	
}

// --------------------------------------------------------------------------

function MD_WFlash(fileUrl, divDestination, sizeX, sizeY, useWmode) {

	var swfHtml;
	swfHtml = '';
	swfHtml += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + sizeX + '" height="' + sizeY + '">';
	swfHtml += '<param name="movie" value="' + fileUrl + '">';
	swfHtml += '<param name="quality" value="high">';

	if(useWmode) {
		swfHtml += '<param name="wmode" value="transparent">';
	}

	if(useWmode) {
		swfHtml += '<embed src="' + fileUrl + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + sizeX + '" height="' + sizeY + '" wmode="transparent">';
	} else {
		swfHtml += '<embed src="' + fileUrl + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + sizeX + '" height="' + sizeY + '">';
	}	
		
	swfHtml += '</embed></object>';

	if(document.getElementById(divDestination)) {
		document.getElementById(divDestination).innerHTML = swfHtml;
	} else {
		document.write(swfHtml);
	}

}

// --------------------------------------------------------------------------

function MD_GetClientSize() {

	var clwidth = 0;
	var clheight = 0;

	try {
		if(typeof(window.innerWidth) == 'number') {
			clwidth = window.innerWidth;
			clheight = window.innerHeight;
		} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
			clwidth = document.documentElement.clientWidth;
			clheight = document.documentElement.clientHeight;
		} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
			clwidth = document.body.clientWidth;
			clheight = document.body.clientHeight;
		}
	} catch(ex) {
		clwidth = 0;
		clheight = 0;
	}
	
	if(clwidth < 0) { clwidth = 0; }
	if(clheight < 0) { clheight = 0; }	
	return [clwidth, clheight];
	
}

function MD_GetClientScroll() {

	var scrX = 0;
	var scrY = 0;
	
	try {
		if(typeof(window.pageYOffset) == 'number') {
			scrY = window.pageYOffset;
			scrX = window.pageXOffset;
		} else if( document.body && (document.body.scrollLeft || document.body.scrollTop)) {
			scrY = document.body.scrollTop;
			scrX = document.body.scrollLeft;
		} else if( document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
			scrY = document.documentElement.scrollTop;
			scrX = document.documentElement.scrollLeft;
		}
	} catch(ex) {
		scrX = 0;
		scrY = 0;	
	}

	if(scrX < 0) { scrX = 0; }
	if(scrY < 0) { scrY = 0; }	
	return [scrX, scrY];
	
}

// --------------------------------------------------------------------------

function MD_VImg(whatSrc, sw, sh) {

	if(!document.getElementById('MD_VImg_JS')) {
		var MD_New_VImg = document.createElement('div');
		MD_New_VImg.setAttribute('name', 'MD_VImg_JS');
		MD_New_VImg.setAttribute('id', 'MD_VImg_JS');
		document.body.appendChild(MD_New_VImg);		
	}

	if(document.getElementById('MD_VImg_JS')) {

		var totalW = (sw+20);
		var totalH = (sh+30);
		
		var VImgDiv = document.getElementById('MD_VImg_JS');
		
		VImgDiv.style.width = totalW + 'px';
		VImgDiv.style.height = totalH + 'px';
		
		var clwidth;
		var clheight;
		var clscrolly;
		
		try {
			clwidth = MD_GetClientSize()[0];
			clheight = MD_GetClientSize()[1];
			clscrolly = MD_GetClientScroll()[1];
		} catch(ex) {
			clheight = 25;
			clheight = 25;
			clscrolly = 0;
		}		
		
		VImgDiv.style.top = ((clheight/2)-(totalH/2)+clscrolly) + 'px';
		VImgDiv.style.left = ((clwidth/2)-(totalW/2)) + 'px';		

		var imghtml;
		imghtml = '';
		imghtml += '<table width="100%" height="'+sh+'" cellspacing="0" cellpadding="0" border="0">';
		imghtml += '<tr><td align="left" style="padding:5px;"">';
		imghtml += '<a href="javascript:MD_VImgH();" class="image_viewer_closelink">';
		imghtml += 'Cerrar';
		imghtml += '</a>';
		imghtml += '</td></tr>';
		imghtml += '<tr><td width="100%" height="100%" align="center" valign="middle">';
		imghtml += '<a href="javascript:MD_VImgH();">';
		imghtml += '<img alt="Click para cerrar" src="'+whatSrc+'" border="0">';
		imghtml += '</a>';
		imghtml += '</td></tr>';
		imghtml += '</table>';
	
		VImgDiv.innerHTML = imghtml;
		VImgDiv.style.visibility = 'visible';
		VImgDiv.style.display = 'block';		
		
	}

}

function MD_VImgH() {

	if(document.getElementById('MD_VImg_JS')) {
		document.getElementById('MD_VImg_JS').style.visibility = 'hidden';
		document.getElementById('MD_VImg_JS').style.display = 'none';		
	}

}

// --------------------------------------------------------------------------

function MD_PrintPage() {
	
	try {

		var currentLoc = location.href;
		var printLoc = '';
		
		if(currentLoc.indexOf('printerFriendlyVersion') == -1) {
			if(currentLoc.indexOf('?') != -1) {
				printLoc = currentLoc + '&printerFriendlyVersion=true';
			} else {
				printLoc = currentLoc + '?printerFriendlyVersion=true';
			}
		} else {
			printLoc = currentLoc;
		}
		
		var printWin = window.open(printLoc, 'printWin', 'width=700,scrollbars=yes,menubar=yes,toolbar=yes,status=yes');

		
	} catch (e) {
		self.window.print();
	}
	
}

// --------------------------------------------------------------------------

function MD_BKPage() {
	if (window.sidebar && window.sidebar.addPanel) { 
		window.sidebar.addPanel(document.title, location.href,''); 
	} else if(window.external) {
		window.external.AddFavorite(location.href, document.title);
	} else {
		alert('Su navegador no soporta esta opción. Por favor realícela manualmente.');
	}
}

// --------------------------------------------------------------------------

function MD_InsertMailLink(p1, p2, htmlTemplate) {

	var emx;
	emx = p1 + '@' + p2;
	
	var genx;
	if(htmlTemplate.indexOf('$emx_here$') == -1) {
		window.status = 'htmlTemplate doesn\'t containe $emx_here$.';
	} else {
		genx = htmlTemplate.replace(/\$emx_here\$/g, emx);
	}

	document.write(genx);
	
}

// --------------------------------------------------------------------------

function MD_err(msg, url, line) {
	try {	
		if(url.toLowerCase().indexOf('http://localhost') == -1 && url.toLowerCase().indexOf('http://192.') == -1) {
			var MD_ErrImg = new Image;
			MD_ErrImg.src = '/site/logger/?msg='+escape(msg)+'&url='+escape(url)+'&line='+escape(line);
			return true;
		} else {
			alert('JS Exception:\n' + msg + '\n' + url + '\n' + line)
		}
	} catch(e) {}	
}

window.onerror = MD_err;

// --------------------------------------------------------------------------

-->