function selectAllCB(objChk,strFormName,strMainId) {
	var frm= gGetElementById(strFormName);
	var ele=frm.elements;
	for(var i=0;i<ele.length;i++)
	{
		if(ele[i].type == "checkbox") {
			if(ele[i].id==strMainId) {
				ele[i].checked=objChk.checked;
			}
		}
	}
}

// cross platform equiv. to document.getElementById
function gGetElementById(s) {
  var o = (document.getElementById ? document.getElementById(s) : document.all[s]);
  return o == null ? false : o;
}

function getCheckBoxSelectCount(strFormName,strMainId) {
	var frm= gGetElementById(strFormName);
	var ele=frm.elements;
	var cnt=0;
	for(var i=0;i<ele.length;i++)
	{
		if(ele[i].type == "checkbox") {
			if(ele[i].id==strMainId) {
				if(ele[i].checked) {
					cnt=cnt+1;
				}
			}
		}
	}
	return(cnt);
}

function getCheckBoxSelectedValues(strFormName,strMainId) {
	var frm= gGetElementById(strFormName);
	var ele=frm.elements;
	var cnt=0;
	var ans="";
	for(var i=0;i<ele.length;i++)
	{
		if(ele[i].type == "checkbox") {
			if(ele[i].id==strMainId) {
				if(ele[i].checked) {
					if(ans=="") 
						ans=ele[i].value;
					else
						ans=ans + "," + ele[i].value;
				}
			}
		}
	}

	return(ans);
}

function actions(strFormName,strAction,strMainId,objCmb) {
	var ans;
	var actionText;
	var frm= gGetElementById(strFormName);
	var cmbAction;
	var cnt;
	if(objCmb.value!="0" && objCmb.value!="-") {
		ans=getCheckBoxSelectedValues(strFormName,strMainId);
		if(ans != "") {
			var objIds;
			objIds=gGetElementById(strMainId + "s");
			if(objCmb.value.indexOf("*S") > 0){
				cnt=getCheckBoxSelectCount(strFormName,strMainId);
				if(cnt==1) {
					objIds.value=ans;
					frm.submit();
				} else {
					alert("Please Select Single Record.");
					objCmb.value=0;
					return false;
				}
			} else if(objCmb.value.indexOf("*M") > 0){
				objIds.value=ans;
				frm.submit();
			} else {
				actionText=gGetElementById(strAction).options[gGetElementById(strAction).selectedIndex].text;
				if(confirm("Are you sure to perform " + actionText + " Action on selected records ?")) {
					objIds.value=ans;
					frm.submit();
				} else {
					objCmb.value=0;
					return false;
				}
			}
		} else {
			alert("You need to some records.");
			objCmb.value=0;
			return false;
		}
	} else {
		objCmb.value=0;
		return false;
	}
}

function resetAndSubmit(strFormName) {
	var frm= gGetElementById(strFormName);
	var ele=frm.elements;
	for(var i=0;i<ele.length;i++)
	{
		if(ele[i].type == "hidden" || ele[i].type == "text") {
			ele[i].value="";
		} else if(ele[i].type == "select-one") {
			ele[i].options[0].selected=true;
		} else {
			
		}
	}
 	return true;
}

function getFront(mainStr,searchStr){
	foundOffset = mainStr.indexOf(searchStr)
	if (foundOffset == -1) {
		return null
	}
	return mainStr.substring(0,foundOffset)
}

// extract back end of string after searchString
function getEnd(mainStr,searchStr) {
	foundOffset = mainStr.indexOf(searchStr)
	if (foundOffset == -1) {
		return null
	}
	return mainStr.substring(foundOffset+searchStr.length,mainStr.length)
}

// insert insertString immediately before searchString
function insertString(mainStr,searchStr,insertStr) {
	var front = getFront(mainStr,searchStr)
	var end = getEnd(mainStr,searchStr)
	if (front != null && end != null) {
		return front + insertStr + searchStr + end
	}
	return null
}

// remove deleteString
function deleteString(mainStr,deleteStr) {
	return replaceString(mainStr,deleteStr,"")
}

