	$(document).ready(function(){
	$('#when').selectbox();
	$(".scroller-inside").scrollable();
	$.fn.supersized.options = {  
		startwidth: 1024,  
		startheight: 683,
		minsize: .50,
		slideshow: 0
	};
	$('img#supersize').supersized();
	$('.scroller-inside').css('width', $(document).width()-70);
	$('.text').jScrollPane();
	$('li.productsl').mouseenter(function(){
		$('li.productsl ul').fadeIn();
	});
	$('li.productsl').mouseleave(function(){
		$('li.productsl ul').fadeOut();
	});
	$('.form .inside .boton_ud').toggle(function() {
		$('.form .inside').animate({top: "0"}, 1000);
		$('.form .inside .boton_ud').css('background-position', '0 -55px');
	}, function() {
		$('.form .inside').animate({top: "390"}, 1000);
		$('.form .inside .boton_ud').css('background-position', '0 0');
	});
	$("#send").click(function(){
		$(".error").removeClass('error');
		$('.noexito').hide();
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

		var emailFromVal = $("#email").val();
		if(emailFromVal == '') {
			$("#email").addClass('error');
			hasError = true;
		}

		var nameVal = $("#name").val();
		if(nameVal == '') {
			$("#name").addClass('error');
			hasError = true;
		}

		var messageVal = $("#when").val();
		if(messageVal == '') {
			$("#when").addClass('error');
			hasError = true;
		}


		if(hasError == false) {
			$(this).hide();
			$("#formulario").append('sending...');

			$.post("./mailsend.php",
				{ email: emailFromVal, name: nameVal, mensaje: messageVal },
					function(data){
						$("#formulario").slideUp("normal", function() {
							$("#formulario").after('<div class="exito><p style="style="font-size: 22px;text-decoration:none; margin-left:22px; color:#36A9E1"><br><br><strong>We will be in contact with you very soon</strong><img src="http://www.discoverglass.com.au/new/c12.png" style="margin:21px 0px 0px 90px"/></p></div>');
						});
					}
				 );
		} else {
			alert('there are some errors in the contact form');
		}

		return false;
	});

	$("#sendc").click(function(){
		$(".error").removeClass('error');
		$('.noexito').hide();
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

		var emailFromVal = $("#emailc").val();
		if(emailFromVal == '') {
			$("#emailc").addClass('error');
			hasError = true;
		}

		var nameVal = $("#namec").val();
		if(nameVal == '') {
			$("#namec").addClass('error');
			hasError = true;
		}

		var messageVal = $("#messagec").val();
		if(messageVal == '') {
			$("#messagec").addClass('error');
			hasError = true;
		}


		if(hasError == false) {
			$(this).hide();
			$("#formularioc").append('sending...');

			$.post("./mailsend2.php",
				{ email: emailFromVal, name: nameVal, mensaje: messageVal },
					function(data){
						$("#formularioc").slideUp("normal", function() {
							$("#formularioc").after('<div class="exito><p style="style="font-size: 22px;text-decoration:none;  color:#36A9E1"><br><br><strong>We will be in contact with you very soon</strong></p></div>');
						});
					}
				 );
		} else {
			alert('there are some errors in the contact form');
		}

		return false;
	});

	
$("#shower .text a[rel=lightbox]").fancybox({
 'transitionIn' : 'none',
 'transitionOut' : 'none',
 'titlePosition' : 'over',
 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
 return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
 }
 }); 	
$(".images a").fancybox({
 'transitionIn' : 'none',
 'transitionOut' : 'none',
 'titlePosition' : 'over',
 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
 return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
 }
 }); 
$(".items a[rel=lightbox]").fancybox({
 'transitionIn' : 'none',
 'transitionOut' : 'none',
 'titlePosition' : 'over',
 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
 return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
 }
 }); 
$("#inline").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
});





});
