var global_valfield = '';

function setFocusDelayed() {
        document.getElementById(global_valfield).select();
        document.getElementById(global_valfield).focus();
}

function setFocus(field) {
  // save valfield in global variable
  global_valfield = field;
  setTimeout( 'setFocusDelayed()', 100 );
}

var main_image_original_width = 1440;
var main_image_original_height = 900;
var pic_width = main_image_original_width;
var pic_height = main_image_original_height;

// extra ifo hiding/showing
function hide_info() {
			jQuery("#panel_over").fadeOut("slow");
			jQuery("#product_show").show();
			jQuery("#product_hide").hide();
}

function show_info() {
			jQuery("#panel_over").fadeIn("slow");
			jQuery("#product_show").hide();
			jQuery("#product_hide").show();
}
 
// extra ifo hiding/showing
function hide_all() {
			jQuery("#panel_over").fadeOut("slow");
			jQuery("#panel_1").fadeOut("slow");
			jQuery("#panel_x").fadeOut("slow");
			wink = 1;			
			jQuery("#panel_downloads").fadeOut("slow");
			jQuery("#panel_downloads_close").fadeOut("slow");
			jQuery("#panel_t").fadeOut("slow");
			jQuery("#panel_2").fadeOut("slow");
			jQuery("#reveal_content").fadeIn("slow");
			jQuery("#product_hide").hide();
			jQuery("#nav_control").fadeOut("slow");
			jQuery("#all_hide").hide();
			jQuery("#all_show").show();
}

function show_all() {
			jQuery("#panel_1").fadeIn("slow");
			jQuery("#panel_2").fadeIn("slow");
			jQuery("#panel_x").fadeIn("slow");
			jQuery("#panel_t").fadeIn("slow");
			jQuery("#reveal_content").fadeOut("slow");
			jQuery("#product_show").show();
			jQuery("#nav_control").fadeIn("slow");
			jQuery("#all_show").hide();
			jQuery("#all_hide").show();
			jQuery("#product_hide").hide();
}

function hide_all2() { jQuery("#panel_over").fadeOut("slow"); wink = 1; jQuery("#panel_downloads").fadeOut("slow"); jQuery("#panel_downloads_close").fadeOut("slow"); jQuery("#panel_1").fadeOut("slow"); jQuery("#panel_2").fadeOut("slow"); jQuery("#panel_x").fadeOut("slow"); jQuery("#panel_t").fadeOut("slow"); jQuery("#reveal_content").fadeIn("slow"); jQuery("#product_hide").hide(); jQuery("#nav_control").fadeOut("slow"); jQuery("#all_hide").hide(); jQuery("#all_show").show(); }

function show_all2() {
			jQuery("#panel_1").fadeIn("slow");
			jQuery("#panel_2").fadeIn("slow");
			jQuery("#panel_x").fadeIn("slow");
			jQuery("#panel_t").fadeIn("slow");
			jQuery("#reveal_content").fadeOut("slow");
			jQuery("#product_show").show();
			jQuery("#nav_control").fadeIn("slow");
			jQuery("#all_show").hide();
			jQuery("#all_hide").show();
			jQuery("#product_hide").hide();
}


function hide_all3() {
			jQuery("#panel_1").fadeOut("slow"); wink = 1;
			jQuery("#panel_4").fadeOut("slow");
			jQuery("#panel_downloads").fadeOut("slow");
			jQuery("#panel_downloads_close").fadeOut("slow");
			jQuery("#map").fadeOut("slow");
			jQuery("#panel_x").fadeOut("slow");
			jQuery("#panel_scroll").fadeOut("slow");
			jQuery("#reveal_content").fadeIn("slow");
			jQuery("#nav_control").fadeOut("slow");
			jQuery("#all_hide").hide();
			jQuery("#all_show").show();
}

function show_all3() {
			jQuery("#panel_1").fadeIn("slow");
			jQuery("#panel_x").fadeIn("slow");
			jQuery("#panel_4").fadeIn("slow");
			jQuery("#map").fadeIn("slow");
			jQuery("#panel_scroll").fadeIn("slow");
			jQuery("#reveal_content").fadeOut("slow");
			jQuery("#nav_control").fadeIn("slow");
			jQuery("#all_show").hide();
			jQuery("#all_hide").show();
			jQuery("#product_hide").hide();
}

