
// start brandsite ---------------------------------------------------------------------------------------------- //

	function animate_loading_text() {
		loadings_counter++;
		if (loadings_counter == 1) {
			document.getElementById('progress_bar_container').style.top = ((Math.round(document.body.clientHeight / 2)) - 33) + 'px';
			document.getElementById('images_preload').style.display='block';
			jQuery("#loading_animated_text").animate({ color: "#bbbbbb" }, 600);
		}
		if (loadings_counter < 10) {
			jQuery("#loading_animated_text").animate({ color: "#bbbbbb" }, 600);
			jQuery("#loading_animated_text").animate({ color: "#666666" }, 600);
			animate_loading_text();
		}
		else {
			jQuery("#loading_animated_text").animate({ color: "#bbbbbb" }, 600);
		}
	}

	function hide_loading_1() {
		jQuery("#images_preload").fadeOut(250, function() {
			jQuery("#logo_brand").fadeIn(800, function() {
				document.getElementById('intro_links').style.top = ((Math.round(document.body.clientHeight / 2)) - 10) + 'px';
				jQuery("#intro_links").fadeIn(700);
			});
		});
	}

	function hide_loading_2() {
		jQuery("#images_preload").fadeOut(250, function() {
			show_brandsite_2();
		});
	}

	function show_main_choice() {
		// prepare space for content boxes - increase container height when content top wants to go up to the position of logo
		// 281 = half of content height
		// 69 = logo height + before and after free space
		if (((Math.round(document.body.clientHeight / 2)) - 281) <= 69) {
			document.getElementById('main_container').style.height = '681px';
		}

		// zoom and center image if its height is not enough
		if (document.getElementById('resized_background').offsetHeight < document.getElementById('main_container').offsetHeight) {
			document.getElementById('resized_background').className = 'resized_background_zoomed';
			document.getElementById('resized_background').style.left = ((Math.round(document.getElementById('resized_background').offsetWidth - document.getElementById('main_container').offsetWidth) / 2) * (-1)) + 'px';
		}
	}

	function show_brandsite() {
		document.getElementById('intro_links').style.display = 'none';

		// calculacte content position and container height
		var brand_container_ext_top = ((Math.round(document.body.clientHeight / 2)) - 281);
		if (brand_container_ext_top > 69) { /* for logo and two 18px spaces */
			document.getElementById('brand_container_ext').style.top = brand_container_ext_top + 'px';
		}
		else {
			document.getElementById('brand_container_ext').style.top = '69px';
			document.getElementById('main_container').style.height = '681px'; // for skipped intro
		}
		document.getElementById('brand_container_ext').style.display = 'block';

		// zoom and center image if its height is not enough
		if (document.getElementById('resized_background').offsetHeight < document.getElementById('main_container').offsetHeight) {
			document.getElementById('resized_background').className = 'resized_background_zoomed';
			document.getElementById('resized_background').style.left = ((Math.round(document.getElementById('resized_background').offsetWidth - document.getElementById('main_container').offsetWidth) / 2) * (-1)) + 'px';
		}
	}

	function show_brandsite_2() {
		// this css things is because of stupid IE
		jQuery("#left_box").css('filter','alpha (opacity=50)').fadeIn(300, function() {
			jQuery("#right_box").css('filter','alpha (opacity=50)').fadeIn(300, function() {
				jQuery("#change_language_div").fadeIn(150, function() {
					jQuery("#top_menu_1").fadeIn(150, function() {
						jQuery("#top_menu_2").fadeIn(150, function() {
							jQuery("#top_menu_3").fadeIn(150, function() {
								jQuery("#top_menu_4").fadeIn(150, function() {
									jQuery("#top_menu_5").fadeIn(150, function() {
										jQuery("#o_nas_left").fadeIn(150, function() {
											loadPortrait();
											highlight_on(1);
										});
									});
								});
							});
						});
					});
				});
			});
		});
	}

