function pie4col(){
	jQuery("ul.ultsub li span").css({float:'left', display:'inline'});
	jQuery("ul.ultsub li a").css({float:'left', padding:'0 0 0 5px'});
}
function pie4colrest(){
	jQuery("ul.ultsub li span").css({float:'none', display:'block'});
	jQuery("ul.ultsub li a").css({float:'none', padding:'0 0 0 15px'});
}

function resizescreen(){

var pantalla_ancho = jQuery(window).width(); // ancho ventana

if (pantalla_ancho > 1364){
	
	pantalla_ancho = 1364;
	
}else if(pantalla_ancho < 980){
	
	pantalla_ancho = 980;
	
}else{
	pie4colrest();
}

var centro_ancho = (pantalla_ancho-324-205-40-10);

var margen = Math.floor(centro_ancho / 177);
if (margen > 3) pie4col();

margen = margen * 177 ;
pantalla_ancho = 324+205+40+margen+34;

var inspiracion = Math.floor( centro_ancho / 330);
inspiracion = inspiracion * 330;
pantalla_inspiracion = 324+205+40+inspiracion+20;

jQuery(".col_cen").css("width",""+margen+"px");
jQuery(".cuerpo").css("width",pantalla_ancho+"px");
jQuery(".col_gallery").css({float:'left', width:''+(pantalla_ancho-205-40)+'px', margin:'0 0 0 10px', border:'0px solid #000'});
jQuery(".col_inspiration").css({float:'left', width:''+(pantalla_inspiracion-205-40)+'px', margin:'0 0 0 10px'});

seeIshome(pantalla_ancho);
seeIsGallery(pantalla_inspiracion);
}

//------------------------- FUNCION RESETEAR VALORES DE CAMPOS INPUT --------------------------------

function focusInput(){
	jQuery('form#myform input, form#submit input').focus(function() {
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	jQuery('input').blur(function() {
		if (jQuery.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
}

// ----------------------------------------------- DOCUMENTO ----------------------------------------------------

jQuery(document).ready(function() {
						
resizescreen();			   

jQuery(window).resize(function () {
resizescreen();	
});
						   
jQuery("#sliderWrap").css("height",0);

jQuery("#menuTopAbrir").mouseover( function(){
				   
if(jQuery("#openCloseIdentifier").css("display") == "none"){
	jQuery("#slider-top").animate({ marginTop: "-180px" }, 500 );
}else{
	jQuery("#slider-top").animate({ marginTop: "0px" }, 500 );
	jQuery("#openCloseIdentifier").css("display","none");
	jQuery("#menuTopAbrir").hide();
	jQuery("#menuTopSubmit").hide();
}
});

jQuery("#sliderWrap").mouseout(function(){
	jQuery().mousemove( function(e) {
		if (e.pageY > 180) {
		if(jQuery("#openCloseIdentifier").css("display") == "none"){
			jQuery("#slider-top").animate({ marginTop: "-180px" }, 500 );
			jQuery("#openCloseIdentifier").css("display","block");
			jQuery("#menuTopSubmit").fadeIn("slow");
			jQuery("#menuTopAbrir").fadeIn("slow");
		}
	}
	});
});

focusInput();

/* Buscador */
jQuery(".color").click(function () {
	jQuery('#acc').val('color');
	jQuery('#search').val( jQuery(this).attr('rel') );
	jQuery('#submit').submit();
});
jQuery("#submit :checkbox").click(function () {
	jQuery('#acc').val('score');
	jQuery('#search').val( jQuery(this).attr('id') );
	jQuery('#submit').submit();
});
jQuery("#submit input").blur(function () {
	jQuery('#acc').val('tags');
	jQuery('#search').val( jQuery(this).val() );
	jQuery('#submit').submit();
});

/* ROLLOVER SIDEBAR */

jQuery(function() {
	jQuery("#tip_sidebar").mouseover(function(event) {
		jQuery("#box_sidebar").fadeIn();
	});
	jQuery("#tip_sidebar").mouseout(function(event) {
		jQuery("#box_sidebar").fadeOut();
	});
});
	
});