function show_warning() { jQuery("#show_content").fadeIn("slow"); }
function hide_warning() { jQuery("#show_content").fadeOut("slow"); }

function show_all_i_need() { jQuery("#panel_sofa_1").fadeIn("slow"); jQuery("#panel_sofa_t1").fadeIn("slow"); }
function hide_all_i_need() { jQuery("#panel_sofa_1").fadeOut("slow"); jQuery("#panel_sofa_t1").fadeOut("slow"); }
 
function show_forever_a() { jQuery("#panel_sofa_2a").fadeIn("slow"); jQuery("#panel_sofa_t2a").fadeIn("slow"); }
function hide_forever_a() { jQuery("#panel_sofa_2a").fadeOut("slow"); jQuery("#panel_sofa_t2a").fadeOut("slow"); }
  
function show_forever_b() { jQuery("#panel_sofa_2b").fadeIn("slow"); jQuery("#panel_sofa_t2b").fadeIn("slow"); }
function hide_forever_b() { jQuery("#panel_sofa_2b").fadeOut("slow"); jQuery("#panel_sofa_t2b").fadeOut("slow"); }
 
function show_happiness() { jQuery("#panel_sofa_3").fadeIn("slow"); jQuery("#panel_sofa_t3").fadeIn("slow"); }
function hide_happiness() { jQuery("#panel_sofa_3").fadeOut("slow"); jQuery("#panel_sofa_t3").fadeOut("slow"); }
  
function show_new_life_a() { jQuery("#panel_sofa_4a").fadeIn("slow"); jQuery("#panel_sofa_t4a").fadeIn("slow"); }
function hide_new_life_a() { jQuery("#panel_sofa_4a").fadeOut("slow"); jQuery("#panel_sofa_t4a").fadeOut("slow"); }
      
function show_new_life_b() { jQuery("#panel_sofa_4b").fadeIn("slow"); jQuery("#panel_sofa_t4b").fadeIn("slow"); }
function hide_new_life_b() { jQuery("#panel_sofa_4b").fadeOut("slow"); jQuery("#panel_sofa_t4b").fadeOut("slow"); }
    
function show_chairs() { jQuery("#panel_chairs").fadeIn("slow"); jQuery("#panel_chairs_t").fadeIn("slow"); }
function hide_chairs() { jQuery("#panel_chairs").fadeOut("slow"); jQuery("#panel_chairs_t").fadeOut("slow"); }
     
function show_tables() { jQuery("#panel_tables").fadeIn("slow"); jQuery("#panel_tables_t").fadeIn("slow"); }
function hide_tables() { jQuery("#panel_tables").fadeOut("slow"); jQuery("#panel_tables_t").fadeOut("slow"); }
     
function show_sofas() { jQuery("#panel_sofas").fadeIn("slow"); jQuery("#panel_sofas_t").fadeIn("slow"); }
function hide_sofas() { jQuery("#panel_sofas").fadeOut("slow"); jQuery("#panel_sofas_t").fadeOut("slow"); }
     
function show_storage() { jQuery("#panel_storage").fadeIn("slow"); jQuery("#panel_storage_t").fadeIn("slow"); }
function hide_storage() { jQuery("#panel_storage").fadeOut("slow"); jQuery("#panel_storage_t").fadeOut("slow"); }

function show_lighting() { jQuery("#panel_lighting").fadeIn("slow"); jQuery("#panel_lighting_t").fadeIn("slow"); }
function hide_lighting() { jQuery("#panel_lighting").fadeOut("slow"); jQuery("#panel_lighting_t").fadeOut("slow"); }
     
function show_mirrors() { jQuery("#panel_mirrors").fadeIn("slow"); jQuery("#panel_mirrors_t").fadeIn("slow"); }
function hide_mirrors() { jQuery("#panel_mirrors").fadeOut("slow"); jQuery("#panel_mirrors_t").fadeOut("slow"); }
     
function show_designer() { jQuery("#panel_designers").fadeIn("slow"); jQuery("#panel_designers_t").fadeIn("slow"); }
function hide_designer() { jQuery("#panel_designers").fadeOut("slow"); jQuery("#panel_designers_t").fadeOut("slow"); }
     
function show_new() { jQuery("#panel_new").fadeIn("slow"); jQuery("#panel_new_t").fadeIn("slow"); }
function hide_new() { jQuery("#panel_new").fadeOut("slow"); jQuery("#panel_new_t").fadeOut("slow"); }

