/*///////////////////////////////////////
Don't Delete Any JS Code For Further Implementations
//////////////////////////////////////*/

/*/ function for display company info

	function viewform(strdisplay,strmode){
		if(strmode=="open")
			document.getElementById(strdisplay).style.display="block";
		else
			document.getElementById(strdisplay).style.display="none";
	}
// function display any one at a time

	function viewformOptional(strdisplay,strclose,strmode){
		if(strmode=="open"){
			document.getElementById(strdisplay).style.display="block";
			document.getElementById(strclose).style.display="none";
		}
	}	
	
*/	
	
/*/ Super Admin Register Users
	function ControlReg(strnone,strblock,strmode,strid,strstep){
		if(strstep=="1"){
			if(strmode=="edit"){
				Edit_Company(strid);
			}
		}
		if(strstep=="2"){
			if(strmode=="edit"){
				Edit_billing(strid);
			}
		}
		if(strstep=="3"){
			//alert(strid);
			if(strmode=="edit"){
				Edit_Contacts(strid);
			}
		}
	}

//	function ControlReg2(strnone,strblock,strmode,strid)

	function CheckPassWord(val){ 
		if(val==1){
			if(document.form1.generate_pass.checked==true){
				document.form1.force_change_pass.checked=true;
				document.form1.force_change_pass.disabled=true;
				document.form1.user_pass.value='firecompany';
				document.form1.confirm_user_pass.value='firecompany';
				document.form1.user_pass.disabled=true;
				document.form1.confirm_user_pass.disabled=true;
			}
			else{
					document.form1.force_change_pass.checked=false;
					document.form1.force_change_pass.disabled=false;
					document.form1.user_pass.value='';
					document.form1.confirm_user_pass.value='';
					document.form1.user_pass.disabled=false;
					document.form1.confirm_user_pass.disabled=false;
			}
		}
		if(val==2){
			if(document.form1.force_change_pass.checked==true){
				document.form1.generate_pass.checked=false;
				document.form1.user_pass.value='';
				document.form1.confirm_user_pass.value='';
				document.form1.user_pass.disabled=false;
				document.form1.confirm_user_pass.disabled=false;
			}	
		}
	}
*/	
// Check availability 	
	
	function CheckAvailability(This){ 
		if(!validateEmail(This.user_email.value,1,1)){
			This.user_email.focus();
			return 	false;			 
		}
		else{
			val = This.user_email.value;
			window.open('checkavailable.php?UserEmail='+val,'myfirecompanies','left=500,top=300,width=250,height=150,toolbar=1,resizable=0');
 			return false;
 			
 			}
	}
	/////validating user forms///
	function SadminValidate(This){
		if(!validateEmail(This.user_email.value,1,1)){
			This.user_email.focus();
			return 	false;			 
		}	
		
		/*////edit from personailize /////
		if(This.chkChngPss){	
			if(This.chkChngPss.checked && !StringSimilir(This.user_pass.value,This.confirm_user_pass.value,This)){	
				return 	false;		
			}
		}
		/////end edit from personailize ////*/
		if(document.getElementById("tr_pass").style.display == ''  ){
			if(!StringSimilir(This.user_pass.value,This.confirm_user_pass.value,This)){
				return 	false;		
			}
		}

		
		if(trim(This.user_first_name.value)==""){	
			alert("First Name Can Not Be Blank");
			This.user_first_name.focus();
			return 	false;		
		}
		/*if(trim(This.user_phone.value)==""){	
			alert("Phone Can Not Be Blank");
			This.user_middle_name.focus();
			return 	false;		
		}*/
		if(trim(This.user_last_name.value)==""){	
			alert("Last Name Can Not Be Blank");
			This.user_last_name.focus();
			return 	false;		
		}	
	}
	//  end
	
	//////open close change pass/////////////
	function opnClsPss()
	{
		if(document.getElementById('chkChngPss').checked)
		{
			document.getElementById('tr_pass').style.display='';document.getElementById('tr_cnfrm_pass').style.display='';  
		} 
		else 
		{
			document.getElementById('tr_pass').style.display='none';document.getElementById('tr_cnfrm_pass').style.display='none';
		} 	
	}
	//////end open close change pass/////////////
	
	
	
	///validating funds ///////
	function adminFundValidate(This){
		if(trim(This.fund_name.value)==""){	
			alert("Images & Files Category Name Can Not Be Blank");
			This.fund_name.focus();
			return 	false;		
		}
		if(trim(This.fund_desc.value)==""){	
			alert("Images & Files Category Description Can Not Be Blank");
			This.fund_desc.focus();
			return 	false;		
		}	
	}
	///end validating funds ///////
	
	///validating listing_cat ///////
	function adminListingCatValidate(This){
		if(trim(This.cat_name.value)==""){	
			alert("Category Name Can Not Be Blank");
			This.cat_name.focus();
			return 	false;		
		}
		/*if(trim(This.listing_cat_desc.value)==""){	
			alert("Listing Category Description Can Not Be Blank");
			This.listing_cat_desc.focus();
			return 	false;		
		}*/	
	}
	///end validating funds ///////
	
	///validating listing ///////
	function adminListingValidate(This){
		if(trim(This.listing_name.value)==""){	
			alert("Listing Name Can Not Be Blank");
			This.listing_name.focus();
			return 	false;		
		}
		if(trim(This.listing_price.value)==""){	
			alert("Listing Price Can Not Be Blank");
			This.listing_price.focus();
			return 	false;		
		}	
	}
	///end validating funds ///////


	///validating listing_user ///////
	function adminListingUserValidate(This){
		if(trim(This.listing_id.value)==""){	
			alert("Listing Can Not Be Blank");
			This.listing_id.focus();
			return 	false;		
		}
		if(trim(This.listing_user_business.value)==""){	
			alert("Business Name Can Not Be Blank");
			This.listing_user_business.focus();
			return 	false;		
		}	
		if(trim(This.listing_user_add_title.value)==""){	
			alert("Add Title Can Not Be Blank");
			This.listing_user_add_title.focus();
			return 	false;		
		}	
		if(checkInternationalPhone(This.listing_user_ph.value)==false)	{
			alert("Please Enter valid contact number.");
			This.listing_user_ph.select();
			return false;					
		}
		if(checkInternationalPhone(This.listing_user_mob.value)==false)	{
			alert("Please Enter valid contact number.");
			This.listing_user_mob.select();
			return false;					
		}
		if(checkInternationalPhone(This.listing_user_fax.value)==false)	{
			alert("Please Enter valid contact number.");
			This.listing_user_fax.select();
			return false;					
		}
		
	}
	///end validating listing_user ///////





	///validating business_type ///////
	function adminBusinessTypeValidate(This){
		if(trim(This.business_type_name.value)==""){	
			alert("Business Type Name Can Not Be Blank");
			This.business_type_name.focus();
			return 	false;		
		}
		/*if(trim(This.business_type_desc.value)==""){	
			alert("Business Type Description Can Not Be Blank");
			This.business_type_desc.focus();
			return 	false;		
		}*/	
	}
	///end validating business_type ///////

	///validating stat ///////
	function adminStatValidate(This){
		if(trim(This.stat_name.value)==""){	
			alert("Stat Name Can Not Be Blank");
			This.stat_name.focus();
			return 	false;		
		}
		if(trim(This.stat_desc.value)==""){	
			alert("Stat Description Can Not Be Blank");
			This.stat_desc.focus();
			return 	false;		
		}	
	}
	///end validating funds ///////

	///validating notify ///////
	function adminNotifyValidate(This){
		if(trim(This.notify_name.value)==""){	
			alert("Notify Name Can Not Be Blank");
			This.notify_name.focus();
			return 	false;		
		}
		if(trim(This.notify_desc.value)==""){	
			alert("Notify Description Can Not Be Blank");
			This.notify_desc.focus();
			return 	false;		
		}	
	}
	///end validating notify ///////


