
function embed_video(video_url, h, w, blockui_id){
	$('#video_container').html('<div id="videoplayer"></div>');
	swfobject.embedSWF(video_url, "videoplayer", h, w, "9.0.0");
	
	if (blockui_id != '')
		$.blockUI({ message: $('#'+blockui_id), css: { width: w } }); 

	return false;
}

function embed_audio(audio_url, container_id, estilo){
	
	
	swfobject.removeSWF("audioplayer");
	$("#audioplayer").remove();
	$('#'+container_id).html('<div id="audioplayer"></div>');
	var flashvars = {
		  mp3: audio_url+"&amp;showtime=1"
		};
		var params = {
		  wmode: "transparent"
		};
		var attributes = {
		  id: "dewplayer",
		  style:estilo
		};
		swfobject.embedSWF("js/lib/dewplayer/dewplayer.swf", 'audioplayer', "200", "20", "9.0.0", false, flashvars, params, attributes);
		
	
	return false;
}

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 popup_locked(url, w, h)
{
	win = window.open(url, '', 'width='+w+',height='+h+',toolbar=no,menubar=no,scrollbars=yes,resizable=no');
	win.moveTo(window.screen.availWidth / 2 - w / 2, window.screen.availHeight / 2 - h / 2);
}

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

