function addFav()
{
	var url = "http://svetstk.ru";
	var title = "Светильники";
	
	if (window.sidebar) 
	{ 
		window.sidebar.addPanel(title, url,"");
	} 
	else if( window.external ) 
	{ 
		window.external.AddFavorite( url, title); 
	}
	else if(window.opera && window.print) 
	{ 
		return true; 
	}
}

function checkOrder()
{
	var name = document.getElementById("name");
	var phone = document.getElementById("phone");
	var date = document.getElementById("date");
	var from = document.getElementById("from");
	var to = document.getElementById("to");
	
	if (name.value=="")
	{
		alert("Пожалуйста, укажите свое ФИО");
		name.focus();
		return false;
	}
	
	if (phone.value=="")
	{
		alert("Пожалуйста, укажите контактный телефон");
		phone.focus();
		return false;
	}
	
	
	if (date.value=="")
	{
		alert("Пожалуйста, укажите дату");
		date.focus();
		return false;
	}
	
	
	if (from.value=="")
	{
		alert("Пожалуйста, укажите время");
		from.focus();
		return false;
	}
	
	
	if (to.value=="")
	{
		alert("Пожалуйста, укажите время");
		to.focus();
		return false;
	}
	
	document.getElementById("order").submit();
}

function checkFeedback()
{
	var name = document.getElementById("name");
	var phone = document.getElementById("phone");
	var email = document.getElementById("email");
	var text = document.getElementById("text");
	
	if (name.value=="")
	{
		alert("Пожалуйста, укажите свое ФИО");
		name.focus();
		return false;
	}
	
	if (email.value=="")
	{
		alert("Пожалуйста, укажите e-mail");
		email.focus();
		return false;
	}
	
	if (phone.value=="")
	{
		alert("Пожалуйста, укажите контактный телефон");
		phone.focus();
		return false;
	}
	
	
	if (text.value=="")
	{
		alert("Пожалуйста, укажите текст сообщения");
		text.focus();
		return false;
	}
	
	document.getElementById("feedback").submit();
}

function ersOn(){if (document.getElementById('selekt') ) if(document.getElementById('selekt').getElementsByTagName('a')[0].offsetHeight<25){document.getElementById('spanner').style.top = '-21px';}else{	document.getElementById('spanner').style.top = '-13px';}};window.onload = function(){ersOn()};window.onresize = function(){ersOn()};

$(document).ready(function(){
  // Disabled options fix for Internet Explorer
  $('select').each(function(){
    this.rejectDisabled = function(){
      if (this.options[this.selectedIndex].disabled){
        if (this.lastSelectedIndex) {
          this.selectedIndex = this.lastSelectedIndex;
        } else {
          var first_enabled = $(this).children('option:not(:disabled)').get(0);
          this.selectedIndex = first_enabled ? first_enabled.index : 0;
        }
      } else {
        this.lastSelectedIndex = this.selectedIndex;
      }
    };
    $(this).change(function() {
      this.rejectDisabled();
    });
  });
  $("select").change(function(){
  	 	this.form.action="/catalog__"+this.name+this.value;this.form.submit();
    });
});


$(document).ready(function(){


	$(".miniProekts > img").click(function(){             
	$(".miniProekts > img").css("border", "none");
	        path = $(this).attr("href");
		$("#swappy").attr("src", path);
		$(this).css("border", "1px");
		$(this).css("border-color", "#CC6600");
		$(this).css("border-style", "solid");
	}
	);
		
	
	$('#ArticleContent img').wrap('<div class="img_stat_big"><div></div></div>');
	var nLT = $('<img src="/images/nLT.gif" class="nLT" alt="" style="position: absolute;">');
	var nRT = $('<img src="/images/nRT.gif" class="nRT" alt="" style="position: absolute; top: -1px;">');
	var nRB = $('<img src="/images/nRB.gif" class="" alt="" style="position: absolute; bottom: -1px; right: -1px;">');
	var nLB = $('<img src="/images/nLB.gif" class="nLB" alt="" style="position: absolute;">');
	$('#ArticleContent .img_stat_big').prepend(nLB).prepend(nRB).prepend(nRT).prepend(nLT);
	
	
	var images = new Array();
	$('#ArticleContent div.img_stat_big > div > img').each(function(pos) {
		height = this.getAttribute('height');
		width = this.getAttribute('width');
		
		if(!isNaN(height) && !isNaN(width) && height && width) {

			height = parseInt(height) + 40 ;
			width = parseInt(width) + 40 ;

			this.parentNode.parentNode.style.width = width + 'px';
			this.parentNode.parentNode.style.height = height + 'px';
		} else {
			var img = new Image();
			img.alt = pos;
			img.onload = function() {
				$('#ArticleContent div.img_stat_big > div > img').eq(this.alt).parent().parent().css({height: (this.height + 40 ) + 'px', width: (this.width + 40 ) + 'px'});
			}
			img.src = 'http://svetstk.ru' + this.getAttribute('src');
		}
	});
		
}
);

function checkPrice()
{
	var name = document.getElementById("name");
	var phone = document.getElementById("phone");
	var email = document.getElementById("email");
	
	
	if (name.value=="")
	{
		alert("Пожалуйста, укажите свое ФИО");
		name.focus();
		return false;
	}
	
	if (email.value=="")
	{
		alert("Пожалуйста, укажите e-mail");
		email.focus();
		return false;
	}
	
	if (phone.value=="")
	{
		alert("Пожалуйста, укажите контактный телефон");
		phone.focus();
		return false;
	}
		
	document.getElementById("order").submit();
}