function show_have_me() { jQuery("#panel_chair_1").fadeIn("slow"); jQuery("#panel_chair_t1").fadeIn("slow"); }
function hide_have_me() { jQuery("#panel_chair_1").fadeOut("slow"); jQuery("#panel_chair_t1").fadeOut("slow"); }
 
function show_have_me_wooden() { jQuery("#panel_chair_1b").fadeIn("slow"); jQuery("#panel_chair_t1b").fadeIn("slow"); }
function hide_have_me_wooden() { jQuery("#panel_chair_1b").fadeOut("slow"); jQuery("#panel_chair_t1b").fadeOut("slow"); }
 
function show_past_in_present() { jQuery("#panel_chair_2").fadeIn("slow"); jQuery("#panel_chair_t2").fadeIn("slow"); }
function hide_past_in_present() { jQuery("#panel_chair_2").fadeOut("slow"); jQuery("#panel_chair_t2").fadeOut("slow"); }
 
function show_peace_of_mind() { jQuery("#panel_chair_3").fadeIn("slow"); jQuery("#panel_chair_t3").fadeIn("slow"); }
function hide_peace_of_mind() { jQuery("#panel_chair_3").fadeOut("slow"); jQuery("#panel_chair_t3").fadeOut("slow"); }
  
function show_use_me() { jQuery("#panel_chair_4").fadeIn("slow"); jQuery("#panel_chair_t4").fadeIn("slow"); }
function hide_use_me() { jQuery("#panel_chair_4").fadeOut("slow"); jQuery("#panel_chair_t4").fadeOut("slow"); }
  
function show_use_me_wooden() { jQuery("#panel_chair_4b").fadeIn("slow"); jQuery("#panel_chair_t4b").fadeIn("slow"); }
function hide_use_me_wooden() { jQuery("#panel_chair_4b").fadeOut("slow"); jQuery("#panel_chair_t4b").fadeOut("slow"); }

function show_break_in_the_cloud() { jQuery("#panel_table_1").fadeIn("slow"); jQuery("#panel_table_t1").fadeIn("slow"); }
function hide_break_in_the_cloud() { jQuery("#panel_table_1").fadeOut("slow"); jQuery("#panel_table_t1").fadeOut("slow"); }
 
function show_break_in_the_cloud_a() { jQuery("#panel_table_1a").fadeIn("slow"); jQuery("#panel_table_t1a").fadeIn("slow"); }
function hide_break_in_the_cloud_a() { jQuery("#panel_table_1a").fadeOut("slow"); jQuery("#panel_table_t1a").fadeOut("slow"); }
 
function show_break_in_the_cloud_b() { jQuery("#panel_table_1b").fadeIn("slow"); jQuery("#panel_table_t1b").fadeIn("slow"); }
function hide_break_in_the_cloud_b() { jQuery("#panel_table_1b").fadeOut("slow"); jQuery("#panel_table_t1b").fadeOut("slow"); }
 
function show_break_in_the_cloud_c() { jQuery("#panel_table_1c").fadeIn("slow"); jQuery("#panel_table_t1c").fadeIn("slow"); }
function hide_break_in_the_cloud_c() { jQuery("#panel_table_1c").fadeOut("slow"); jQuery("#panel_table_t1c").fadeOut("slow"); }
 
function show_break_in_the_cloud_d() { jQuery("#panel_table_1d").fadeIn("slow"); jQuery("#panel_table_t1d").fadeIn("slow"); }
function hide_break_in_the_cloud_d() { jQuery("#panel_table_1d").fadeOut("slow"); jQuery("#panel_table_t1d").fadeOut("slow"); }
 
function show_by_the_trees() { jQuery("#panel_table_2").fadeIn("slow"); jQuery("#panel_table_t2").fadeIn("slow"); }
function hide_by_the_trees() { jQuery("#panel_table_2").fadeOut("slow"); jQuery("#panel_table_t2").fadeOut("slow"); }
 
function show_here_comes_love() { jQuery("#panel_table_3").fadeIn("slow"); jQuery("#panel_table_t3").fadeIn("slow"); }
function hide_here_comes_love() { jQuery("#panel_table_3").fadeOut("slow"); jQuery("#panel_table_t3").fadeOut("slow"); }
  
