
/*
 Con estas 2 funciones puedo hacer que una serie de imagenes esten intercambiandose
 con un fadein fadeout. el arreglo recibe el nombre del div contenedor que esta en
 (position:relative) y hace fade a los divs hijos de este div, que generalmente
 estan en css position:ablolute.
 Ej:
 <div class="imagenInicio">
    <div>
        <img src="" />
    </div>
    <div>
        <img src="" />
    </div>
 </div>
 se manda llamar con el siguiente codigo desde la página
 <script type = "text/javascript">
    $(document).ready(function()
    {
        fadeDivs($("div.imagenInicio"));
    });
 </script>
*/
function fadeDivs(arregloImg,tiempo){
    if(arregloImg.length>=1){
        arrImg = arregloImg.children();
        arregloImg.children().css('display',"none");
        fadeImgs(arrImg,0,arrImg.length-1,tiempo);
    }
}

function fadeImgs(arrImg,a,b,tiempo){
    $(arrImg[b]).fadeOut('slow');
    $(arrImg[a]).fadeTo('slow', 1.0 );
    if(a >= arrImg.length-1){
        a = 0;
        b = arrImg.length-1;
    }
    else{
        a++;
        if(b >= arrImg.length-1){
          b = 0;  
        }
        else{
           b++; 
        }
    }
    window.setTimeout(function() {
        fadeImgs(arrImg,a,b,tiempo);
   }, tiempo);
}

//-------------------------------------------------------------
//abrir un sitio en una ventana sin marcos
function abrir(sitio, nombre) {

        window.open(sitio,nombre,"titlebar=0,screenX=0,screenY=0,height="+ (screen.height) +",width="+ (screen.width) +",top=0,left=0,resizable=0,scrollbars=0,directories=0,status=0,toolbar=0,menubar=0,location=0,maximized=0");
}

//-----------------------------------------------------------
//hacer que una imagen se haga mas grande al hacer un hover

function hacerImgGrd(imagenes){
    
    imagenes.hover(function() {

        $(this).css({'z-index' : '150'});
	$(this).find('img.hovcasc').animate({
			width: '200px',
			height: 'auto'
		}, 200);
        $(this).find('img.hovplant').animate({
			width: '200px',
			height: 'auto'
		}, 200);
        $(this).find('img.hovsuel').animate({
			width: '90px',
			height: 'auto'
		}, 200);
        
	} , function() {
	$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
	$(this).find('img.hovcasc').animate({
			width: '150px', /* Set width back to default */
			height: 'auto' /* Set height back to default */
		}, 200);
        $(this).find('img.hovplant').animate({
			width: '150px', /* Set width back to default */
			height: 'auto' /* Set height back to default */
		}, 200);
        $(this).find('img.hovsuel').animate({
			width: '60px', /* Set width back to default */
			height: 'auto' /* Set height back to default */
		}, 200);
    });
    
}

