
var countdownTimer=new Object();var commentshowreply=new Object();function getElementsByClassName(classname){if(document.getElementsByTagName){var els=document.getElementsByTagName("*");var c=new RegExp('/b^|'+classname+'|$/b');elem=new Array();var n=0;for(var i=0;i<els.length;i++){if(els[i].className){if(c.test(els[i].className)){elem[n]=els[i];n++;}}}
return elem;}else{return false;}}
function getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)
endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}
function GetCookie(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg)
return getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}
return null;}
function SetCookie(name,value){var argv=SetCookie.arguments;var argc=SetCookie.arguments.length;var expires=(argc>2)?argv[2]:null;if(expires){var date=new Date();date.setTime(date.getTime()+(expires*24*60*60*1000));var expires="; expires="+date.toGMTString();}
var path=(argc>3)?argv[3]:null;var domain=(argc>4)?argv[4]:null;var secure=(argc>5)?argv[5]:false;document.cookie=name+"="+escape(value)+
((expires==null)?"":("; expires="+expires))+
((path==null)?"":("; path="+path))+
((domain==null)?"":("; domain="+domain))+
((secure==true)?"; secure":"");}
function startCountdown(element,secondsremaining,showreply){$(element).innerHTML=secondsremaining;commentshowreply[element]=showreply;if(!countdownTimer[element]){countdownTimer[element]=setInterval('updateCountdown(\''+element+'\')',1000);}}
function updateCountdown(element){if(element==null){clearInterval(countdownTimer[element]);countdownTimer[element]=null;}else{var target=$(element);if(target){current=parseInt(target.innerHTML);current--;if(current<=0){target.innerHTML=0;clearInterval(countdownTimer[element]);countdownTimer[element]=null;var id=element.replace(/countdown/,'');var newtarget=$('cbody'+id);var content=newtarget.innerHTML.replace(/^[\s\S]*Seconds\)<\/a>/i,'');content=content.replace(/\<a [^<]*\[reply\].*$/i,'');var newhtml='<div class="c-body-inside" id="cbody-inside-'+id+'">'+content;if(commentshowreply[element]){var replylink=newtarget.innerHTML.replace(/^[\s\S]*setupcreply\(/i,'setupcreply(');replylink=replylink.replace(/\)\)[\s\S]*$/mi,')');newhtml+='<a href="?creplyto='+id+'#creplyform" onclick="return('+replylink+')" class="c-reply">[reply]</a>';}
newhtml+='</div>';newtarget.innerHTML=newhtml;$('c'+id).className='c-normal';}else{target.innerHTML=current;}}}}
function initPreview(){setInterval('updateAll()',1000);}
function updateAll(){$('titlepreview').innerHTML=$('title').value;$('bodytextpreview').innerHTML=$('bodytext').value;charCounter($('title'),75,$('titleCounter'));charCounter($('bodytext'),350,$('bodytextCounter'));}
function charLimit(field,maxLength){var inputLength=field.value.length;if(inputLength>=maxLength){field.value=field.value.substring(0,maxLength);}}
function charCounter(field,maxLength,countTarget){var inputLength=field.value.length;if(inputLength>=maxLength){field.value=field.value.substring(0,maxLength);}
countTarget.innerHTML=maxLength-field.value.length;}
function charCounterPreview(field,maxLength,countTarget,previewTarget,emptyFlag){charCounter(field,maxLength,countTarget);if(emptyFlag&&field.value.length==0){previewTarget.innerHTML='&nbsp;';}else{previewTarget.innerHTML=field.value;}}
function updateTopicPreview(text,cleantext){var target=$('topicpreview');target.innerHTML=text;target.href='/'+cleantext;}
function unpopp(){poppDiv=$('poppDiv');if(poppDiv){poppDiv.parentNode.removeChild(poppDiv);poppDiv=false;}}
function popp(id){unpopp();$('enclosure'+id).innerHTML+='<div id="poppDiv" class="inline-warning"><div><p><strong>Para poder votar debes estar registrado.</strong><br>Si lo estas y no iniciaste sesion, hacelo ahora: <a href="login.asp">login</a>,<br>si no tenes usuario y queres crearlo ahora, hacelo <a href="registro.asp">aquí</a>.Es rápido y gratuito.</p><a href="javascript:unpopp()"><img src="images/close.gif" class="close" width="22" height="22" alt="Close" /></a></div></div>';return(false);}
function poppC(id){unpopp();$('enclosure'+id).innerHTML+='<div id="poppDiv" class="inline-warning"><div><p><strong>Si queres dejar comentarios, Registrate.</strong><br>Si lo estas y no iniciaste sesion, hacelo ahora: <a href="login.asp">login</a>,<br>si no tenes usuario y queres crearlo ahora, hacelo <a href="registro.asp">aquí</a>.Es rápido y gratuito.</p><a href="javascript:unpopp()"><img src="images/close.gif" class="close" width="22" height="22" alt="Close" /></a></div></div>';return(false);}
function poppV(id,linkvideo){	unpopp();$('enclosure'+id).innerHTML+='<table id="Tabla_01" width="600" height="496" border="0" cellpadding="0" cellspacing="0"><tr><td height="119" colspan="3">&nbsp;&nbsp;<img src="images/cabecera/5.gif" width="325" height="90"></td></tr><tr><td width="75" rowspan="2">&nbsp;</td><td width="425" height="350"><div align="center"><object width="425" height="350"><param name="movie" value="' + linkvideo + '"></param><embed src="' + linkvideo + '" type="application/x-shockwave-flash" width="425" height="350"></embed></object></div></td><td width="100" rowspan="2">&nbsp;</td></tr><tr><td><a href="Recomenda_Video_Hdp.asp?Cod=' + id + '"></a><a href="javascript:window.close()"></a></td></tr></table>';return(false);}
function toggleDisclosureWidget(id){var div=document.getElementById(id);if(div.className=='slide-show'){div.className='slide-hide';}else{div.className='slide-show';}
return(false);}
function tdw(id){return(toggleDisclosureWidget(id));}
function toggleLogin(){unpopp();toggleDisclosureWidget('login-form');return(false);}
function topsearch(){var all;if(all=$('search-all')){if(all.checked==true){$('search').action='/search';}
all.disabled=true;$('search-specific').disabled=true;}
$('top-submit').disabled=true;return true;}
function copyToClipboard(elt) {
		var urlSwf = "/include/swf/_clipboard.swf";
		var strMssgBoxId = "notifyTextCopied";
		var eltNotify = null;

		// Display Notifications
		if((eltNotify = $(strMssgBoxId)) == null){
			// Attach the notification to the DOM
			var eltBody = document.getElementsByTagName('body').item(0);

			eltNotify = document.createElement('div');
			eltNotify.setAttribute('id', strMssgBoxId);
			eltNotify.style.display = 'none';

			eltNotify.innerHTML = 'Copied';

			eltBody.appendChild(eltNotify);
		}
		elt.onblur =
			function(e){
				Element.hide(eltNotify);
				return true;
			}

		var z = Position.cumulativeOffset(elt);
		var x = z[0];
		var y = z[1];

		Element.show(eltNotify);

		if(navigator.appName == 'Microsoft Internet Explorer'){
			if(x < 100){
				eltNotify.style.left = (x + (elt.offsetWidth - 23)) + 'px';
			}
			else{
				eltNotify.style.left = (x - (eltNotify.offsetWidth + 2)) + 'px';
			}
		}
		else{
			if(x < 100){
				eltNotify.style.left = (x + (elt.offsetWidth + 3)) + 'px';
			}
			else{
				eltNotify.style.left = (x - (eltNotify.offsetWidth + 2)) + 'px';
			}
		}

		eltNotify.style.top = y + 'px';

		var xEffect = Effect.Fade(eltNotify, { fps: 75, from: 1.9, to: 0.0, duration: 1.0, queue: 'front' } );
		window.status = 'Copied text to clipboard';

		// Copy the text inside the text box to the user's clipboard
		var flashcopier = 'flashcopier';
		if(!$(flashcopier)){
			var divholder = document.createElement('div');
			divholder.id = flashcopier;
			document.body.appendChild(divholder);
		}

		$(flashcopier).innerHTML = '';
		var divinfo = '<embed src="' + urlSwf + '" FlashVars="clipboard='+escape(elt.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
		$(flashcopier).innerHTML = divinfo;

		elt.select();

		return true;
	}