// replace searchString with replaceString
function replaceString(mainStr,searchStr,replaceStr) {
	var front = getFront(mainStr,searchStr)
	var end = getEnd(mainStr,searchStr)
	if (front != null && end != null) {
		return front + replaceStr + end
	}
	return null
}
function edCmdImage(strCommand,opType) {
//opType=1 = Enable
//opType=2 = Disable
	var Img;
	var temp;
	var strReplace;
	var strReplaceBy;
	Img=gGetElementById("cmd"+strCommand);
	temp=Img.src;
	
	if(getFront(temp,strCommand + "_o.jpg")) {
		strReplace=strCommand + "_o.jpg";
	} else {
		strReplace=strCommand + "_d.jpg";
	}
	
	if(opType=="1") {
		strReplaceBy=strCommand + "_o.jpg";
	} else {
		strReplaceBy=strCommand + "_d.jpg";
	}
	temp=replaceString(temp,strReplace,strReplaceBy);
	Img.src=temp;
}
function clickCmdImgs(opType,baseURL,strFormName,cbId) {
	var cnt;
	var a;
	switch(opType) {
		case "add":
			a=gGetElementById("addLink"+strFormName);
			window.location=a;
			break;
		case "edit":
			a=gGetElementById("editLink"+strFormName);
			a=a + getCheckBoxSelectedValues(strFormName,cbId);
			cnt=getCheckBoxSelectCount(strFormName,cbId)		
			if(cnt==1) {
				window.location=a;
			}
			break;
		case "delete":
			a=gGetElementById("deleteLink"+strFormName);
			a=a + getCheckBoxSelectedValues(strFormName,cbId);
			cnt=getCheckBoxSelectCount(strFormName,cbId)
			if(cnt>0) {
				window.location=a;
			}
			break;
			
		case "send_msg":
			/*a=gGetElementById("sendLink"+strFormName);
			a=a + getCheckBoxSelectedValues(strFormName,cbId);
			cnt=getCheckBoxSelectCount(strFormName,cbId)*/
			var extra=gGetElementById('arrstr').value;
			a=gGetElementById("sendLink"+strFormName);
			//return false;
			var val=getCheckBoxSelectedValues(strFormName,cbId);
			if(val!=''){
				//alert("sendLink"+strFormName);
				a=a + val;
				
			}else if(extra!=''){
				a=a + extra;
			}
			window.location=a;
				break;
			/*if(cnt>0) {
					window.location=a;
				
			}else{
					alert("Please select record to send message");
			}
			break;*/
	}
	return false;
}
function changeCmdImgs(baseURL,strFormName,cbId) {
	var cnt;
	cnt=getCheckBoxSelectCount(strFormName,cbId)
	if(cnt==1) {
		edCmdImage("edit",1);
	} else {
		edCmdImage("edit",0);
	}
	
	if(cnt>0) {
		edCmdImage("delete",1);
	} else {
		edCmdImage("delete",0);
	}
	/*if(baseURL=='admin/subscribers'){
	/*if(cnt>0) {
		edCmdImage("send_msg",1);
	} else {
		edCmdImage("send_msg",0);
	}/*
	}*/
}
function setAddOther(strFieldName) {
		var field;
		field=gGetElementById(strFieldName);
		field.value="1";
		return true;
}
function submitDelete(strFormName,cbId) {
var cnt;
var ids;
cnt=getCheckBoxSelectCount(strFormName,cbId);
if(cnt > 0 ) {
	ids=gGetElementById("deleteIds");
	ids.value=getCheckBoxSelectedValues(strFormName,cbId);
	return true;
} else {
	alert("You need to select the Records to Delete.");
	return false;
}
		
}

function setUrl(){
	var ele;
	ele=gGetElementById("name");
	ele1=gGetElementById("url");
	ele1.value=ele.value;
//	alert(ele.value);
}

function getComboValue(){
		var ele;
		ele=gGetElementById("pa");
		ele1=gGetElementById("spa");
		ele2=gGetElementById("province");
		ele3=gGetElementById("city");
		List=Array();
		List['pa']=ele.value;
		List['spa']=ele1.value;
		List['province']=ele2.value;
		List['city']=ele3.value;
		ele5=gGetElementById("list");
		ele5.value=List['pa']+","+List['spa'];
		return true;
}

function search_term(){
		var ele,val;
		ele=gGetElementById("txtTerm");
		if(ele.value=='e.g. toronto; civil lawyer;'){
			ele.value='';
		}
}
function set_same_value(){
	ele=gGetElementById("txtTerm");
	val=ele.value;
	if(val==''){
		ele.value='e.g. toronto; civil lawyer;';
	}
}