// showing subpages --------------------------------------------------------------------------------------------- //

	function show_about_us() {
		menu_active = 1;
		highlight_off_all(true);

		if (document.getElementById('collections_left').style.display == 'block') {
			jQuery("#collections_left").fadeOut(150, function() {
				jQuery(".collections_lf_cursor").fadeOut(1);
				jQuery(".collections_cursor").fadeOut(1);
				if (jQuery(".collections_right").length > 0)	{
					jQuery(".collections_right").fadeOut(150, function() {
						jQuery("#o_nas_left").fadeIn(150, function() {
							loadPortrait();
						});
					});
				}
				else {
					jQuery("#o_nas_left").fadeIn(150, function() {
						loadPortrait();
					});
				}
			});
		}

		else if (document.getElementById('contact_left').style.display == 'block') {
			jQuery("#contact_left").fadeOut(150, function() {
				jQuery("#o_nas_left").fadeIn(150, function() {
					loadPortrait();
				});
			});
		}
	}

	function show_collections() {
		menu_active = 2;
		highlight_off_all(true);

		if (document.getElementById('o_nas_left').style.display == 'block') {
			jQuery("#o_nas_left").fadeOut(150, function() {
				jQuery("#o_nas_right").fadeOut(150, function() {
					jQuery("#collections_left").fadeIn(150, function() {
						for (i=0; i<coll_active.length; i++) {
							if (coll_active[i]) {
								coll_active[i] = false;
								colllight_on(i + 1);
								showColl(i + 1);
								break;
							}
						}
					});
				});
			});
		}

		else if (document.getElementById('contact_left').style.display == 'block') {
			jQuery("#contact_left").fadeOut(150, function() {
				jQuery("#collections_left").fadeIn(150, function() {
					for (i=0; i<coll_active.length; i++) {
						if (coll_active[i]) {
							coll_active[i] = false;
							colllight_on(i + 1);
							showColl(i + 1);
							break;
						}
					}
				});
			});
		}

	}

	function show_contact() {
		menu_active = 3;
		highlight_off_all(true);

		if (document.getElementById('o_nas_left').style.display == 'block') {
			jQuery("#o_nas_left").fadeOut(150, function() {
				jQuery("#o_nas_right").fadeOut(150, function() {
					jQuery("#contact_left").fadeIn(150);
				});
			});
		}

		else if (document.getElementById('collections_left').style.display == 'block') {
			jQuery("#collections_left").fadeOut(150, function() {
				jQuery(".collections_lf_cursor").fadeOut(1);
				jQuery(".collections_cursor").fadeOut(1);
				if (jQuery(".collections_right").length > 0)	{
					jQuery(".collections_right").fadeOut(150, function() {
						jQuery("#contact_left").fadeIn(150);
					});
				}
				else {
					jQuery("#contact_left").fadeIn(150);
				}
			});
		}
	}

// highlighting menu elements ----------------------------------------------------------------------------------- //

	function highlight_on_1() {
		if ((!highlighting_1) && (menu_active != 1)) { play();	highlighting_1 = true;	highlight_on(1); }

		if (highlighting_2) { highlight_off(2); highlighting_2 = false; }
		if (highlighting_3) { highlight_off(3); highlighting_3 = false; }
		if (highlighting_4) { highlight_off(4); highlighting_4 = false; }
		if (highlighting_5) { highlight_off(5); highlighting_5 = false; }
	}

	function highlight_on_2() {
		if ((!highlighting_2) && (menu_active != 2)) { play();	highlighting_2 = true;	highlight_on(2); }

		if (highlighting_1) { highlight_off(1); highlighting_1 = false; }
		if (highlighting_3) { highlight_off(3); highlighting_3 = false; }
		if (highlighting_4) { highlight_off(4); highlighting_4 = false; }
		if (highlighting_5) { highlight_off(5); highlighting_5 = false; }
	}

	function highlight_on_3() {
		if ((!highlighting_3) && (menu_active != 3)) { play();	highlighting_3 = true;	highlight_on(3); }

		if (highlighting_1) { highlight_off(1); highlighting_1 = false; }
		if (highlighting_2) { highlight_off(2); highlighting_2 = false; }
		if (highlighting_4) { highlight_off(4); highlighting_4 = false; }
		if (highlighting_5) { highlight_off(5); highlighting_5 = false; }
	}

	function highlight_on_4() {
		if (!highlighting_4) {	play();	highlighting_4 = true;	highlight_on(4);	}

		if (highlighting_1) { highlight_off(1); highlighting_1 = false; }
		if (highlighting_2) { highlight_off(2); highlighting_2 = false; }
		if (highlighting_3) { highlight_off(3); highlighting_3 = false; }
		if (highlighting_5) { highlight_off(5); highlighting_5 = false; }
	}

	function highlight_on_5() {
		if (!highlighting_5) {	play();	highlighting_5 = true;	highlight_on(5);	}

		if (highlighting_1) { highlight_off(1); highlighting_1 = false; }
		if (highlighting_2) { highlight_off(2); highlighting_2 = false; }
		if (highlighting_3) { highlight_off(3); highlighting_3 = false; }
		if (highlighting_4) { highlight_off(4); highlighting_4 = false; }
	}