// Change Password
	function CheckPassword(This){
		if(trim(This.old_pass.value)==""){	
			alert("Old Password Can Not Be Blank");
			This.old_pass.focus();
			return 	false;		
		}
		if(!StringSimilir(This.user_pass.value,This.confirm_user_pass.value,This)){
			return 	false;		
		}
	}

	///validating funds ///////
	function adminFundFileValidate(This){
		if(trim(This.file_caption.value)==""){	
			alert(" File Caption Can Not Be Blank");
			This.file_caption.focus();
			return 	false;		
		}
		if(trim(This.fund_id.value)==""){	
			alert("Images & Files Category Can Not Be Blank");
			This.fund_id.focus();
			return 	false;		
		}	
		/*if(trim(This.file_uploader.value)==""){	
			alert("File Browser Not Be Blank");
			This.file_uploader.focus();
			return 	false;		
		}*/	
		
	}
	///end validating funds ///////
	
	////sh confirm delete ////////////
	function confirm_del()
	{
		if( confirm("Are You Sure To Delete This Information ?") )
			return true;
		else
			return false;
	}
	////sh end confirm delete ////////////
	
	/////////////sh validate manage_email_admin 
	function checksendmail(This){ 
	
		var emails=This.addr.split(",");
		for(var i=0;i<emails.length();i++)
		{
			if(!validateEmail(emails[i],1,1)){
				alert(emails[i]+" is not a valid email.");
				This.addr.focus();
				return 	false;			 
			}
		}
		return true;
	}
	/////////////sh end validate manage_email_admin 
	
	/////////////sh validate contacts
	function checkCntct(This){ 
	
			if(!validateEmail(This.cntct_email,1,1)){
				alert(This.cntct_email+" is not a valid email.");
				This.cntct_email.focus();
				return 	false;			 
			}
		if(trim(This.cntct_name.value)==""){	
			alert(" Contact Name Can Not Be Blank");
			This.cntct_name.focus();
			return 	false;		
		}
			
		return true;	
	}
	/////////////sh end validate manage_email_admin 
	
	/////////////sh validate tellfriend 
	function adminTellfrndValidate(This){ 
	
		if(trim(This.tellfrnd_name.value)==""){	
			alert("Please Provide Your Name !!! ");
			This.tellfrnd_name.focus();
			return 	false;		
		}
		if(!validateEmail(This.tellfrnd_email.value,1,1)){
			alert(This.tellfrnd_email.value+" is not a valid email. Please Provide Your Vaild Email's !!! ");
			This.tellfrnd_email.focus();
			return 	false;			 
		}
		if(trim(This.tellfrnd_frnd_email.value)==""){	
			alert("Please Provide Your Friend Email's !!! ");
			This.tellfrnd_frnd_email.focus();
			return 	false;		
		}
		var emails=This.tellfrnd_frnd_email.split(",");
		for(var i=0;i<emails.length();i++)
		{
			if(!validateEmail(emails[i],1,1)){
				alert(emails[i]+" is not a valid email. Please Provide Your Friend Vaild Email's !!! ");
				This.tellfrnd_frnd_email.focus();
				return 	false;			 
			}
		}
		if(trim(This.tellfrnd_desc.value)==""){	
			alert("Please Provide Message !!! ");
			This.tellfrnd_desc.focus();
			return 	false;		
		}
		return true;
	}
	/////////////sh end validate tellfriend 


