function setCoreComboDescription(idCombo){
	
  if( document.getElementById("comboDescription"+idCombo) && document.getElementById(idCombo).selectedIndex > -1 && document.getElementById(idCombo).options[document.getElementById(idCombo).selectedIndex].childNodes.length ){
		document.getElementById("comboDescription"+idCombo).innerHTML = document.getElementById(idCombo).options[document.getElementById(idCombo).selectedIndex].childNodes[0].nodeValue;
	}else{
		document.getElementById("comboDescription"+idCombo).innerHTML = "";
	}
}

function soyPopup(obj){
	
	obj.body.style.height = '100%';
	
	var div_height 		= 0;
	var div_width 		= 0;
	var div_offsetY 	= f_scrollTopParent();
	var clientHeight 	= f_clientHeight() - div_offsetY;
	var clientWidth  	= f_clientWidth();
	
	// Busco la altura del div exterior
	for(i=0;i<obj.body.childNodes.length;i++)
	{
		if(obj.body.childNodes[i].tagName == 'DIV'){
			div = obj.body.childNodes[i];
			
			div_height = div.offsetHeight;
			div_width = div.offsetWidth;
			break;
		}
	}
	
	
	if(div_height > clientHeight){
		
		div_height = clientHeight - 100;

		div.style.height = div_height+'px';
		div.style.width	 = parseInt(div.offsetWidth + 20)+'px';
		div.style.overflow = 'auto';		
	}
		
	if( window.frameElement )
	{
		var top 	 = div_offsetY + ((clientHeight - div_height - 40)/2);
		var left 	 = (clientWidth - div_width)/2;
		var height = clientHeight; // - vtop;
		
		div.style.position = 'absolute';
		div.style.top  = top+'px';
		div.style.left  = left+'px';
		//div.style.top  = vtop+'px';
	}
	
	
	
	
	
}

function PopUp(src)
{
	
  var iframe_name = 'iframe';
  
		block(); 

		var strFrame = (isMSIE()) ? "<iframe id='popup_iframe' name='"+iframe_name+"' frameborder='0' allowtransparency='true' scrolling='no'>" : "iframe";
		
		var objPopup = null; 
				
		objPopup = document.createElement(strFrame);
		objPopup.setAttribute("id"	,	"popup_iframe");
		objPopup.setAttribute("name"	,	iframe_name);
		objPopup.setAttribute("frameborder", "0");
		objPopup.setAttribute("scrolling", "no");
		
		objPopup.name = iframe_name;
		objPopup.src	= src;
		objPopup.style.position	= 'absolute';
		
		var width		= f_clientWidth();
		var height	= f_clientHeight() + f_scrollTop();
		
		var top 		= '0';
		var left 		= '0';
		
		objPopup.style.width	= width+'px';
		objPopup.style.height	= height+'px';
		objPopup.style.top 	= top+'px';
		objPopup.style.left = left+'px';
		
		document.documentElement.style.overflow = 'hidden';
		document.body.appendChild(objPopup);

}


function block()
{
	document.documentElement.style.overflow = 'hidden';
	
	var objBlock = null;
	if( objBlock == null )
	{
		
		var width		= f_clientWidth();
		var height		= f_clientHeight() + f_scrollTop();
		var top 		= 0;
		var left 		= 0;
		
		var strFrame = (isMSIE()) ? "<iframe id='block_iframe' name='block_iframe' frameborder='0' allowtransparency='true' scrolling='no'>" : "iframe";
		
		objBlock = document.createElement(strFrame);
				
		objBlock.src				= 'block.html';
		objBlock.style.position 	= 'absolute';
		
		objBlock.setAttribute("id"	,	"block_iframe");
		objBlock.setAttribute("name"	,	"block_iframe");
		objBlock.setAttribute("frameborder"	,	"0");
		objBlock.setAttribute("scrolling"		,	"no");
		objBlock.name = 'block_iframe';
		objBlock.style.width	= width+'px';
		objBlock.style.height	= height+'px';
		objBlock.style.top 	= top+'px';
		objBlock.style.left = left+'px';
		
		if(isMSIE()){
			objBlock.style.filter = 'alpha(opacity=80)';
		}else{
			objBlock.style.opacity = 0.8;
		}
		
		document.body.appendChild(objBlock);
		
	}
}


