function openCenteredWindow(url, name, width, height, features) {
  if(screen.width){
	  var winl = (screen.width-width)/2;
	  var wint = (screen.height-height)/2;
  } else {
		winl = 0;
		wint =0;
  }
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + height + ',';
  settings += 'width=' + width + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(url, name, settings);
  win.window.focus();
}

function openIconPopup(name, context_path) {
	openCenteredWindow(context_path + '/popups/icono.php?name=' + name, 'icono_popup', 100, 100, 'scrollbars=no, resizable=no')
}

function openProductPopup(id) {
	openCenteredWindow('popup.php?id=' + id, 'product_popup', 290, 310, 'scrollbars=no, resizable=no')
}

function openLegalPopup(context_path) {
	openCenteredWindow(context_path + '/popups/legal.php', 'legal_popup', 400, 300, 'scrollbars=no, resizable=no')
}

function openPoliticasPopup(context_path) {
	openCenteredWindow(context_path + '/popups/politicas.php', 'politicas_popup', 400, 300, 'scrollbars=no, resizable=no')
}

function openEntregaPopup(context_path) {
	openCenteredWindow(context_path + '/popups/entrega.php', 'entrega_popup', 400, 300, 'scrollbars=no, resizable=no')
}

function openForgetPasswordPopup(context_path) {
	openCenteredWindow(context_path + '/popups/clave.php', 'clave_popup', 290, 150, 'scrollbars=no, resizable=no')
}

function noen() {
	alert('Coming Soon...');
}

function internalLink(link) {
	if (opener) {
		opener.location = link;
		opener.focus();
	} else {
		window.location = link;
	}
}