function show_i_only_have_eyes_for_you() { jQuery("#panel_table_4").fadeIn("slow"); jQuery("#panel_table_t4").fadeIn("slow"); }
function hide_i_only_have_eyes_for_you() { jQuery("#panel_table_4").fadeOut("slow"); jQuery("#panel_table_t4").fadeOut("slow"); }
   
function show_only_you() { jQuery("#panel_table_5").fadeIn("slow"); jQuery("#panel_table_t5").fadeIn("slow"); }
function hide_only_you() { jQuery("#panel_table_5").fadeOut("slow"); jQuery("#panel_table_t5").fadeOut("slow"); }
    
function show_ooh_la_la() { jQuery("#panel_table_6").fadeIn("slow"); jQuery("#panel_table_t6").fadeIn("slow"); }
function hide_ooh_la_la() { jQuery("#panel_table_6").fadeOut("slow"); jQuery("#panel_table_t6").fadeOut("slow"); }
    
function show_temptation() { jQuery("#panel_table_7").fadeIn("slow"); jQuery("#panel_table_t7").fadeIn("slow"); }
function hide_temptation() { jQuery("#panel_table_7").fadeOut("slow"); jQuery("#panel_table_t7").fadeOut("slow"); }
    
function show_the_only_one() { jQuery("#panel_table_8").fadeIn("slow"); jQuery("#panel_table_t8").fadeIn("slow"); }
function hide_the_only_one() { jQuery("#panel_table_8").fadeOut("slow"); jQuery("#panel_table_t8").fadeOut("slow"); }
     
function show_dont_think_too_much() { jQuery("#panel_storage_1").fadeIn("slow"); jQuery("#panel_storage_t1").fadeIn("slow"); }
function hide_dont_think_too_much() { jQuery("#panel_storage_1").fadeOut("slow"); jQuery("#panel_storage_t1").fadeOut("slow"); }
 
function show_surprise_me() { jQuery("#panel_storage_2").fadeIn("slow"); jQuery("#panel_storage_t2").fadeIn("slow"); }
function hide_surprise_me() { jQuery("#panel_storage_2").fadeOut("slow"); jQuery("#panel_storage_t2").fadeOut("slow"); }
       
function show_we_are_all_made_of_stars() { jQuery("#panel_lighting_1").fadeIn("slow"); jQuery("#panel_lighting_t1").fadeIn("slow"); }
function hide_we_are_all_made_of_stars() { jQuery("#panel_lighting_1").fadeOut("slow"); jQuery("#panel_lighting_t1").fadeOut("slow"); }
 
function show_young_tree_table() { jQuery("#panel_lighting_2").fadeIn("slow"); jQuery("#panel_lighting_t2").fadeIn("slow"); }
function hide_young_tree_table() { jQuery("#panel_lighting_2").fadeOut("slow"); jQuery("#panel_lighting_t2").fadeOut("slow"); }
       
function show_young_tree_floor() { jQuery("#panel_lighting_3").fadeIn("slow"); jQuery("#panel_lighting_t3").fadeIn("slow"); }
function hide_young_tree_floor() { jQuery("#panel_lighting_3").fadeOut("slow"); jQuery("#panel_lighting_t3").fadeOut("slow"); }
    
function show_gold_moon() { jQuery("#panel_mirrors_1").fadeIn("slow"); jQuery("#panel_mirrors_t1").fadeIn("slow"); }
function hide_gold_moon() { jQuery("#panel_mirrors_1").fadeOut("slow"); jQuery("#panel_mirrors_t1").fadeOut("slow"); }
 
function show_undress_me_now() { jQuery("#panel_mirrors_2").fadeIn("slow"); jQuery("#panel_mirrors_t2").fadeIn("slow"); }
function hide_undress_me_now() { jQuery("#panel_mirrors_2").fadeOut("slow"); jQuery("#panel_mirrors_t2").fadeOut("slow"); }
     
// emulate 'position: fixed;' for IE6
function move_box() {
	var main_image_element = document.getElementById('image_holder');
    main_image_element.style.top = (document.documentElement.scrollTop + 0) + 'px';
}

function show_more_info() {
	jQuery("#panel_3").css("display", "block");
	more_info_showing = true;
}

function hide_more_info() {
	jQuery("#panel_3").css("display", "none");
	more_info_showing = false;
}

