// JavaScript Document

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//Alert message for deleting admin user

function deleteAdmin(id) {
	if(confirm("Are you sure you want to delete the Admin?")) {
	    document.form1.action="admin.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting a sub category

function deleteSubcategory(id) {
	if(confirm("Are you sure you want to delete the Sub Category?")) {
	    document.form1.action="sub_category.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting Region

function regionDelete(id) {
	if(confirm("Are you sure you want to delete the Region?")) {
	    document.form1.action="regions.php?action1=delete&status=submit&region_id="+id;
		document.form1.submit();
 	}  
}

function mediaDelete(id) {
	if(confirm("Are you sure you want to delete the media details?")) {
			document.form1.action="media.php?action1=delete&status=submit&media_id="+id;
			document.form1.submit();
		}  
}
// Alert message for deleting Client

function clientDelete(id) {
	if(confirm("Are you sure you want to delete the Client?")) {
	    document.form1.action="clientexp.php?action1=delete&status=submit&client_id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting Director

function staffDelete(id) {
	if(confirm("Are you sure you want to delete the Staff?")) {
	    document.form1.action="staff.php?action1=delete&status=submit&staff_id="+id;
		document.form1.submit();
 	}  
}


function galleryDelete(id,pid) {
	//alert(pid);
	if(confirm("Are you sure you want to delete the Image?")) {
	    document.frmgallery.action="addgallery.php?action1=delete&status=submit&gallery_id="+id+"&gallery_project_id="+pid;
		document.frmgallery.submit();
 	}  
}



function projectDelete(id) {
	if(confirm("Are you sure you want to delete the Project?")) {
	    document.form1.action="project.php?action1=delete&status=submit&project_id="+id;
		document.form1.submit();
 	}  
}

function linkDelete(id) {
	if(confirm("Are you sure you want to delete the Link?")) {
	    document.form1.action="link.php?action1=delete&status=submit&link_id="+id;
		document.form1.submit();
 	}  
}

function newsDelete(id) {
	if(confirm("Are you sure you want to delete the news?")) {
	    document.form1.action="news.php?action1=delete&status=submit&news_id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting a category

function deleteGallery(id) {
	if(confirm("Are you sure you want to delete the Gallery?")) {
	    document.form1.action="galleries_view.php?action=delete&gallery_id="+id;
		document.form1.submit();
 	}  
}
function deleteProperty(id) {
	if(confirm("Are you sure you want to delete the property?")) {
	    document.form1.action="property_view.php?status=delete&property_id="+id;
		document.form1.submit();
 	}  
}
function deletePropertyimage(id) {
	if(confirm("Are you sure you want to delete the image?")) {
	    document.form1.action="propertyimage_view.php?status=delete&image_id="+id;
		document.form1.submit();
 	}  
}

function deleteGalleryimage(id) {
	if(confirm("Are you sure you want to delete the image?")) {
	    document.form1.action="galleryimage_view.php?status=delete&image_id="+id;
		document.form1.submit();
 	}  
}
function deleteAddon(id) {
	if(confirm("Are you sure you want to delete the Addon?")) {
	    document.form1.action="addon_view.php?status=delete&addon_id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting latest news

function deleteNews(id) {
	if(confirm("Are you sure you want to delete the News?")) {
	    document.form1.action="latest_news.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting customer company

function deleteCustomerCompany(id) {
	if(confirm("Are you sure you want to delete the Company?")) {
	    document.form1.action="customer_company.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Req field
function WebValidate(txtCtrl, val) 
{
	//alert(txtCtrl);
	var ctrName = val;
 	if (txtCtrl.value.indexOf("www") < 0 || txtCtrl.value.indexOf(".") < 0) 
	{ 
		alert("Please enter valid " + ctrName + ".\t\n eg: www.domainname.com");
		txtCtrl.focus();	   	
		return false;
	}		
	if(txtCtrl.value.indexOf("'") > -1)
	{
		alert("Please Don't enter ' in " + ctrName + ".");		
		txtCtrl.focus();   	
		return false;
	}			
}

// Alert message for deleting account manager 

function deleteManager(id) {
	if(confirm("Are you sure you want to delete the account manager?")) {
	    document.form1.action="account_manager.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting customer 

function deleteCustomer(id) {
	if(confirm("Are you sure you want to delete the Customer?")) {
	    document.form1.action="customer.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting career

function deleteCareer(id) {
	if(confirm("Are you sure you want to delete the Job?")) {
	    document.form1.action="career.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting Region

function deleteCareer(id) {
	if(confirm("Are you sure you want to delete the Job?")) {
	    document.form1.action="career.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}
// Aert message for deleting brand

function deleteBrand(id) {
	if(confirm("Are you sure you want to delete the Brand?")) {
	    document.form1.action="brand.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting product

function deleteProduct(id) {
	if(confirm("Are you sure you want to delete the Product?")) {
	    document.form1.action="product.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting product price

function deleteProductprice(id) {
	if(confirm("Are you sure you want to delete the price?")) {
	    document.form1.action="price.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting  customization price

function deleteCustomizationprice(id) {
	if(confirm("Are you sure you want to delete the customize price?")) {
	    document.form1.action="customization_price.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}

// Alert message for deleting menu

function deleteMenu(id) {
	if(confirm("Are you sure you want to delete the menu?")) {
	    document.form1.action="menu.php?action=delete&id="+id;
		document.form1.submit();
 	}  
}
	
	


// To validate sub category form fields

function subcategoryValidate() {
	if(document.frmsubcategory.selcategory.value=="0"){
		alert("Please select the category");
		document.frmsubcategory.selcategory.focus();
		return false;	
	}
	if(TextValidate(document.frmsubcategory.txtsubcategoryname," Sub Category name")==false) { return false;	}
 	
	document.frmsubcategory.action = "sub_category.php";
	document.frmsubcategory.submit();
}

// To validate category form fields

function categoryValidate() {
	if(TextValidate(document.frmcategory.txtcategoryname," Category name")==false) { return false;	}
 	
	document.frmcategory.action = "category.php";
	document.frmcategory.submit();
}

// To validate news form fields

/*function newsValidate() {
	if(TextValidate(document.frmnews.txtnewstitle," News Title")==false) { return false;	}
 	
	document.frmnews.action = "latest_news.php";
	document.frmnews.submit();
}*/

// To validate customer company fields

function companyValidate() {
	if(TextValidate(document.frmcompany.txtcompanyname," Company Name")==false) { return false;	}
/* 	if(TextValidate(document.frmcompany.company_website," Company Website")==false) { return false;	}
	if(WebValidate(document.frmcompany.company_website," Company Website")==false) { return false;	}
*/	if(document.frmcompany.selcompany[0].value==0){
		alert("please select the account manager");
		document.frmcompany.selcompany.focus();
		return false;
	}
	document.frmcompany.action = "customer_company.php";
	document.frmcompany.submit();
}

// To validate account manager form fields

function managerValidate() {
	if(TextValidate(document.frmaccount.txtaccountmanagerfirstname,"First Name")==false) { return false;	}
	if(TextValidate(document.frmaccount.txtaccountmanageremail," email")==false) { return false;	}
	if(EmailValidate(document.frmaccount.txtaccountmanageremail," email")==false) { return false;	}
 	document.frmaccount.action = "account_manager.php";
	document.frmaccount.submit();
}

// To validate  customer form fields
function customerValidate() {
	if(TextValidate(document.frmcustomer.txtcustomerfirstname," Name")==false) { return false;	}
 	if(TextValidate(document.frmcustomer.txtcustomeremail," Email")==false) { return false;	}
	if(EmailValidate(document.frmcustomer.txtcustomeremail," Email")==false) { return false; }
	if(TextValidate(document.frmcustomer.pwdcustomerpassword," Password")==false) { return false;	}
	if(document.frmcustomer.txtcustomerdiscount.value!=""){
		if(isNaN(document.frmcustomer.txtcustomerdiscount.value)){
			alert("Please enter valid number");
			document.frmcustomer.txtcustomerdiscount.focus();
			return false;
		}
	}
		
	document.frmcustomer.action = "customer.php";
	document.frmcustomer.submit();
}
//To validate  career form fields

function careerValidate() {
	if(TextValidate(document.frmcareer.txtcareerjobtitle," Job Title")==false) { return false;	}
 	if(TextValidate(document.frmcareer.txtcareercontactemail," email")==false) { return false;	}
	if(EmailValidate(document.frmcareer.txtcareercontactemail," email")==false) { return false;}
	document.frmcareer.action = "career.php";
	document.frmcareer.submit();
}

// To validate brand form fields

function brandValidate() {
	if(TextValidate(document.frmbrand.txtbrandname," Brand name")==false) { return false;	}
 	
	document.frmbrand.action = "brand.php";
	document.frmbrand.submit();
}
// To validate product form fields

function productValidate() {
	if(TextValidate(document.frmproduct.txtproductcode," Product code")==false) { return false;	}
 /*	if(isNaN(document.frmproduct.txtproductcode.value)){
		alert("Please enter valid number");
		document.frmproduct.txtproductcode.focus();
		return false;
	}
	*/
	//if(SelectValidate(document.frmproduct.product_image1," Product for image")==false) { return false;	}
	document.frmproduct.action = "product.php";
	document.frmproduct.submit();
}
function callsubcategory(cat1){
	
	document.frmproduct.action="product.php?subcat=1&id=<?php echo $_GET['id']?>";
	//document.frmproduct.image1.value=cat1;
	document.frmproduct.submit();
	
}

// To validate price form fields

function priceValidate() {
	if(SelectValidate(document.frmprice.selproductcode," Product code")==false) { return false;	}
	if(document.frmprice.txtproductprice_quantity_lowerlimit.value!=""){
		if(isNaN(document.frmprice.txtproductprice_quantity_lowerlimit.value)){
			alert("Please enter valid number");
			document.frmprice.txtproductprice_quantity_lowerlimit.focus();
			return false;
		}
	}
	if(document.frmprice.txtproductprice_quantity_upperlimit.value!=""){
		if(isNaN(document.frmprice.txtproductprice_quantity_upperlimit.value)){
			alert("Please enter valid number");
			document.frmprice.txtproductprice_quantity_upperlimit.focus();
			return false;
		}
	}
	if(document.frmprice.txtproductprice_peritem.value!=""){
		if(isNaN(document.frmprice.txtproductprice_peritem.value)){
			alert("Please enter valid number");
			document.frmprice.txtproductprice_peritem.focus();
			return false;
		}
	}
	document.frmprice.action = "price.php";
	document.frmprice.submit();
}

// To validate customization price form fields

function customizationpriceValidate() {
	if(SelectValidate(document.frmcustprice.selproductcode," Product code")==false) { return false;	}
 	if(TextValidate(document.frmcustprice.txtcustomizationtype," Customization type")==false) { return false;	}
	if(document.frmcustprice.txtcustomizationprice_quantity_lowerlimit.value!=""){
		if(isNaN(document.frmcustprice.txtcustomizationprice_quantity_lowerlimit.value)){
			alert("Please enter valid number");
			document.frmcustprice.txtcustomizationprice_quantity_lowerlimit.focus();
			return false;
		}
	}
	if(document.frmcustprice.txtcustomizationprice_quantity_upperlimit.value!=""){
		if(isNaN(document.frmcustprice.txtcustomizationprice_quantity_upperlimit.value)){
			alert("Please enter valid number");
			document.frmcustprice.txtcustomizationprice_quantity_upperlimit.focus();
			return false;
		}
	}
	if(document.frmcustprice.txtcustomization_cost_peritem.value!=""){
		if(isNaN(document.frmcustprice.txtcustomization_cost_peritem.value)){
			alert("Please enter valid number");
			document.frmcustprice.txtcustomization_cost_peritem.focus();
			return false;
		}
	}
	document.frmcustprice.action = "customization_price.php";
	document.frmcustprice.submit();
}

// To validate admin form fields

function adminValidate() {
	if(SelectValidate(document.frmadmin.seladminsalutation," salutation")==false) { return false;	}
	if(TextValidate(document.frmadmin.txtadminname," Admin name")==false) { return false;	}
 	if(TextValidate(document.frmadmin.txtadminemail," email")==false) { return false;	}
	if(EmailValidate(document.frmadmin.txtadminemail," email")==false) { return false;	}
	if(TextValidate(document.frmadmin.txtadminusername," username")==false) { return false;	}
	if(TextValidate(document.frmadmin.pwdadminpassword," password")==false) { return false;	}
	if(TextValidate(document.frmadmin.pwdadminconfirmpassword," confrim password")==false) { return false;}
   	if(document.frmadmin.pwdadminconfirmpassword.value != document.frmadmin.pwdadminpassword.value){
		alert("Your password and confirm password does not match.");
		document.frmadmin.pwdadminconfirmpassword.focus();
		return false;
	}
	document.frmadmin.action = "admin.php";
	document.frmadmin.submit();
}

// Region Validate
/*function regionValidate() {	
	//alert(document.frmregion.txtregionurl);
	if(TextValidate(document.frmregion.txtregionadd1," Address1")==false) { return false;	}
	if(TextValidate(document.frmregion.txtregionadd2," Address2")==false) { return false;}
   	if(TextValidate(document.frmregion.txtregioncity," City")==false) { return false;	}
	if(TextValidate(document.frmregion.txtregionstate," State")==false) { return false;	}
	if(TextValidate(document.frmregion.cmbregioncountry," Country")==false) { return false;	}
 	if(TextValidate(document.frmregion.txtregionphoneno," Phone no")==false) { return false;	}
	if(EmailValidate(document.frmregion.txtregionemail," Email")==false) { return false;	}
 	if(WebValidate(document.frmregion.txtregionurl," URL")==false) { return false;	}
	
	if(document.frmregion.action1.value == "Add"){
		document.frmregion.action = "regions.php?status=submit";		
	}else{
		document.frmregion.action = "regions.php?status=submit&action1=edit";
	}
	document.frmregion.submit();
}*/

function regionValidate() {	
	//alert(document.frmregion.txtregionurl);
	if(TextValidate(document.frmregion.txtregionname," Name")==false) { return false;}
	//if(TextValidate(document.frmregion.txtregionadd1," Address1")==false) { return false;	}
	//if(TextValidate(document.frmregion.txtregionadd2," Address2")==false) { return false;}
   	//if(TextValidate(document.frmregion.txtregioncity," City")==false) { return false;	}
	//if(TextValidate(document.frmregion.txtregionstate," State")==false) { return false;	}
	if(TextAreaValidate(document.frmregion.txtregiondesc," Description")==false) { return false;}
	
	//if(TextValidate(document.frmregion.txtregioncountry," Country")==false) { return false;	}
	if(TextValidate(document.frmregion.cmbregioncountry," Country")==false) { return false;	}
	
 	//if(TextValidate(document.frmregion.txtregionphoneno," Phone no")==false) { return false;	}
	//if(EmailValidate(document.frmregion.txtregionemail," Email")==false) { return false;	}
 	//if(WebValidate(document.frmregion.txtregionurl," URL")==false) { return false;	}
	
	if(document.frmregion.action1.value == "Add"){
		document.frmregion.action = "regions.php?status=submit";		
	}else{
		document.frmregion.action = "regions.php?status=submit&action1=edit";
	}
	document.frmregion.submit();
}

// Client Experience Validate
function clientValidate() {
	//alert(tinyMCE.getContent('txtstaffdescription'));
	if(TextValidate(document.frmclient.txtclientname," Name")==false) { return false; }
	if(TextAreaValidate(document.frmclient.txtcampaign," Campaign")==false) { return false; }
   	if(TextValidate(document.frmclient.txtregions," Region")==false) { return false; }
	
	if(document.frmclient.action1.value == "Add"){
		document.frmclient.action = "clientexp.php?status=submit";		
	}else{
		document.frmclient.action = "clientexp.php?status=submit&action1=edit";
	}
	document.frmclient.submit();
}

function mediaValidate() {	
	if(TextValidate(document.frmmedia.txtmedianame,"the Name")==false) { return false; }
	
	var editor_id = tinyMCE.getInstanceById('txtmediadescription');
	if(Remove_Spaces_Editor((tinyMCE.getContent('txtmediadescription')),editor_id,"Please enter a short description")==false) { return false; }	
	
	if(document.frmmedia.hidfile.value == ""){		
		if(document.frmmedia.media_upfile.value == "") {
			alert("Please choose the media file to upload");
			document.frmmedia.media_upfile.focus();
			return false;
		}
		if(MediaFormatValidate(document.frmmedia.media_upfile)==false) { return false; }
	}
	else{
		if(TextValidate(document.frmmedia.hidfile,"the File")==false) { return false; }
		if(MediaFormatValidate(document.frmmedia.media_upfile)==false) { return false; }
	}
	
	
 	if(document.frmmedia.action1.value == "Add"){
		document.frmmedia.action = "media.php?status=submit";		
	}else{
		document.frmmedia.action = "media.php?status=submit&action1=edit";
	}
	document.frmmedia.submit();
}



function imgValidate(){
	
	//if(TextValidate(document.frmgallery.gallery_image," File")==false) { return false; }
	if(document.frmgallery.hidfile.value == ""){
		//alert(document.frmmedia.media_upfile.value);
		//if(TextValidate(document.frmgallery.gallery_image,"the File")==false) { return false; }
		if(document.frmgallery.gallery_image.value == "") {
			alert("Please choose the image file to upload");
			document.frmgallery.gallery_image.focus();
			return false;
		}
		if(ImageFormatValidate(document.frmgallery.gallery_image)==false) { return false; }
	}
	else{
		//alert(document.frmmedia.hidfile.value);
		if(TextValidate(document.frmgallery.hidfile,"the File")==false) { return false; }
		if(ImageFormatValidate(document.frmgallery.gallery_image)==false) { return false; }
	}
	
	if(document.frmgallery.action1.value == "Add"){
		document.frmgallery.action = "addgallery.php?status=submit";		
	}else{
		document.frmgallery.action = "addgallery.php?status=submit&action1=edit";
	}
	document.frmgallery.submit();
}


// Staff Validate
function staffValidate() {	
	//alert(document.frmstaff.stafftitle.value);
	//alert(tinyMCE.getContent('txtstaffdescription'));
	if(SelectValidate(document.frmstaff.stafftitle,"the Title")==false) { return false;	}
	if(TextValidate(document.frmstaff.txtstaffname,"the Name")==false) { return false;	}
	var editor_id = tinyMCE.getInstanceById('txtstaffdescription');
	if(Remove_Spaces_Editor((tinyMCE.getContent('txtstaffdescription')),editor_id,"Please enter a short description")==false) { return false; }
	//if(tinyMCE.getContent('txtstaffdescription')=="") { alert("Please enter description"); document.getElementById('txtstaffdescription').focus(); return false; }
	if(ImageFormatValidate(document.frmstaff.staff_image)==false) { return false; }
	if(document.frmstaff.action1.value == "Add"){
		document.frmstaff.action = "staff.php?status=submit";		
	}else{
		document.frmstaff.action = "staff.php?status=submit&action1=edit";
	}
	document.frmstaff.submit();
}

// Project Validate
function projectValidate() {	
//alert("hi");
	//alert(document.frmstaff.stafftitle.value);
	//alert(tinyMCE.getContent('txtshortdesc'));
	if(SelectValidate(document.frmproject.selcategory,"the Project category")==false) { return false; }
	if(TextValidate(document.frmproject.txtprojname,"the Project name")==false) { return false;	}
	
	var editor_id1 = tinyMCE.getInstanceById('txtshortdesc');
	if(Remove_Spaces_Editor((tinyMCE.getContent('txtshortdesc')),editor_id1,"Please enter a short description")==false) { return false; }
	//if(tinyMCE.getContent('txtshortdesc')=="" || tinyMCE.getContent('txtshortdesc')=="&nbsp;") { alert("Please enter a short description"); document.getElementById('txtshortdesc').focus(); return false; }
	
	var editor_id2 = tinyMCE.getInstanceById('txtlongdesc');
	if(Remove_Spaces_Editor((tinyMCE.getContent('txtlongdesc')),editor_id2,"Please enter a long description")==false) { return false; }
	//if(tinyMCE.getContent('txtlongdesc')=="" || tinyMCE.getContent('txtshortdesc')=="&nbsp;") { alert("Please enter the long description"); document.getElementById('txtlongdesc').focus(); return false; }
	
	if(TextValidate(document.frmproject.txtdate,"the Date")==false) { return false; }
	
	
	if(document.frmproject.action1.value == "Add"){
		document.frmproject.action = "project.php?status=submit";		
	}else{
		document.frmproject.action = "project.php?status=submit&action1=edit";
	}
	document.frmproject.submit();
}

// Category Validate
function catgValidate(){
	if(TextValidate(document.frmcatg.txtcatg,"the Category")==false) { return false;}
	//if(TextValidate(document.frmcatg.txtcatg,"Category")==false) { return false; }
	/*document.frmcatg.action = "addcatg.php";
	document.frmcatg.submit();*/
}

// News Validate
function newsValidate() {	
	//alert(document.frmstaff.stafftitle.value);
	//alert(tinyMCE.getContent('txtstaffdescription'));
	//if(SelectValidate(document.frmstaff.stafftitle," Title")==false) { return false;	}
	if(TextValidate(document.frmnews.newstitle,"the News title")==false) { return false;	}
	if(TextAreaValidate(document.frmnews.txtnewsdescription,"a short description")==false) { return false; }
	var editor_id = tinyMCE.getInstanceById('txtnewsarticle');
	if(Remove_Spaces_Editor((tinyMCE.getContent('txtnewsarticle')),editor_id,"Please enter the Full news article")==false) { return false; }
	/*if(tinyMCE.getContent('txtnewsarticle')=="") { 
		alert("Please enter full article");
		tinyMCE.getElementById('txtnewsarticle').focus();
		return false;
	}*/
	if(TextValidate(document.frmnews.txtdate,"the Date")==false) { return false;	}
	
	if(document.frmnews.action1.value == "Add"){
		document.frmnews.action = "news.php?status=submit";		
	}else{
		document.frmnews.action = "news.php?status=submit&action1=edit";
	}
	document.frmnews.submit();
}

// Links Validate
function linkValidate() {	
	if(TextValidate(document.frmlink.txtsitename,"the Site name")==false) { return false;	}
	var editor_id = tinyMCE.getInstanceById('txtlinkdescription');
	if(Remove_Spaces_Editor((tinyMCE.getContent('txtlinkdescription')),editor_id,"Please enter a short description")==false) { return false; }
	//if(tinyMCE.getContent('txtlinkdescription')=="") { alert("Please enter a short description"); document.getElementById('txtnewsarticle').focus(); return false; }
	if(TextValidate(document.frmlink.txtlink,"the Link")==false) { return false;	}
	
	if(document.frmlink.action1.value == "Add"){
		document.frmlink.action = "link.php?status=submit";		
	}else{
		document.frmlink.action = "link.php?status=submit&action1=edit";
	}
	document.frmlink.submit();
}

// Directors Validate
function contentValidate() {	
	//alert(tinyMCE.getContent('page_content'));
	if(tinyMCE.getContent('page_content')=="") { alert("Please enter content"); return false; }	
	document.frmcontent.action = "content.php";
	document.frmcontent.submit();
}

// To validate 
function menuValidate() {
	if(TextValidate(document.frmmenu.txtmenutitle," Menu title")==false) { return false;	}
	if(TextValidate(document.frmmenu.txtmenulink," Menu link")==false) { return false;	}
	document.frmmenu.action = "menu.php";
	document.frmmenu.submit();
}


// To validate change password form fields

function changePwdvalidate()
{
	var form_name=document.frmpassword;
	if(TextValidate(form_name.old_password,"Old Password")==false){return false;}
	if(TextValidate(form_name.new_password,"New Password")==false){return false;}
	if(TextValidate(form_name.confirm_password,"Confirm Password")==false){return false;}
	if(Comparetextboxes(form_name.new_password,form_name.confirm_password)==false){return false;}
	//document.frmpassword.action = "admin_home.php";
	//document.frmpassword.submit();
}