/*/ company registration step1 validation
	function CompanyRegStep1(strformname,strmode){
		if(strmode=="add"){
			if(trim(strformname.Cbocompanytype.value)==""){
				alert("Please select company type.");
				strformname.Cbocompanytype.focus();
				return 	false;
			}
		}
		if(trim(strformname.txtCompanyName.value)==""){
			alert("Please enter company name.");
			strformname.txtCompanyName.focus();
			return 	false;
		}
		/*if(trim(strformname.txtCompanyDName.value)==""){
			alert("Please enter company display name.");
			strformname.txtCompanyDName.focus();
			return 	false;
		}* /
		if(trim(strformname.txtCompanyNumber.value)==""){
			alert("Please enter company number name.");
			strformname.txtCompanyNumber.focus();
			return 	false;
		}
		if(trim(strformname.txtCompanyLName.value)==""){
			alert("Please enter company link name.");
			strformname.txtCompanyLName.focus();
			return 	false;
		}
		if(trim(strformname.txtCompanyAddress.value)==""){
			alert("Please enter street address.");
			strformname.txtCompanyAddress.focus();
			return 	false;
		}
		if(trim(strformname.txtCompanyCity.value)==""){
			alert("Please enter city name.");
			strformname.txtCompanyCity.focus();
			return 	false;
		}
		if(trim(strformname.txtCompanyState.value)==""){
			alert("Please enter state name.");
			strformname.txtCompanyState.focus();
			return 	false;
		}
		//alert(strformname.txtCompanyCountry.value);
		if(trim(strformname.txtCompanyCountry.value)==""){
			alert("Please enter country name.");
			strformname.txtCompanyCountry.focus();
			return 	false;
		}
		if(trim(strformname.txtPhoneNumber.value)==""){
			alert("Please enter phone number.");
			strformname.txtPhoneNumber.focus();
			return 	false;
		}
		if(isNumeric(strformname.txtPhoneNumber)==false){
			alert("Please enter valid phone number.");
			strformname.txtPhoneNumber.focus();
			return 	false;
		}		
		if(trim(strformname.txtFaxNumber.value)==""){
			alert("Please enter fax number .");
			strformname.txtFaxNumber.focus();
			return 	false;
		}
		if(!validateEmail(strformname.txtEmail.value,1,1)){
			strformname.txtEmail.focus();
			return 	false;
		}
		if(trim(strformname.txtCompanyZipCode.value)==""){
			alert("Please enter zip code.");
			strformname.txtCompanyZipCode.focus();
			return 	false;
		}
		if(strmode=="edit"){
			if(!SendFormData(strformname,'1')){
				return false;
			}
		}
	}

	function CompanyRegStep2(strformname){
		
		if(trim(strformname.txtCompanyPayPal.value)==""){
			alert("Please enter company paypal address .");
			strformname.txtCompanyPayPal.focus();
			return 	false;
		}
		if(!validateEmail(strformname.txtCompanyPayPal.value,1,1)){
			strformname.txtCompanyPayPal.focus();
			return 	false;
		}
		if(trim(strformname.cbopayment.value)==""){
			alert("Please select payment gateway .");
			strformname.cbopayment.focus();
			return 	false;
		}
		if(trim(strformname.txtBillingAddress.value)==""){
			alert("Please enter billing address.");
			strformname.txtBillingAddress.focus();
			return 	false;
		}
		if(trim(strformname.txtBillingCity.value)==""){
			alert("Please enter city name .");
			strformname.txtBillingCity.focus();
			return 	false;
		}
		if(trim(strformname.txtBillingState.value)==""){
			alert("Please enter state name .");
			strformname.txtBillingState.focus();
			return 	false;
		}
		if(trim(strformname.txtBillingCountry.value)==""){
			alert("Please enter country name .");
			strformname.txtBillingCountry.focus();
			return 	false;
		}
		if(trim(strformname.txtBillingZipCode.value)==""){
			alert("Please enter zip code .");
			strformname.txtBillingZipCode.focus();
			return 	false;
		}
		if(trim(strformname.txtBillingPhone.value)==""){
			alert("Please enter phone number .");
			strformname.txtBillingPhone.focus();
			return 	false;
		}

		/*if(trim(strformname.txtBillingCounty.value)==""){
			alert("Please enter county name .");
			strformname.txtBillingCounty.focus();
			return 	false;
		}* /
		if(trim(strformname.txtBillingEmail.value)==""){
			alert("Please enter email address .");
			strformname.txtBillingEmail.focus();
			return 	false;
		}
		if(!validateEmail(strformname.txtBillingEmail.value,1,1)){
			strformname.txtBillingEmail.focus();
			return 	false;
		}
		if(trim(strformname.txtBillingFax.value)==""){
			alert("Please enter fax number .");
			strformname.txtBillingFax.focus();
			return 	false;
		}
		if(isNumeric(strformname.txtBillingPhone)==false){
			alert("Please enter valid phone number.");
			strformname.txtBillingPhone.focus();
			return 	false;
		}
		if(!SendFormData(strformname,'2')){
			return false;
		}
	}

	function CompanyRegStep3(strformname){
		if(trim(strformname.txtContactName.value)==""){
			alert("Please enter contact name .");
			strformname.txtContactName.focus();
			return 	false;
		}
		if(trim(strformname.txtContactRelation.value)==""){
			alert("Please enter relation .");
			strformname.txtContactRelation.focus();
			return 	false;
		}
		if(trim(strformname.txtContactemail.value)==""){
			alert("Please enter email address .");
			strformname.txtContactemail.focus();
			return 	false;
		}
		if(!validateEmail(strformname.txtContactemail.value,1,1)){
			strformname.txtContactemail.focus();
			return 	false;
		}
		if(trim(strformname.txtContactphone.value)==""){
			alert("Please enter phone number .");
			strformname.txtContactphone.focus();
			return 	false;
		}
		if(isNumeric(strformname.txtContactphone)==false){
			alert("Please enter valid phone number.");
			strformname.txtContactphone.focus();
			return 	false;
		}
		if(trim(strformname.txtContactfax.value)==""){
			alert("Please enter company fax .");
			strformname.txtContactfax.focus();
			return 	false;
		}
		if(!SendFormData(strformname,'3')){
			return false;
		}
	}


	function CompanyRegStep4(strformname){
		strformname.hdmode.value="useradd";
		if(trim(strformname.cbouser.value)==""){
			alert("Please select user");
			strformname.cbouser.focus();
			return false;
		}
		if(Check_Element(strformname,'radio')==false){
			alert("Please select company user type");
			return false;
		}
		if(!SendFormData(strformname,'4')){
			return false;
		}
	}

	function CompanyUpStep4(strformname){
		strformname.hdmode.value="useredit";
		if(trim(strformname.cbouser.value)==""){
			alert("Please select user");
			strformname.cbouser.focus();
			return false;
		}
		if(Check_Element(strformname,'radio')==false){
			alert("Please select company user type");
			return false;
		}
		if(!SendFormData(strformname,'7')){
			return false;
		}
		
	}


	function CompanyRegStep5(strformname){
		strformname.hddommode.value="domainadd";
		if(strformname.txtdomainname.value==""){
			alert("Please enter domain name.");
			strformname.txtdomainname.focus();
			return false;
		}
		if(!CheckElementsId(strformname,'radio','rdsel')){
			alert("Please select domain.");
			return false;
		}
		if(strformname.txtdate.value==""){
			alert("Please select date");
			return false;
		}
		if(!CheckElementsId(strformname,'radio','rddom')){
			alert("Please select register.");
			return false;
		}
		if(!SendFormData(strformname,'5')){
			return false;
		}
	}
	
	function CompanyUpRegStep5(strformname){
		strformname.hddommode.value="domainedit";
		if(strformname.txtdomainname.value==""){
			alert("Please enter domain name.");
			strformname.txtdomainname.focus();
			return false;
		}
		if(!CheckElementsId(strformname,'radio','rdsel')){
			alert("Please select domain.");
			return false;
		}
		if(strformname.txtdate.value==""){
			alert("Please select date");
			return false;
		}
		if(!CheckElementsId(strformname,'radio','rddom')){
			alert("Please select register.");
			return false;
		}
		if(!SendFormData(strformname,'8')){
			return false;
		}
	}



	function CompanyRegStep6(strformname){
		if(!Check_Element(strformname,'checkbox')){
			alert("Please select module.");
			return false;
		}
		if(!SendFormData(strformname,'6')){
			return false;
		}
	}
	
	function SearchCompany(strformname){
		if(trim(strformname.txtsearchcomp.value)==""){
			alert("Please enter search string");
			strformname.txtsearchcomp.focus();
			return false
		}
	}

	function RemoveCompany(strid,strname){
		if(confirm("Are you sure you want to delete "+strname+" ?")){
			document.frmcomplist.action="company_list.php?ID="+strid;
			document.frmcomplist.submit();
		}
	}
	////////////////////////////////////////      Edit Company       ///////////////////////////////
	
	function Edit_Company(strid) {
		http.open('get', 'registration_operation.php?comp_id='+strid);
		http.onreadystatechange = handleResponse;
		http.send(null);
	}

	function Edit_billing(strid) {
		http.open('get', 'registration_operation.php?compb_id='+strid);
		http.onreadystatechange = handleResponsebilling1;
		http.send(null);
	}

	function Edit_Contacts(strid) {
		//alert(strid);
		http.open('get', 'registration_operation.php?compc_id='+strid);
		http.onreadystatechange = handleContactResponse1;
		http.send(null);
	}
	
	function EditUser(strid,strcid){
		//alert(strid);
		http.open('get', 'registration_operation.php?eduser_id='+strid);
		http.onreadystatechange = handleUserResponse1;
		http.send(null);
	}
	
	function EditDomain(strdomid,strcompid){
		http.open('get', 'registration_operation.php?eddomid='+strdomid);
		http.onreadystatechange = handleDomainResponse4;
		http.send(null);
	}

	///////////////////////////////////////          END            ///////////////////////////////
	
	function NewsCat(strformname){
		
		if(trim(strformname.company_name.value)==""){
			alert("Please Select Company.");
			strformname.company_name.focus();
			return false;
		}
		if(trim(strformname.txtcatname.value)==""){
			alert("Please enter category name.");
			strformname.txtcatname.focus();
			return false;
		}
		if(trim(strformname.txtmaxnews.value)==""){
			alert("Please enter maximum news display.");
			strformname.txtmaxnews.focus();
			return false;
		}
		if(trim(strformname.txtmaxchar.value)==""){
			alert("Please enter maximum characters of a news.");
			strformname.txtmaxchar.focus();
			return false;
		}
		if(trim(strformname.no_of_image.value)==""){
			alert("Please enter no of images display.");
			strformname.no_of_image.focus();
			return false;
		}
		if(trim(strformname.thumb_img_width.value)==""){
			alert("Please enter thumb image size.");
			strformname.thumb_img_width.focus();
			return false;
		}
		if(trim(strformname.popup_img_width.value)==""){
			alert("Please enter pop up image size.");
			strformname.popup_img_width.focus();
			return false;
		}
		if(trim(strformname.layout.value)==""){
			alert("Please select layout.");
			strformname.layout.focus();
			return false;
		}
	}
	
	function addNewsStep1(strformname){
		if(trim(strformname.txtheadline.value)==""){
			alert("Please enter headline.");
			strformname.txtheadline.focus();
			return false;
		}
		if(trim(strformname.incdate.value)==""){
			alert("Please enter incident date.");
			strformname.incdate.focus();
			return false;
		}
		if(trim(strformname.txtstory.value)==""){
			alert("Please enter story.");
			strformname.txtstory.focus();
			return false;
		}
	}
	
	function autoSave(strstatus){ 
		var strformname=document.addnews;
		var flag;
		flag=true;
		strformname.hdmode.value="news";
		if(trim(strformname.txtheadline.value)==""){
			flag=false;
			return false;
		}
		if(strstatus=="SA"){
			if(strformname.cbocompany.value==""){
				//alert("Please select company");
				//strformname.cbocompany.focus();
				flag=false;
				return false;
			}
		}
		if(strformname.cbocat.value==""){
			//alert("Please select category");
			//strformname.cbocat.focus();
			flag=false;
			return false;
		}
		if(strformname.incdate.value==""){
			//alert("Please select incident date");
			//strformname.incdate.focus();
			flag=false;
			return false;
		}
		if(strformname.txtstory.value==""){
			//alert("Please enter story");
			//strformname.txtstory.focus();
			flag=false;
			return false;
		}
		if(flag==true){
			if(!SendFormDataSave()){
				return false;
			}
		}
	}
	
	function autoSave_Save(strformname,strstatus){ 
		strformname.hdmode.value="news";
		if(trim(strformname.txtheadline.value)==""){
			alert("Please enter news headline");
			strformname.txtheadline.focus();
			return false;
		}
		if(strstatus=="SA"){
			if(strformname.cbocompany.value==""){
				alert("Please select company");
				strformname.cbocompany.focus();
				return false;
			}
		}
		if(strformname.cbocat.value==""){
			alert("Please select category");
			strformname.cbocat.focus();
			return false;
		}
		if(strformname.incdate.value==""){
			alert("Please select incident date");
			strformname.incdate.focus();
			return false;
		}
		if(strformname.txtstory.value==""){
			alert("Please enter story");
			strformname.txtstory.focus();
			return false;
		}
		if(!SendFormData(strformname,'newssave')){
			return false;
		}
	}

	function autoSave_next(strformname,strstatus){ 
		strformname.hdmode.value="news";
		if(trim(strformname.txtheadline.value)==""){
			alert("Please enter news headline");
			strformname.txtheadline.focus();
			return false;
		}
		if(strstatus=="SA"){
			if(strformname.cbocompany.value==""){
				alert("Please select company");
				strformname.cbocompany.focus();
				return false;
			}
		}
		if(strformname.cbocat.value==""){
			alert("Please select category");
			strformname.cbocat.focus();
			return false;
		}
		if(strformname.incdate.value==""){
			alert("Please select incident date");
			strformname.incdate.focus();
			return false;
		}
		if(strformname.txtstory.value==""){
			alert("Please enter story");
			strformname.txtstory.focus();
			return false;
		}
		if(!SendFormData(strformname,'newssavenext')){
			return false;
		}
	}


	// select category under particular comapny
	function SelectCat(){ 
			document.SelectCategory.submit();
			return true;	
	}
	
	function SelectCategoryList(){ 
			document.viewCategoryfrm.submit();
			return true;	
	}
	
	// delete category under particular comapny
	
	function doCatDelete(frm){ 
		if(confirm("Are You Sure Want To Delete?")){
			frm.hddelete.value="del";
			frm.mode.value="";
			frm.action = "edit_news_category.php";
			frm.submit();
		}
		else{  
				frm.edit_layout.focus();
				return false;
			}
	}
*/	
	
	
///sh clear form fields ///////////
function clear_form(frm){   
		for (var i=0; i<frm.elements.length; i++){						
			if(frm.elements[i].type == "text" || frm.elements[i].type == "hidden" || frm.elements[i].type == "textarea"){
				frm.elements[i].value="";
			}
			if(frm.elements[i].type == "checkbox"){
				frm.elements[i].checked=false;				
 			}

			if(frm.elements[i].type == "radio"){
				frm.elements[i].checked=false;				
			}
			if(frm.elements[i].type == "select-one"){
				var sel = frm.elements[i];				
				sel.selectedIndex=0;
 			}
			if(frm.elements[i].type == "select-multiple"){
				var sel = frm.elements[i];
				 sel.selectedIndex=0;
			}
			if(frm.elements[i].type == "file"){
				frm.elements[i].value="";
			}
			
			
		}// end for
	
}
///sh end clear form fields ///////////