function check_combo_exist(){
	ids=Array();
	ids[0]='city_search';
	ids[1]='spa_search';
	ids[2]='city_search_1';
	ids[3]='spa_search_1';
	for(i=0;i<ids.length;i++){
		ele=gGetElementById(ids[i]);
		if(ele){
			Element.hide(ids[i]);
		}
	}
	return true;
}


function checkForPresenceInSelect2(optVal, text, selList) {
 for (i = 0; i < selList.length; i++) {
   if (selList.options[i].value == optVal) return true;
   if (selList.options[i].text == text) return true;
 }
 return false;
}
// Logic for moving a multi-select from element1 to element2
function gGetElementById(s) {
  var o = (document.getElementById ? document.getElementById(s) : document.all[s]);
  return o == null ? false : o;
}
function selectAllOptions(oblCmb)
{
var len = oblCmb.length;
for (var i = 0; i < len; ++i) {
 	 oblCmb.options[i].selected = true;
   }
}

function one2two(element1, element2) {
 var memberList = gGetElementById(element1);
 var selectedList = gGetElementById(element2);
 var len = memberList.length;

 // Ignore any selections that are made to "------"
 for (var i = 0; i < len; ++i) {
   if (memberList.options[i].selected == true) {
	 memberList.options[i].selected = false;
	 if (memberList.options[i].text == "------") {
	   continue;
	 }
	 
	 if (checkForPresenceInSelect2(memberList.options[i].value, memberList.options[i].text, selectedList) == false) {

	   selectedList.options[selectedList.length] = new Option(memberList.options[i].text, memberList.options[i].value);
	   
	 }
   }
 }
}

// moving a multi-select from element2 to element1.
// Actually this assumes that the values being moved are
// already present in element1 and ends up deleting
// the selected values in element2.
function two2one(element1, element2) {
 var selectedList = gGetElementById(element2);
 for (i = selectedList.length -1; i >= 0; i--) {
   if (selectedList.options[i].selected == true) {
	 selectedList.options[i] = null;
   }
 }
}

function one2twoSingle(element1, element2) {
 var memberList = gGetElementById(element1);
 var selectedList = gGetElementById(element2);
 var len = memberList.length;
 for (var i = 0; i < len; i++) {
    if (memberList.options[i].selected == true) {
		memberList.options[i].selected = false;
	 if (checkForPresenceInSelect2(memberList.options[i].value, memberList.options[i].text, selectedList) == false) {
	   selectedList.options[selectedList.length] = new Option(memberList.options[i].text, memberList.options[i].value);
	 }
	}
 }
}

function two2oneSingle(element1, element2) {
	var selectedList = gGetElementById(element2);
	for (i = selectedList.length -1; i >= 0; i--) {
		if(selectedList.options[i].selected==true) {
			selectedList.options[i].selected=false;
			selectedList.options[i] = null;
		}
	}
}

function setTextarea() {
		ele=gGetElementById('editor_Html Text');
		ele1=gGetElementById('editor_Simple Text');
		simed=gGetElementById('simTextEd1');
		htmed=gGetElementById('htmlTextEd1');
		if(ele.checked){	
			simed.style.display='none';
			htmed.style.display='';
			
			/*document.getElementById('simTextEd').style.display='none';
			document.getElementById('htmlTextEd').style.display='';*/
		}
		else if(ele1.checked){
			htmed.style.display='none';			
			simed.style.display='';
		}
}

function SelectList() {
		/*ele=gGetElementById('radio_Category');
		ele1=gGetElementById('radio_Product');
		ele2=gGetElementById('radio_All Products');*/
		
		pro=gGetElementById('SelMovie');
		pList=gGetElementById('MovieList');
		pList2=gGetElementById('Movie');
		/*if(ele2.checked){
			cList='';
		selectAllOptions(pList);
			one2two('firstListProduct', 'firstProduct');
		}else{
			selectAllOptions(pList2);
			two2one('firstListProduct', 'firstProduct');	
			
		}*/

			pro.style.display='none';
}
function submitForm(strFormName){
	var frm= gGetElementById(strFormName);
	frm.submit();
	return true;
}

