function changeMod(obj){
	var id = obj.id;
	//alert(obj.value);
	if(id == "foa_comment"  ){
		if(obj.value ==''){ obj.className=''; obj.value ="What are you doing right now ?"; }
		else if(obj.value =="What are you doing right now ?"){ obj.className='';  obj.value=""; }
	}
}


function writerblock()
{
	var title=document.getElementById("title").value;
	var desp=document.getElementById("desp").value;
	var startDate=document.getElementById("startDate").value;
	var startHour=document.getElementById("startHour").value;
	var startMin=document.getElementById("startMin").value;
	var msg="";
	var  valid=true;

	if(title=="")
	{
		msg+="Please Enter Title\n";
		valid=false;
	}

	if(desp=="")
	{
		msg+="Please Enter Description\n";
		valid=false;
	}

	if(startDate=="")
	{
		msg+="Please Select the Date\n";
		valid=false;
	}

	if(startHour==""&startHour=="Hr")
	{
		msg+="Please Select Hours\n";
		valid=false;
	}
	
	if(startMin==""&startMin=="00")
	{
		msg+="Please Select Minutes\n";
		valid=false;
	}

	if(!valid)
	{
		alert(msg);
		return false;
	}
		return true;	
}


function output()
{
alert("testing checkbox events");
}
function echeck(str){

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true
	}




function singup()
	{
	var fullName=document.getElementById("fullName").value;
	var password=document.getElementById("password").value;
	var gender=document.getElementById("gender").value;
	var birthmonth=document.getElementById("birthMonth").value;
	var birthdate=document.getElementById("birthDate").value;
	var birthyear=document.getElementById("birthYear").value;
	var emailID=document.getElementById("email").value;

	var msg="";
	var valid=true;	
	var skillSelected=false;

	var skillCount=document.getElementById("skillCount").value;

	for(i=0;i<skillCount;i++)
	{
		if(document.getElementById("skill["+i+"]").checked)
	   {			
			skillSelected=true;
			break;								
	   }
	}

	if(fullName=="")
	{
		msg+="Please Enter Your Full Name\n ";
		valid=false;
	}

	if(emailID=="")
	{
		msg+="Please Enter Your Email ID\n ";
		valid=false;
	}
	else if(echeck(emailID)==false)
		{
		emailID="";
		msg+="Please Enter Your Email ID\n ";
		valid=false;
		}

			
	if(password=="")
	{
		msg+="Please Enter password \n";
		valid=false;
	}


	if(gender=="")
	{
		msg+="Please select the Sex \n";
		valid=false;
	}

	if(birthmonth=="")
	{
		msg+="Please select the month\n";
		valid=false;
	}
	if(birthdate=="")
	{
		msg+="Please select the date\n";
		valid=false;
	}
	if(birthyear=="")
	{
		msg+="Please select the Year\n";
		valid=false;
	}

		if(!skillSelected)
			{
				msg+="Please select one Skill Id\n";
				valid=false;
			}
		


	if(!valid)
	{
		alert(msg);
		return false;
	}

	return true;



 }



function getType(){
var getType=document.getElementById("type").value;
var skillId=document.getElementById("skill_name").value;
location.href="work-management.php?getType="+getType+"&skillType="+skillId;
}





function getSkillName(){
var skillId=document.getElementById("skill_name").value;
location.href="my-works.php?skillType="+skillId;
}


function getSkillId(){
var skillId=document.getElementById("getSkill").value;
location.href="question-page.php?skillType="+skillId;
}
function security()
	{
	var squestion=document.getElementById("squestion").value;
	var sanswer=document.getElementById("sanswer").value;
	var msg="";
	var  valid=true;
	if(squestion=="")
	{
		msg+="Please Enter your Security Question\n";
		valid=false;
	}
	if(sanswer=="")
	{
		msg+="Answer feild should not be empty\n";
		valid=false;
	}
	if(!valid)
	{
		alert(msg);
		return false;
	}
		return true;

	}

function skillId()
	{
		
	var skill=document.getElementById("skill_name").value=document.getElementById("skill").value;
	}
	
	
	
	function work()
	{
    //var image=document.getElementById("image").checked;
    //var video2=document.getElementById("video1").checked;
    var photo=document.getElementById("photo").value;
	var msg="";
	var  valid=true;

	 if(photo=="")
	 {
	msg+="Please Select the  Path \n";
	valid=false;	
	}
		 
		
	if(!valid)
	{
		alert(msg);
		return false;

	}
		return true;


	}
	
	function work1()
	{
    //var image=document.getElementById("video1").checked;
    
    //var video2=document.getElementById("video1").checked;
    var photo=document.getElementById("video").value;
	var msg="";
	var  valid=true;
	 if(photo=="")
	 {
	msg+="Please Select the  Path \n";
	valid=false;	
	}
		 
		
	if(!valid)
	{
		alert(msg);
		return false;

	}
		return true;


	}

	
	