// highlighting menu - turn on function ------------------------------------------------------------------------- //

	function highlight_on(number) {

		var time_delay = 0;
		var current_left = document.getElementById('top_menu_span_' + number).offsetLeft; // always 10 - defined as CSS padding :)
		var new_offset_value = 0;
		var background_left = (document.getElementById('top_menu_' + number).offsetLeft + ((21 - current_left) * 2));
		var background_width = (document.getElementById('top_menu_' + number).offsetWidth - ((21 - current_left) * 4));
		var narrow_left = (document.getElementById('top_menu_' + number).offsetLeft + 7);
		var narrow_width = 0;

		document.getElementById('top_menu_span_' + number).style.left = '0px';
		document.getElementById('top_menu_div_' + number).style.left = background_left + 'px';
		document.getElementById('top_menu_div_' + number).style.width = background_width + 'px';
		document.getElementById('top_menu_narrow_' + number).style.left = narrow_left + 'px';
		document.getElementById('top_menu_narrow_' + number).style.width = '0px';

		while (true) {
			background_left = background_left - 2;
			background_width = background_width + 4;
			new_offset_value = new_offset_value + 1;
			if ((current_left + new_offset_value) > 12) {
				narrow_width = narrow_width + 1;
			}

			setTimeout("highlight_move_text(" + new_offset_value + ", '" + number + "')", time_delay * 25);
			setTimeout("highlight_background_width(" + background_width + ", '" + number + "')", time_delay * 25);
			setTimeout("highlight_background_left(" + background_left + ", '" + number + "')", time_delay * 25);
			setTimeout("highlight_narrow_width(" + narrow_width + ", '" + number + "')", time_delay * 25);

			time_delay++;
			if ((current_left + new_offset_value) >= 21) {
				break;
			}
		}
	}

// highlighting menu - additional functions --------------------------------------------------------------------- //

	function highlight_move_text(new_offset_value, number) {
		var new_offset_str = new_offset_value + 'px';
		document.getElementById('top_menu_span_' + number).style.left=new_offset_str;
	}

	function highlight_background_width(background_width, number) {
		var background_width_str = background_width + 'px';
		document.getElementById('top_menu_div_' + number).style.width=background_width_str;
	}

	function highlight_background_left(background_left, number) {
		var background_left_str = background_left + 'px';
		document.getElementById('top_menu_div_' + number).style.left=background_left_str;
	}

	function highlight_narrow_width(narrow_width, number) {
		var narrow_width_str = narrow_width + 'px';
		document.getElementById('top_menu_narrow_' + number).style.width=narrow_width_str;
	}

// higlighting menu - turning off ------------------------------------------------------------------------------- //

	function highlight_off_all(fasthide) {
		if (fasthide) {
			highlight_off_fast(1); highlighting_1 = false;
			highlight_off_fast(2); highlighting_2 = false;
			highlight_off_fast(3); highlighting_3 = false;
			highlight_off_fast(4); highlighting_4 = false;
			highlight_off_fast(5); highlighting_5 = false;
		}
		else {
			highlight_off(1); highlighting_1 = false;
			highlight_off(2); highlighting_2 = false;
			highlight_off(3); highlighting_3 = false;
			highlight_off(4); highlighting_4 = false;
			highlight_off(5); highlighting_5 = false;
		}
	}

	function highlight_off(number) {
		if ((menu_active != number) && (!h_turning_off[(number - 1)])) {

			var time_delay = 0;
			var new_offset_value = document.getElementById('top_menu_span_' + number).offsetLeft - 10; // always 10 - defined as CSS padding :)
			if (new_offset_value > 0) {

				h_turning_off[(number - 1)] = true;
				var background_left = document.getElementById('top_menu_div_' + number).offsetLeft;
				var background_width = document.getElementById('top_menu_div_' + number).offsetWidth;
				var narrow_width = document.getElementById('top_menu_narrow_' + number).offsetWidth;

				while (true) {
					new_offset_value--;
					background_left = background_left + 1;
					background_width = background_width - 4;
					narrow_width--;

					setTimeout("highlight_move_text(" + new_offset_value + ", '" + number + "')", time_delay * 25);
					setTimeout("highlight_background_left(" + background_left + ", '" + number + "')", time_delay * 25);
					setTimeout("highlight_background_width(" + background_width + ", '" + number + "')", time_delay * 25);
					if (narrow_width >= 0) setTimeout("highlight_narrow_width(" + narrow_width + ", '" + number + "')", time_delay * 25);

					time_delay++;
					if (new_offset_value == 0) {
						setTimeout("highlight_background_width(0, '" + number + "')", time_delay * 25);
						setTimeout("switch_turning_off_flag(" + number + ", false)", time_delay * 25);
						break;
					}
				}
			}
		}
	}

	function switch_turning_off_flag(number, flag_value) {
		h_turning_off[(number - 1)] = flag_value;
	}

	function highlight_off_fast(number) {
		if (menu_active != number) {
			document.getElementById('top_menu_div_' + number).style.width='0px';
			document.getElementById('top_menu_narrow_' + number).style.width='0px';
			document.getElementById('top_menu_span_' + number).style.left='0px';
		}
	}