function checkStrLen(txtObj,minLength,MaxLength,msgDisplay)
{
var strData;
strData=txtObj.value;
//alert(strData.length);
if(strData.length < Number(minLength))
{
	alert("Please Enter Valid Value In The Following Field : " + msgDisplay);
	txtObj.focus();
	return false;
}
if(strData.length > Number(MaxLength))
{
	alert("Please Enter Value Lesser Than " + MaxLength +" In The Following Field : " + msgDisplay);
	txtObj.focus();
	return false;

}
}
function checkEmail(objTxt) {
	var GoodChars = "@_-.:/ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	var UpperEmail = objTxt.value.toUpperCase()
	var ValidChars = true;
	
	for (tfCharNum = 0; tfCharNum > objTxt.value.length; tfCharNum++) {
		Char = UpperEmail.charAt(tfCharNum);
		for (gcCharNum = 0;  gcCharNum < GoodChars.length;  gcCharNum++) {
				 if (Char == GoodChars.charAt(gcCharNum))
			     break;
		}
				 
		if (gcCharNum == GoodChars.length)   {
		     ValidChars = false;
		     break;
   		}
	}
	
	if (!ValidChars || objTxt.value.length < 7 || 
		objTxt.value.indexOf("@") == "-1" ||
		objTxt.value.indexOf(".") == "-1" || 
		objTxt.value.indexOf("..") != "-1" || 
		objTxt.value.indexOf("@.") != "-1" || 
		objTxt.value.indexOf("@:") != "-1" || 
		objTxt.value.indexOf("@/") != "-1" || 
		objTxt.value.indexOf("@-") != "-1" || 
		objTxt.value.indexOf("@_") != "-1" || 
		objTxt.value.indexOf(".@") != "-1" || 
		objTxt.value.indexOf(":@") != "-1" || 
		objTxt.value.indexOf("/@") != "-1" || 
		objTxt.value.indexOf("-@") != "-1" || 
		objTxt.value.indexOf("_@") != "-1" || 
		objTxt.value.indexOf("@") != objTxt.value.lastIndexOf("@")) {
		objTxt.focus();
			return (false);
	}
	return (true);
}
function checkCombo(cmbObject,defaultValue,msgDisplay)
{
var strData;
strData=cmbObject.value;
//alert("strDate : " + strData);
//alert("Default Value : " + defaultValue);
if(strData == defaultValue)
{
	alert("Please Select Appropriate Option from the  Following Field : " + msgDisplay);
	cmbObject.focus();
	return false;
}
}


function Validate1(){
		var name;
	var email,comment;
name=gGetElementById("comment_name");
email=gGetElementById("comment_email");
comment=gGetElementById("comment_text");
vcode=gGetElementById("cmtcode");

if(checkStrLen(name,1,60," Name")==false){
	return false;
}

if(!checkEmail(email)){
	alert("Please Enter Proper Value For Email");
	return false;
}
if(comment.value==''){
	alert("Please Enter Comment");
	comment.focus();
	return false;
}
if(vcode.value != "12" || vcode.value == '') {
		alert("Plese Enter Valid verification Answer.");
		vcode.focus();
		return false;
	}
return;
}
function Validate(){
		var name;
	var email,subject,query;
name=gGetElementById("qry_name");
email=gGetElementById("qry_email");
subject=gGetElementById("qry_subject");
query=gGetElementById("query");
vcode=gGetElementById("qrycode");

if(checkStrLen(name,1,60," Name")==false){
	return false;
}

if(!checkEmail(email)){
	alert("Please Enter Proper Value For Email");
	return false;

}
if(checkStrLen(subject,1,60," Subject")==false){
	return false;
}
if(query.value==''){
	alert("Please Enter Query");
	query.focus();
	return false;
}
if(vcode.value != "12" || vcode.value == '') {
		alert("Plese Enter Valid verification Answer.");
		vcode.focus();
		return false;
	}

return;
}
function Validate_sub(){
		var name;
	var email;
name=gGetElementById("sub_name");
email=gGetElementById("sub_email");
city=gGetElementById("city");
vcode=gGetElementById("subcode");

if(checkStrLen(name,1,60," Name")==false){
	return false;
}

if(!checkEmail(email)){
	alert("Please Enter Proper Value For Email");
	return false;

}
if(checkStrLen(city,1,60," City")==false){
	return false;
}
if(vcode.value != "12" || vcode.value == '') {
		alert("Plese Enter Valid verification Answer.");
		vcode.focus();
		return false;
	}

return;
}
// added by akshay for application form controller

