// set actions for webmail form
function webmailFormActions() {
	
	// hide form
	$('#webmailForm').hide();
	
	// set input field actions
	$('#txtEmail, #txtPassword').focus(function() {
		if(this.value == this.defaultValue) { this.value = ''; }
	}).blur(function() {
		if(this.value == '') { this.value = this.defaultValue; }
	});
	
	// set toggle actions
	$('#loginButton a').click(function() {
		
		// button disappears
		$('#loginButton').DropOutRight(500);
		
		// form appears
		setTimeout(function() {$('#loginButton').remove(); $('#webmailForm').DropInRight(500);}, 600);

		return false;
	});
}


// set hover actions for services
function serviceHovers() {
	
	// set images and alt text
	var serviceImages = ['http://www.biznet.net/images/hosting_image.jpg', 'http://www.biznet.net/images/design_image.jpg', 'http://www.biznet.net/images/ecommerce_image.jpg'];
	
	// get all service divs
	$('div.service').each(function(i) {
		
		// set hover actions for each div
		$(this).mouseover(function() {

			// remove active class
			$('div.service.active').removeClass('active');

			// add active class to current div
			$(this).addClass('active');
			
			// change image
			$('#serviceImage img').attr('src', serviceImages[i]);
		}).mouseout(function() {

			// remove active class
			$('div.service.active').removeClass('active');

			// return to default image
			var def = $('div.service').get(1);
			$(def).addClass('active');
			$('#serviceImage img').attr('src', serviceImages[1]);
		});
	});
}


// opens links with rel="external" in new windows
function externalLinks() {
	$('a[@rel=external]').click(function() { window.open($(this).attr("href")); return false; });
}


// displays tooltips over rss icons
function rssToolTips() {
	$('#subscribe a').ToolTip({
		className: 'toolTip',
		position: 'left',
		delay: 500
	});
}


// initialize actions
$(document).ready(function() {

	// set actions for webmail form
	webmailFormActions();
	
	// set hover actions for services
	serviceHovers();

	// open external links in new windows
	// externalLinks();

	// rss tooltips
	rssToolTips();
});