$(document).ready(function() {
	
	var flashvars = {};
	var params = {};
	params.wmode = "transparent";
	var attributes = {};
	attributes.id = "flashobj_header";
	swfobject.embedSWF("f/header.swf", "flash", "500", "300", "10.0.0", "f/expressInstall.swf", flashvars, params, attributes);
	
	// =======================================
	// = HOVER STATE FOR OVER LOGO IN HEADER =
	// =======================================
	$('p#overitmedia a').after('<a href="http://overit.com" class="hoverstate"><img src="images/producthover.jpg" alt="A product of Overit Media" /></a>');
	$('p#overitmedia a.hoverstate').hide();
	$('p#overitmedia').hover(function() {
		$('p#overitmedia a.hoverstate').fadeIn();
	}, function() {
		$('p#overitmedia a.hoverstate').fadeOut();
	});
	
	// =================================
	// = HOVER STATES FOR CAPABILITIES =
	// =================================
	$('li#goods-services h3 img').after('<span class="hoverstate"><img src="images/goodsserviceshover.gif" alt="Goods &amp; Services - Offer it? Sell it." /></span>');
	$('li#ticket-sales h3 img').after('<span class="hoverstate"><img src="images/ticketsaleshover.gif" alt="Ticket Sales - Events, seats, concerts" /></span>');			
	$('li#memberships h3 img').after('<span class="hoverstate"><img src="images/membershipshover.gif" alt="Memberships - Subscription based sales" /></span>');		
	$('li#digital-media h3 img').after('<span class="hoverstate"><img src="images/digitalmediahover.gif" alt="Digial Media - Audio, Video, Documents, etc." /></span>');
	
	$('#capabilities li h3 span.hoverstate').hide();

	$('#capabilities li').hover(function() {
		$(this).find('h3 span.hoverstate').fadeIn();
	}, function() {
		$(this).find('h3 span.hoverstate').fadeOut();
	});
	
	// ================
	// = CONTACT FORM =
	// ================
	$('form div.textfield, form div.textarea').click(function() {
		if($(this).find('textarea').length!=0) {
			$(this).find('textarea').focus();
		}
		if($(this).find('input').length!=0) {
			$(this).find('input').focus();
		}
		return false;
	});
	if(!$('#contact').hasClass('visible') && $('#contact').length!=0) {
		$('#contact').hide();
		$('#contactinfo').before('<p id="showform"><a href="#"><img src="images/dropline.gif" alt="Drop us a line!" /><span><img src="images/droplinehover.gif" alt="Drop us a line!" /></span></a></p>');
		$('#showform a').click(function() {
			$('#showform a').fadeOut(function() {
				$('#showform').animate({'width': '0'}, 'fast', function() {
					$('#showform').remove();
				});
				$('#contact').slideDown(function() {
					$.scrollTo('100%','100%');
					$('#name').focus();
				});
			});
			return false;
		});
	}
	
});
