function MM_openBrWindow(theURL,winName,features)
{ 
LeftPosition = (screen.width) ? (screen.width-249)/2 : 0;
TopPosition = (screen.height) ? (screen.height-400)/2 : 0;

window.open(theURL,winName,features+',top='+TopPosition+',left='+LeftPosition);
}


function addbookmark()
{
	if (navigator.appName.indexOf("Netscape") > -1) 
	{
	alert ("Su navegador es Netscape.\n\n Por favor, para marcarnos como favoritos :\n\n Ctrl + D si usa Windows\n Cmd + D si usa Macintosh");
	}
	if (navigator.appName.indexOf("Explorer") > -1)
	{	urllocation= 'http://www.infomed.es';
	  	urltitle = 'Infomed Dental';
		window.external.AddFavorite(urllocation,urltitle);
	}
}

function Opinar(IdNot,Titular,Fecha)
{
  window.open("/noticias/opinar.asp?Id="+IdNot+"&Titular="+Titular+"&Fecha="+Fecha,"VOp","scrollbars=yes,menubar=no,toolbar=no,directories=no,width=600,height=450")
}

function MasNot()
{
  window.open("masnot.asp","VMasNot","scrollbars=yes,menubar=no,toolbar=no,directories=no,width=600,height=450")
}

function Registro()
{
  window.open("form_registro.html","NV","menubar=no,toolbar=no,directories=no,status=yes,scrollbars=yes,resizable=no,width=550,height=480")
}

function DW(dwURL) {

  popupWin = window.open(dwURL, 'DW', 'scrollbars,resizable=yes,width=517,height=400,left=25,top=25');

  window.top.name = 'opener';
}

function VerEncuesta(IdEncuesta)
{
	LeftPosition = (screen.width) ? (screen.width-400)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-200)/2 : 0; 
	window.open("encuesta.asp?accion=ver&id="+IdEncuesta,"NV","menubar=no,toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,top="+TopPosition+",left="+LeftPosition+",width=450,height=250")
}

function setCookie(cookieName, cookieValue, cookiePath, cookieExpires)
{
   cookieValue = escape(cookieValue);
 
   if (cookieExpires == "")
   {
      var nowDate = new Date();
      nowDate.setMonth(nowDate.getMonth() + 6);
      cookieExpires = nowDate.toGMTString();
   }
 
   if (cookiePath != "")
   {
      cookiePath = ";Path=" + cookiePath;
   }
 
   document.cookie = cookieName + "=" + cookieValue + 
      ";expires=" + cookieExpires + cookiePath;
}
 
function getCookieValue(cookieName)
{
   var cookieValue = document.cookie;
   var cookieStartsAt = cookieValue.indexOf(" " + cookieName + "=");
 
   if (cookieStartsAt == -1)
   {
      cookieStartsAt = cookieValue.indexOf(cookieName + "=");
   }
 
   if (cookieStartsAt == -1)
   {
      cookieValue = null;
   }
   else
   {
      cookieStartsAt = cookieValue.indexOf("=", cookieStartsAt) + 1;
      var cookieEndsAt = cookieValue.indexOf(";", cookieStartsAt);
      if (cookieEndsAt == -1)
      {
         cookieEndsAt = cookieValue.length;
      }
      cookieValue = unescape(cookieValue.substring(cookieStartsAt,
         cookieEndsAt));
   }
 
   return cookieValue;
}

//function to check valid email address
function isValidEmail(strEmail){
	validRegExp = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	// search email text for regular exp matches
    if (!validRegExp.test(strEmail)) 
	{
		alert("ERROR: la dirección de correo '"+strEmail+"' no es válida.");
		return false;
    } 
    return true; 
}
