 $(document).ready(function(){
	//alert('test');
	
/* --------------------------- fading images on homepage ------------------------------- */						
	$('ul#fade').innerfade({
		speed: 1000,
		//timeout: 6000,
		timeout: 4000,
		type: 'sequence',
		containerheight: '141px'
	});
	
	
/* --------------------- clearing text input fields on focus ------------------------- */
var clearMePrevious = "";

// clear input on focus
$(".clearme").focus(function()
	{
		
	if($(this).val()==$(this).attr("title"))
		{
		clearMePrevious = $(this).val();
		$(this).val("");
		}
	});

// if field is empty afterward, add text again
$(".clearme").blur(function()
	{
	if($(this).val()=="")
	{
	$(this).val(clearMePrevious);
	}
	});	
	
	
/* ------------------------------- contact form validation ------------------------------ */
$("#formcontact").validate({
	rules: {
		fname: {
			required: true
		},
		femail: {
			required: true,
			email: true
		},
		fmessage: {
			required: true
		}		
	},
	messages: {
		fname: "Please enter your name.",
		femail: "Please enter valid email.",			
		fmessage: "Please enter the message for us."
	}
	});

/* --------------------------- lightbox ------------------------------- */	
	 $(function() {
        $('.lightbox').lightBox();
    });	
	
/* ---------------------------- expandable boxes ----------------------*/


function linkToggle(el) {
	if (el.text() == "Read more")
		alert();
	alert(el.text() + "aa");
	}

$(".expandable").css("display", "none");
$(".expand").css("display", "block");

$(".expand").click(function(e){
	e.preventDefault();
	//linkToggle($(this));
	$(this).parents(".expandbox").children(".expandable").slideToggle();
//alert($(this).text());
		//$(this).parents(".expandbox").children(".expandable").css("display","block");
	if ($(this).text() == "Read more")
		{
			$(this).text("Read less");
			$(this).addClass("collapse");
		}
	else 
		{
			$(this).text("Read more");
			$(this).removeClass("collapse");			
		}
});

});

