jQuery.noConflict();

jQuery(document).ready(function() {
	/*
	DOC: En la carga de la pagina se realizan las siguientes acciones:
	*/


	//Calculo cada vez que redimensione
	jQuery( window ).resize(function(){
		onWindowResize();
	});
	//Llamo a la funcion la primera vez en la carga
	new onWindowResize();

	/**Acepto las condiciones de uso - checkbox**/
	jQuery(".field_acepto1").bind("change", function(){
		if(jQuery(".field_acepto1").attr('checked')){
			jQuery(".field_acepto_label1").addClass('checked');
		}else{
			jQuery(".field_acepto_label1").removeClass('checked');
		}
	});
	jQuery(".field_acepto2").bind("change", function(){
		if(jQuery(".field_acepto2").attr('checked')){
			jQuery(".field_acepto_label2").addClass('checked');
		}else{
			jQuery(".field_acepto_label2").removeClass('checked');
		}
	});
	jQuery(".field_acepto3").bind("change", function(){
		if(jQuery(".field_acepto3").attr('checked')){
			jQuery(".field_acepto_label3").addClass('checked');
		}else{
			jQuery(".field_acepto_label3").removeClass('checked');
		}
	});
	jQuery(".field_acepto4").bind("change", function(){
		if(jQuery(".field_acepto4").attr('checked')){
			jQuery(".field_acepto_label4").addClass('checked');
		}else{
			jQuery(".field_acepto_label4").removeClass('checked');
		}
	});
	
	
    jQuery('#gallery a').lightBox();
});




function onWindowResize(){
	//Cuento los altos de todos los elementos
	var altototal=0;
	var altototal_contenedor_web=jQuery('#contenedor_web').innerHeight();
	var altototal_cabecera_top=jQuery('#cabecera_top').innerHeight();
	var altototal_publicidadtop_content=jQuery('#publicidadtop_content').innerHeight();
	var altototal_contenedor_pie=jQuery('#contenedor_pie').innerHeight();
	altototal+=altototal_contenedor_web;
	altototal+=altototal_cabecera_top;
	altototal+=altototal_publicidadtop_content;
	altototal+=altototal_contenedor_pie;

	//calculo el alto disponible de la ventana
	var w = jQuery( window );
	myvarw = w.width(); // window.innerWidth;
	myvarh = w.height(); // window.innerHeight;

	//Si el alto de la ventana es mayor que el del conjunto de los elementos, le anhado la clase que me lleva el pie abajo
	if(altototal>myvarh){
		jQuery('#contenedor_pie').removeClass('fullbottom');
	}else{
		jQuery('#contenedor_pie').addClass('fullbottom');
	}
}

jQuery(window).load(function () {
	jQuery(".corners").corner();
});

function getFlashMovieObject(movieName)
{
	if (window.document[movieName])
	{
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1)
	{
		if (document.embeds && document.embeds[movieName])
			return document.embeds[movieName];
	}
	else
	{
		return document.getElementById(movieName);
	}
}


/**Funcion para el menu de productos**/
function menu_productos(){
	jQuery('.menu_productos').toggle('fast');
	jQuery('.item_menu_productos').toggleClass('item_menu_productos_activo');
}

function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
	thisfield.value = "";
	}
	}
	function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
	thisfield.value = defaulttext;
	}
	}
	function PNG_loader() {
		   for(var i=0; i<document.images.length; i++) {
		      var img = document.images[i];
		      var imgName = img.src.toUpperCase();
		      if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
		         var imgID = (img.id) ? "id='" + img.id + "' " : "";
		         var imgClass = (img.className) ? "class='" + img.className + "' " : "";
		         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
		         var imgStyle = "display:inline-block;" + img.style.cssText;
		         if (img.align == "left") imgStyle += "float:left;";
		         if (img.align == "right") imgStyle += "float:right;";
		         if (img.parentElement.href) imgStyle += "cursor:hand;";
		         var strNewHTML = "<span " + imgID + imgClass + imgTitle
		            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
		            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
		         img.outerHTML = strNewHTML;
		         i--;
		      }
		   }
		}
		
		if(window.attachEvent)
			window.attachEvent("onload", PNG_loader);


function mostrar(capa){ 
	var obj = document.getElementById(capa) 
	if(obj.style.display == "block") obj.style.display = "none" 
	else obj.style.display = "block" 
	}
	

// JavaScript Document

    //jQuery.noConflict();
     
	var $jQ = jQuery.noConflict();
    // Use jQuery via $j(...)
    $jQ(document).ready(function(){
     	//$jQ("div").hide();
    });
     
    // Use Prototype with $(...), etc.

function loadTooltip()
{
	jQuery.extend($jQ.fn.Tooltip.defaults, {
		track: true,
		delay: 2,
		showURL: false,
		showBody: " - "
	});
	jQuery('#galerias_detalle .fotografias_listado_item_mosca a').Tooltip();
}