function submitForm(){
var stype=document.getElementById("skill_id").value;
location.href="question.php?skillType="+stype;
alert(stype);
}


function question()
	{
	var msg="";
	var  valid=true;

	var question= document.getElementsByName("question[]");
	var order= document.getElementsByName("orderNo[]");
	var i;		
	for (i=0;i<(question.length);i++)
	{
		if(question[i].value=="")
		{		
		valid=false;
		break;
		}
	}

	for (i=0;i<(order.length);i++)
	{
		if(order[i].value=="")
		{			
		valid=false;
		break;
		}

	}

	if(!valid)
	{
		alert("please enter question and Order no to corresponding to all the questions");
		return false;

	}
		return true;

}
	
	function addTextField()
	{
	var intTextBox = intTextBox + 1;
	var container = document.getElementById("container");
	var noOfQuestions= document.getElementById("noOfQuestions").value;
	var maxIdValue= document.getElementById("maxIdValue").value;
	for(var i=1;i<=noOfQuestions;i++)
		{
	var newTBDiv = document.createElement("div");
	newTBDiv.setAttribute("id","question["+(maxIdValue+i)+"]");
	newTBDiv.innerHTML ="Question:<input type=\"text\" name=\"question[]\"> <input type=\"text\" name=\"orderNo[]\" size=\"2\"><input type=hidden value=\"questionId[]\"><input type=\"button\" value=\"Remove\" onclick=\"removeElement('question["+(maxIdValue+i)+"]')\">";
	container.appendChild(newTBDiv);
		}

	}

 function removeElement(questionId)
 {
	
	var container = document.getElementById("container");	
	var removeTextFiled=document.getElementById(questionId);
	container.removeChild(removeTextFiled);
 }


function emailChange()
{
	var newEmail=document.getElementById("newEmail").value;
	var newPassword=document.getElementById("newPassword").value;
	

	var msg="";
	var  valid=true;


		

	if(newEmail=="")
	{
		msg+="Please Enter your Email Id\n";
		valid=false;
	}
	if(newPassword=="")
	{
		msg+="Please Enter password \n";
		valid=false;
	}
	if(!valid)
	{
		alert(msg);
		return false;
	}
		return true;
}

function passwordChange()
		{
		var oldPassword=document.getElementById("oldPassword").value;
		var newPassword=document.getElementById("newPassword").value;
		var confirmPassword=document.getElementById("confirmPassword").value;
		var msg="";
		var  valid=true;
		
		if(oldPassword=="")
		{
			msg+="Please Enter Your old Password\n";
			valid=false;
		}

		if(newPassword=="")
		{
			msg+="Please Enter Your New Password\n";
			valid=false;
		}
		if(confirmPassword=="")
		{
			msg+="Please Enter Your Confirm Password\n";
			valid=false;
		}


		if(newPassword!=confirmPassword)
		{			
			msg+="your New Password and Confirm Password not matched\n";
			valid=false;	
		}
								
		if(!valid)
		{
			alert(msg);
			return false;
		}
		return true;
		}
function login(frm)
{
	var loginName=document.getElementById("loginName").value;
	var loginPassword=document.getElementById("loginPassword").value;
	var msg="";
	var  valid=true;

	if(loginName=="")
	{
		msg+="Please Enter your Email Id\n";
		valid=false;
	}
	if(loginPassword=="")
	{
		msg+="Please Enter password \n";
		valid=false;
	}
	if(!valid)
	{
		alert(msg);
		return false;
	}
		frm.submit();
}





function nameChange()
		{
		var firstName=document.getElementById("firstName").value;
		var lastName=document.getElementById("lastName").value;
		var middleName=document.getElementById("middleName").value;

		var msg="";
		var  valid=true;
		if(firstName=="")
		{
			msg+="Please Enter Your First Name\n";
			valid=false;
		}
		/*if(middleName=="")
		{
			msg+="Please Enter Your Middle Name \n";
			valid=false;
		} */
		if(lastName=="")
		{
			msg+="Please Enter  Last Name \n";
			valid=false;
		}
		
		if(!valid)
		{
			alert(msg);
			return false;
		}
		return true;
		}


		function formerName()
		{
		var fullFormerName=document.getElementById("fullFormerName").value;
		var msg="";
		var  valid=true;
		if(fullFormerName=="")
		{
			msg+="Please Enter Your Former Name\n";
			valid=false;
		}		
		
		if(!valid)
		{
			alert(msg);
			return false;
		}
		return true;
		}

