// JavaScript Document
window.addEvent('domready', function() 
{

		$$(".menu_li").each(function(Menuelemento){
								 					 
			Menuelemento.addEvents(
			{
				'mouseenter': function()
				{
					var submenu = Menuelemento.getFirst().getNext();
					if (submenu){
						
						
						submenu.setStyle('display', 'block'); //muestro el submenu
					}
				},
				'mouseleave': function()
				{
					var submenu = Menuelemento.getFirst().getNext();
					if (submenu){
						
						submenu.setStyle('display', 'none');
					}
				}
			});							
												
	});




	/**************************************************** CONTACTO **************************************************/

	
	$$('#contacto input', '#contacto textarea').each(function(inputEl)
	{
		if (inputEl.getProperty('class')!="form_button")
		{
			inputEl.addEvents(
			{
				'focus': function()
				{
					inputEl.setStyle('background', '#FFFFCC ');
				},
				'blur': function()
				{
					inputEl.setStyle('background', 'none');
				}
			});
		}
	});


	/**************************************************** REGISTRESE **************************************************/

	
	$$('#registrese input', '#registrese textarea', '#registrese select').each(function(inputEl)
	{
		
		if (inputEl.getProperty('class')!="form_button" && !window.ie6)
		{
			inputEl.addEvents(
			{
				'focus': function()
				{
					inputEl.setStyle('background', '#FFFFCC ');
				},
				'blur': function()
				{
					inputEl.setStyle('background', 'none');
				}
			});
		}
	});



	/*************************************************************************************************************************/



}); //end  domload



/*************************************************** POP UP **************************************************/

var popUpWin =0;
function popUpWindow(URLStr, left, top, width, height,scrollb)
{
  width = width + 40;
  height = height + 20;
  left = screen.width/2 - width/2
  top = screen.height/2 - height/2
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin= open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollb+',resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

var popUpWin2 =0;
function popUpWindow2(URLStr, left, top, width, height)
{
  left = screen.width/2 - width/2
  top = screen.height/2 - height/2
  if(popUpWin2)
  {
    if(!popUpWin2.closed) popUpWin2.close();
  }
  popUpWin2 = open(URLStr, 'popUpWin2', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

/*************************************************** AGRANDAR TEXTO **************************************************/

minsize=8;
maxsize=18;
deft=10;
actual=13;

function MasTxt(div){
actual = actual+1;
if (actual > maxsize) {
actual = maxsize
}
var divID = document.getElementById(div);
divID.style.fontSize = actual+"px";
// px porque estoy usando css
}

function MenosTxt(div) {
actual = actual-1;
if (actual < minsize) {
actual = minsize
}
var divID = document.getElementById(div);
divID.style.fontSize = actual+"px";
}

/*************************************************** PRINT **************************************************/
function printPage() { print(document); }

/*************************************************** BOOKMARK **************************************************/
function agregar(){
   if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
      var url="http://www.TuSitio.com/";
      var titulo=" Descripcion de mi sitio web";
      window.external.AddFavorite(url,titulo);
   }
   else {
      if(navigator.appName == "Netscape")
         alert ("Presione Crtl+D para agregar este sitio en sus Bookmarks");
   }
} 

/*************************************************** ENCUESTA **************************************************/
function getRadioButtonSelectedValue(ctrl)
{
    for(i=0;i<ctrl.length;i++)
        if(ctrl[i].checked) return ctrl[i].value;
} 

/*************************************************** BLINK **************************************************/
/*

	var opciones = {
		'property' : 'color',
		'from' : new Color('#fff'),
		'to' : new Color('#f00'),
		'endActive' : false,
		'times':80,
		'duration' : 300
	};

	var els = new blinkProperty('DIV ID',opciones);
	els.doIt();

*/


var blinkProperty = new Class({
	opciones : {},
	element : null,

	initialize : function(el, opciones) {
		this.opciones = Object.extend({
			'property' : 'border-color',
			'duration' : 500,
			'margin' : 50,
			'from' : new Color('#000'),
			'to' : new Color('#fff'),
			'times' : 3,
			'transition' : Fx.Transitions.linear,
			'endActive' : true
		}, opciones || {});

		this.element = el;
	},

	doIt : function() {
		var blink = new Fx.Style(this.element, this.opciones['property'], {'duration': this.opciones['duration'], 'transition': this.opciones['transition']});
		blink.start(this.opciones['from'], this.opciones['to']);
		for(var i = 0; i < this.opciones['times']; i++) {
			blink.start.pass([this.opciones['to'], this.opciones['from']], blink).delay((this.opciones['duration']+this.opciones['margin']) * ((i*2)+1));
			blink.start.pass([this.opciones['from'], this.opciones['to']], blink).delay((this.opciones['duration']+this.opciones['margin']) * ((i*2)+2));
		}
		if(!this.opciones['endActive'])
			blink.start.pass([this.opciones['to'], this.opciones['from']], blink).delay((this.opciones['duration']+this.opciones['margin']) * ((i*2)+1));
	}
});

