// JavaScript Document

// JavaScript Document

//popup sin tener que generar cada archivo//


<!--
function flvFPW1(){//v1.44
// Copyright 2002-2004, Marja Ribbers-de Vroed, FlevOOware (www.flevooware.nl/dreamweaver/)
var v1=arguments,v2=v1[2].split(","),v3=(v1.length>3)?v1[3]:false,v4=(v1.length>4)?parseInt(v1[4]):0,v5=(v1.length>5)?parseInt(v1[5]):0,v6,v7=0,v8,v9,v10,v11,v12,v13,v14,v15,v16;v11=new Array("width,left,"+v4,"height,top,"+v5);for (i=0;i<v11.length;i++){v12=v11[i].split(",");l_iTarget=parseInt(v12[2]);if (l_iTarget>1||v1[2].indexOf("%")>-1){v13=eval("screen."+v12[0]);for (v6=0;v6<v2.length;v6++){v10=v2[v6].split("=");if (v10[0]==v12[0]){v14=parseInt(v10[1]);if (v10[1].indexOf("%")>-1){v14=(v14/100)*v13;v2[v6]=v12[0]+"="+v14;}}if (v10[0]==v12[1]){v16=parseInt(v10[1]);v15=v6;}}if (l_iTarget==2){v7=(v13-v14)/2;v15=v2.length;}else if (l_iTarget==3){v7=v13-v14-v16;}v2[v15]=v12[1]+"="+v7;}}v8=v2.join(",");v9=window.open(v1[0],v1[1],v8);if (v3){v9.focus();}document.MM_returnValue=false;return v9;}
//-->

//popup//

function Abrir_ventana (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=396 , height=480, top=0, left=500";
window.open(pagina,"",opciones);
}

/*google maps */
function createMarker(point) {
  // Create a lettered icon for this point using our icon class
  //var icon = new GIcon(baseIcon);

  // Set up our GMarkerOptions object
  //markerOptions = {icon: icon};
  markerOptions = {};
  
  var marker = new GMarker(new GLatLng(point.lat, point.lng));

  GEvent.addListener(marker, "click", function() {
	marker.openInfoWindowHtml(point.info);
  });
  return marker;
}
function initializeMap(points)
{
	if (GBrowserIsCompatible())
	{
		var centerLat = points[0].lat;
		var centerLng = points[0].lng;
		var zoom = 16;
		
		var map = new GMap2($("map"));
		map.setMapType(G_HYBRID_MAP);
		map.setUIToDefault();
		map.setCenter(new GLatLng(centerLat, centerLng), zoom);
		
		points.each(function(point){
			map.addOverlay(createMarker(point));
		});
  	}
}

// INICIO FUNCIONES PARA EMULAR POPUPS (con divs ocultos) 
function openPopup(div_id){
	var popups = document.getElementById("popups");			
	var pops=popups.getElementsByTagName("div");
	for (var i=0; i< pops.length;  i++)
		pops[i].style.display = 'none' ;

	diviframe 	= document.getElementById(div_id);			
	diviframe.style['display'] 	= 'block';
}

function openImgPopup(div_id, imgPath){
	var popups = document.getElementById("popups");			
	var pops=popups.getElementsByTagName("div");
	//for (var i=0; i< pops.length;  i++)		pops[i].style.display = 'none' ;

	diviframe 	= document.getElementById(div_id);			
	diviframe.style['display'] 	= 'block';
	diviframe.childNodes[0].childNodes[0].src=imgPath;

}

function 	close_me (div_id){
	diviframe 	= document.getElementById(div_id);			
	diviframe.style['display'] 	= 'none';
}


// FIN FUNCIONES PARA EMULAR POPUPS (con divs ocultos)/
//-->
function doPrint() {
	window.document.getElementById ? browser=2 : window.document.all ? browser=1 : browser=0;
	browser==2 ? window.print() : print_window();
}

function expand(div_id, ico_id){
  divBar  = document.getElementById(div_id);      
  ico     = document.getElementById(ico_id);      

  if (divBar.style['display'] == 'none'){
    divBar.style['display']   = 'block';
    ico.src = "modules/admin/images/" + ico_id +"_on.gif";  
  }
  else{
    divBar.style['display']   = 'none';
    ico.src = "modules/admin/images/" + ico_id +"_off.gif";
  }
}

function getBrowserName(){
	var idString = navigator.userAgent.toLowerCase();
	
	if (idString.indexOf('konqueror')+1) browser = "Konqueror";
	else if (idString.indexOf('safari')+1) browser = "Safari";
	else if (idString.indexOf('omniweb')+1) browser = "OmniWeb";
	else if (idString.indexOf('opera')+1) browser = "Opera";
	else if (idString.indexOf('firefox')+1) browser = "Firefox";
	else if (idString.indexOf('webtv')+1) browser = "WebTV";
	else if (idString.indexOf('icab')+1) browser = "iCab";
	else if (idString.indexOf('msie')+1) browser = "Internet Explorer";
	else if (!idString.indexOf('compatible')+1) browser = "Netscape Navigator";
	else browser = "An unknown browser";

	return browser;
}


function Get_Cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
		return null;
	
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

/* para borrar una cookie se puede usar así:
Modify_Cookie('bblastvisit','/','','0','0')
*/
function Modify_Cookie(name, path, domain,expires,secure) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
		( ( path ) ? ";path=" + path : "") +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( expires ) ? ";expires=" + expires : "" ) +
		( ( secure ) ? ";secure=" + secure : "" ) + ";";
}


// FIN FUNCIONES PARA faq (con divs ocultos)/
function doPrint() {
	window.document.getElementById ? browser=2 : window.document.all ? browser=1 : browser=0;
	browser==2 ? window.print() : print_window();
}

var idOpen = new Array();
var idOpenIco = new Array();
var count = 0;

function expand_this(div_id, ico_id){
	divBar  = document.getElementById(div_id);      
	ico     = document.getElementById(ico_id);      
  
	if (divBar.style['display'] == 'none'){
		divBar.style['display'] = 'block';
		ico.src = "../images/" +"tit_right_off.gif";
	
	if (idOpen[count-1] && idOpen[count-1] != div_id){
		remove = document.getElementById(idOpen[count-1]);
		removeIco = document.getElementById(idOpenIco[count-1]);
		remove.style['display'] = 'none';
		removeIco.src = "../images/" +"tit_right_on.gif";
	}

	idOpen[count] = div_id;
	idOpenIco[count] = ico_id;
	count ++;

	} else {
		divBar.style['display'] = 'none';
		ico.src = "../images/" +"tit_right_on.gif";  
	}
}

String.prototype.isDate = function()
{
	return /^\d{1,2}\/\d{1,2}\/\d{4}$/.test(this);
}

String.prototype.toDate = function()
{
	if(!this.isDate())
	{
		return null;
	}

	var date_s = this.split("/");
	var new_date = [date_s[1],date_s[0],date_s[2]];

	// Formato mm/dd/yyyy
	var dDate = new Date(new_date.join("/"));

	return dDate;

}
Date.prototype.toStrDate = function()
{
	var day = parseInt(this.getDate(), 10);
	var month = parseInt(this.getMonth(), 10)+1;

	return (day < 10 ? "0"+day : day) + "/" + (month < 10 ? "0"+month : month) + "/" + this.getFullYear();
}
