function validationImage(){
	objVal = getFieldsObject('image')
	error = v_image(objVal);
	return error;
}
function signUpsubmit(){
	objVal = getFieldsObject('signup')
	error = v_signup(objVal);
	return error;
}
function loginsubmit(){
	objVal = getFieldsObject('login')
	error = v_login(objVal);
	return error;
}
function onLogout(){ 
	document.frmlogout.submit();
}
function onSubmitProfile(){
	objVal = getFieldsObject('profile')
	error = v_profile(objVal);
	return error;
}
function selectState(connectScript,value,selVal){
	var sendParams=null;
	var sendReqMethod=null;
	var selectedIndex = "";
	connectScript=connectScript+"?selectedIndex="+ encodeURIComponent(value) +"&selVal="+selVal;
	sendRequest(connectScript,sendParams,sendReqMethod,"stateDiv");
}
function imageUpload(userId){
	document.getElementById('buttonhide').innerHTML = "";
	document.getElementById("iframeid1").style.display = "block";
	// window.open ("imageupload.php","Thankoo.com","location=0,status=0,scrollbars=0,width=300,height=150");
}
function onSubmitthankoo(){
	objVal = getFieldsObject('thankoonote')
	error = v_thankoo(objVal);
	return error;
}
function changeSubmit(){
	objVal = getFieldsObject('change')
	error = v_change(objVal);
	return error;
}
function getnickName(connectScript,value,selVal){
	document.getElementById(selVal).disabled = false;
	
	if(value != "")
	{
		var sendParams=null;
		var sendReqMethod=null;
		var selectedIndex = "";
		connectScript=connectScript+"?selectedIndex="+value+"&hAction=nick";
		sendRequest(connectScript,sendParams,sendReqMethod,"txtnickName");
	}
}
function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm[z].checked = theElement.checked;
	  }
	   
     }
	 
}
function submittype(value){
	if(document.getElementById('chknoteid')){
		if(document.getElementById('chknoteid')){
		var objCheckId = document.frmthankoolist.chknoteid;
		var thankIdsLen	= document.frmthankoolist.chknoteid.length;
		var thankIdsFlag	= false;
		for(var i=0; i<thankIdsLen; i++){
			if(objCheckId[i].checked == true){
				thankIdsFlag = true;
			}
		}
		if(!thankIdsFlag){
			alert('Select atleast one Thankoo Note');
		}else{
			//if(document.getElementById('chknoteid').checked == true){
				if(document.getElementById('selType').value == "Delete"){
				if(confirm("Are you sure to delete?")){
					document.frmthankoolist.submit();
				}
				}else if(document.getElementById('selType').value == "Hide"){
				if(confirm("Are you sure to Hide?")){
					document.frmthankoolist.submit();
				}
				}
				else if(document.getElementById('selType').value == "Unhide"){
				if(confirm("Are you sure to Unhide?")){
					document.frmthankoolist.submit();
				}
				}
			//}
		}
	}
	}
}
function deleteNote(id){
	if(confirm("Are you sure to delete?")){
		document.frmthankoolist.hAction.value = "deleteNote";
		document.getElementById('ThankoonoteID').value = id;
		document.frmthankoolist.submit();
	}
}
function imageDelete(){	//alert('here');
	document.frmdelete.submit();
}

function frameload(){
	var fr=frames['iframeid1']; 
	if(fr && fr.document){ 
		fr=fr.document.forms[0];
		if(fr.elements["filename"]){
			if(fr.elements["filename"].value != ""){
				document.getElementById('profileImage').src = fr.elements["filename"].value;
			}
		}
		else{
			document.getElementById('profileImage').src = "images/loginuser_photo_default.gif";
		}
	}
}

function postMsgValidation(objForm){
	objVal = getFieldsObject('message')
	error = v_message(objVal);
	objForm.hdAction.value = 'Compose';
	return error;
}

function selectAll(objForm){
	var sentIdsLen	= objForm.chkSentIds.length;
	if(document.getElementById("chkAllIds").checked == true)
	{
		for(var i=0; i<sentIdsLen; i++){
			objForm.chkSentIds[i].checked = true;
		}
	}
	//if(document.getElementById("chkAllIds").checked == false)
	else
	{
		for(var i=0; i<sentIdsLen; i++){
			objForm.chkSentIds[i].checked = false;
		}
	}
}
function deleteMessages(objForm){
	var sentIdsLen	= objForm.chkSentIds.length;
	var sentIdsFlag	= false;
	for(var i=0; i<sentIdsLen; i++){
		if(objForm.chkSentIds[i].checked == true){
			sentIdsFlag = true;
		}
	}
	if(!sentIdsFlag){
			alert("Select a message for delete");
			return false;
	}
	if(confirm("Are you sure you want to delete?"))
	{
		document.frmSentMessages.hdAction.value = 'MsgDelete';
		document.frmSentMessages.submit();
	}
}

function deleteSentMsg(objForm){ 
	if(confirm("Are you sure you want to delete?"))
	{
		objForm.hdAction.value = 'MsgDelete';
		objForm.submit();
	}
}

function postFeedbackValidation(objForm){
	objVal = getFieldsObject('feedback');
	error = v_feedback(objVal);
	objForm.hdAction.value = 'Feedback';
	return error;
}