$(function(){
	$(".searchtype").textPlaceholder();
			
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
		});
});
		
$(document).ready(function() {
	/*$("#twitpic li").hover(function() {
		$(this).find("img").stop().fadeTo('fast', 0.7 , function() {
		});
	} , function() {
		$(this).find("img").stop().fadeTo('fast', 1).show();
	});*/
			
	$(".closeit").click(function(){
		$("#slide-signup").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
});



/**
 * @see http://github.com/NV/placeholder.js
 */
jQuery.fn.textPlaceholder = function () {
	return this.each(function(){
		var that = this;
		if (that.placeholder && 'placeholder' in document.createElement(that.tagName)) return;
		var placeholder = that.getAttribute('placeholder');
		var input = jQuery(that);
		if (that.value === '' || that.value == placeholder) {
			input.addClass('text-placeholder');
			that.value = placeholder;
		}
		input.focus(function(){
			if (input.hasClass('text-placeholder')) {
				this.value = '';
				input.removeClass('text-placeholder')
			}
		});
		input.blur(function(){
			if (this.value === '') {
				input.addClass('text-placeholder');
				this.value = placeholder;
			} else {
				input.removeClass('text-placeholder');
			}
		});
		that.form && jQuery(that.form).submit(function(){
			if (input.hasClass('text-placeholder')) {
				that.value = '';
			}
		});
	});
};




// For Contact Form (jQuery Jigowatt)
jQuery(document).ready(function(){
	$('#contactform').submit(function(){
		var action = $(this).attr('action');
		$("#message").slideUp(750,function() {
		$('#message').hide();
 		$('#submit')
			.after('<img src="/images/contact-ajax_loader.gif" class="loader" />')
			.attr('disabled','disabled');
		$.post(action, { 
			name: $('#name').val(),
			email: $('#email').val(),
			subject: $('#subject').val(),
			comment: $('#comment').val(),
			verify: $('#verify').val()
		},
			function(data){
				document.getElementById('message').innerHTML = data;
				$('#message').slideDown('slow');
				$('#contactform img.loader').fadeOut('slow',function(){$(this).remove()});
				$('#contactform #submit').attr('disabled',''); 
				if(data.match('success') != null) $('#contactform').slideUp('slow');
				
			}
		);
		});
		return false; 
	});
});
