if( jQuery.browser.mozilla ) {
	$( function() {
		$( 'form.cmxform' ).hide().find( 'p>label:not(.nocmx):not(.error)' ).each( function() {
			var $this = $(this);
			var labelContent = $this.html();
			var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' );
			var labelSpan = $("<span>")
				.css("display", "block")
				.width(labelWidth)
				.html(labelContent);
			$this.css("display", "-moz-inline-box")
				.empty()
				.append(labelSpan);
		}).end().show();
	});
};


$(function() {
  $('#gallery a').lightBox();
});

$(document).ready(function(){
	$('table.main_table').pngFix( );
});


function ChangeImg() {
 if(document.images) {
  eval("document."+ChangeImg.arguments[0]+
  ".src=('"+ChangeImg.arguments[1]+"')");
 }
}

function preload() {
  if (document.images) {
    var imgsrc = preload.arguments;
    arr=new Array(imgsrc.length);
    for (var j=0; j<imgsrc.length; j++) {
      arr[j] = new Image;
      arr[j].src = imgsrc[j];
    }
  }
}



$(document).ready(function() {
	var validator = $("#orderform").validate({
		meta: "validate",
    
    rules: {
			name: "required",
			phone: "required",
			email: "required",
			country: "required",
			period: "required"
			
		},
		
    messages: {
			name: "&nbsp;",
			phone: "&nbsp;",
			email: "&nbsp;",
			country: "&nbsp;",
			period: "&nbsp;"
		},
		
    errorPlacement: function(error, element) {
			error.appendTo( element.parent().next() );
		},
		
    submitHandler: function() {
			submit();
		},
		
    success: function(label) {
			label.html("&nbsp;").addClass("checked");
		}
	});
});


$(document).ready(function() {
	var validator = $("#contactsform").validate({
		meta: "validate",
    
    rules: {
			name: "required",
			phone: "required",
			email: "required"
		},
		
    messages: {
			name: "Введите&nbsp;имя",
			phone: "Введите&nbsp;телефон",
			email: "Укажите&nbsp;E-Mail"
		},
		
    errorPlacement: function(error, element) {
			error.appendTo( element.parent().next() );
		},
		
    submitHandler: function() {
			submit();
		},
		
    success: function(label) {
			label.html("&nbsp;").addClass("checked");
		}
	});
});