//-----------------------------------------------------------------------------------------------

function popup(url,nombre,ancho,alto,scroll) {
newWindow = window.open(url,nombre,'resizable=yes,menubar=no,location=no,toolbar=no,status=no,scrollbars='+scroll+',directories=no,width='+ancho+',height='+alto+',left='+(screen.availWidth-ancho)/2+',top='+(screen.availHeight-alto)/2);
}


//------------------------------------------------------------------

function runSWF(archivo, ancho, alto, version, bgcolor, id, menu, FlashVars, quality, allowScriptAccess) { 
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";
}
var quality="high"; // calidad de visualización de la peli
document.write('<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');
document.write('<param name="movie" value='+archivo+' />\n');
document.write('<param name= "allowScriptAccess" value= '+allowScriptAccess_data+' />\n');
document.write('<param name="quality" value='+quality_data+' />\n');
document.write('<param name="FlashVars" value='+FlashVars+' />\n');
document.write('<param name="bgcolor" value='+bgcolor_data+' />\n');
document.write('<param name="menu" value='+menu_data+' />\n');
document.write('<param name="wmode" value="transparent" />\n');
document.write('<embed name="pelicula" 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 name='+id_data+' wmode="transparent"></embed>');
document.write('</object>\n');
} 

//-----------------------------------------------------------------------------------------------

function negrita(from) {
strSelection = document.selection.createRange().text
if (strSelection != "") {
document.selection.createRange().text = "<b>" + strSelection + "</b>"
return;
}
}


function cursiva(from) {
strSelection = document.selection.createRange().text
if (strSelection != "") {
document.selection.createRange().text = "<i>" + strSelection + "</i>"
return;
}
}

function titulo(from) {
strSelection = document.selection.createRange().text
if (strSelection != "") {
document.selection.createRange().text = "<font class='c3'><b>" + strSelection + "</b></font>"
return;
}
}

function link() {
strSelection = document.selection.createRange().text
if (strSelection != "") {
strHref = prompt("Enter the URL of the site you to link:","http://")
if (strHref == null) return;
document.selection.createRange().text = "<a href=" + strHref + " target='_blank' class='trebuchet t13 c3 tdunderline'>" + strSelection + "</a>"
return;
}
}

//-----------------------------------------------------------------------------------------------

//------------------------------------------------------------------

function findObj(n, d) { 
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}

	if(!(x=d[n])&&d.all) { 
		x=d.all[n]; 
	}

	for (i=0;!x&&i<d.forms.length;i++) {
		x=d.forms[i][n];
	}

	for(i=0;!x&&d.layers&&i<d.layers.length;i++) {
		x=findObj(n,d.layers[i].document);
	}

	if(!x && document.getElementById) {
		x=document.getElementById(n); 
	}

	return x;
}

//---------------------------------------------------------------------------------------

function getCookie(name) {
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    }
  }
  return null;
}

// --------------------------------------------------------------------------------------

function setCookie(name,value,days)
{
	// todo expira a un día
	days = 1;
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}


// --------------------------------------------------------------------------------------
function delCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
//     cambiaFuente('12', '');
  }
}

// --------------------------------------------------------------------------------------
var firstCall = true;

// --------------------------------------------------------------------------------------
function cambia(fSize, increment) {
  
	if (firstCall) { firstCall = false;
		if (increment != "") cambia('12', '');
	}
  
	if (document.getElementsByTagName) {
		tags = new Array ("font");
		for (j=0; j<tags.length; j++) {
			var getElement = document.getElementsByTagName(tags[j]);
			var eachElement, currentFontSize, fontIncrease, newFontSize;
			for (i=0; i<getElement.length; i++) {
				eachElement = getElement[i];
				if (increment != "") {
					currentFontSize = parseInt(eachElement.style.fontSize);
					fontIncrease = parseInt(increment);
					newFontSize = currentFontSize + fontIncrease;

				} else if (fSize != "") newFontSize = parseInt(fSize);

				if (newFontSize > 14) newFontSize = 14;
				if (newFontSize < 11) newFontSize = 11;
				eachElement.style.fontSize = newFontSize + "px";
				setCookie('fontSize', newFontSize);
			}
		}
	}
}



//-----------------------------------------------------------------------------------------------