function cal_pro_total_admin(){
	
	var films_directed=gGetElementById("films_directed").value;
	if(films_directed!='' && IsNumeric(films_directed)==true){
		
		for(i=1;i<=films_directed;i++){
			var fieldtitle=gGetElementById("title"+i);
			var fieldyear=gGetElementById("year"+i);
			var fieldaward=gGetElementById("award"+i);
			var fieldsponsor=gGetElementById("sponsor"+i);
			var fieldtheme=gGetElementById("theme"+i);
			var fieldrole=gGetElementById("role"+i);
			
				if(countWords(fieldtitle,1)==false){
					alert("Please enter valid Directed Film Title");
					fieldtitle.focus();
					return false;
				}else if(countWords(fieldyear,1)==false){
					alert("Please enter valid Directed Film Year");
					fieldyear.focus();
					return false;
				}
				if(fieldaward.value!=''){
					if(countWords(fieldaward,1)==false || countWordsMax(fieldaward,30)==false){
						alert("Please enter valid Directed Film Award");
						fieldaward.focus();
						return false;
					}
				}
				if(countWords(fieldsponsor,1)==false || countWordsMax(fieldsponsor,15)==false){
					alert("Please enter valid Directed Film Sponsor");
					fieldsponsor.focus();
					return false;
				}else if(countWords(fieldtheme,1)==false || countWordsMax(fieldtheme,10)==false){
					alert("Please enter valid Directed Film Theme");
					fieldtheme.focus();
					return false;
				}else if(countWords(fieldrole,1)==false || countWordsMax(fieldrole,10)==false){
					alert("Please enter valid Your Role in Directed Film");
					fieldrole.focus();
					return false;
				}
			}
	}
	
}
function cal_pro_total(){

	PreProduction=gGetElementById("pre_production").value;
	Script=gGetElementById("script").value;
	FormFilming=gGetElementById("filming").value;
	FormEditing=gGetElementById("editing").value;
	CompletedFlim=gGetElementById("completed_flim").value;
	FinalDeliverables=gGetElementById("final_deliverables").value;
	FormTotal=gGetElementById("ApplicationFormTotal");
	
	
	if(PreProduction!='' || Script!='' || FormFilming!='' || FormEditing!='' || CompletedFlim!='' || FinalDeliverables!=''){
		FormTotal.value=Number(PreProduction) + Number(Script) + Number(FormFilming) + Number(FormEditing) + Number(CompletedFlim) + Number(FinalDeliverables);
		
		return true;
	}else{
		FormTotal.value=0;
		FormTotal.focus();
		return false;
	}
}

function dwnfrmchk(){
		var title=gGetElementById("title").value;
		var email=gGetElementById("email");
		var pdf=gGetElementById("pdf").value;
		
		var lbltitle=gGetElementById("lbltitle");
		var lblemail=gGetElementById("lblemail");
		var lblpdf=gGetElementById("lblpdf");
		var lblpdf1=gGetElementById("lblpdf1");
		
		
		if(title==''){
			lbltitle.style.display="";
			return false;
		}else if(!checkEmail(email)){
			lblemail.style.display="";
			return false;
		}else if(pdf==''){
			lblpdf.style.display="";
			return false;
		}else if(pdf!=''){
				if (pdf.indexOf(".pdf") == -1) {
				lblpdf.style.display="none";
				lblpdf1.style.display="";
				return false;
				}
		}
		
			return true;	
		
}