// Show user Form and Hide records at a time	
	
	function ShowAddForm(FrmId1,FrmId2,val,mod){
		//alert("sh");
		if(val=='showForm'){ 
			FrmId1.style.display = 'none';
			FrmId2.style.display = ''; 
			showpaging = document.getElementById("showPagination");
			showpaging.style.display='none';
			
			if(mod=='ins') //insert mode
			{
				document.getElementById("tr_pass").style.display = ''; 
				document.getElementById("tr_cnfrm_pass").style.display = ''; 
				document.getElementById("tr_stat").style.display = 'none'; 
			}
			else  ///edit mode
			{
				document.getElementById("tr_pass").style.display = 'none'; 
				document.getElementById("tr_cnfrm_pass").style.display = 'none'; 
				document.getElementById("tr_stat").style.display = ''; 
			}
		}
		if(val=='showRecord'){ 
			FrmId1.style.display = '';
			FrmId2.style.display = "none";
			showpaging = document.getElementById("showPagination");
			showpaging.style.display='';
			clear_form(FrmId2);			
		 }
		 //alert(FrmId1.style.display+" <> "+FrmId2.style.display);
		 return false;
	}
	
// Show fund Form and Hide records at a time	
	
	function ShowAddFundForm(FrmId1,FrmId2,val,mod){
		
		if(val=='showForm'){ 
			FrmId1.style.display = 'none';
			FrmId2.style.display = ''; 
			showpaging = document.getElementById("showPagination");
			showpaging.style.display='none';
			if(mod=='ins') //insert mode
			{
				document.getElementById("addForm_Heading").innerHTML =(!arguments[4] ? 'Fund Insertion' : arguments[4]); 
				if(arguments[4]) 
					document.getElementById("tr_edit_file").style.display = 'none'; 
			}
			else  ///edit mode
			{
				document.getElementById("addForm_Heading").innerHTML = (!arguments[4] ? 'Fund Updation' : arguments[4]); 
				if(arguments[4]) 
					document.getElementById("tr_edit_file").style.display = ''; 
			}
			
		}
		if(val=='showRecord'){ 
			FrmId1.style.display = '';
			FrmId2.style.display = "none";
			showpaging = document.getElementById("showPagination");
			showpaging.style.display='';
			clear_form(FrmId2);			
		 }
		 //alert(FrmId1.style.display+" <> "+FrmId2.style.display);
		 return false;
	}
