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

function resizescreen(){

var pantalla_ancho = $(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;

$(".col_cen").css("width",""+margen+"px");
$(".cuerpo").css("width",pantalla_ancho+"px");
$(".col_gallery").css({float:'left', width:''+(pantalla_ancho-205-40)+'px', margin:'0 0 0 10px', border:'0px solid #000'});
$(".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(){
	$('form#myform input, form#submit input').focus(function() {
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('input').blur(function() {
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
}

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

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

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

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

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

focusInput();

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

/* ROLLOVER SIDEBAR */

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