jQuery.noConflict();
jQuery(document).ready(function(){
	jQuery('.navi').click(function(){
		var title = jQuery(this).attr('title');
		jQuery('#nav').val(title);
		window.location = "?nav="+title;
	});
	jQuery('.btn_show_allcourses').click(function(){
		window.location = "?nav=courses";
	});
	

});

jQuery(document).ready(function(){
	jQuery("ul.thumb li").hover(function() {								
	jQuery(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
	jQuery(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
		.animate({
			marginTop: '-80px', /* The next 4 lines will vertically align this image */ 
			marginLeft: '-90px',
			top: '50%',
			left: '50%',
			width: '165px', /* Set new width */
			height: '141px', /* Set new height */
			padding: '0px'
		}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */

	} , function() {
	jQuery(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
	jQuery(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
		.animate({
			marginTop: '0', /* Set alignment back to default */
			marginLeft: '0',
			top: '0',
			left: '0',
			width: '135px', /* Set width back to default */
			height: '115px', /* Set height back to default */
			padding: '5px'
		}, 400);
});
});


function chkMail(){
	var help = 0;

	var name = jQuery('#name');
	var	text_name = getValue(name);		
		if(text_name != "" && text_name == 'Name'){
			//getStuck(name);
			name.next().text('Please input name!');
			help = 0;
			name.focus();
			name.select();
			return false;
		}else{
			help = 1;
			name.next().text('');
		}
		
		
	var email = jQuery('#email');	
	var text_email = getValue(email);
	if(text_email != "" && text_email == "Your email"){
		help = 0;
		email.next().text('Please input your email');
		email.focus();
		email.select();
		return false;
	}else{		
		if(validateEmail(text_email) == 0){
			help = 0;
			email.next().text('Invalid email address!');
			email.focus();
			email.select();
			return false;
		}else{
			help = 1;
			email.next().text('');
		}
	}
		
		
	var subject = jQuery('#subject');
	var text_subject = getValue(subject);
		if(text_subject != "" && text_subject == 'Subject'){
			//getStuck(subject);
			help = 0;
			subject.next().text('Please input subject');
			subject.focus();
			subject.select();
			return false;
		}else{
			help = 1;
			subject.next().text('');
		}
	var message = jQuery('#message');
	var text_message = getValue(message);
		if(text_message != "" && text_message == 'Message'){
			//getStuck(message);
			help = 0;
			message.next().next().text('Please write your message');
			message.focus();
			message.select();
			return false;
		}else{
			help = 1;
			message.next().text('');
		}
		if(help == 1){
			return true;
		}
	//var name = document.getElementById('txtname').value;
}
function validateEmail ( email ) {

	var help = 0 ;

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z\.]{2,4})$/;
	//var reg =/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/;

	var address = email;



	if ( reg.test(address) == false ) {

	return help;

	}

	}

function getValue(object){
	var textvalue = object.val();
	textvalue = jQuery.trim(textvalue);
	return textvalue;
}

function getStuck( object ){
	//alert("Please input value");
	object.focus();
	/*if( object.next().text() == ''){
		object.after(' <span style="color:red;">Please input value!</span>');	
	}*/
	if( object.next().text() == ''){
		jQuery(".confirm").text('Please input value!');
	}
}
function btnClear(){
	jQuery(".confirm").text('');
}

// start gallery

jQuery(document).ready(function(){
	   var firstImg = jQuery('.left').find('img:first');
	   var srcFirstImg = firstImg.attr('src');
	   jQuery('.bigImg').hide();
	   jQuery('.bigImg').attr('src', srcFirstImg).fadeIn(1500);
	   
	   // when image on the left is clicked
	   jQuery('.left img').click(function(){
			var e = jQuery(this);
			var src = e.attr('src');
			jQuery('.bigImg').hide();
			jQuery('.bigImg').attr('src', src).fadeIn(1500);
	   });
	});

// end gallery