//end  Show fund Form and Hide records at a time	

// Show listing category Form and Hide records at a time	
	
	function ShowAddListingCatForm(FrmId1,FrmId2,val,mod){
		if(val=='showForm'){ 
			FrmId1.style.display = 'none';
			FrmId2.style.display = ''; 
			showpaging = document.getElementById("showPagination");
			showpaging.style.display='none';
			if(mod=='ins') //insert mode
			{
				document.getElementById("addForm_Heading").innerHTML =(!arguments[4] ? '' : arguments[4]); 
			}
			else  ///edit mode
			{
				document.getElementById("addForm_Heading").innerHTML = (!arguments[4] ? 'Updation' : arguments[4]); 
			}
			
		}
		if(val=='showRecord'){ 
			FrmId1.style.display = '';
			FrmId2.style.display = "none";
			showpaging = document.getElementById("showPagination");
			showpaging.style.display='';
			clear_form(FrmId2);			
		 }
		 //alert(FrmId1.style.display+" <> "+FrmId2.style.display);
		 return false;
	}
//end  Show fund Form and Hide records at a time	

// Show stat Form and Hide records at a time	
	
	function ShowAddStatForm(FrmId1,FrmId2,val,mod){
		
		if(val=='showForm'){ 
			FrmId1.style.display = 'none';
			FrmId2.style.display = ''; 
			showpaging = document.getElementById("showPagination");
			showpaging.style.display='none';
			if(mod=='ins') //insert mode
			{
				document.getElementById("addForm_Heading").innerHTML =(!arguments[4] ? 'Stat Insertion' : arguments[4]); 
			}
			else  ///edit mode
			{
				document.getElementById("addForm_Heading").innerHTML = (!arguments[4] ? 'Stat Updation' : arguments[4]); 
			}
			
		}
		if(val=='showRecord'){ 
			FrmId1.style.display = '';
			FrmId2.style.display = "none";
			showpaging = document.getElementById("showPagination");
			showpaging.style.display='';
			clear_form(FrmId2);			
		 }
		 //alert(FrmId1.style.display+" <> "+FrmId2.style.display);
		 return false;
	}