function enviar(frm)
{
	var frm      = document.getElementById(frm);
	var strError = false;

	frm.emails.value = frm.emails.value.trim();
	if(!strError && frm.emails.value.length<= 3){
		strError = "Ingrese los destinatarios e-mail.\n";
		frm.emails.focus();
	}
	
	frm.nombre.value = frm.nombre.value.trim();
	if(!strError && frm.nombre.value.length<= 3){
		strError = "Ingrese los destinatarios e-mail.\n";
		frm.nombre.focus();
	}

	if(strError){
		alert(strError);
	}else{
		var query_string = "_post/enviar_nota.php?";
		for(i = 0 ; i < frm.length ; i++ ){
			query_string += frm.elements[i].name+"="+frm.elements[i].value+"&";
		}    
		//window.open(query_string);
		_post(query_string);
	}  
	
	return false;
}




function contacto(frm)
{
	var frm      = document.getElementById(frm);
	var strError = false;

	frm.email.value = frm.email.value.trim();
	if(!strError && frm.email.value.length<= 3){
		strError = "Ingrese su e-mail.\n";
		frm.email.focus();
	}
	
	if(!strError && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.email.value))) {
		strError = "Error, por favor introduzca un email válido.\n";
		frm.email.focus();
	}

	if(strError){
		alert(strError);
	}else{
		var query_string = "_post/contacto.php?";
		for(i = 0 ; i < frm.length ; i++ ){
			query_string += frm.elements[i].name+"="+frm.elements[i].value+"&";
		}    
		//window.open(query_string);
		_post(query_string);
	}  
	
	return false;
}

function suscribe(frm)
{
	var frm      = document.getElementById(frm);
	var strError = false;

	frm.email.value = frm.email.value.trim();
	if(!strError && frm.email.value.length<= 3){
		strError = "Ingrese su e-mail.\n";
		frm.email.focus();
	}
	
	if(!strError && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.email.value))) {
		strError = "Error, por favor introduzca un email válido.\n";
		frm.email.focus();
	}

	if(strError){
		alert(strError);
	}else{
		var query_string = "_post/suscribe.php?";
		for(i = 0 ; i < frm.length ; i++ ){
			query_string += frm.elements[i].name+"="+frm.elements[i].value+"&";
		}    
		//window.open(query_string);
		_post(query_string);
	}  
	
	return false;
}

function _post(url)
{	
	var _objPost = document.createElement("iframe");
			_objPost.style.display 	= "none";
			_objPost.style.width   	= "100%";
			_objPost.style.height  	= "200";
			_objPost.src 						= url;
	document.body.appendChild(_objPost);	
}

function clear_this(obj,val){
	if(obj.value == val) obj.value = '';
	return;
}

function fill_this(obj,val){
	if(obj.value == '') obj.value = val;
	return;
}

tamanio0=12; 	// cuerpo
tamanio1=12;	// copete

tamanioL0=20;
tamanioL1=20;

function setTamFuente(nodo,tamanio,tamanioL)
{
	// nodo actual
	if(nodo && nodo.style)
	{ nodo.style.fontSize = tamanio+'px'; nodo.style.lineHeight = tamanioL+'px'; }

	// tiene hijos?
	if(nodo.childNodes.length)
	{
		nodo = nodo.firstChild;

		// primer hijo
		if(nodo.style) { nodo.style.fontSize = tamanio+'px'; nodo.style.lineHeight = tamanioL+'px'; }
		setTamFuente(nodo,tamanio,tamanioL);

		// resto de los hijos
		while(nodo = nodo.nextSibling)
		{
			if(nodo.style) { nodo.style.fontSize = tamanio+'px'; nodo.style.lineHeight = tamanioL+'px'; }
			setTamFuente(nodo,tamanio,tamanioL);
		}
	}
}

