function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block'){
          e.style.display = 'none';
		  //document.getElementById('share-img').src = "img/plus.gif";
       } else {
          e.style.display = 'block';
		  //document.getElementById('share-img').src = "img/minus.gif";
		}
    }

function changeText(){
	document.getElementById("def-text").style.display='none';
	document.getElementById("chang-text").style.display='block';
}
function backText(){
	document.getElementById("chang-text").style.display='none';
	document.getElementById("def-text").style.display='block';
}

function changeSize(size){
	document.getElementById('wrapper-content').className = "text-"+size;
}

function openSubCat(id){
	$('.main-cat-link').removeClass('cat-selected');
	$('.plus-minus').attr('src', 'img/plus.gif');
	$('.subcat-holder').hide('fast');
	$('#subcat-holder'+id).show('fast');
	$('#plus-minus'+id).attr('src', 'img/minus.gif');
	$('#main-cat-link'+id).addClass('cat-selected');
}


function openFaqAnswer(id){
	$('.faq-answer').hide('fast');
	$('#faq-answer'+id).show('fast');
	
}

function newsletterFocus(element){
	if (element.value == 'Your Email Here'){
		element.value = '';
		element.style.fontStyle = 'normal';
	}
}

function newsletterBlur(element){
	if (element.value == ''){
		element.value = 'Your Email Here';
		element.style.fontStyle = 'italic';
	}	
}

function submitNewsletter(){
	
	email			= document.getElementById('email').value;
	var emailReg	= /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
	var email 		= trimAll(email);
	
	if (emailReg.test(email)){
		document.getElementById('loader').style.display = 'block';
		$.ajax({
			url: 'ajaxpages/subscribe.php',
			type: 'POST',
			data: "email="+email,
			error: function(){
				document.getElementById('loader').style.display = 'none';
				alert('Unexpected Error. Please try again');
			},
			success: function(reponseText){
				document.getElementById('loader').style.display = 'none';
				if (reponseText == 'failed'){
					alert('Unexpected Error. Please try again');
				} else if (reponseText == 'exist'){
					alert('Your email address already exists in our record');
				} else {
					alert('Your email address has been added to the subscriber list');	
				}
					//document.getElementById('image-contents').innerHTML=data.image;
			}
		});			
		
	} else {
		alert('Please enter a valid email address');
	}
	
}