//end  Show Stat Form and Hide records at a time	




///////////sh set file information for fund_file ///////////////
function setFileInfo(frm)
{	//alert(frm.id);
	var fle_uploder=frm.file_uploader;
	if(fle_uploder.value!="")
	{
		//alert(fle_uploder.value+" ;size:"+fle_uploder.size+" ;type="+fle_uploder.type+" <>");
		fle_uploder.value="";
	}
}
///////////sh end set file information for fund_file ///////////////



/*	
	function setAction(strvalue,strformname){
		var straction=strvalue.split(":");
		if(straction[0] !=""){
			strformname.hdmewsid.value=straction[1];
			strformname.hdmode.value="action";
			strformname.action="newslist.php";
			strformname.submit();
		}
	}	

	function doRedirect(Strform,Strpre){
		Strform.action=Strpre;
		Strform.submit();
	}

	function doPublish(stradd){
		flag=true;
		if(stradd.hdnews.value==""){
			alert("Please save your news.");
			flag=false;
			return false;
		}
		if(flag==true){
			stradd.hdmode.value="publish";
			//return false;
		}
	}
	
	function DeleteData(strdata,strform){
		if(strdata.value !=""){
			if(Check_Element(strform,'checkbox')==false){
				alert("Please select news");
				return false;
			}else{
				strform.hdmode.value="delete";
				strform.action="newslist.php";
				strform.submit();
			}
		}
	}

	function newsAutoSave(strstatus){
		autoSave(strstatus)
	}

	function do_news_save(){
		//alert("hdfjjfjfjfj");
		document.getElementById('active').style.display="block";
		document.getElementById('inactive').style.display="none";

	}

// news photo delete 

	function deleteImage(frm,phid,setMode){
		frm.pht_id.value = phid;
		frm.mode.value = setMode;
		frm.submit();
	}

// Image Moving

	function ImageMove(frm,virtualId,SetMode){
		frm.virtual_id.value = virtualId;
		frm.mode.value = SetMode;
		frm.submit();
	}
*/
// Uploading file like image or document

	function checkFileUpload(frm,strid){
		var flag=1;
		for(var i=0; i<frm.elements.length; i++){
			if(frm.elements[i].type=='file'){
				if(frm.elements[i].id==strid){
					if(frm.elements[i].value!=""){
						flag =0;
					}
				}
			} 
		}
		if(flag){
			alert("plaese select at least one file");
			return false;
		}
		else{
				UploadOBj = document.getElementById("uploadingPic");
				UploadOBj.style.display='';
		}
	}

// Link And Url validation

	function checkLinkUpload(frm){
		if(frm.linkurl.value==""){
			alert('Web URL Can not blank Please Check');
			frm.linkurl.focus();
			return false;
		}
		value = frm.linkurl.value;
		var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
		if(!urlregex.test(value))
		{
			alert('Web URL Invalid Please Check');
			frm.linkurl.focus();
			return false;
		}
		if(frm.linkname.value==""){
			alert('Link Name Can not blank Please Check');
			frm.linkname.focus();
			return false;
		}
	}

/*
	function doPrevNext(page,pf)
	{
		var strcomp; 
		//alert(page);
		
		document.getElementById('pageno').value=page;
		//document.getElementById('pageno').value=strcomp;
		strcomp=document.getElementById('hdcomuser').value
		document.getElementById('p_f').value=pf;
		//alert(strcomp);
		DoPaging(page,pf,strcomp);
		//makeRequest("inc/events_table.php?page="+page+"&p_f="+pf,'alertContents_1');
	}

// Gallery Related java Script

	function CheckAlbumCaption(frm){ 
		if(frm.album_name.value==""){
			alert("Album Name Can Not Be Balnk");
			frm.album_name.focus();
			return false;
		}
		else{
			frm.mode.value = 'SubmitCaption';
			frm.submit();
		}
	}

	function MoveGalleryPhoto(frm){
		if(trim(frm.disp_album.value)=="0"){
			alert("Please Select Valid Album");
			frm.disp_album.focus();
			return false;
		}
	}

	function PhotoUploadUnderAlbum(frm){   
		if(trim(frm.upload_photo.value)==""){
			alert("Please Select Photo");
			frm.upload_photo.focus();
			return false;
		}
		frm.mode.value = "UploadImage";
	}

	function UploadImageGallery(frm){
		if(trim(frm.disp_album.value)=="0"){
			alert("Please Select Valid Album");
			frm.disp_album.focus();
			return false;
		}
		
		if(trim(frm.upload_photo.value)==""){
			alert("Please Select Photo");
			frm.upload_photo.focus();
			return false;
		}
		frm.mode.value = "UploadImage";

	}
// Image Rotation

	function RotateImagage(val,frm){
		if(val=='Rotate'){
			frm.mode.value="Rotate";
		}
		if(val=='save'){
			frm.mode.value="save";
		}
		if(val=='discard'){ 
			frm.mode.value="discard";
		}
		return true;
	}


// File Locker Module

	function checkProperValue(frm){
		if(isNaN(trim(frm.max_file_no.value)) ){
			alert("Please Provide Numeric Number");
			frm.max_file_no.focus();
			return false;
		}
		if(frm.max_file_no.value==0 || frm.max_file_no.value==""){
		
			alert("Please Provide Numeric Number");
			frm.max_file_no.focus();
			return false;
		
		}
		if(isNaN(trim(frm.total_max_file_size.value))){
			alert("Please Provide Numeric Number");
			frm.total_max_file_size.focus();
			return false;
		}
		if(frm.total_max_file_size.value == 0 || frm.total_max_file_size.value == ""){
			alert("Please Provide Numeric Number");
			frm.total_max_file_size.focus();
			return false;
		
		}
		frm.mode.value="FileLockerSetting";	
	}


	function checkCatName(frm){
		if(trim(frm.cat_name.value)==""){
			alert("Category name can not be blank");
			frm.cat_name.focus();
			return false;
		}
		if(!isNaN(trim(frm.cat_name.value))){
			alert("Category name must be string");
			frm.cat_name.focus();
			return false;
		}
		frm.mode.value="AddCategory";	
		return true;
	}

	function submitFileLocker(frm){
		if(frm.cat_name.value=="0"){
			alert("Please Select category");
			frm.cat_name.focus();
			return false;
		}
		if(trim(frm.title_name.value)==""){
			alert("Title Can not be blank");
			frm.title_name.focus();
			return false;
		}
		if(trim(frm.fileloc_cat_desc.value)==""){ 
			alert("Description Can not be blank");
			frm.fileloc_cat_desc.focus();
			return false;
		}
			frm.mode.value = 'Filelocker_Upload';
	}
	*/