function Trim(nStr){return nStr.replace(/(^\s*)|(\s*$)/g, "");}
function fnPaste(){event.returnValue=false;}
function isNull(obj,msg){
	if(msg!="Password")
		obj1=Trim(obj.value);
	else
		obj1=obj.value;
	if (obj1==""){
		alert("Please enter the " +msg);
		obj.focus();
		return true;
	}else
		return false;
}

function isTxtareaNull(obj,msg){
	if(Trim(obj.innerText) == ""){
		alert("Please enter " + msg);
		obj.focus();
		return true;
	}else
		return false;
}
function notChecked(obj,msg){
	checked = false;
	if(obj.length){
		for(i=0;i<obj.length;i++){
			if(obj[i].checked){
				checked = true;break;
			}
		}
	}else if(obj.checked)
		checked = true;
	if(!(checked)){
		alert("Please select the "+msg);
		if(obj.length)
			obj[0].focus();
		else
			obj.focus();
		return true;
	}
}

function newtest(obj,msg){
	var shy = "";
	checked = false;
	if(obj.length){
		for(i=0;i<obj.length;i++){
			if(obj[i].checked){
				shy += obj[i].value + "9865615650-shyju"; 
				checked = true;
			}
		}
	}
		return shy;
	
}

function notSelected(obj,msg){
	if (obj.options[obj.selectedIndex].value == ""){
		alert("Please select the "+ msg);
		obj.focus();
		return true;
	}else
		return false;
}
function notImageFile(obj,msg){
	var exp = /^.+\.(jpg|gif|jpeg|JPG|JPEG|GIF)$/;
	if (!exp.test((obj.value).toLowerCase())){
		alert("Please choose jpg or gif file for "+msg);
		//obj.focus();
		return true;
	}else
		return false;
}

function notSongFile(obj,msg){
	var exp = /^.+\.(mp3|MP3|WMA|wma)$/;
	if (!exp.test((obj.value).toLowerCase())){
		alert("Please choose Mp3 or WMA file for "+msg);
		//obj.focus();
		return true;
	}else
		return false;
}



function notDocFile(obj,msg){
	if(Trim(obj.value)!=""){
		var exp = /^.+\.(DOC|doc|TXT|txt)$/;
		if (!exp.test((obj.value).toLowerCase())){
			alert("Please choose doc or txt file for "+msg);
			obj.value="";
			//obj.focus();
			return true;
		}else
			return false;	
	}else
		return false;
}
function notPdfDocFile(obj,msg){
	var exp = /^.+\.(pdf|doc|PDF|DOC)$/;
	if (!exp.test((obj.value).toLowerCase())){
		alert("Please choose pdf or doc file for "+msg);
		obj.value="";
		//obj.focus();
		return true;
	}else
		return false;
}
function notPdfFile(obj,msg){
	var exp = /^.+\.(pdf|PDF)$/;
	if (!exp.test((obj.value).toLowerCase())){
		alert("Please choose pdf file for "+msg);
		obj.value="";
		//obj.focus();
		return true;
	}else
		return false;
}
function fnChkNum(obj,msg){
	exp = /^[\d]*$/;
	if (!exp.test(obj.value)){
		alert("Please enter only numeric values in "+msg);
		obj.focus();
		return true;
	}else
		return false;
}

function fnShowDate(obj,msg){
	var retdate=window.showModalDialog("includes/calender.htm","","dialogHeight: 219px; dialogWidth: 273px;  center: Yes; help: No; resizable: No; status: No;titlebar:No");
	obj.value=retdate;
}
	
function isNullMulti(obj,msg){
	if (Trim(obj.value)==""){
		alert("Please select the " + msg);
		obj.focus();
		return true;
	}else
		return false;
}
function isNullCbo(obj,msg)
{
	if (Trim(obj.value)=="")
	{
		alert("Please select the " + msg);
		obj.focus();
		return true;
	}
	else
		return false;
}

function notFile(obj,msg){
	if(Trim(obj.value)!=""){
		var exp = /^.+\.(DOC|doc|TXT|txt|JPG|jpg|JPEG|jpeg|GIF|gif|XLS|xls)$/;
		if (!exp.test((obj.value).toLowerCase())){
			alert("Please choose doc | txt | file for "+msg);
			obj.value="";
			//obj.focus();
			return true;
		}else
			return false;	
	}else
		return false;
}

function isNullhid(obj,msg)
	{
	if (obj=="")
		{
		alert("Please enter the " +msg);
		return true;
		}
	else
		return false;
	}
function fnPressFiles(obj){
	var exp = /^.+\.(pdf|PDF|mp3|MP3)$/;
	if (!exp.test((obj.value).toLowerCase())){
		alert("Please choose valid file");
		obj.value="";
		//obj.focus();
		return true;
	}else
		return false;
}

