<!--

// --------------------------------------------------------------------------

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 = '/do/jslogger/default.aspx?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;

// --------------------------------------------------------------------------

function MD_Void() {
	return;
}

// --------------------------------------------------------------------------

rightColVideosNav_Page = 0;
rightColGaleriesNav_Page = 0;

function rightColVideosNav(w) {
	
	var i;
	var sumNav = (w=='prev') ? -1 : 1;
	var pgsNav = Math.floor(right_vids.length/3)-1;
	var startI;
	var endI;
	var currI;
	
	//
	
	if((rightColVideosNav_Page+sumNav) > pgsNav || (rightColVideosNav_Page+sumNav) < 0) {
		return;
	} else {
		rightColVideosNav_Page += sumNav;
		startI = rightColVideosNav_Page * 3
		endI = (rightColVideosNav_Page * 3) + 1;
	}
	
	//

	for(i=0;i<3;i++) {
		currI = startI+i;
		if(right_vids[currI]) {
			document.getElementById('rightcol-videos-lnk-' + i).href = right_vids[currI].split('|')[0];
			document.getElementById('rightcol-videos-img-' + i).src = right_vids[currI].split('|')[1];
			document.getElementById('rightcol-videos-title-' + i).innerHTML = right_vids[currI].split('|')[2];
			document.getElementById('rightcol-videos-time-' + i).innerHTML = right_vids[currI].split('|')[3];
		}	
	}
	
	//
	
	if(rightColVideosNav_Page == 0) {
		document.getElementById('rightcol-videos-arrprev').className = 'rightcol-videos-arrprev-off';
	} else {
		document.getElementById('rightcol-videos-arrprev').className = 'rightcol-videos-arrprev-on';
	}
	
	if(rightColVideosNav_Page == pgsNav) {
		document.getElementById('rightcol-videos-arrnext').className = 'rightcol-videos-arrnext-off';
	} else {
		document.getElementById('rightcol-videos-arrnext').className = 'rightcol-videos-arrnext-on';
	}
	
}

function rightColGaleriesNav(w) {

	var i;
	var sumNav = (w=='prev') ? -1 : 1;
	var pgsNav = Math.floor(right_gals.length/6)-1;
	var startI;
	var endI;
	var currI;
	
	//
	
	if((rightColGaleriesNav_Page+sumNav) > pgsNav || (rightColGaleriesNav_Page+sumNav) < 0) {
		return;
	} else {
		rightColGaleriesNav_Page += sumNav;
		startI = rightColGaleriesNav_Page * 6
		endI = (rightColGaleriesNav_Page * 6) + 1;
	}
	
	//

	for(i=0;i<6;i++) {
		currI = startI+i;
		if(right_gals[currI]) {
			document.getElementById('rightcol-galeries-lnk-' + i).href = right_gals[currI].split('|')[0];
			document.getElementById('rightcol-galeries-img-' + i).src = right_gals[currI].split('|')[1];
		}	
	}
	
	//
	
	if(rightColGaleriesNav_Page == 0) {
		document.getElementById('rightcol-galeries-arrprev').className = 'rightcol-videos-arrprev-off';
	} else {
		document.getElementById('rightcol-galeries-arrprev').className = 'rightcol-videos-arrprev-on';
	}
	
	if(rightColGaleriesNav_Page == pgsNav) {
		document.getElementById('rightcol-galeries-arrnext').className = 'rightcol-videos-arrnext-off';
	} else {
		document.getElementById('rightcol-galeries-arrnext').className = 'rightcol-videos-arrnext-on';
	}
	
}

// --------------------------------------------------------------------------

function commentTextBlur(src, maxc) {

	var t2;
	t2 = document.getElementById('txtText');

	if(src.value.length > maxc) {
		src.value = src.value.substring(0, maxc);
		alert('El texto del comentario no de exceder los ' + maxc + ' caracteres.');		
	}

}

function commentTextCount(maxc) {
	var charsleft = maxc - document.getElementById('txtText').value.length;
	if(charsleft >= 0) {
		document.getElementById('CharsLeftSpan').innerHTML = charsleft;	
	} else {
		document.getElementById('CharsLeftSpan').innerHTML = '0';	
	}
}


// --------------------------------------------------------------------------

function flashTopLogin(act) {

	if(act == 'login') {
		setTimeout('flashTopLogin(\'green\');', 300);
		setTimeout('flashTopLogin(\'blank\');', 600);
		setTimeout('flashTopLogin(\'green\');', 900);
		setTimeout('flashTopLogin(\'blank\');', 1200);
		setTimeout('flashTopLogin(\'green\');', 1500);
		setTimeout('flashTopLogin(\'blank\');', 1800);
		setTimeout('flashTopLogin(\'green\');', 2100);
		setTimeout('flashTopLogin(\'blank\');', 2400);
		setTimeout('flashTopLogin(\'green\');', 2700);
		setTimeout('flashTopLogin(\'blank\');', 3000);
	}
	
	if(act == 'logout') {
		setTimeout('flashTopLogin(\'red\');', 300);
		setTimeout('flashTopLogin(\'blank\');', 600);
		setTimeout('flashTopLogin(\'red\');', 900);
		setTimeout('flashTopLogin(\'blank\');', 1200);
		setTimeout('flashTopLogin(\'red\');', 1500);
		setTimeout('flashTopLogin(\'blank\');', 1800);
		setTimeout('flashTopLogin(\'red\');', 2100);
		setTimeout('flashTopLogin(\'blank\');', 2400);
		setTimeout('flashTopLogin(\'red\');', 2700);
		setTimeout('flashTopLogin(\'blank\');', 3000);
	}	
	
	if(act == 'green') {
		document.getElementById('header-logo-logged').style.backgroundColor = '#DDFBC8';
	}
	
	if(act == 'red') {
		document.getElementById('header-logo-logged').style.backgroundColor = '#FBD7D7';
	}
	
	if(act == 'blank') {
		document.getElementById('header-logo-logged').style.backgroundColor = '';
	}	
	
}

