/** TOP LINKS **/
$(document).ready(function() {
	var topLinks = $('.top_links a');
	for(var i = 0; i < topLinks.length; i++) {
		$(topLinks[i]).prev().width(($(topLinks[i]).width() + 10) + 'px');
		$(topLinks[i]).parent().mouseover(function() {
			var theLink = $(this).children('a');
			theLink = theLink[0];
			var newHeight = $(this).height() + 'px';
			$(theLink).prev().css({
				'display':'block'
			});
			$(theLink).css({
				'color':'#660000'
			});
		});
		$(topLinks[i]).parent().mouseout(function() {
			var theLink = $(this).children('a');
			theLink = theLink[0];
			$(theLink).prev().css({
				'display':'none'
			});
			$(theLink).css({
				'color':'#FFFFFF'
			});
		});
	}
});

/** OLD ANIMATION
$(document).ready(function() {
	var topLinks = $('.top_links a');
	for(var i = 0; i < topLinks.length; i++) {
		$(topLinks[i]).prev().width(($(topLinks[i]).width() + 10) + 'px');
		$(topLinks[i]).mouseover(function() {
			var newHeight = $(this).parent().height() + 'px';
			$(this).prev().stop().animate({
				height:newHeight
			}, 500 );
			$(this).stop().animate({
				color:'#660000'
			}, 500 );
		});
		$(topLinks[i]).mouseout(function() {
			$(this).prev().stop().animate({
				height:0
			}, 500 );
			$(this).stop().animate({
				color:'#FFFFFF'
			}, 500 );
		});
	}
}); */

/** NAV LINKS **/
/*
	OLD NAV LINKS ANIMATION
$(document).ready(function() {
	var navLinks = $('.nav_links a');
	for(var i = 0; i < navLinks.length; i++) {
		$(navLinks[i]).mouseover(function() {
			var newHeight = ($(this).height() + 10) + 'px';
			var newWidth = ($(this).width() + 10) + 'px';
			$(this).prev().stop().animate({
				height:newHeight,
				width:newWidth,
				left:'-5px',
				top:'-4px'
			}, 500 );
			$(this).stop().animate({
				color:'#660000'
			}, 500 );
		});
		$(navLinks[i]).mouseout(function() {
			$(this).prev().stop().animate({
				height:0,
				width:0,
				left:'50%',
				top:'50%'
			}, 500 );
			$(this).stop().animate({
				color:'#FFFFFF'
			}, 500 );
		});
	}
});*/

/** FOOTER TOP LINKS **/
/*$(document).ready(function() {
	var navLinks = $('.footer_top_links a');
	for(var i = 0; i < navLinks.length; i++) {
		$(navLinks[i]).mouseover(function() {
			var newHeight = ($(this).height() + 10) + 'px';
			var newWidth = ($(this).width() + 10) + 'px';
			$(this).prev().stop().animate({
				height:newHeight,
				width:newWidth,
				left:'-5px',
				top:'-4px'
			}, 500 );
			$(this).stop().animate({
				color:'#660000'
			}, 500 );
		});
		$(navLinks[i]).mouseout(function() {
			$(this).prev().stop().animate({
				height:0,
				width:0,
				left:'50%',
				top:'50%'
			}, 500 );
			$(this).stop().animate({
				color:'#FFFFFF'
			}, 500 );
		});
	}
});*/


/** NAV LINKS **/
$(document).ready(function() {
	var navLinks = $('.nav_links li');
	var temp = 'temp';
	for(var i = 0; i < navLinks.length; i++) {
		var navAnchors = $(navLinks[i]).children('a:not(".nav_selected")');
		var navSubMenu = $(navLinks[i]).children('.nav_submenu');

		$(navLinks[i]).mouseover(function() { // show the drop down menu when hovering the nav link
			var navSubMenu = $(this).children('.nav_submenu');
			$(navSubMenu).stop(true).css('display', 'block');
			if(IE_VERSION < 0) {
				$(navSubMenu).stop(true).animate({
					opacity: 1.0
				}, 200 );
			}
		});
		$(navSubMenu).mouseover(function() { // show the drop down menu when hovering the subnav (so it doesn't disappear)
			$(this).stop(true).css('display', 'block');
			if(IE_VERSION < 0) {
				$(this).stop(true).animate({
					opacity: 1.0
				}, 200 );
			}
		});
		$(navLinks[i]).mouseout(function() { // hide the drop down menu if mousing out of nav link
			var navSubMenu = $(this).children('.nav_submenu');
			if(IE_VERSION > 0) {
				$(navSubMenu).stop(true).animate({opacity: 1.0}, 100, "linear", function() {
					$(this).css('display', 'none');
				});
			} else {
				$(navSubMenu).animate({
					opacity: 0.0
				}, 200, "linear", function() {
						var testing = this;
						$(this).css('display', 'none');
					});
			}
		});
		$(navSubMenu).mouseout(function() { // hide the drop down menu if mousing out of the submenu
			if(IE_VERSION > 0) {
				$(this).stop(true).animate({opacity: 1.0}, 100, "linear", function() {
					$(this).css('display', 'none');
				});
			} else {
				$(this).animate({
					opacity: 0.0
				}, 200, "linear", function() {
						var testing = this;
						$(this).css('display', 'none');
					});
			}
		});
	}
});

/** TEXT SIZE ADJUST **/
var currentTextSize = 1;

function textSizeAdjust(coef) {
	currentTextSize = coef == 0 ? 1 : currentTextSize + coef * 0.1;
	$('body').css('fontSize', currentTextSize  + 'em');
}

/** GALLERY **/
var origionalSizes = new Array();

function gallery_hover(id, mousein) {
	var children = $('#gallery_link_'+id).children();
	if(mousein) {
		if(IE_VERSION > 0) {
			$(children[0]).css('opacity', '0.0');
		} else {
			$(children[0]).stop().animate({
				opacity: 0.0
			}, 300 );
		}
	} else {
		if(IE_VERSION > 0) {
			$(children[0]).css('opacity', '0.3');
		} else {
			$(children[0]).stop().animate({
				opacity: 0.3
			}, 300 );
		}
	}
}
/** OLD GALLERY ANIMATION **
function gallery_hover(id, mousein) {
	var children = $('#gallery_link_'+id).children();
	if(mousein) {
		$(children[0]).stop().animate({
			opacity: 0.0
		}, 500 );
		$('#gallery_link_'+id).stop().animate({
			height:(origionalSizes[id]['height'] + 5)+'px',
			width:(origionalSizes[id]['width'] + 5)+'px',
			top:(origionalSizes[id]['top'] - 13)+'px',
			left:(origionalSizes[id]['left'] - 13)+'px'
		}, 500);
	} else {
		$(children[0]).stop().animate({
			opacity: 0.3
		}, 500 );
		$('#gallery_link_'+id).stop().animate({
			height:origionalSizes[id]['height']+'px',
			width:origionalSizes[id]['width']+'px',
			top:origionalSizes[id]['top']+'px',
			left:origionalSizes[id]['left']+'px'
		}, 1000);
	}
}*/

/** TAB BOX IMAGES **/
function tab_box_image_hover(e, mousein) {
	if(mousein) {
		if(IE_VERSION < 0) {
			$(e).stop().animate({
				opacity: 0.6
			}, 500 );
		}
	} else {
		if(IE_VERSION < 0) {
			$(e).stop().animate({
				opacity: 1.0
			}, 500 );
		}
	}
}
