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

function ventana(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, FullScreen) { 

var bgcolor_ie = '';
var transparent_ie = '<param name="wmode" value="transparent">\n';

var bgcolor_ns = '';
var transparent_ns = 'wmode="transparent"';

if(version!=""){
	var version_data=version;
}else{
	var version_data="6,0,0,0";
}

if(menu!=""){
	menu_data=menu;
}else{
	menu_data=false;
}

bgcolor = '';
if(bgcolor!="" && bgcolor != null){
	var bgcolor_data = bgcolor;
	bgcolor_ie = '<param name="bgcolor" value='+bgcolor_data+'>\n';
	bgcolor_ns = 'bgcolor='+bgcolor_data;
	transparent_ie = '';
	transparent_ns = '';
}


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 (FullScreen != '') {
	allowfullscreen_data_ie = '<param name="allowfullscreen" value=true>';
	allowfullscreen_data_ns = ' allowfullscreen=true';
} else {
	allowfullscreen_data_ie = "";
	allowfullscreen_data_ns = ""
}

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(bgcolor_ie);
document.write(transparent_ie);
document.write(allowfullscreen_data_ie);

document.write('<param name="menu" value='+menu_data+' >\n');
document.write('<embed src='+archivo+' '+bgcolor_ns+' '+transparent_ns+' FlashVars='+FlashVars+' menu='+menu_data+' allowScriptAccess='+allowScriptAccess_data+' quality='+quality_data+allowfullscreen_data_ns+' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+ancho+' height='+alto+' swLiveConnect=true name='+id_data+'></embed>');
document.write('</object>\n');
} 

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

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('13', '');
	}
  
	if (document.getElementsByTagName) {
		tags = new Array ("span");
		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 > 15) newFontSize = 15;
				if (newFontSize < 11) newFontSize = 11;
				eachElement.style.fontSize = newFontSize + "px";
				setCookie('fontSize', newFontSize);
			}
		}
	}
}



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


function verificaEmail(sEmail) { 
var emailexp = /^[a-z_0-9\-\']+(\.[a-z_0-9\-\']+)*@[a-z_0-9\-]+(\.[a-z_0-9\-]+){1,}$/i
 if (emailexp.test(sEmail) )
   return 0
 else
   return 1
}
//------------------------------------------------------------------

function verificaTexto(cadena){

var exp = /[^A-Za-z0-9_]/

if (exp.test(cadena))
   return 1
else
   return 0
}

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