// --------------------------------------------------------------------------

var sessionPingStarted = false;
function MD_DoSessionPing(firstStart) {

	if(firstStart) {
		if(!sessionPingStarted) {
			sessionPingStarted = true;
			setTimeout('MD_DoSessionPing(false);', 1000*30);
		}
	} else {
		if(sessionPingStarted) {
			setTimeout('MD_DoSessionPing(false);', 1000*60);
			var newSessImg;
			newSessImg = new Image();
			newSessImg.src = '/do/account_session_ping.aspx?' + escape(new Date());	
		}
	}
	
}

// --------------------------------------------------------------------------

function MD_OpenWin(theURL, winName, features) {
	window.open(theURL, winName, features);
}

// --------------------------------------------------------------------------

function MD_NpSurveyVote(s, a) {
	location.href = '/dr/surveys?action=vote&s=' + s + '&a=' + a;
}

function MD_NpReportPost(itemType, itemId, commentId) {
	MD_OpenWin('/reportar-post?itemType=' + escape(itemType) + '&itemId=' + itemId + '&commentId=' + commentId, 'ReportCommentWindow', 'width=475,height=420,scrollbars=yes');
}

function MD_OpenSendToFriend(itemType, itemId) {
	MD_OpenWin('/enviar-a-amigo?item_type='+escape(itemType)+'&item_id=' + itemId, 'SendArticleWindow', 'width=515,height=550,scrollbars=yes');
}

// --------------------------------------------------------------------------

function MD_OpenTermsOfUse() {
	MD_OpenWin('/terminos-uso', 'TermsOfUseWindow', 'width=475,height=470,scrollbars=yes');
}

function MD_OpenPostingRules() {
	MD_OpenWin('/reglas-posteo', 'PostingRulesWindow', 'width=475,height=470,scrollbars=yes');
}

// --------------------------------------------------------------------------

function startPrint() {
	window.print();
}

// --------------------------------------------------------------------------

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_GetHttpObj(textMode) {
	try {	
		var returnObj;
		if(window.XMLHttpRequest) { 
			returnObj = new XMLHttpRequest();
			if (returnObj.overrideMimeType) {
				if(textMode) {
					returnObj.overrideMimeType('text/plain');
				} else {
					returnObj.overrideMimeType('text/xml');
				}
			}
		} else if(window.ActiveXObject) {
			try {
				returnObj = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					returnObj = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
	} catch(e) {
		returnObj = false;
	}	
	return returnObj;
}

// --------------------------------------------------------------------------

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;
	var atchar;
	atchar = '@';
	emx = p1 + atchar + 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_GCookie(cn) {
	var start = document.cookie.indexOf(cn + '=');
	var len = start + cn.length + 1;
	if((!start) && (cn != document.cookie.substring(0, cn.length))) return null;
	if(start == -1) return null;
	var end = document.cookie.indexOf(';', len);
	if(end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len, end));
}

function MD_SCookie(cn, cv, cp, cex, cd, cs) {
	var today = new Date();
	today.setTime(today.getTime());
	if (cex) cex = cex * 1000;
	var ex_date = new Date(today.getTime() + (cex));
	document.cookie = cn+'='+escape(cv) +
		((cex) ? ';expires='+ex_date.toGMTString() : '') +
		((cp) ? ';path=' + cp : '') +
		((cd) ? ';domain=' + cd : '') +
		((cs) ? ';secure' : '');
}

function MD_DCookie(cn, cp, cd) {
	if(_agbm_ckG(cn)) {
		document.cookie = cn + '=' +
			((cp) ? ';path=' + cp : '') +
			((cd) ? ';domain=' + cd : '') +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
	}
}

function MD_DyToSec(dy) {
	return dy * 60 * 60 * 24;
}

function MD_MnToSec(mn) {
	return mn * 60;
}

// --------------------------------------------------------------------------

function MD_ToggleActiveStyleSheet(ttl) {

	var i;
	var c;

	for(i=0; (c = document.getElementsByTagName("link")[i]); i++) {
		if(c.getAttribute("rel").indexOf("style") != -1 && c.getAttribute("title")) {
			c.disabled = true;
			if(c.getAttribute("title") == ttl) {
				c.disabled = false;
			}
		}
	}
	
}

// --------------------------------------------------------------------------

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';		
	}

}

-->