$(document).ready(function(){
   
   $("#tabs .ui-tabs-nav li:first-child").addClass('ui-tabs-selected');
   $("#tabs .ui-tabs-panel").hide();
   $("#tabs #fragment-1").show();
   
   $("#tabs .ui-tabs-nav li").click(function () {
   	
		href = $(this).find('a').attr('href').replace("#", "");
   		//alert (href);
   		$('#tabs .ui-tabs-panel').hide();
   		$('#tabs #'+href).show();
   		
   		
   		$("#tabs .ui-tabs-nav li.ui-tabs-selected").removeClass('ui-tabs-selected');
   		$(this).addClass('ui-tabs-selected');
   		
		return false;
   });

    var n=0;
	var item_width = $('#choose-slideshow .item').width();
    
    $('#choose-slideshow .item').each(function () {
    	$(this).attr('id', 'item'+n);
    	n++;
    });
    
/*    $('#choose-slideshow .item').click(function () {
    	var item = $(this);
    	$('#curr').animate({ opacity: 0}, 200 , function () {changeCurrentDescription(item);})
    	
    	return false;

    });*/
   
    function changeCurrentDescription (item) {
		$('#curr').animate({ opacity: 0 }, 200);
    	$('#choose-slideshow .item').css('display','block');
    	item.css('display','none');
    	$('#curr .image img').attr('src',item.find('img').attr('src'));
    	$('#curr .logo img').attr('src',item.find('.logo img').attr('src'));
    	$('#curr .position').text(item.find('.position').text());
    	
    	$('#curr .name embed').attr('flashvars', 'textalign=left&offsetTop=0&textcolor=#000000&hovercolor=#CCCCCC&linkcolor=#000000&w=270&h=25&txt=' +item.find('.name').text());
    	var embed = $('#curr .name embed');
    	$('#curr .name embed').remove();
    	$('#curr .name').append(embed);
    	
    	$('#curr').animate({ opacity: 1 }, 200);

    
    }
    
    
     


    if(typeof sIFR == "function"){

// This is the preferred "named argument" syntax

	sIFR.replaceElement(named({sSelector:"#subscribe h3, .take_part h3", sFlashSrc:"/images/design/bmi/sifr/arial_narrow.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#F3F3F3", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0	, sFlashVars:"textalign=left&offsetTop=0"}));

		sIFR.replaceElement(named({sSelector:"body h3.blue", sFlashSrc:"/images/design/bmi/sifr/arial_narrow.swf", sColor:"#1b699e", sLinkColor:"#1b699e", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0	, sFlashVars:"textalign=left&offsetTop=0"}));
	
	sIFR.replaceElement(named({sSelector:"body h3.red", sFlashSrc:"/images/design/bmi/sifr/arial_narrow.swf", sColor:"#cc0000", sLinkColor:"#cc0000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0	, sFlashVars:"textalign=left&offsetTop=0"}));
	
		sIFR.replaceElement(named({sSelector:"body h3", sFlashSrc:"/images/design/bmi/sifr/arial_narrow.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0	, sFlashVars:"textalign=left&offsetTop=0"}));

// This is the older, ordered syntax
	//sIFR.replaceElement("h5#pullquote", "tradegothic.swf", "#000000", "#000000", "#FFFFFF", "#FFFFFF", 0, 0, 0, 0);
	//sIFR.replaceElement("h3", "http://localhost/interviev/js/sifr/arial_narrow.swf", "#000000", null, null, null, 0, 0, 0, 0);
	//sIFR.replaceElement("h4.subhead", "tradegothic.swf", "#660000", null, null, null, 0, 0, 0, 0);
	//sIFR.replaceElement("h3.sidebox","tradegothic.swf","#000000", "#000000", "#DCDCDC", "#DCDCDC", 0, 0, 0, 0, null);
	//sIFR.replaceElement("h3", "tradegothic.swf", "#000000", null, null, null, 0, 0, 0, 0, null);

};



});
var updater=function(data)
{
	if(data=='true'){
		$('#tellwrapper').html('<br><br>Операция завершена успешно, спасибо.');
		window.setTimeout(tb_remove,1000);
	}
	else {
		$('#message').html(data);
	}
}
var updater2=function(data)
{
	if(data=='true'){
		$('#partwrapper').html('<br><br>Ваша заявка принята, спасибо.');
		window.setTimeout(tb_remove,1000);
	}
	else {
		$('#message').html(data);
	}
}

var partsubm=function()
{
	$.post('/participate.html',{name:$('#name').attr('value'),position:$('#position').attr('value'),company:$('#company').attr('value'),email:$('#email').attr('value'),phone:$('#phone').attr('value')},updater2);
}