// click sound -------------------------------------------------------------------------------------------------- //

                function getFlashObject() {
                    return document.getElementById("myFlash");
                }
                function play() {
                    getFlashObject().SetVariable("method:play", "");
                    getFlashObject().SetVariable("enabled", "true");
                }
                function stop() {
                    getFlashObject().SetVariable("method:stop", "");
                }
                function setVolume() {
                    var volume = document.getElementById("inputVolume").value;
                    getFlashObject().SetVariable("method:setVolume", volume);
                }

// scroll ------------------------------------------------------------------------------------------------------- //

	function getContainerHeight(o) {
		containerHeight = document.getElementById('o_nas_left').offsetHeight;
//    	containerHeight = jQuery(o).parent().height();
	}
	function getScrollContent(o) {
		sc = jQuery(o).next();
		if (navigator.appName == 'Opera') {
			sch = document.getElementById('o_nas_left_text').offsetHeight;
		}
		else {
			sch = sc.height();
		}
	}

// for 'about us' page ------------------------------------------------------------------------------------------ //

	function loadPortrait() {
		document.getElementById('o_nas_right').style.width='422px';
		jQuery("#o_nas_right").fadeIn(600);
	}

// highlighting collections links ------------------------------------------------------------------------------- //

	function colllight_on(number) {
		if ((!colllighting[number - 1]) && (!coll_active[number - 1])) {
			play();
			colllighting[number - 1] = true;

			var time_delay = 0;
			var link_width = document.getElementById('coll_link_' + number).offsetWidth;
			var new_offset_value = 0;
			var background_width = 40;
			var background_left = 21;
			var background_one_step = ((link_width - 40) / 21);
			var narrow_width = 0;

			document.getElementById('coll_div_' + number).style.width = background_width + 'px';
			document.getElementById('coll_div_' + number).style.left = background_left + 'px';
			document.getElementById('coll_span_' + number).style.left = '0px';
			document.getElementById('coll_narrow_' + number).style.width = '0px';

			while (true) {
				new_offset_value = new_offset_value + 1;
				background_width = (background_width + background_one_step);
				background_left--;
				if (new_offset_value > 12) {
					narrow_width = narrow_width + 1;
				}

				setTimeout("colllight_move_text(" + new_offset_value + ", '" + number + "')", time_delay * 15);
				setTimeout("colllight_background_width(" + background_width + ", '" + number + "')", time_delay * 15);
				setTimeout("colllight_background_left(" + background_left + ", '" + number + "')", time_delay * 15);
				setTimeout("colllight_narrow_width(" + narrow_width + ", '" + number + "')", time_delay * 15);

				time_delay++;
				if (new_offset_value >= 21) {
					break;
				}
			}
		}
	}

// highlighting collections links - additional functions -------------------------------------------------------- //

	function colllight_move_text(new_offset_value, number) {
		var new_offset_str = new_offset_value + 'px';
		document.getElementById('coll_span_' + number).style.left=new_offset_str;
	}

	function colllight_background_width(background_width, number) {
		var background_width_str = Math.round(background_width) + 'px';
		document.getElementById('coll_div_' + number).style.width=background_width_str;
	}

	function colllight_background_left(background_left, number) {
		var background_left_str = background_left + 'px';
		document.getElementById('coll_div_' + number).style.left=background_left_str;
	}

	function colllight_narrow_width(narrow_width, number) {
		var narrow_width_str = narrow_width + 'px';
		document.getElementById('coll_narrow_' + number).style.width=narrow_width_str;
	}

