function externalLinks() {  if (!document.getElementsByTagName) return;  var anchors = document.getElementsByTagName("a");  for (var i=0; i<anchors.length; i++) {  var anchor = anchors[i];  if (anchor.getAttribute("href") &&  anchor.getAttribute("rel") == "external")  anchor.target = "_blank";  }  };  
function internalLinks() {  if (!document.getElementsByTagName) return;  var anchors = document.getElementsByTagName("a");  for (var i=0; i<anchors.length; i++) {  var anchor = anchors[i];  if (anchor.getAttribute("href") &&  anchor.getAttribute("rel") == "internal")  anchor.target = "_self";  }  };  


$("document").ready(function() {
	externalLinks();
	internalLinks();
	
	// For drop-down menu in Archive:
	$('ul li.toplevel ul, ul li.toplevellast ul',this).css('display','none'); // Turn off CSS hover effect when JS enabled
	$("#dd > ul li.toplevel, #dd > ul li.toplevellast").hover(													
		function () {
			//show its submenu
			/*$('#scroller',this).css('display','block');*/
			//h = $('#scroller',this).height();
			//if (h!=null) { alert (h) };
			$('#innerContainer',this).css('top','0px');
			$('ul', this).slideDown(175);
			$('#scroller',this).slideDown(175);
			
			$('.c-6').fadeTo(1,0.2);
		}, 
		function () {
			//hide its submenu
			/*$('#scroller',this).css('display','none');*/
				
			$('#scroller', this).slideUp(175);
			$('ul', this).slideUp(175);
			$('.c-6').fadeTo(1,1);
		}
	);
});


	
		$(document).ready(function() { 
			reset();
			
			 $('.slideshow').cycle({
				fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
				timeout: 6000,
			});
			
		});

		function showSubscribe(){
			//$('#subscribe').show('fast');
		}
		
		function reset(){
		$('p#emailError').hide();
		$('p#thanks').hide();
		}
	
		
		function validate_email(field)
		{
			var apos;
			var dotpos;
			var isValid = true;
			apos = field.indexOf("@");
			dotpos = field.lastIndexOf(".");
			if (apos < 1 || dotpos - apos < 2)
			{
				isValid = false;
			}
	
			return isValid;
		}
	
		function validate(){
	
		reset();
		var valid = true;
		if (!validate_email(document.getElementById('email').value)) {
			$('p#emailError').show('fast');
			valid = false;
		}
		
		if(valid){
			$.get("http://www.wearehold.com/reg.php", { email: document.getElementById('email').value});
			$("#form").hide('fast');
			$("#thanks").show('fast');
		}
		return false;
	}


	