$(document).ready(function(){

	$("#login").click(function() { 

	$('#login_div').show();
 

	});
	
	
	$("ul.subnav").parent().append("<span></span>"); 

	$("ul.topnav li").click(function() { 

		$(this).find("ul.subnav").slideDown('fast').show(); 

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); 
		});
		}).hover(function() {
			$(this).addClass("subhover"); 
		}, function(){	
			$(this).removeClass("subhover"); 
	});

});


$(document).ready(function(){
	$(".CheckBoxClass").change(function(){
		if($(this).is(":checked")){
			$(this).next("label").addClass("LabelSelected");
		}else{
			$(this).next("label").removeClass("LabelSelected");
		}
	});
	
	
	
	$('#nav li').hover(
		function () {
			$('ul', this).slideDown(300);
		}, 
		function () {
			$('ul', this).slideUp(100);			
		}
	);
	
	

	
	
});


$(window).scroll(function()
{ var top_h = $(window).scrollTop()+$(window).height()-54;

  $('#chat').animate({top:top_h+"px"},{queue: false, duration: 350});
});
// JavaScript Document
$(document).ready(function() {
 
	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
 
});


function validateForm()
{
var name=document.forms["enquiry"]["name"].value
var phone=document.forms["enquiry"]["phone"].value
var x=document.forms["enquiry"]["email"].value

if (name==''|| name.length<3)
  {
message('Please Fill Your Name!')
  return false;
  }
  

			
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
  {
 message('Not a valid e-mail address')
  return false;
  }
  
  var inpVal = parseInt(phone, 10);
    if (isNaN(inpVal) || phone.length<10) {
	message('Please Fill a Valid Phone Number!')
	 return false;
	}
	
}

function message(msg)
{
	  document.getElementById('error').innerHTML = msg;
}
