function pop_up(href, titulo,  w,h, left, top ){
window.open(href, titulo, "menubar=0,toolbar=0,scrollbars=1,directories=0,resize=0,width="+w+",height="+h+",left="+left+", top="+top); 

}

function checkEnter(e){ //e is event object passed from function invocation
	var characterCode;
	
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		document.forms[0].submit() //submit the form
		return false
	}
	else{
		return true
	}

}



function pop_up(href, titulo,  w,h, left, top ){
	window.open(href, titulo, "menubar=0,toolbar=0,scrollbars=0,directories=0,resize=0,width="+w+",height="+h+",left="+left+", top="+top);}



	function addRowToTable(tbl_id)
	{
	  var tbl = document.getElementById(tbl_id);
	  var lastRow = tbl.rows.length;
	  // if there's no header row in the table, then iteration = lastRow + 1
	  var iteration = lastRow + 1;
	  var row = tbl.insertRow(lastRow);
	  
	  // left cell
	  var cellLeft = row.insertCell(0);
	  var textNode = document.createTextNode("Opción " + iteration + ": ");
	  cellLeft.appendChild(textNode);
	  
	  // right cell
	  var cellRight = row.insertCell(1);
	  var el = document.createElement('input');
	  el.type = 'text';
	  el.name = 'op' + iteration;
	  el.id = 'op' + iteration;
	  el.size = 40;
		cellRight.appendChild(el);
		
		document.getElementById('cant_op').value = iteration;
		
	}
	
	
function removeRowFromTable(tbl_id)
	{
	  var tbl = document.getElementById(tbl_id);
	  var lastRow = tbl.rows.length;
	  if (lastRow > 1){ 
	  	 tbl.deleteRow(lastRow - 1);
	 	 document.getElementById('cant_op').value = document.getElementById('cant_op').value - 1;
	  }
	}



function setCookie(name, value, expires) {
	document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}

function getCookie (name) {
    var dc = document.cookie;
    var cname = name + "=";

    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 delCookie(name) {
	document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
} 

var exp = new Date();     //setar el objeto date
exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));     //30 dias

