function log(x){ if(window.console && console.log){ console.log(x); } }
//--------------------------------------
function ready_process(x){
	
	if(!x || typeof(x)=="undefined"){
		var x = "";
	}
	
	// пример применения: <a href="#d2" class="toggle">ссылка</a>...<div id="d2">изначально скрытый текст</div>
	$(x+".toggle").click(function(){ var id = this.href.split("#"); if(id[1]){ $("#"+id[1]).toggle(); return false; } });
	$(x+".toggle").each(function(){ var id = this.href.split("#"); if(id[1]){ $("#"+id[1]).hide(); } });
	
	/* для поп-ап ссылок обратной связи */
	$(x+".contactWindow").click(function(){
		OpenWindow('330','230',this.href);
		return false;
	});
	$(x+".chatWindow").click(function(){
		OpenWindow(595,745,this.href);
		return false;
	});
	
	$(x+".quotationsWindow").click(function(){
		OpenWindow(470,550,this.href, 'w'+Math.random());
		return false;
	});
	
	$(x+".callbackWindow").addClass("iframe").attr("alt","700*350");
	
	if($.isFunction($.fn.fancybox)){//"x="+x
		
		$(x+"A.iframe").each(function(){
			
			var wh = $(this).attr("alt");
			if(!wh || wh == ""){
				wh = $(this).attr("rel");
			}
			if(wh && wh != ""){
				wh = wh.split("*");
				$(this).fancybox({
					'margin' : 0,
					'speedIn' : 0,
					'speedOut' : 0,
					'autoDimensions' : false,
					'width' : ~~wh[0],
					'height' : ~~wh[1],
					'titleShow' : false
				});
			}else{
				$(this).fancybox({
					'margin' : 0,
					'speedIn' : 0,
					'speedOut' : 0,
					'titleShow' : false
				});
			}
		});
		$(x+"A.fancyboxIMG").fancybox();
	}
}
$(document).ready(function(){
	
	// меню сайта
	var curStep = 0;
	
	$(".steps A").each(function(i){
		
		$(this).mouseover(function(){
			
			$(".steps A").removeClass("mouseover");
			
			$(this).addClass("mouseover");
			
			var left_ = parseInt( $('.stepsWrapper').width() ) * ( i );
			
			var term = ( 250 * Math.abs( i - curStep ) ) - ( 120 * Math.abs( i - curStep ) );// здесь можно отрегулировать скорость
			
			$('.stepsInner').animate({left:-left_},term);
			
			curStep = i;
		});
		
	});
	
	$(".navact").trigger('mouseover');
	
	// ифрэйм Гугл-мапс в контактах
	var googleMapLink = $("#googleMapIframe").attr("href");
	
	$('<iframe id="googleMapIframe" src="'+googleMapLink+'" frameborder="0" scrolling="no" height="550" width="960" marginwidth="0" marginheight="0"></iframe>').replaceAll("#googleMapIframe");
	
	ready_process();
	
	// подгрузка контактов
	$("#ajax_contact").data("ajax_contact_open", true).click(function(){
		
		if($(this).data("ajax_contact")!=true){
			
			$(this).data("ajax_contact", true);
			
			$("#contactArea").html("подгружаю данные...");
			
			$.post(this.href, {"lebnik_ajax_content":"lebnik_ajax_content"}, function(r){
				
				$("#contactArea").html(r);
				
				ready_process("#contactArea ");
				
				if($.browser.msie){/* IE 6,7 */
					$("#contactArea").get(0).style.removeAttribute("filter");
				}
				
			});
		}
		
		if($(this).data("ajax_contact_open")==true){
			
			$(this).data("ajax_contact_open", false);
			
			$("#contactArea").animate({height: "300px","padding":"25px 0 0 20%"}, {queue:false, duration: 1700, easing: 'easeOutBounce'});
			
		}else{
			
			$(this).data("ajax_contact_open", true);
			
			$("#contactArea").animate({height: "0px","padding-top":"0"}, {queue:false, duration: 1700, easing: 'easeOutBounce'});
		}
		return false;
	});
	
	$(".down-zone-bottom-right").css("cursor","pointer").click(function(){
		 document.location.href = "http://smsdesign.com.ua/contacts.html";
	});
	/*
	
	
.down-zone-bottom-right {
	position: relative;
}
#contactLinkBottom {
	position:absolute;
	right:0px;
	border: 1px dashed #FFF;
	width:250px;
	height: 65px;
	display:block;
	color:#000;
	font-size: 1px;
}
<a href="/as" id="/contacts.html">Контакты</a>

	
	// если нет
	if(!$.isFunction($.fn.fancybox)){
		//$(document.body).append('<link rel="stylesheet" type="text/css" href="/javascript/fancybox/jquery.fancybox-1.3.1.css" />'");
		$.ajax({
			url: "/javascript/fancybox/jquery.fancybox-1.3.1.css",
			dataType: "text/css"
		});
		$.getScript("/javascript/fancybox/jquery.fancybox-1.3.1.pack.js", function(){
			
			ready_process();
			
		});
	}
	
	
	$("", {
	rel: "stylesheet",
	type: "text/css",
	href: "/javascript/fancybox/jquery.fancybox-1.3.1.css"
	}).appendTo("head");
	
	var head = document.getElementsByTagName('head')[0];
$(document.createElement('link'))
    .attr({type: 'text/css', href: css_href, rel: 'stylesheet, media:
'screen''})
    .appendTo(head); 
    
	*/
	
});
