$(window).load(function() {

/* detect html5 feature */
var nativePlaceholderSupport = (function(){var i = document.createElement('input');return ('placeholder' in i);})();
if(!nativePlaceholderSupport){

	$input = $('input');
	$input.each(function(){
		$t = $(this)
		$t.val($t.attr('placeholder')).data('placeholder',$t.attr('placeholder')).focus(function(){
			if($(this).val() == $(this).data('placeholder')){
				$(this).val('');
			}
		}).blur(function(){
			if($(this).val()==''){$(this).val($(this).data('placeholder'));}
								  
			});					 
		
	});
	
}
$('#fb_feed').load('/d/get_facebook.php',function(){																	 
	$('#fb_iframe').after('<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fchemicalstorm.com&amp;send=false&amp;layout=standard&amp;width=280&amp;show_faces=false&amp;action=like&amp;colorscheme=dark&amp;font=arial&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:280px; height:35px;" allowTransparency="true"></iframe>  ')																		 
});

$join = $('#join');

$join.click(function(){

	$(this).blur().hide();
	$thepath = '/d/list-join.php';
	$theform = $('#mlist');
	$theform.find('.errmsg').slideUp(function(){$(this).remove();});
	
	$str = $('#mlist').serialize();
	$.post($thepath,$str,function(data){
		if(data == 'success'){
			$theform.html('<div class="msg">Success. A confirmation email will be sent shortly.</div>');
		}else{
			$theform.append('<div class="errmsg">'+data+'</div>');
			$join.show()
		}
	});		
	return false;
});


if (navigator.standalone) {
   
   $("nav a, .nav a").click(function (event) {
		event.preventDefault();
		window.location = $(this).attr("href");
	});
   
}


// -------------------------------------------------------
sp = $('article div.slidetitle');

	if(sp.length){
		
		sc = $('article div.sc');
		sc.hide();

		sp_a = $('article');
		sp.css({cursor:'pointer'}).click(function(e){								  
			$this = $(this);
			
			if($this.hasClass('active')){
				$this.removeClass('active').parent().find('div.sc').stop(true,true).slideUp();
			}else{
				$this.addClass('active').parent().find('div.sc').stop(true,true).slideDown();
			}
			

			
		});
	}
// -------------------------------------------------------
});




