﻿Cufon.replace('h1', { fontFamily: 'Futuris' });
Cufon.replace('#site-name a', { fontFamily: 'HeliosCondLight' });
Cufon.replace('#header .bottom-block .contents .links ul li h4', { fontFamily: 'HeliosCondLight' });
Cufon.replace('#header .bottom-block .contents .text p strong', { fontFamily: 'FuturisBold' });
Cufon.replace('#header .bottom-block .contents .text p span', { fontFamily: 'Futuris' });
Cufon.replace('#header .bottom-block .contents .text .more', { fontFamily: 'Futuris' });
Cufon.replace('#footer .contents .heading', { fontFamily: 'Futuris' });
function BuildPage() {
	$.localScroll({hash: true});
	setShadow();
	remShadow();
	if ($('#top-menu ul li:first').hasClass('current')) {$('#top-menu .corner-left').css('background-position','0px -14px')};
	if ($('#top-menu ul li:last').hasClass('current')) {$('#top-menu .corner-right').css('background-position','-14px -14px')};
	$('#top-menu ul li').each(function(i){
		if (!$(this).hasClass('current')) {
			if (i==0) {
				$(this).find('a').mouseenter(function(){$('#top-menu .corner-left').css('background-position','0px -14px')});
				$(this).find('a').mouseleave(function(){$('#top-menu .corner-left').css('background-position','0px 0')});
			};
			if ($('#top-menu ul li').length==i+1) {
				$(this).find('a').mouseenter(function(){$('#top-menu .corner-right').css('background-position','-14px -14px')});
				$(this).find('a').mouseleave(function(){$('#top-menu .corner-right').css('background-position','-14px 0')});
			}
		}
	});
	$('#contact-form .text_input').each(function(i){
		$(this).focus(function () {
			if ($.browser.msie && $.browser.version == 6) {}
			else {$(this).parent().css('background-position','0px -35px');}
			if (i == 0 && $(this).val() == 'Name:') {$(this).val('')}
			if (i == 1 && $(this).val() == 'E-mail:') {$(this).val('')}
		});
		$(this).blur(function () {
			if ($.browser.msie && $.browser.version == 6) {}
			else {$(this).parent().css('background-position','0px 0px');}
			if (i == 0 && $(this).val() == '') {$(this).val('Name:')}
			if (i == 1 && $(this).val() == '') {$(this).val('E-mail:')}
		});
	});
	$('#contact-form .textarea_input').each(function(i){
		$(this).focus(function () {
			if ($.browser.msie && $.browser.version==6) {}
			else {$(this).parent().css('background-position','0px -83px');}
			if (i == 0 && $(this).val() == 'Message:') {$(this).val('')}
		});
		$(this).blur(function () {
			if ($.browser.msie && $.browser.version==6) {}
			else {$(this).parent().css('background-position','0px 0px');}
			if (i == 0 && $(this).val() == '') {$(this).val('Message:')}
		});
	});
	$('#contact-form .submit_input').each(function(i){
		$(this).mousedown(function () {
			if ($.browser.msie && $.browser.version==6) {}
			else {$(this).parent().css('background-position','0px -35px');}
		});
		$(this).mouseup(function () {
			if ($.browser.msie && $.browser.version==6) {}
			else {$(this).parent().css('background-position','0px 0px');}
		});
	});
	
	if ($('.photo-items').length>0) {
		if ($('.photo-items .item').length>0) {
			var MainHeight=$(window).height()-130;
			if (MainHeight>103) {$('.overlay .content').css('max-height',MainHeight+'px')}
			else {$('.overlay .content').css('max-height','103px')}
			$('.photo-items .item .scroll-block .scroll .text').hide();
			$('.photo-items .item .scroll-block .scroll .more').hide();
			$('.photo-items .item:even').css('float','left');
			$('.photo-items .item:odd').css('float','right');
			$('.photo-items .item').each(function(i){
				$(this).find('.scroll-block .scroll').mouseenter(function(){
					$(this).find('img:last').animate({'opacity': 'hide'},	'fast', 'linear');
					$(this).find('.text').animate({'opacity': 'show'}, 'normal', function(){$('.photo-items .item').eq(i).css('borderColor', '#c5d8e1')});
					$(this).find('.more').animate({'opacity': 'show'}, 'normal');
				});
				$(this).find('.scroll-block .scroll').mouseleave(function(){
					$(this).find('img:last').animate({'opacity': 'show'}, 'fast', 'linear')
					$(this).find('.text').animate({'opacity': 'hide'}, 'fast', function(){$('.photo-items .item').eq(i).css('borderColor', '#e3e3e3')});
					$(this).find('.more').animate({'opacity': 'hide'}, 'fast');
				});
			});
			$(".photo-items .item .scroll-block .scroll .more[rel]").overlay({
				expose: {
					color: '#04090b',
					opacity: 0.26
				},
				left: 'center',
				top: 'center'
			});
		}
	};
	if ($('#center .content img').length>0) {
		if ($('#center .content img').attr('align')=='left') {
			$('#center .content img').css('margin-left','0px')
		};
		if ($('#center .content img').attr('align')=='right') {
			$('#center .content img').css('margin-right','0px')
		};
	};
};
function setShadow() {
	if ($.browser.msie) {
		$('#top-menu ul li a').textShadow();
		$('#header .bottom-block .contents .links ul li a.button').textShadow();
	}
};
function remShadow() {
	if ($.browser.msie) {
		var option = {
					x:      0, 
					y:      0, 
					radius: 0,
					color:  '#4fa9d2'
				},
				option1 = {
					x:      1, 
					y:      1, 
					radius: 0,
					color:  '#097d9a'
				},
				option2 = {
					x:      0, 
					y:      0, 
					radius: 0,
					color:  '#b8b8b8'
				},
				option3 = {
					x:      -1, 
					y:      -1, 
					radius: 0,
					color:  '#fefefe'
				};
		$('#top-menu ul li').each(function(i){
			if (!$(this).hasClass('current')) {
				$(this).find('a').mouseenter(function(){$(this).textShadow(option)});
				$(this).find('a').mouseleave(function(){$(this).textShadow(option1)})
			}
		});
		$('#header .bottom-block .contents .links ul li a.button').each(function(i){
			$(this).mouseenter(function(){$(this).textShadow(option2)});
			$(this).mouseleave(function(){$(this).textShadow(option3)})
		});
	}
};
$(document).ready(function(){BuildPage();});

