function tratarError(){  
   return true;  
}  

//window.onerror = tratarError;

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function validar(formulario,lang) {
	if ( lang == "es" ) {
		Error1 = "Necesitamos que rellenes el campo '";
		Error2 = "'.\n\n"
		Error3 = "Necesitamos que aceptes la poltica de privacidad.\n\n"
	} else {
		Error1 = "We need you fill '";
		Error2 = "' field.\n\n"
		Error3 = "We need you accept out privacy policy.\n\n"
	}

	if ( formulario.nombre.value == "" ) {
		if ( lang == "es" ) { Error = Error1 + "Nombre" + Error2; } else { Error = Error1 + "Name" + Error2; }
		alert(Error);
		formulario.nombre.focus();
		return false;
	}
				
	/*
	if ( formulario.web.value == "" ) {
		Error = Error1 + "Web" + Error2;
		alert(Error);
		formulario.web.focus();
		return false;
	}
	*/
				
	if ( formulario.email.value == "" ) {
		Error = Error1 + "Email" + Error2;
		alert(Error);
		formulario.email.focus();
		return false;
	}
				
	if ( formulario.mensaje.value == "" ) {
		if ( lang == "es" ) { Error = Error1 + "Mensaje" + Error2; } else { Error = Error1 + "Message" + Error2; }
		alert(Error);
		formulario.mensaje.focus();
		return false;
	}
				
	if (!formulario.acepto.checked) {
		alert(Error3);
		formulario.acepto.focus();
		return false;
	}
	
	return true;
}

function validarsearch(formulario,lang) {
	if ( lang == "es" ) {
		Error = "Necesitamos que escribas lo que buscas.'";
	} else {
		Error = "We need you write what are you looking for.'";
	}

	if ( formulario.searchtext.value == "" ) {
		alert(Error);
		formulario.searchtext.focus();
		return false;
	}

	return true;
}

function commentsEmailNotifications(cn_sendtoemail,cn_fromname,cn_fromemail,cn_subject,cn_title,cn_path) {

FB.Event.subscribe('comments.add', function(response) {

// Email message subject text
if(cn_subject == 'false') {
cn_subject = 'A new comment posted on your site.';}

// Email message title text
if(cn_title == 'false') {
cn_title = 'A new comment posted on your site.';}

// Comment Date and Time
var commentdate = new Date();
var curr_date = commentdate.getDate();
var curr_month = commentdate.getMonth();
curr_month++;
var curr_year = commentdate.getFullYear();
var a_p = "";
var curr_hour = commentdate.getHours();
if (curr_hour < 12){a_p = "AM";}else{a_p = "PM";}if (curr_hour == 0){curr_hour = 12;}if (curr_hour > 12){curr_hour = curr_hour - 12;}
var curr_min = commentdate.getMinutes();
commentdate = curr_date + "." + curr_month + "." + curr_year + " at " + curr_hour + ":" + curr_min + " " + a_p;

// Comment Page Title
pagetitle = $('[notify="true"]').attr('title');

// Comment Page URL
pageurl = $('[notify="true"]').attr('url');

email_message =
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'+
'<html xmlns="http://www.w3.org/1999/xhtml">'+
'<head>'+
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'+
'</head>'+
'<body>'+
'<div style="font-size:11px; font-family:\'lucida grande\',tahoma,verdana,arial,sans-serif;">'+
''+ cn_title +
'<br /><br /></div>'+
'<div style="color:#333333; direction:ltr; font-family:\'lucida grande\',tahoma,verdana,arial,sans-serif; font-size:11px; text-align:left; border-bottom:1px solid #D8DFEA; margin:10px 10px 5px 0; padding-bottom:5px;">'+
'<div><img src="http://static.ak.fbcdn.net/rsrc.php/z5HB7/hash/ecyu2wwn.gif" style="display:block; float:left; border:none;"></div>'+
'<div style="margin-left:50px; padding-left:10px;">'+
'<span style="color:#808080; font-size:9px; padding-top:2px;">'+ commentdate +'</span>'+
'<div style="padding:3px 0;">Posted on page:'+
'<br /><span style="font-weight:bold;">'+pagetitle+'</span></div>'+
'<div style="padding:3px 0; font-size:9px;">'+
'<a href="'+pageurl+'" target="_blank" style="color:#3B5998; cursor:pointer; text-decoration:underline;">Click here to view it in the page!</a>'+
'</div>'+
'</div>'+
'</div>'+
'</body>'+
'</html>';

$(document).ready(function(){
$.post(cn_path,{ to: cn_sendtoemail, fromname: cn_fromname, fromemail: cn_fromemail, subject: cn_subject, message: email_message }, "html");
});

});

}