function frmappchk(){
	var directors=gGetElementById("directors");
	var title=gGetElementById("title");
	var synopsis=gGetElementById("synopsis");
	var budget=gGetElementById("budget") ;
	var material=gGetElementById("material") ;
	var payment_crew=gGetElementById("payment_crew") ;
	var equipment_rental=gGetElementById("equipment_rental") ;
	var travel_board=gGetElementById("travel_board") ;
	var misc_exp=gGetElementById("misc_exp") ;
	var language=gGetElementById("language") ;
	var duration=gGetElementById("duration") ;
	var location=gGetElementById("location") ;
	var einstitute1=gGetElementById("einstitute1") ;
	var equalification1=gGetElementById("equalification1") ;
	var eqyear1=gGetElementById("eqyear1") ;
	var eqsub1=gGetElementById("eqsub1") ;
	var flim_subject=gGetElementById("flim_subject") ;
	var address=gGetElementById("address") ;
	var telephone=gGetElementById("telephone") ;
	var email=gGetElementById("email");
	var place=gGetElementById("place") ;
	var formdate=gGetElementById("IdApplicationForm/formdate") ;
	var einstitute1=gGetElementById("einstitute1");
	var equalification1=gGetElementById("equalification1");
	var eqyear1=gGetElementById("eqyear1");
	var eqsub1=gGetElementById("eqsub1");
	var terms=gGetElementById("terms").checked;
	var PreProduction=gGetElementById("pre_production");
	var Script=gGetElementById("script");
	var FormFilming=gGetElementById("filming");
	var FormEditing=gGetElementById("editing");
	var CompletedFlim=gGetElementById("completed_flim");
	var FinalDeliverables=gGetElementById("final_deliverables");
	var films_directed=gGetElementById("films_directed").value;
	var vcode=gGetElementById("onlinevcode");
	if(countWords(directors,1)==false || countWordsMax(directors,15)==false){
		alert("Please enter valid Director");
		directors.focus();
		return false
	}else if(countWords(title,1)==false || countWordsMax(title,15)==false){
		alert("Please enter valid Title");
		title.focus();
		return false
	}else if(countWords(synopsis,1)==false || countWordsMax(synopsis,24)==false){
		alert("Please enter valid Synopsis (Maximum 20 words)");
		synopsis.focus();
		return false
	}
	if(films_directed!='' && IsNumeric(films_directed)==true){
		
		if(films_directed > 5)
			films_directed=5;
			
		
		for(i=1;i<=films_directed;i++){
			var fieldtitle=gGetElementById("title"+i);
			var fieldyear=gGetElementById("year"+i);
			var fieldaward=gGetElementById("award"+i);
			var fieldsponsor=gGetElementById("sponsor"+i);
			var fieldtheme=gGetElementById("theme"+i);
			var fieldrole=gGetElementById("role"+i);
			
			
				if(countWords(fieldtitle,1)==false){
					alert("Please enter valid Directed Film Title");
					fieldtitle.focus();
					return false;
				}else if(countWords(fieldyear,1)==false){
					alert("Please enter valid Directed Film Year");
					fieldyear.focus();
					return false;
				}
				if(fieldaward.value!=''){
					if(countWords(fieldaward,1)==false || countWordsMax(fieldaward,30)==false){
						alert("Please enter valid Directed Film Award");
						fieldaward.focus();
						return false;
					}
				}
				if(countWords(fieldsponsor,1)==false || countWordsMax(fieldsponsor,15)==false){
					alert("Please enter valid Directed Film Sponsor");
					fieldsponsor.focus();
					return false;
				}else if(countWords(fieldtheme,1)==false || countWordsMax(fieldtheme,10)==false){
					alert("Please enter valid Directed Film Theme");
					fieldtheme.focus();
					return false;
				}else if(countWords(fieldrole,1)==false || countWordsMax(fieldrole,10)==false){
					alert("Please enter valid Your Role in Directed Film");
					fieldrole.focus();
					return false;
				}
			}
	}
	
	if(countWords(budget,1)==false || countWordsMax(budget,15)==false){
		alert("Please valid Total Budget");
		budget.focus();
		return false
	}else if(countWords(material,1)==false){
		alert("Please enter valid Material");
		material.focus();
		return false
	}else if(countWords(payment_crew,1)==false){
		alert("Please enter valid Payments to Crew");
		payment_crew.focus();
		return false
	}else if(countWords(equipment_rental,1)==false){
		alert("Please enter valid Equipment Rental");
		equipment_rental.focus();
		return false
	}else if(countWords(travel_board,1)==false){
		alert("Please enter valid Travel, Board and Lodging");
		travel_board.focus();
		return false
	}else if(countWords(misc_exp,1)==false){
		alert("Please enter valid Admin and Misc. Expenses");
		misc_exp.focus();
		return false
	}else if(countWords(language,1)==false || countWordsMax(language,15)==false){
		alert("Please valid Language");
		language.focus();
		return false
	}else if(countWords(duration,1)==false || countWordsMax(duration,15)==false){
		alert("Please valid Duration");
		duration.focus();
		return false
	}else if(countWords(PreProduction,1)==false || IsNumeric(PreProduction.value)==false){
		alert("Please enter valid Pre Production");
		PreProduction.focus();
		return false
	}else if(countWords(Script,1)==false || IsNumeric(Script.value)==false){
		alert("Please enter valid Script");
		Script.focus();
		return false
	}else if(countWords(FormFilming,1)==false || IsNumeric(FormFilming.value)==false){
		alert("Please enter valid Filming");
		FormFilming.focus();
		return false
	}else if(countWords(FormEditing,1)==false || IsNumeric(FormEditing.value)==false){
		alert("Please enter valid Editing and Rough Cut");
		FormEditing.focus();
		return false
	}else if(countWords(CompletedFlim,1)==false || IsNumeric(CompletedFlim.value)==false){
		alert("Please enter valid Editing/ Post Production to Completed Film");
		CompletedFlim.focus();
		return false
	}else if(countWords(FinalDeliverables,1)==false || IsNumeric(FinalDeliverables.value)==false){
		alert("Please enter valid Final Deliverables");
		FinalDeliverables.focus();
		return false
	}else if(countWords(location,1)==false){
		alert("Please enter valid Location");
		location.focus();
		return false
	}else if(countWords(einstitute1,1)==false || countWordsMax(einstitute1,10)==false){
		alert("Please valid Educational Institution");
		einstitute1.focus();
		return false
	}else if(countWords(equalification1,1)==false || countWordsMax(equalification1,10)==false){
		alert("Please valid Educational Qualification");
		equalification1.focus();
		return false
	}else if(countWords(eqyear1,1)==false){
		alert("Please enter valid Educational Year");
		eqyear1.focus();
		return false
	}else if(countWords(eqsub1,1)==false || countWordsMax(eqsub1,10)==false){
		alert("Please valid Educational Subject");
		eqsub1.focus();
		return false
	}else if(countWords(flim_subject,1)==false || countWordsMax(flim_subject,520)==false){
		alert("Please enter valid Film Subject. It should not more than 500 words");
		flim_subject.focus();
		return false
	}else if(countWords(address,1)==false){
		alert("Please enter valid Address");
		address.focus();
		return false
	}else if(countWords(telephone,1)==false){
		alert("Please enter valid Telephone");
		telephone.focus();
		return false
	}else if(!checkEmail(email)){
		alert("Please enter valid Email");
		email.focus();
		return false;
	}else if(countWords(place,1)==false){
		alert("Please enter valid Place");
		place.focus();
		return false
	}else if(countWords(formdate,1)==false){
		alert("Please enter valid Date");
		formdate.focus();
		return false
	}else if(terms==false){
		alert("Please select Terms");
		return false
	}
	else if(vcode.value != "12" || vcode.value == '') {
		alert("Plese enter valid verification Answer.");
		vcode.focus();
		return false;
	}else{
		return cal_pro_total();	
	}
	
	
	
}
 function countWords(field,count){
	 if(field.value=='')
	 	words=0;
	else
	 	words = field.value.split(' ').length;
	if(words < count){
		return false;	
	}else{
		return true;	
	}
}
function countWordsMax(field,count){
	var char_count = field.value.length;
	var fullStr = field.value + " ";
	var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
	var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
	var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
	var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
	var splitString = cleanedStr.split(" ");
	var words = splitString.length -1;
	
	//if(count==500){
		//alert(words);
		//return false;
	//}
	if(words > count){
		return false;	
	}else{
		return true;	
	}
}
function checkNumber(obj,msg){
	var val=gGetElementById(obj);
	if(val.value!=''){
		if(IsNumeric(val.value)==false){
			alert("Please enter valid "+msg);
			val.focus();
			return false;
		}else{
			cal_pro_total();
			return true;
		}
	}
}

function checkNumber_new(val,msg){
	
	if(val.value!=''){
		if(IsNumeric(val.value)==false){
			alert("Please enter valid "+msg);
			val.value='';
			return false;
		}else{
			return true;
		}
	}
}
function IsNumeric(strString)
   {
	   var strValidChars = "0123456789";
	   var strChar;
	   var blnResult = true;

  		 if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   			for (i = 0; i < strString.length && blnResult == true; i++)
      		{
     			 strChar = strString.charAt(i);
      				if (strValidChars.indexOf(strChar) == -1){
       					  blnResult = false;
         				}
      		}
 	  return blnResult;
   }
//
