// JavaScript Document

/*
Script para menu -

*/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*
Script para abrir una ventana popup centrada -
© DHTMLShock (www.dhtmlshock.com)
To add more shock to your site, visit www.DHTMLShock.com
*/

function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

/*
Script para lograr scroll vertical del contenido <DIV></DIV> -
*/

function vScroll( p_objName, p_divName )
{
	/* Properties */
	this.objName = p_objName;
	this.divName = p_divName;
	this.marqueewidth = "185px";
	this.marqueeheight = "135px";
	this.marqueespeed = 1;
	this.pauseit = 1;
	this.marqueecontent = "";
	
	this.marqueespeed = (document.all)? this.marqueespeed : Math.max(1, this.marqueespeed-1); //slow speed down by 1 for NS
	this.copyspeed = this.marqueespeed;
	this.pausespeed = (this.pauseit==0)? this.copyspeed: 0;
	this.iedom = document.all||document.getElementById;
	this.actualheight = '';
	this.cross_marquee = '';
	this.ns_marquee = '';
	
	/* Public Methods */
	this.scroll = vs_scrollmarquee;
	this.setContent = vs_setcontent;
	this.setSpeed = vs_setcopyspeed;
	this.setWidth = vs_setwidth;
	this.setHeight = vs_setheight;
	this.writeDiv = vs_writediv;
	
	/* Private Methods */
	this._getDiv = vs_getdiv;
	this._populate = vs_populate;
}

/* Class Methods */

function vs_setcontent( p_content )
{
	this.marqueecontent = p_content;
}

function vs_setcopyspeed( p_speed )
{
	this.copyspeed = p_speed;
}

function vs_setwidth( p_w )
{
	this.marqueewidth = p_w;
}

function vs_setheight( p_h )
{
	this.marqueeheight = p_h;
}

function vs_writediv( p_outerCSS, p_innerCSS )
{
	document.write( this._getDiv(p_outerCSS,p_innerCSS) );
	this._populate();
}

function vs_getdiv( p_outerCSS, p_innerCSS )
{
	var outerClass = '';
	var innerClass = '';
	if( p_outerCSS )
		outerClass = "class='" + p_outerCSS + "'";
	if( p_innerCSS )
		innerClass = "class='" + p_innerCSS + "'";
	
	var mouseover = this.objName + ".setSpeed('" + this.pausespeed + "')";
	var mouseout = this.objName + ".setSpeed('" + this.marqueespeed + "')";
	var outerDiv = "<div "+outerClass+" style=\"position:absolute; left:670px; top:210px; width:"+this.marqueewidth+"; height:"+this.marqueeheight+"; overflow:hidden; z-index:3;\" onmouseover=\""+mouseover+"\" onmouseout=\""+mouseout+"\">";
	var innerDiv = "<div id=\"" + this.divName + "\" "+innerClass+" style=\"position:absolute; left:0px; top:0px; width: 100%;\"></div>";
	outerDiv += (innerDiv + "</div>");
	
	return outerDiv;
}

function vs_populate(){
	if(this.iedom)
	{
		if( document.getElementById )
		{
			this.cross_marquee = document.getElementById(this.divName);
		}
		else
		{
			//alert('document.all');
			this.cross_marquee = eval('document.all.'+this.divName);
		}
		this.cross_marquee.style.top = parseInt(this.marqueeheight)+8+"px";
		this.cross_marquee.innerHTML = this.marqueecontent;
		this.actualheight = this.cross_marquee.offsetHeight;
	}
	else if(document.layers)
	{
		this.ns_marquee = document.ns_marquee.document.ns_marquee2;
		this.ns_marquee.top = parseInt(this.marqueeheight)+8;
		this.ns_marquee.document.write(this.marqueecontent);
		this.ns_marquee.document.close();
		this.actualheight = this.ns_marquee.document.height;
	}
	lefttime=setInterval(this.objName+".scroll()",50)
}

function vs_scrollmarquee(){
	if (this.iedom)
	{
		if (parseInt(this.cross_marquee.style.top)>(this.actualheight*(-1)+8))
			this.cross_marquee.style.top = parseInt(this.cross_marquee.style.top)-this.copyspeed+"px";
		else
			this.cross_marquee.style.top = parseInt(this.marqueeheight)+8+"px";
	}
	else if (document.layers){
		if(this.ns_marquee.top > (this.actualheight*(-1)+8))
			this.ns_marquee.top -= this.copyspeed;
		else
			this.ns_marquee.top = parseInt(this.marqueeheight)+8;
	}
}

/* Hace la pagina como inicio */
function inicio(objk,direccion){ 
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>3)){ 
		objk.style.behavior="url(#default#homepage)"; 
		objk.setHomePage(direccion); 
	} 
	else{ 
		alert("su navegador no dispone de esta opción"); 
	} 
}

