// JavaScript Document

$(function() {
	$.fn.preload = function(){
    this.each(function(){
    $('<img/>')[0].src = this
    })
    }
	$(['/images/back-ah.png','/images/back-ai.png','/images/ajax-loader.gif']).preload();
	if($.browser.msie && ($.browser.version == '7.0'))
	{
	$('.order-page > form > ul > li').find('select').css('margin-top', '8px');	
	$('.order-page > form > ul > li').find('select').ieSelectStyle();
	}
	$('#a-ru-version').tooltip({showURL:false});
    $.easing['easeoutcubic'] = function(x, t, b, c, d){
	return c*((t=t/d-1)*t*t + 1) + b;
    }
	$('#main-menu').jcarousel({
	wrap: 'circular',
	start_correction: 25,
	easing: 'easeoutcubic',
	animation: 'slow'
    });
	$('.portfolio-items .image-container').hover(function(){
	if($(this).attr('class')!= 'image-container active')
	{
	$(this).find('img').css('margin-top','1px')
	}
	}, function(){
	$(this).find('img').css('margin-top','0')	
	})
	$('.portfolio-items .image-container').click(function(){
	if($(this).attr('class')!= 'image-container active')
	{
	$('li.active').removeClass('active');
	$('.portfolio-page .right > h5').html('<img src="/images/ajax-loader.gif" width="128" height="15" alt="" style="margin-left:36px;border:0;float:left" />');
	var n_ber = $(this).index();
	var s_r_c = $(this).find('img').attr('src');
	$('.portfolio-page .right > img:eq(0)').attr('src', s_r_c.replace(/-sm/g,''));
	$('.portfolio-page .right > p').html(''+img_text[n_ber]+'');
	$('.portfolio-page .left .m_left-5 .buttons > ul > li:eq('+n_ber+')').addClass('active');
	$(this).addClass('active')
	}
	})
	$('.portfolio-page .left .m_left-5 .buttons > ul > li').click(function(){
	if($(this).attr('class')!= 'active')
	{
	$('li.active').removeClass('active');
	$('.portfolio-page .right > h5').html('<img src="/images/ajax-loader.gif" width="128" height="15" alt="" style="margin-left:36px;border:0;float:left" />');
	var n_ber = $(this).index();
	var s_r_c = $('.portfolio-items img:eq('+n_ber+')').attr('src');
	$('.portfolio-page .right > img:eq(0)').attr('src', s_r_c.replace(/-sm/g,''));
	$('.portfolio-page .right > p').html(''+img_text[n_ber]+'');
	$('.portfolio-items .image-container:eq('+n_ber+')').addClass('active');
	$(this).addClass('active')
	}
	})
	$('.portfolio-page .right > img').bind('load', function(){
	$('.portfolio-page .right > h5').html('Creative Web Development')
    })
	$(".order-page > form > ul > li.left > label > input, .order-page > form > ul > li.center > label > input, .order-page > form > ul > li.center > label > textarea").keyup(function() {
	$(this).css('border-color', '#FFBF00');
	return false	
	});
	$(".order-page > ul > li.buttons > a.first").click(function() {
	var str = $(".order-page > form").serialize();
	$.post("scripts/brain.php", str, function(data) {
	$(".order-page > ul > li#message").html(data);
    $(".order-page > form > ul > li.center > img").attr({src: "images/captcha.php?q="+Math.random()+""});
    });
	$(this).blur();
    return false
    });
	$(".order-page > ul > li.buttons > a.second").click(function() {
	document.forms[0].reset();
	$(".order-page > form > ul > li.left > label > input, .order-page > form > ul > li.center > label > input, .order-page > form > ul > li.center > label > textarea").css('border-color', '#FFBF00');
	$(".order-page > ul > li#message").html('');
	$(".order-page > form > ul > li.center > img").attr({src: "images/captcha.php?q="+Math.random()+""});
	$(this).blur();
    return false
    });
});

	var img_text=new Array();
	img_text[0]='Site <span>&quot;WHAT IS MY SIGN&quot;</span> is the unique tool to find out what is my sign. Our site developers were assigned the task of realizing a unique program and site performance optimization.';
	img_text[1]='Website <span>&quot;EDUCATION PURPOSE&quot;</span> contains articles about US education. Our team was assigned the task to create this site for earnings due to advertising sales on its pages.';
	img_text[2]='The site of the company <span>&quot;AVTOMART&quot;</span>. Our site developers were assigned the task of creative web development and site performance optimization.';
	img_text[3]='Site <span>&quot;WWW.CAREERSAMHERST.COM&quot;</span> is the useful source of information about Amherst town, Massachusetts. Facts about people, weather, University of Massachusetts and more…';
	img_text[4]='<span>Official website of Mihai Timofti</span>. Mihai Timofti is director, actor and musician. In this project we tried to convey the atmosphere of theatre life and dramatic art.';
	img_text[5]='The site of the company <span>&quot;PATIUM DESIGN&quot;</span>. This company is specialized on architectural design, interior design and landscape design.'