var wink = 1; 

function load_downloads () {
	
	jQuery("#panel_downloads").fadeIn("slow");
	jQuery("#panel_downloads_close").fadeIn("slow");
	jQuery("#panel_downloads").load("http://62.169.138.13/~admin45/poo.html");

}

function close_downloads () {
	
	jQuery("#panel_downloads").fadeOut("slow");
	jQuery("#panel_downloads_close").fadeOut("slow");
	jQuery("#panel_downloads").load("http://62.169.138.13/~admin45/poo.html");

}

function download_cycle () {
	if (wink == 1) 
{
	// jQuery("#panel_downloads").load("http://62.169.138.13/~admin45/downloads.php");
	jQuery("#panel_downloads").fadeIn("slow");
	jQuery("#panel_downloads_close").fadeIn("slow");
    wink = 2;
} else {
	jQuery("#panel_downloads").fadeOut("slow");
	jQuery("#panel_downloads_close").fadeOut("slow");
	wink = 1;
}
}

function resize_image() {
	var win_width = jQuery(window).width();
//	alert(win_width);

	var win_height = jQuery(window).height();
//	alert(win_height);

	current_width = jQuery('#main_image').width();
	if (current_width > 1) {
		pic_width = current_width;
	} else {
		pic_width = pic_width;
	}
	
	current_height = jQuery('#main_image').height();
	if (current_height > 1) {
		pic_height = current_height;
	} else {
		pic_height = pic_height;
	}
			
	// make image fit in window height
	var new_height = win_height;
	var new_width = (win_height / pic_height) * pic_width;
	
//	alert(new_width);

	if (new_width > win_width) {
		new_width = win_width;
		new_height = (win_width / pic_width) * pic_height;		
	}
	
	if (main_image_original_width < new_width || main_image_original_height < new_height) {
		new_width= main_image_original_width;
		new_height = main_image_original_height;
	}

	jQuery('#main_image').width(new_width);
	jQuery('#main_image').height(new_height);

	
	jQuery('#image_holder').css({visibility:"visible", display:"block"});
	
	
	
}

function zoom_cropping() {
	var win_width = jQuery(window).width();
	var win_zoomed = win_width - 450;
	jQuery('.MagicZoomBigImageCont').css({width: win_zoomed});
}


function resize_image_with_cropping() {
	var win_width = jQuery(window).width();
	var win_height = jQuery(window).height();
	var win_aspect_ratio = win_width / win_height;

	current_width = jQuery('#main_image').width();
	if (current_width > 1) {
		pic_width = current_width;
	}	

	current_height = jQuery('#main_image').height();
	if (current_height > 1) {
		pic_height = current_height;
	}
	
	pic_aspect_ratio = pic_width / pic_height;
	
	if (win_aspect_ratio > pic_aspect_ratio) {
		// scale pic to fit window width
		var new_height = (win_width / pic_width) * pic_height;
		var new_width = win_width;
	} else {
		// scale pic to fit window height		
		var new_height = win_height;
		var new_width = (win_height / pic_height) * pic_width;
	}
	
	// center image
	new_top = 0 - ((new_height - win_height) / 2);
	new_left =  0 - ((new_width - win_width) / 2);
//	alert('new_top: ' + new_top + 'new_left: ' + new_left);
	jQuery('#main_image').css({top: new_top, left: new_left});

	jQuery('#main_image').css({height: new_height, width: new_width});
	jQuery('#image_holder').css({height: win_height, width: win_width});

	
	jQuery('#image_holder').css({visibility:"visible", display:"inline"});
	
	
}


function resize_image_non_linear() {
	var win_width = jQuery(window).width();
//	alert(win_width);

	var win_height = jQuery(window).height();
//	alert(win_height);

	current_width = jQuery('#main_image').width();
	if (current_width > 1) {
		pic_width = current_width;
	} else {
		pic_width = pic_width;
	}
	
	current_height = jQuery('#main_image').height();
	if (current_height > 1) {
		pic_height = current_height;
	} else {
		pic_height = pic_height;
	}
			
	// make image fit in window height
	var new_height = win_height;
	var new_width = win_width;
	
//	alert(new_width);

	jQuery('#main_image').width(new_width);
	jQuery('#main_image').height(new_height);

	
	jQuery('#image_holder').css({visibility:"visible", display:"block"});
	
	
	
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