function tamFuente(operacion)
{
	
  if (operacion == 0)
  {
    if (tamanio0 > 8) { tamanio0--; tamanioL0--; }
    if (tamanio1 > 8) { tamanio1--; tamanioL1--; }

  }
  else if(operacion == 1)
  {
    if (tamanio0 < 30) { tamanio0++; tamanioL0++; }
    if (tamanio1 < 30) { tamanio1++; tamanioL1++; }
  }
  else if(operacion == 2)
  {
  	tamanio0=12;
		tamanio1=12;
		
		tamanioL0=20;
		tamanioL1=20;
  }

	setTamFuente(document.getElementById('news-detail-obj-copete'),tamanio1,tamanioL1);
	setTamFuente(document.getElementById('news-detail-obj-cuerpo'),tamanio0,tamanioL0);

}

function toggle(id){

  if(document.getElementById(id).style.display == 'none')
		document.getElementById(id).style.display = 'block';
	else
		document.getElementById(id).style.display = 'none';
}

function toggleClass(obj,class1,class2){
  
  if(obj.className != class1) 
    obj.className = class1; 
  else 
    obj.className = class2;
  
}

function runSWF(archivo, ancho, alto, version, bgcolor, id,idm, menu, FlashVars, quality, allowScriptAccess , writeScript ) {
  if(version!=""){
  	var version_data=version;
  }else{
  	var version_data="6,0,0,0";
  }
  if(menu!=""){
  	menu_data=menu;
  }else{
  	menu_data=false;
  }
  if(bgcolor!=""){
  	var bgcolor_data=bgcolor;
  }else{
  	var bgcolor_data="#FFFFFF";
  }
  if(id!=""){
  	id_data=id;
  }else{
  	id_data="flashMovie";
  }
  if(quality!=""){
  	quality_data=quality;
  }else{
  	quality_data="high";
  }
  if(allowScriptAccess!=""){
  	allowScriptAccess_data=allowScriptAccess;
  }else{
  	allowScriptAccess_data="always";
  }
  if( typeof(writeScript) == "undefined" ){
    writeScript = "1" ;
  }

  var quality="high"; // calidad de visualización de la peli
  html  = "";
  html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version_data+'" width='+ancho+' height='+alto+' id='+id_data+'>\n';
  html += '<param name="movie" value='+archivo+'>\n';
  html += '<param name="allowScriptAccess" value='+allowScriptAccess_data+'>\n';
  html += '<param name="quality" value='+quality_data+'>\n';
  html += '<param name="FlashVars" value='+FlashVars+'>\n';
  html += '<param name="bgcolor" value='+bgcolor_data+'>\n';
  html += '<param name="menu" value='+menu_data+' >\n';
  html += '<param name="wmode" value="transparent">\n';
  html += '<embed wmode="transparent" src='+archivo+' bgcolor='+bgcolor_data+' FlashVars='+FlashVars+' menu='+menu_data+' allowScriptAccess='+allowScriptAccess_data+' quality='+quality_data+' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+ancho+' height='+alto+' swLiveConnect="true" id='+idm+' ></embed>';
  html += '</object>\n';

  if(writeScript == "1"){
    document.write(html);
  }else{
    return html;
  }
}

function nextcase(){
  
  document.getElementById('caso'+act_caso).style.display = 'none';
  
  act_caso++;
  if(act_caso > 5) act_caso = 1;
  
  
  document.getElementById('caso'+act_caso).style.display = 'block';
  
}

function prevcase(){
  
  document.getElementById('caso'+act_caso).style.display = 'none';
  
  act_caso--;
  if(act_caso == 0) act_caso = 5;
  
  document.getElementById('caso'+act_caso).style.display = 'block';
  
}

function f_clientWidth() {
	
	return document.documentElement.clientWidth;

}
function f_clientHeight() {
	
	return document.documentElement.clientHeight;

}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_scrollTopParent() {
	return f_filterResults (
		window.parent.window.pageYOffset ? window.parent.window.pageYOffset : 0,
		window.parent.document.documentElement ? window.parent.document.documentElement.scrollTop : 0,
		window.parent.document.body ? window.parent.document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function close(){
	
	parent.window.closePopUp();	
}

function isMSIE(){
	return (navigator.appName == "Microsoft Internet Explorer");
}

function closePopUp() {
	
	parent.document.documentElement.style.overflow = 'auto';
	
	var objBlock = parent.document.getElementById('block_iframe');
	var objPopup = parent.document.getElementById('popup_iframe');
	
	objBlock.parentNode.removeChild(objBlock);
	objPopup.parentNode.removeChild(objPopup);

}


