$(function(){
	//portfolio thumb fadein fadeout
	$('#content div.portfolio').hover(function(){
		$(this).find('img').fadeOut();

	}, function(){
		$(this).find('img').fadeIn();
	});
	//load menu
	$('#nav-drop').droppy();
	});

function popup_PhotoGallery(path)
{
	var width = 710
	var height = 470

	LeftPosition = ((document.body.offsetWidth-width) / 2);
	TopPosition = ((document.body.offsetHeight-height) / 2);
	window.open(path, "PhotoGallery", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width="+width+",height="+height+",top="+TopPosition+",left="+LeftPosition)
}


function fun1(frm)
{
	if (frm.sugg.value != '')	
	{	
		s=frm.sugg.value
		if (s.length > 2050)
		{ 
			alert("Comments should not exceed 50 Lines.");
			frm.sugg.value=s.substring(0,2048);
		}
	}
}

function cl(frm)
{
	if (frm.sugg.value == "Please enter your comments here")
	{
		frm.sugg.value = ""
	}
}

function f_feedback_validate()
{
	if (document.f_feedback.txtname.value=="")
	{
		alert("Please enter Name");
		document.f_feedback.txtname.focus();
		return false;
	}
	if(document.f_feedback.email.value !='') 
	{
		var atsign=document.f_feedback.email.value.indexOf("@");
		var period=document.f_feedback.email.value.lastIndexOf(".");
		var  len=document.f_feedback.email.value.length;
		if  ((atsign == 0) || (period <= (atsign+1)) || ((len-1)<=period) || (atsign == -1) || (period == -1))
		{
			 alert("Please enter a proper email address.");
			 document.f_feedback.email.focus();
			 return false;
		}
	 }
	 else
	{
		 alert("Please enter email")
		 document.f_feedback.email.focus();
		 return false;
	}
							
	if (document.f_feedback.email.value != '')
	{ 
		 s=document.f_feedback.email.value;
		 isnot="!#$%^ &*()+=|\~`?><,':;{[}]";
		 var  inval= false;
		 var x;
		 isnot=isnot+'"'
		 for (var i=0; i<s.length; i++)
		 {
			 for (x=0; x<isnot.length; x++)
			 {
				 if (s.charAt(i) == isnot.charAt(x))
				 inval = true
			 }
		 }
		 if (inval == true)
		 { 
				alert("Email address should not contain special characters\nExcept alphanumerics, Atrate(@), Dot(.), Slash(/),hyphen(-) and Underscore(_) with out any space");
				document.f_feedback.email.focus();
				return false;
		 }
	 }
	 if (document.f_feedback.sugg.value == '' || document.f_feedback.sugg.value == 'Please enter your comments here')
	{
		 alert("Please enter your comments")
		 document.f_feedback.sugg.value=''
		 document.f_feedback.sugg.focus();
		 return false;

	}
}

function f_login_validate()
{
	if (document.f_login.username.value=="")
	{
		alert("The username field is required");
		document.f_login.username.focus();
		return false;
	}
	if (document.f_login.password.value=="")
	{
		alert("The password field is required");
		document.f_login.password.focus();
		return false;
	}
	return true;
}

function f_askhelp_validate()
{
	if (document.f_askhelp.txtname.value=="")
	{
		alert("The Applicant name is required");
		document.f_askhelp.txtname.focus();
		return false;
	}
	if (document.f_askhelp.txtfather.value=="")
	{
		alert("The Father/Mother Name is required");
		document.f_askhelp.txtfather.focus();
		return false;
	}
	if (document.f_askhelp.txtprofession.value=="")
	{
		alert("The Father/Mother Occupation is required");
		document.f_askhelp.txtprofession.focus();
		return false;
	}
	if (document.f_askhelp.txtIncome.value=="")
	{
		alert("The Income is required");
		document.f_askhelp.txtIncome.focus();
		return false;
	}
	if (document.f_askhelp.txtmobile.value=="")
	{
		alert("Mobile number is required");
		document.f_askhelp.txtmobile.focus();
		return false;
	}
	if (document.f_askhelp.txtemail.value=="")
	{
		alert("Email is required");
		document.f_askhelp.txtemail.focus();
		return false;
	}
	if (document.f_askhelp.txtaddress.value=="")
	{
		alert("Address is required");
		document.f_askhelp.txtaddress.focus();
		return false;
	}
}
