// JavaScript Document

jQuery(document).ready(function() {
	jQuery("#more_artists_select").selectbox();
   
	//Footer position
	var win_h = jQuery(window).height();
	var current_h = jQuery('#wrapper').height();
	if(current_h < win_h) {
		space_h = win_h - current_h;
		//alert(space_h);
		jQuery('.content_left_subpage').css('padding-bottom', space_h);
	}
	
	/*
	jQuery(function() {
		var zIndexNumber = 1000;
		jQuery('div').each(function() {
			jQuery(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
	});
	*/
	
	jQuery('#subheads').cycle({
		fx: 	'fade',
		speed: 	2000,
		timeout:  6000
	});
	
	jQuery("h1.shadow").textShadow();
	
	
	
	
	
	jQuery('form#tradingnews').submit(function() {
		var email = jQuery("input#email_from").val();
		var messageVal = 'Newsletter signup';
		
		// Check email
		var re = new RegExp("^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$");
		if( !email.match(re) ) {
			alert('Please enter a email address.');
			return false;
		}
		
		// Send POST
		jQuery.post("http://waddelltradingco.com/formmail_news.php",
			{ email_from: email, message: messageVal },
			function(data) {
				jQuery('form#tradingnews p').html('You have successfully signed up to receive Waddell Trading News!');
			}
		);
	});
	
	
	
	
	
	
});

function productInquire(prodName, prodDesc) {
	window.open('http://waddelltradingco.com/request_product_info.php?prodName=' + prodName + '&prodDesc=' + prodDesc, 'product_info_request', 'width=500,height=540,status=0,toolbar=0,menubar=0');
}
