var MakeCurrent = function(theNode){
	var classArray = dom.$c(dom.$('PatentLeft'), 'current');
	for(var i=0; i< classArray.length; i++){
		dom.removeClass(classArray[i], 'current');
	}
	dom.addClass(theNode, 'current');
}

var ShowContent= function(theDiv) {
	var classArray = dom.$c(dom.$('PatentRight'), 'PatentContent');
	for(var i=0; i< classArray.length; i++){
		classArray[i].style.display = 'none';
	}
	dom.$(theDiv).style.display = 'block';
}

var TogglePatentInventionForm = function(theAction) {
	dom.$('NewInvention').style.display		= (theAction == 'show') ? 'block' : 'none';
	dom.$('InventionGallery').style.display	= (theAction == 'show') ? 'none' : 'block';
	dom.$('FormAction').value				= (theAction == 'show') ? 'NewInvention' : 'FromGallery';
	if(arguments[1] == null)
		dom.$('ErrorMessage').innerHTML		= '';
}

$(document).ready( function() {
	var RegBubbleAnimating = false;
	$('#InventorsPlant').hover(
		function() {
			if ( RegBubbleAnimating == false ) { 
				RegBubbleAnimating = true;
				$('.RegBubble').fadeIn( 'fast', function() { RegBubbleAnimating = false; } ); 
			}
		},

		function() {
			if ( RegBubbleAnimating == false ) { 
				RegBubbleAnimating = true;
				$('.RegBubble').fadeOut( 'fast', function() { RegBubbleAnimating = false; } ); 
			}
		}
	);
});

var LeavingSite = function() {
	var This = {
		ShowDisclaimer : function( ParentNode, URL) {
			var HTML =	'<div class="LVG_Container">You are now leaving www.InventNow.org.  We are not responsible for the content provided at any other site.  ' + 
						'Please be careful when submitting personal information at any website. Always ask an adult for help if you have a question. ' + 
						'Click <a href="' + URL + '" target="_blank">here</a> to leave www.InventNow.org</div>';
			$(ParentNode).append( HTML );
			var nodeTop		= ( $(ParentNode).height() / 2 ) - ($('.LVG_Container').height() /2);
			var nodeLeft	= ( $(ParentNode).width() / 2 ) - ($('.LVG_Container').width() / 2);
			$('.LVG_Container').css({top: nodeTop, left: nodeLeft});
		}
	};

	return This;
}