// -------------------------------------------------------------------------------------------------------------- //

	function colllight_off_all() {
		for (i=0; i<colllighting.length; i++) {
			colllight_off(i + 1);
		}
	}

	function colllight_off(number) {
		if ((!coll_active[number - 1]) && (!c_turning_off[(number - 1)])) {

			var time_delay = 0;
			var new_offset_value = document.getElementById('coll_span_' + number).offsetLeft; // always 10 - defined as CSS padding :)
			if (new_offset_value > 0) {

				c_turning_off[(number - 1)] = true;
				var background_left = document.getElementById('coll_div_' + number).offsetLeft;
				var background_width = document.getElementById('coll_div_' + number).offsetWidth;
				var background_one_step = ((document.getElementById('coll_link_' + number).offsetWidth - 40) / 21);
				var narrow_width = document.getElementById('coll_narrow_' + number).offsetWidth;

				while (true) {
					new_offset_value--;
					background_left++;
					background_width = (background_width - background_one_step);
					narrow_width--;

					setTimeout("colllight_move_text(" + new_offset_value + ", '" + number + "')", time_delay * 10);
					setTimeout("colllight_background_left(" + background_left + ", '" + number + "')", time_delay * 10);
					setTimeout("colllight_background_width(" + background_width + ", '" + number + "')", time_delay * 10);
					if (narrow_width >= 0) setTimeout("colllight_narrow_width(" + narrow_width + ", '" + number + "')", time_delay * 10);

					time_delay++;
					if (new_offset_value == 0) {
						setTimeout("colllight_background_width(0, '" + number + "')", time_delay * 10);
						setTimeout("switch_c_turning_off_flag(" + number + ", false)", time_delay * 10);
						break;
					}
				}
			}

			colllighting[(number - 1)] = false;
		}
	}

	function switch_c_turning_off_flag(number, flag_value) {
		c_turning_off[(number - 1)] = flag_value;
	}

// for collection chosen ---------------------------------------------------------------------------------------- //

	function showColl(number) {
		if (!coll_active[number - 1]) {
			jQuery(".collections_lf_cursor").fadeOut(1);
			jQuery(".collections_cursor").fadeOut(1);
			for (i=0; i<coll_active.length; i++) {
				if (coll_active[i]) {
					coll_active[i] = false;
					colllighting[i] = false;

					document.getElementById('coll_span_' + (i + 1)).style.left = '0px';
					document.getElementById('coll_div_' + (i + 1)).style.left = '0px';
					document.getElementById('coll_div_' + (i + 1)).style.width = '0px';
					document.getElementById('coll_narrow_' + (i + 1)).style.width = '0px';

					break;
				}
			}
			coll_active[number - 1] = true;
			if (displayed_coll != '') {
				jQuery("#collections_right_" + displayed_coll).fadeOut(300, function() {
					showColl_animation(number);
					displayed_coll = number;
				});
			}
			else {
				showColl_animation(number);
				displayed_coll = number;
			}
		}
	}

	function showColl_animation(number) {
		document.getElementById('collections_right_' + number).style.width='422px';
		jQuery("#collections_right_" + number).fadeIn(450, function() {
			if (document.getElementById('collections_lf_cursor_' + number) != null) {
				document.getElementById('collections_lf_cursor_' + number).style.display='block';
			}
			if (document.getElementById('collections_cursor_' + number) != null) {
				document.getElementById('collections_cursor_' + number).style.display='block';
			}
		});
	}

	function coll_next(current_id, next_id) {
		document.getElementById('collections_lf_cursor_' + current_id).style.display='none';
		document.getElementById('collections_cursor_' + current_id).style.display='none';

		document.getElementById('collections_lf_cursor_' + next_id).style.display='block';
		document.getElementById('collections_cursor_' + next_id).style.display='block';

		jQuery("#collections_right_" + current_id).fadeOut(300, function() {
			document.getElementById('collections_right_' + next_id).style.width='422px';
			jQuery("#collections_right_" + next_id).fadeIn(450, function() {
				displayed_coll = next_id;
			});
		});
	}

// -------------------------------------------------------------------------------------------------------------- //

	function cancel_event_propagation(e){
		if(!e) e.window.event;
		e.cancelBubble = true;
		if(e.stopPropagation) {
			e.stopPropagation()
		}
	}

	function do_nothing(e) {
		cancel_event_propagation(e);
	}

// -------------------------------------------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //




