/* Common Javascript Function Starts */
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 isNull_file(obj,msg){
	if(msg!="Password")
		obj1=Trim(obj.value);
	else
		obj1=obj.value;
	if (obj1==""){
		alert("Please upload the " +msg);
		obj.focus();
		return true;
	}else	
		return false;
}
function isNull_chk(obj,msg,div){
	if(msg!="Password")
		obj1=Trim(obj.value);
	else
		obj1=obj.value;
	if (obj1==""){
		document.getElementById(div).innerHTML = msg;
		obj.focus();
		return true;
	}else{	
		document.getElementById(div).innerHTML = '';
		return false;
	}
}
function fnchkcontent(objval,div){
	if (Trim(objval)!=""){
		document.getElementById(div).innerHTML = '';
		return true;
	}
}
function chkSpeicalChar(obj,msg){
  var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
  for (var i = 0; i < obj.value.length; i++) {
  	if (iChars.indexOf(obj.value.charAt(i)) != -1) {
  	alert ("Special Characters Not Allowed");
	obj.focus();
  	return true;
  	}
  }
}
function isNull1(obj,msg){
	if(msg!="Password")
		obj1=Trim(obj.value);
	else
		obj1=obj.value;
	if (obj1==""){
		alert("Please select the " +msg);
		obj.focus();
		return true;
	}else
		return false;
}
function fnTel(obj,msg){
	exp = /^\+?[0-9+ -]*$/;
	if (!exp.test(obj.value)){
		alert("Please enter only numeric values in "+msg);
		obj.focus();
		return true;
	}else
		return false;
}
function isLen(obj,siz,msg){
	if(msg!="Password")
		obj1=Trim(obj.value);
	else
		obj1=obj.value;
	if(obj1!=""){
		var strLen=obj.value;
		if(strLen.length < siz){
			alert(msg+" should have atleast " + siz + " characters");
			obj.focus();
			return true;  
		} 
	}else
		return false;
}
function isSame(obj1,obj2,msg1,msg2){
	if((Trim(obj1.value))==(Trim(obj2.value))){
		alert(msg1+" is matched with the "+msg2);
		obj2.focus();
		return true;
	}else
		return false;
}	
function isNotSame(obj1,obj2,msg1,msg2){
	if((Trim(obj1.value))!=(Trim(obj2.value))){
		alert(msg1+" and "+msg2+" should be same ");
		obj2.focus();
		return true;
	}else
		return false;
}	
function isCorrect(obj1,obj2,msg1,msg2){
	if((Trim(obj1.value)) >= (Trim(obj2.value))){
		alert(msg1+" should be less than "+msg2);
		obj2.focus();
		return true;
	}else
		return false;
}	
function isTxtareaNull(obj,msg){
	if(Trim(obj.innerText) == ""){
		alert("Please enter the " + msg);
		obj.focus();
		return true;
	}else
		return false;
}
function isTxtareaLen(obj,msg){
	if(obj.innerHTML.length > 255){
		alert("Please enter below 256 characters in " + msg);
		obj.focus();
		return true;
	}else
		return false;
}
function notEmail(obj,msg){
	var exp=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	if (!exp.test(obj.value)){
		alert("Please enter valid "+msg);
		obj.focus();
		return true;
	}else
		return false;
}

function validateemail(obj,msg) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = obj.value;
   if(reg.test(address) == false) {
      alert('Invalid Email Address');
	  obj.focus();
     return true;
	 }
	 else return false;
   
}


function notZipcode(obj,msg){
	exp = /[a-zA-Z|\d]-{1}/;
	if (!exp.test(obj.value)){
		alert("Please enter valid "+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 notCheckedfeatured(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);
		
		return true;
	}
}
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 notImageFilepaper(obj,msg){
	var exp = /^.+\.(jpg|gif|jpeg|JPG|JPEG|GIF|pdf|PDF)$/;
	if (!exp.test((obj.value).toLowerCase())){
		alert("Please choose jpg or gif or pdf file for "+msg);
		obj.focus();
		return true;
	}else
		return false;
}
function notJpgFile(obj,msg){
	var exp = /^.+\.(jpg|jpeg|JPG|JPEG)$/;
	if (!exp.test((obj.value).toLowerCase())){
		alert("Please choose jpg 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 notMediaFile(obj,msg){
	var exp = /^.+\.(mp3|mp4|MP3|MP4)$/;
	if (!exp.test((obj.value).toLowerCase())){
		alert("Please choose MP3 or MP4 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 notPrice(obj,msg){
	exp = /^[\d]*([\.]|[\,]){0,1}[\d]{1,2}$/;
	if (!exp.test(obj.value)){
		alert("Please enter valid "+msg);
		obj.focus();
		return true;
	}else
		return false;
}
function fnChkNum(obj,msg){
	exp = /^[0-9]*$/;
	if (!exp.test(obj.value)){
		alert("Please enter only numeric values in "+msg);
		obj.focus();
		return true;
	}else
		return false;
}
function fnChkAlpha(obj,msg){
	exp = (/(^([a-z]|[A-Z]|["."]|[\s])*$)/);
	if (!exp.test(obj.value)){
		alert("Please enter only alphabets in "+msg);
		obj.focus();
		return true;
	}else
		return false;
}
function fnChkAlphaNum(obj,msg){
	exp = (/(^([a-z]|[A-Z]|[0-9])*$)/);
	if (!exp.test(obj.value)){
		alert("Please enter only alphanumeric in "+msg);
		obj.focus();
		return true;
	}else
		return false;
}
function fnChkAlphaNumeric(obj,msg){
	var alpha = /[a-zA-Z|]/;
	var Num = /[\d]/;
	if (!(Alpha.test(obj.value) && Num.test(obj.value))){
		alert("Please enter only alphanumeric in "+msg);
		obj.focus();
		return true;
	}else
		return false;
}
function GetCountry(defaultValue,isNotWithSelect){
	var sCountry="Afghanistan,Albania,Algeria,American Samoa,Andorra,Angola,Anguilla,Antarctica,Antigua and Barbuda,Argentina,Armenia,Aruba,Australia,Austria,Azerbaidjan,Bahamas,Bahrain,Bangladesh,Barbados,Belarus,Belgium,Belize,Benin,Bermuda,Bolivia,Bosnia-Herzegovina,Botswana,Bouvet Island,Brazil,British Indian O. Terr.,Brunei Darussalam,Bulgaria,Burkina Faso,Burundi,Bhutan,Cambodia,Cameroon,Canada,Cape Verde,Cayman Islands,Central African Rep.,Chad,Chile,China,Christmas Island,Cocos (Keeling) Isl.,Colombia,Comoros,Congo,Cook Islands,Costa Rica,Croatia,Cuba,Cyprus,Czech Republic,Czechoslovakia,Denmark,Djibouti,Dominica,Dominican Republic,East Timor,Ecuador,Egypt,El Salvador,Equatorial Guinea,Estonia,Ethiopia,Falkland Isl.(Malvinas),Faroe Islands,Fiji,Finland,France,France (European Ter.),French Southern Terr.,Gabon,Gambia,Georgia,Germany,Ghana,Gibraltar,Great Britain (UK),Greece,Greenland,Grenada,Guadeloupe (Fr.),Guam (US),Guatemala,Guinea,Guinea Bissau,Guyana,Guyana (Fr.),Haiti,Heard & McDonald Isl.,Honduras,Hong Kong,Hungary,Iceland,India,Indonesia,Iran,Iraq,Ireland,Israel,Italy,Ivory Coast,Jamaica,Japan,Jordan,Kazakhstan,Kenya,kyrgyzstan,Kiribati,Korea (North),Korea (South),Kuwait,Laos,Latvia,Lebanon,Lesotho,Liberia,Libya,Liechtenstein,Lithuania,Luxembourg,Macau,Madagascar,Malawi,Malaysia,Maldives,Mali,Malta,Marshall Islands,Martinique (Fr.),Mauritania,Mauritius,Mexico,Micronesia,Moldavia,Monaco,Mongolia,Montserrat,Morocco,Mozambique,Myanmar,Namibia,Nauru,Nepal,Netherland Antilles,Netherlands,Neutral Zone,New Caledonia (Fr.),New Zealand,Nicaragua,Niger,Nigeria,Niue,Norfolk Island,Northern Mariana Isl.,Norway,Oman,Pakistan,Palau,Panama,Papua New,Paraguay,Peru,Philippines,Pitcairn,Poland,Polynesia (Fr.),Portugal,Puerto Rico (US),Qatar,Reunion (Fr.),Romania,Russian Federation,Rwanda,Saint Lucia,Samoa,San Marino,Saudi Arabia,Senegal,Seychelles,Sierra Leone,Singapore,Slovak Republic,Slovenia,Solomon Islands,Somalia,South Africa,Spain,Sri Lanka,St. Helena,St. Pierre & Miquelon,St. Tome and Principe,St.Kitts Nevis Anguilla,St.Vincent & Grenadines,Sudan,Suriname,Svalbard & Jan Mayen Is,Swaziland,Sweden,Switzerland,Syria,Tadjikistan,Taiwan,Tanzania,Thailand,Togo,Tokelau,Tonga,Trinidad & Tobago,Tunisia,Turkey,Turkmenistan,Turks & Caicos Islands,Tuvalu,Uganda,Ukraine,United Arab Emirates,United Kingdom,United States,Uruguay,US Minor outlying Isl.,Uzbekistan,Vanuatu,Vatican City State,Venezuela,Vietnam,Virgin Islands (British)";
	var xCountry=sCountry.split(",");
	var str="";
	if (!isNotWithSelect)str+="<option value='' selected>Select Country</option>\n";else str+="<option value='' selected>Doesn't Matter</option>\n";
	for(i=0;i<xCountry.length; i++)
	if(xCountry[i]==defaultValue)str+="<option value='"+xCountry[i]+"' selected>"+xCountry[i]+"</option>\n";else str+="<option value='"+xCountry[i]+"'>"+xCountry[i]+"</option>\n";
	document.write(str);
}
function fnselectall(){
	//alert("fnselectall");
	obj = document.thisForm.elements['chkSelect[]'];
	chkSelectAll = document.thisForm.chkSelectAll;
	if(obj.length){
		if(chkSelectAll.checked == true){
			for(i=0;i<obj.length;i++){
				if(obj[i].checked == false){
					obj[i].checked = true;
				}
			}
		}else{
			for(i=0;i<obj.length;i++){
				if(obj[i].checked == true){
					obj[i].checked = false;
				}
			}
		}
	}else{
		if(chkSelectAll.checked == true){
			obj.checked = true;
		}else{
			obj.checked = false;
		}
	}		
}
function fnselect(){
	//alert("fnselect");
	obj = document.thisForm.elements['chkSelect[]'];
	chkSelectAll = document.thisForm.chkSelectAll;
	if(obj.length){
		chkSelectAll.checked = true;
		for(i=0;i<obj.length;i++){
			if(obj[i].checked == false){
				chkSelectAll.checked = false;
				break;
			}
		}
	}else{
		if(obj.checked == true){
			chkSelectAll.checked = true;
		}else{
			chkSelectAll.checked = false;
		}
	}	
}
function fnChangeStatus(arg,page_name,type){
	//alert("fghf");
	if(notChecked(document.thisForm.elements['chkSelect[]'],type+' to '+arg)){ return false };
	if(confirm("Are you sure, do you want to "+arg+" the selected "+type+"?")){
		document.thisForm.action=page_name+"?action="+arg;
		document.thisForm.submit();
	}	
}
//function fnChangeAppointmentStatus(arg,page_name,type){
	//document.thisForm.action=page_name+"?action="+arg;
	//document.thisForm.submit();

//}
function fnChangefeatured(arg,page_name,type){
	if(notCheckedfeatured(document.thisForm.elements['chkSelectfeatured[]'],type+' to '+arg)){ return false };
	if(confirm("Are you sure, do you want to "+arg+" the selected "+type+"?")){
		document.thisForm.action=page_name+"?action="+arg;
		document.thisForm.submit();
	}	
}
/* Common Javascript Function Ends */
/* Change Password Validation Starts */
function fnValidateChangePassword(){
  	if(isNull(document.thisForm.txtoldpassword,"old password")) return false;
	if(fnChkAlphaNum(document.thisForm.txtoldpassword,"old password")) return false;
	if(isLen(document.thisForm.txtoldpassword,5,"old password")){
	    document.thisForm.txtoldpassword.value="";
	    return false;
	 }
	if(isNull(document.thisForm.txtnewpassword,"new password")) return false;
	if(fnChkAlphaNum(document.thisForm.txtnewpassword,"new password")) return false;
    if(isLen(document.thisForm.txtnewpassword,5,"new password")){ 
	   document.thisForm.txtnewpassword.value="";
	   return false;
	}
	if(Trim(document.thisForm.txtoldpassword.value)==Trim(document.thisForm.txtnewpassword.value)){
		alert("Old and new password should not be the same");
		document.thisForm.txtnewpassword.value="";
		document.thisForm.txtconfirmpassword.value="";
		document.thisForm.txtnewpassword.focus();
		return false;
	}	
	if(isNull(document.thisForm.txtconfirmpassword,"confirm password")) return false;
	if(fnChkAlphaNum(document.thisForm.txtconfirmpassword,"confirm password"))
	if(isLen(document.thisForm.txtconfirmpassword,5,"confirm password")){
       document.thisForm.txtconfirmpassword.value="";
	   return false;
	}
  	if(isNotSame(document.thisForm.txtnewpassword,document.thisForm.txtconfirmpassword,"New","Confirm Password")){
      document.thisForm.txtconfirmpassword.value="";
	  return false;	  
	}
	if(isSame(document.thisForm.txtnewpassword,document.thisForm.txtoldpassword,"New Password","Old Password")) return false;
}
/* Change Password Validation Ends */
/* Login Validation Starts */
function fnValidateLogin(){
	if (isNull(document.thisForm.txtUserName,"username")){ return false; }
	if (isNull(document.thisForm.txtPassword,"password")){ return false; }
	if (document.thisForm.txtPassword.value.length<5)	{ 
		alert("Password should have atleast 5 characters");
		document.thisForm.txtPassword.focus();
		return false; 
	}	
}
/* Login Validation Ends */
/* News & Events Validation Starts */
function fnValidateNews(){
	//if(isNull(document.thisForm.txteventname,"event name")){ return false; }
	if(document.thisForm.txteventname.value=="")
    {
		document.thisForm.txteventname.focus();
		alert("Please enter the event name");
		return false;
	}

	if(document.thisForm.txtDate.value==""){ 
	    document.thisForm.txtDate.focus();
   		alert("Please select the start date");
		return false; 
	}
	if(document.thisForm.txtEndDate.value!=""){ 
	if(document.thisForm.txtDate.value<=document.thisForm.txtEndDate.value) 
	{
	}
	else
	{
	alert("Please choose valid end date");
	return false;
	}
	}
	var fcktext = FCKeditorAPI.GetInstance("FCKeditor1").EditorWindow.parent.FCK.GetHTML() ; 
	if(fcktext == ''){
		alert("Please enter the description");
		return false;
	}
	
	count=document.thisForm.hidcount.value;
	objimagetitle 		= document.getElementsByName("txttitle[]");
	objimagefile		= document.getElementsByName("txtFile[]");
	objhidFile          = document.getElementsByName("hidFile[]");
	if(count>1){
		//alert(1);
		for(i=0;i<objimagetitle.length;i++){
			if(isNull(objimagetitle[i],"title")){ return false; }
			if(objhidFile[i].value.length>0 && objimagefile[i].value.length==0)
			{
				if(notImageFile(objhidFile[i],"image")){ return false; }
			}
			else
			{
				if(notImageFile(objimagefile[i],"image")){ return false; }
			}
		}
	}
	else
	{
		//alert(2);
		if(objhidFile[0].value.length>0 && count==1)
		{
			 if(isNull(objimagetitle[0],"title")){ return false; }
			 if(objhidFile[0].value.length>0 && objimagefile[0].value.length==0)
				{
					if(notImageFile(objhidFile[0],"image")){ return false; }
				}
				else
				{
					if(notImageFile(objimagefile[0],"image")){ return false; }
				}
		}
		else if(count==1 && objimagetitle[0].value.length>0 || objimagefile[0].value.length>0)
		{
			if(isNull(objimagetitle[0],"title")){ return false; }
			if(notImageFile(objimagefile[0],"image")){ return false; }		
		 }
	}

}
function fnDeleteNews(id){
	if(confirm("Are you sure, do you want to delete this event name?")) {
		document.thisForm.action="view_news.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* News & Events Validation Ends */
/* What's New Validation Starts */
function fnValidateWhatsnew(){
	if(isNull(document.thisForm.txttitle,"title")){ return false; }
	var fcktext = FCKeditorAPI.GetInstance("FCKeditor1").EditorWindow.parent.FCK.GetHTML() ; 
	if(fcktext == ''){
		alert("Please enter the description");
		return false;
	}
	if(document.thisForm.hidfile.value==""){
		if (isNull_file(document.thisForm.txtfile,"file")){ return false; }
		if (notImageFile(document.thisForm.txtfile,"file")){ return false; }
	}
	if(document.thisForm.hidfile.value!="" && document.thisForm.txtfile.value!=""){
		if (notImageFile(document.thisForm.txtfile,"file")){ return false; }
	}
}
function fnMNewsletter(){
	if(isNull(document.thisForm.txtdesc,"Description")){ return false; }
	
	if(document.thisForm.hidimage.value==""){
		if (isNull_file(document.thisForm.txtimage,"image file")){ return false; }
		if (notImageFile(document.thisForm.txtimage,"image file")){ return false; }
	}
	if(document.thisForm.hidpdf.value==""){
		if (isNull_file(document.thisForm.txtpdf,"Newsletter PDF")){ return false; }
		if (notPdfFile(document.thisForm.txtpdf,"Newsletter")){ return false; }
	}
}
function fnDeleteWhatsnew(id){
	if(confirm("Are you sure, do you want to delete this title?")) {
		document.thisForm.action="view_whatsnew.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
function fnDeleteNewsletter(id){
	if(confirm("Are you sure, do you want to delete this newsletter?")) {
		document.thisForm.action="view_newsletter.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* What's New Validation Ends */
/* Photo Gallery Validation Starts */
function fnValidatePhotogallery(){
	if(notSelected(document.thisForm.cmbCat,"category")){ return false;}
    if(isNull(document.thisForm.txtgallerytitle,"album name")){ return false; }
	if(document.thisForm.txtDate.value==""){ 
	    document.thisForm.txtDate.focus();
   		alert("Please select the date");
		return false; 
	}
	var fcktext = FCKeditorAPI.GetInstance("FCKeditor1").EditorWindow.parent.FCK.GetHTML() ; 
	if(fcktext == ''){
		alert("Please enter the description");
		return false;
	}
	$count=document.thisForm.hidcount.value;
	objimagetitle 		= document.getElementsByName("txttitle[]");
	objimagefile		= document.getElementsByName("txtFile[]");
	objhidFile             = document.getElementsByName("hidFile[]");
	for($i=0;$i<objimagetitle.length;$i++){
		if(isNull(objimagetitle[$i],"title")){ return false; }
		if(objhidFile[$i].value==""){
			if(notImageFile(objimagefile[$i],"image")){ return false; }
		} else{ 
			if(objimagefile[$i].value!="" && objhidFile[$i].value!="" ){
				if(notImageFile(objimagefile[$i],"image")){ return false; }
			}else{
				if(notImageFile(objhidFile[$i],"image")){ return false; }
			}
		}	
	}
}
function fnDeletePhotogallery(id){
	if(confirm("Are you sure, do you want to delete this album name?")) {
		document.thisForm.action="view_photo_gallery.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Photo Gallery Validation Ends */
/* Gallery Category Validation Starts */
function fnValidateGallerycategory(){
    if(isNull(document.thisForm.txtcategoryname,"category name")){ return false; }
}
function fnDeleteGallerycategory(id){
	if(confirm("Are you sure, do you want to delete this gallery category?")) {
		document.thisForm.action="view_gallery_category.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Gallery Category Validation Ends */
/* Paper Clipping Validation Starts */
function fnValidatePaperclipping(){
	if(isNull(document.thisForm.txtnewspapertitle,"news paper name")){ return false; }
	if(isNull(document.thisForm.txttitle,"clipping title")){ return false; }
	if(document.thisForm.txtDate.value==""){ 
	    document.thisForm.txtDate.focus();
   		alert("Please select the date");
		return false; 
	}
	if(document.thisForm.hidfile.value==""){
		if (isNull_file(document.thisForm.txtfile,"paper clipping")){ return false; }
		if (notImageFilepaper(document.thisForm.txtfile,"upload paper clipping")){ return false; }
	}
	if(document.thisForm.hidfile.value!="" && document.thisForm.txtfile.value!=""){
		if (notImageFilepaper(document.thisForm.txtfile,"upload paper clipping")){ return false; }
	}
}
function fnDeletePaperclipping(id){
	if(confirm("Are you sure, do you want to delete this clipping title?")) {
		document.thisForm.action="view_paper_clipping.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Paper Clipping Validation Ends */
/* Service Validation Starts */
function fnValidateService(){
	if(isNull(document.thisForm.txttitle,"title")){ return false; }
	var fcktext = FCKeditorAPI.GetInstance("FCKeditor1").EditorWindow.parent.FCK.GetHTML() ; 
	if(fcktext == ''){
		alert("Please enter the description");
		return false;
	}
}
function fnDeleteService(id){
	if(confirm("Are you sure, do you want to delete this title?")) {
		document.thisForm.action="view_service.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Service Validation Ends */
/* Tender Validation Starts */
function fnValidateTender(){
	if(isNull(document.thisForm.txttenderno,"tender number")){ return false; }
	if(document.thisForm.hidfile.value=="" || document.getElementById('id').value=="" ){
		if (isNull_file(document.thisForm.txtfile,"file")){ return false; }
		if (notPdfDocFile(document.thisForm.txtfile,"file")){ return false; }
	}
	if(document.thisForm.hidfile.value!="" && document.thisForm.txtfile.value!="" &&document.getElementById('id').value!=""){
		if (notPdfDocFile(document.thisForm.txtfile,"file")){ return false; }
	}
	if(document.thisForm.txtclosingdate.value==""){ 
	    document.thisForm.txtclosingdate.focus();
   		alert("Please select the closing date");
		return false; 
	}
	if(notSelected(document.thisForm.closingtime,"closing hour")){ return false;}
	if(notSelected(document.thisForm.closingmin,"closing minute")){ return false;}
	if(document.thisForm.txtopeningdate.value==""){ 
	    document.thisForm.txtopeningdate.focus();
   		alert("Please select the opening date");
		return false; 
	}
	//if(document.thisForm.txtclosingdate.value<=document.thisForm.txtopeningdate.value) 
//	{
//	}
//	else
//	{
//	alert("Please choose valid opening date");
//	return false;
//	}
	if(notSelected(document.thisForm.openingtime,"opening hour")){ return false;}
	if(notSelected(document.thisForm.openingmin,"opening minute")){ return false;}
	//if(document.thisForm.txtclosingdate.value==document.thisForm.txtopeningdate.value){
//		if(document.thisForm.openingtime.value>document.thisForm.closingtime.value){
//			alert("Please choose valid opening hour");
//			return false;
//		}
//		if((document.thisForm.openingtime.value==document.thisForm.closingtime.value) && document.thisForm.openingmin.value<document.thisForm.closingmin.value){
//			alert("Please choose valid opening minute");
//			return false;
//		}
//    }
	var fcktext = FCKeditorAPI.GetInstance("FCKeditor1").EditorWindow.parent.FCK.GetHTML() ; 
	if(fcktext == ''){
		alert("Please enter the description");
		return false;
	}
	if(document.getElementById('e_tender_no').checked){
	
		$count=document.thisForm.hidcount.value;
		objimagetitle 		= document.getElementsByName("txttenderFile1[]");
		var files;
		files=document.getElementsByName("hidtenderFile1[]");
			if(document.getElementById('id').value=="" ){
				for($i=0;$i<objimagetitle.length;$i++){
					if(isNull(objimagetitle[$i],"document")){ return false; }
					if(notPdfDocFile(objimagetitle[$i],"document")){ return false; }
					//alert(objimagetitle[$i]);
				}
			}
		if(document.getElementById('id').value!="" ){
			for($k=0;$k<files.length;$k++){
				if(isNull(files[$k],"document")){ return false; }
				if(notPdfDocFile(files[$k],"document")){ return false; }
			//alert(files[$k].value);
			}
		}
	}
}
function fnDeleteTender(id){
	if(confirm("Are you sure, do you want to delete this tender?")) {
		document.thisForm.action="view_tender.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
function fnDeletePastTender(id){
	if(confirm("Are you sure, do you want to delete this Past tender?")) {
		document.thisForm.action="view_past_tender.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Tender Validation Ends */
/* Current Project Validation Starts */
function fnValidateCurrentproject(){
	if(isNull(document.thisForm.txtprojectname,"project name")){ return false; }
	if(isNull(document.thisForm.txtshortdescription,"short description")){ return false; }
	if (document.thisForm.txtfile.value!=""){
		if(notPdfDocFile(document.thisForm.txtfile,"upload document1")){ return false; }
	}
	if (document.thisForm.txtfile2.value!=""){
		if(notPdfDocFile(document.thisForm.txtfile2,"upload document2")){ return false; }
	}
	if (document.thisForm.txtfile3.value!=""){
		if(notPdfDocFile(document.thisForm.txtfile3,"upload document3")){ return false; }
	}
}
function fnDeleteCurrentproject(id){
	if(confirm("Are you sure, do you want to delete this project name?")) {
		document.thisForm.action="view_current_project.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Current Project Validation Ends */
/* It Park Validation Starts */
function fnValidateItpark(){
	if(isNull(document.thisForm.txtcompanynameaddress,"company name and address")){ return false; }
	if(isNull(document.thisForm.txttelephonemail,"telephone and email")){ return false; }
	if (document.thisForm.txtfile.value!=""){
		if(notImageFile(document.thisForm.txtfile,"upload image")){ return false; }
	}
}
function fnDeleteItpark(id){
	if(confirm("Are you sure, do you want to delete this company name and address?")) {
		document.thisForm.action="view_it_park.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* It Park Validation Ends */
/* Appointment Validation Starts */
function fnDeleteAppointmentdetails(id){
	if(confirm("Are you sure, do you want to delete this name?")) {
		document.thisForm.action="view_appointment.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
function fnValidateAppointmentmail(){
	if(isNull(document.thisForm.txtmailto,"to mail")){ return false; }
	if(notEmail(document.thisForm.txtmailto,"to mail")){ return false; }
	if(isNull(document.thisForm.txtmailfrom,"from mail")){ return false; }
	if(notEmail(document.thisForm.txtmailfrom,"from mail")){ return false; }
	if(isNull(document.thisForm.txtsubject,"subject")){ return false; }
	if(isNull(document.thisForm.txtcontent,"message")){ return false; }
}
/* Appointment Validation Ends */
/* Land Requirement Validation Starts */
function fnValidateLand(){
	if(isNull(document.thisForm.txtlandname,"land name")){ return false; }
	if(isNull(document.thisForm.txtlocation,"location")){ return false; }
	if(isNull(document.thisForm.txtaddress,"address")){ return false; }
	if(isNull(document.thisForm.txtarea,"area")){ return false; }
	if(notPrice(document.thisForm.txtarea,"area")){ return false; }
	if(isNull(document.thisForm.txtallotted,"allotted")){ return false; }
	if(notPrice(document.thisForm.txtallotted,"allotted")){ return false; }
	if(isNull(document.thisForm.txtremaining,"remaining")){ return false; }
	if(notPrice(document.thisForm.txtremaining,"remaining")){ return false; }
}
function fnDeleteLand(id){
	if(confirm("Are you sure, do you want to delete this land name?")) {
		document.thisForm.action="view_land_requirement.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Land Requirement Validation Ends */
/* Land Application Validation Starts */
function fnDeleteLandApplication(id){
	if(confirm("Are you sure, do you want to delete this company name?")) {
		document.thisForm.action="view_land_application.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Land Application Validation Ends */
/* Appointment Validation Starts */
function fnValidateAppointment(){
	if(notSelected(document.thisForm.appointmentfor,"appointment to")){ return false;}
	if(document.thisForm.txtDate.value==""){ 
	    document.thisForm.txtDate.focus();
   		alert("Please select the appointment date");
		return false; 
	}
	if(notSelected(document.thisForm.starttime,"start time")) { return false; }
	if(notSelected(document.thisForm.startmin,"start minute")) { return false; }
	if(notSelected(document.thisForm.endtime,"end time")) { return false; }
	if(notSelected(document.thisForm.endmin,"end minute")) { return false; }
	if(document.thisForm.endtime.value<document.thisForm.starttime.value && ( document.thisForm.starttime_am_pm=="pm" && document.thisForm.endtime_am_pm=="pm")){
		alert("Please choose valid end hour");
		return false;
	}
	if(document.thisForm.starttime_am_pm.value=="pm" && document.thisForm.endtime_am_pm.value=="am"){
		alert("Please choose valid end hour");
		return false;
	}
	if((document.thisForm.endtime.value==document.thisForm.starttime.value) && document.thisForm.endmin.value<document.thisForm.startmin.value){
		alert("Please choose valid end minute");
		return false;
	}
	if((document.thisForm.endtime.value==document.thisForm.starttime.value) && (document.thisForm.starttime_am_pm.value==document.thisForm.endtime_am_pm.value) && (document.thisForm.endmin.value==document.thisForm.startmin.value)){
		alert("Please choose valid end hour");
		return false;
	}
}
function fnDeleteAppointment(id){
	if(confirm("Are you sure, do you want to delete this appointment?")) {
		document.thisForm.action="view_appointment_details.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
/* Appointment Validation Ends */
function fnDeleteTenderApplication(id){
	if(confirm("Are you sure, do you want to delete this Tender Application?")) {
		document.thisForm.action="view_tender_applications.php?action=delete&id="+id;
		document.thisForm.submit();
	}
}