/* Agrega a favoritos */
function favorita(){
	if ((navigator.appName== "Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
		var url="http://www.comunidadpymes.com/";
		var titulo="Comunidad Pymes";
		window.external.AddFavorite(url,titulo);
	}
	else {
		if(navigator.appName == "Netscape") {
			alert ("Presione Crtl+D para agregar este sitio en sus Bookmarks");
		}
	}
}

/* Recomendar a un amigo */
function recomendar(){
	OpenBrWindow('popup_nota_enviar.php?tipo=env_sitio','recomendar','scrollbars=no','389','288','true');
}

///////////////////////////////////////////////////////////
// "Live Clock" script (3.1)
// Modificado por: Ezequiel Garlando (ezequiel@zonacerovirtual.com)
// Basado en: "Live Clock" script (3.0)
///////////////////////////////////////////////////////////

var LC_Style=[
	"Verdana",			// Fuente
	"8px",				// Tamaño
	"black",			// Color
	"white",			// Color de fondo
	" - ",		// Texto antes de la hora
	"",					// Texto despues de la hora
	300,				// ancho del reloj
	1,					// 12(1) or 24(0) formato de la hora?
	2,					// actualizar: nunca(0) por segundo(1) por minuto(2)
	3,					// sin fecha(0) dd/mm/yy(1) mm/dd/yy(2) DDDD MMMM(3) DDDD MMMM YYYY(4)
	0,					// abreviar dias/meses si(1) no(0)
	null				// diferencia horario de gmt (null para desactivar)
];

///////////////////////////////////////////////////////////

var LC_IE=(document.all);
var LC_NS=(document.layers);
var LC_N6=(window.sidebar);
var LC_Old=(!LC_IE && !LC_NS && !LC_N6);

var LC_Clocks=new Array();

var LC_DaysOfWeek=[
	["Domingo","Dom"],
	["Lunes","Lun"],
	["Martes","Mar"],
	["Miercoles","Mie"],
	["Jueves","Jue"],
	["Viernes","Vie"],
	["Sabados","Sab"]
];

var LC_MonthsOfYear=[
	["Enero","Ene"],
	["Febrero","Feb"],
	["Marzo","Mar"],
	["Abril","Abr"],
	["Mayo","May"],
	["Junio","Jun"],
	["Julio","Jul"],
	["Agosto","Ago"],
	["Septiembre","Sep"],
	["Octubre","Oct"],
	["Noviembre","Nov"],
	["Diciembre","Dic"]
];

var LC_ClockUpdate=[0,1000,60000];

///////////////////////////////////////////////////////////

function LC_CreateClock(c) {
	if(LC_IE||LC_N6){clockTags='<span id="'+c.Name+'" style="width:'+c.Width+'px;background-color:'+c.BackColor+'"></span>'}
	else if(LC_NS){clockTags='<ilayer width="'+c.Width+'" bgColor="'+c.BackColor+'" id="'+c.Name+'Pos"><layer id="'+c.Name+'"></layer></ilayer>'}

	if(!LC_Old){document.write(clockTags)}
	else{LC_UpdateClock(LC_Clocks.length-1)}
}

function LC_InitializeClocks(){
	LC_OtherOnloads();
	if(LC_Old){return}
	for(i=0;i<LC_Clocks.length;i++){
		LC_UpdateClock(i);
		if (LC_Clocks[i].Update) {
			eval('var '+LC_Clocks[i].Name+'=setInterval("LC_UpdateClock("+'+i+'+")",'+LC_ClockUpdate[LC_Clocks[i].Update]+')');
		}
	}
}

function LC_UpdateClock(Clock){
	var c=LC_Clocks[Clock];

	var t=new Date();
	if(!isNaN(c.GMT)){
	var offset=t.getTimezoneOffset();
	if(navigator.appVersion.indexOf('MSIE 3') != -1){offset=offset*(-1)}
		t.setTime(t.getTime()+offset*60000);
		t.setTime(t.getTime()+c.GMT*3600000);
	}
	var day=t.getDay();
	var md=t.getDate();
	var mnth=t.getMonth();
	var hrs=t.getHours();
	var mins=t.getMinutes();
	var secs=t.getSeconds();
	var yr=t.getYear();

	if(yr<1900){yr+=1900}

	

	var ampm="";
	if(c.Hour12==1){
		ampm="AM";
		if(hrs>=12){ampm="PM"; hrs-=12}
		if(hrs==0){hrs=12}
	}
	if(mins<=9){mins="0"+mins}
	if(secs<=9){secs="0"+secs}

	var html = '<font color="'+c.FntColor+'" face="'+c.FntFace+'" style="font-size: 11px;">';
	if(c.Hour12){html+=' '+ampm}
	if(c.DisplayDate==1){html+=' '+md+'/'+(mnth+1)+'/'+yr}
	if(c.DisplayDate==2){html+=' '+(mnth+1)+'/'+md+'/'+yr}
	if(c.DisplayDate>=3){html+=LC_DaysOfWeek[day][c.Abbreviate]+', '+md+' '+LC_MonthsOfYear[mnth][c.Abbreviate]}
	if(c.DisplayDate>=4){html+=' de '+yr}
	html+=c.OpenTags;
	html+=hrs+':'+mins;
	if(c.Update==1){html+=':'+secs}
	html+=c.CloseTags;
	html+='</font>';

	if(LC_NS){
		var l=document.layers[c.Name+"Pos"].document.layers[c.Name].document;
		l.open();
		l.write(html);
		l.close();
	}else if(LC_N6||LC_IE){
		document.getElementById(c.Name).innerHTML=html;
	}else{
		document.write(html);
	}
}

function LiveClock(a,b,c,d,e,f,g,h,i,j,k,l){
	this.Name='LiveClock'+LC_Clocks.length;
	this.FntFace=a||LC_Style[0];
	this.FntSize=b||LC_Style[1];
	this.FntColor=c||LC_Style[2];
	this.BackColor=d||LC_Style[3];
	this.OpenTags=e||LC_Style[4];
	this.CloseTags=f||LC_Style[5];
	this.Width=g||LC_Style[6];
	this.Hour12=h||LC_Style[7];
	this.Update=i||LC_Style[8];
	this.Abbreviate=j||LC_Style[10];
	this.DisplayDate=k||LC_Style[9];
	this.GMT=l||LC_Style[11];
	LC_Clocks[LC_Clocks.length]=this;
	LC_CreateClock(this);
}

///////////////////////////////////////////////////////////

LC_OtherOnloads=(window.onload)?window.onload:new Function;
window.onload=LC_InitializeClocks;
