
var domain= document.domain;
function LTrim( value ) 
{
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) 
{
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) 
{
	
	return LTrim(RTrim(value));
	
}

function checkURL(value) 
	{
		var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
		if (tomatch.test(value))
		{
			
				return true;
		}
		else
		{
			 
			return false; 
		}
	
	}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   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;
   }

function isValidImage(imagename)
{
	
	imagefile_value = imagename;
	var checkimg = imagefile_value.toLowerCase();
	if (!checkimg.match(/(\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG|\.jpeg|\.JPEG)$/))
	{
		return false;
	}
	else
	{
		return true;
	}
}

function isValidFlash(flashname)
{

	flashfile_value = flashname;
	var checkflash = flashfile_value.toLowerCase();
	if (!checkflash.match(/(\.swf|\.SWF)$/))
	{
		return false;
	}
	else
	{
		return true;
	}
}

function chkSearch(thisform)
{

	with(thisform)
	{
		if((trim(ArticleSearch.value) == "Enter Keyword here") || (trim(ArticleSearch.value) == ""))
		{
			alert("Please enter search criteria");
			ArticleSearch.value ="";
			ArticleSearch.focus();
			return false;
		}
		
	}
	return true;
}
function chkAdminLogin(thisform)
{

	with(thisform)
	{
		if(trim(txtLoginName.value) == "")
		{
			alert("Login field left blank");
			txtLoginName.focus();
			return false;
		}
		if(trim(txtPassword.value) == "")
		{
			alert("Password field left blank");
			txtPassword.focus();
			return false;
		}
		
		
	}
	return true;
}

function chkcontact(thisform)
{

	with(thisform)
	{
		if(trim(txtname.value) == "")
		{
			alert("Name field left blank");
			txtname.focus();
			return false;
		}
		if(trim(txtemail.value) == "")
		{
			alert("Email field left blank");
			txtemail.focus();
			return false;
		}
		else
		 {
			//Check for '@' and '.' in Field Email
			if(txtemail.value.indexOf("@")<1 || txtemail.value.indexOf(".")<1)
			{	
				alert("Email is Invalid");
				txtemail.value="";
				txtemail.focus();
				return false;
			}
			//Check if index of '@' < '.' in Field Email
			if((txtemail.value.lastIndexOf(".")-(txtemail.value.indexOf("@")))<3)
			{
				alert("Email is Invalid");
				txtemail.value="";
				txtemail.focus();
				return false;
			}
		 }
		if(trim(txtphnno.value) == "")
		{
			alert("Phone No left blank");
			txtphnno.focus();
			return false;
		}
		if(trim(txtenquiry.value) == "")
		{
			alert("Enquiry left blank");
			txtenquiry.focus();
			return false;
		}
		if(!chk.checked)
		{
			alert("Select the checkbox");
			chk.focus();
			return false;
		}
		
		
	}
	return true;
}

function chkAddSection(thisform)
{

	with(thisform)
	{
		if(trim(txtSectionName.value) == "")
		{
			alert("Section Name field left blank");
			txtSectionName.focus();
			return false;
		}
	}
	return true;
}

function chkAddSubSection(thisform)
{

	with(thisform)
	{
		if(trim(txtSectionName.value) == "")
		{
			alert("Sub-Section Name field left blank");
			txtSectionName.focus();
			return false;
		}
	}
	return true;
}

function chkAddArticle(thisform)
{
	
	with(thisform)
	{
		if(selSection.value == "0")
		{
			alert("Please Select Section");
			selSection.focus();
			return false;
		}
		if(document.getElementById("selCategory")!= null)
		{
		if(selCategory.value == "")
		{
			alert("Please Select Category");
			selCategory.focus();
			return false;
		}
		}
		if(trim(ArticleHeading.value) == "")
		{
			alert("Article1 heading cannot be left blank");
			ArticleHeading.focus();
			return false;
		}
		/*if(trim(ArticleSubHeading.value) == "")
		{
			alert("Article Sub-heading cannot be left blank");
			ArticleSubHeading.focus();
			return false;
		}*/
		if((selAuthor.value == "0") && (trim(AuthorName.value) == ""))
		{
			alert("Please select Author");
			selAuthor.focus();
			return false;
		}
		if(trim(file.value) == "")
		{
			alert("Please upload an article image");
			file.focus();
			return false;
		}
		if(trim(ArticlePublishDate.value) == "")
		{
			alert("Article Publish date cannot be left blank");
			selAuthor.focus();
			return false;
		}
		if(trim(ArticleSummary.value) == "")
		{
			alert("Article Summary cannot be left blank");
			ArticleSummary.focus();
			return false;
		}
		if(trim(ArticleDescription.value) == "")
		{
			alert("Article Desription cannot be left blank");
			ArticleDescription.focus();
			return false;
		}
		/*if(trim(ArticleText.value) == "")
		{
			alert("Article Text cannot be left blank");
			ArticleText.focus();
			return false;
		}*/
		var EditorInstance = FCKeditorAPI.GetInstance('ArticleText') ; //message is name of field to be validate
		editor_content = EditorInstance.EditorDocument.body.innerHTML;
		editor_content = editor_content.replace("<p><br></p>","");
		//editor_content = editor_content.replace("\<p\>\<\/p\>","");
		//editor_content = editor_content.replace("\<p\>\<\/p\>","");
		newText = editor_content.replace(/\<\/p\>/gi, '');
		newText = newText.replace(/\<p\>/gi, '');
		newText = newText.replace(/&nbsp;/gi,'');
		newText = newText.replace(/_fckxhtmljob=/gi, '');
		newText = newText.replace(/\<p/gi, '');
		//newText = newText.replace(/\"/gi, '');
		newText = newText.replace(/\>/gi, '');
		newText = newText.replace(/[0-9\.-]/gi, '');
		if(newText.length =='0' || newText.length =='3')
		{
			alert("Article Text cannot be left blank");
			EditorInstance.EditorDocument.body.focus();
			return false;
		}
		if(trim(ArticlePoint1.value) == "")
		{
			alert("Article Point 1 cannot be left blank");
			ArticlePoint1.focus();
			return false;
		}
		if(trim(ArticlePoint2.value) == "")
		{
			alert("Article Point 2 cannot be left blank");
			ArticlePoint2.focus();
			return false;
		}
		/*if(trim(ArticlePoint3.value) == "")
		{
			alert("Article Point 3 cannot be left blank");
			ArticlePoint3.focus();
			return false;
		}
		if(trim(ArticlePoint4.value) == "")
		{
			alert("Article Point 4 cannot be left blank");
			ArticlePoint4.focus();
			return false;
		}
		if(trim(ArticlePoint5.value) == "")
		{
			alert("Article Point 5 cannot be left blank");
			ArticlePoint5.focus();
			return false;
		}*/
		if(trim(ArticleTags.value) == "")
		{
			alert("Article Tags cannot be left blank");
			ArticlePoint5.focus();
			return false;
		}
		if(trim(title.value) == "")
		{
			alert("Title cannot be left blank");
			title.focus();
			return false;
		}
		if(trim(keywords.value) == "")
		{
			alert("Keywords cannot be left blank");
			keywords.focus();
			return false;
		}
		if(trim(description.value) == "")
		{
			alert("Description cannot be left blank");
			description.focus();
			return false;
		}

	}
	return true;
}

function chkEditArticle(thisform)
{

	with(thisform)
	{
		if(selSection.value == "0")
		{
			alert("Please Select Section");
			selSection.focus();
			return false;
		}
		if(document.getElementById("selCategory")!= null)
		{
		if(selCategory.value == "")
		{
			alert("Please Select Category");
			selCategory.focus();
			return false;
		}
		}
		if(trim(ArticleHeading.value) == "")
		{
			alert("Article heading cannot be left blank");
			ArticleHeading.focus();
			return false;
		}
		if(trim(ArticleSubHeading.value) == "")
		{
			alert("Article Sub-heading cannot be left blank");
			ArticleSubHeading.focus();
			return false;
		}
		if((selAuthor.value == "0") && (trim(AuthorName.value) == ""))
		{
			alert("Please select Author");
			selAuthor.focus();
			return false;
		}
		
		if(trim(ArticlePublishDate.value) == "")
		{
			alert("Article Publish date cannot be left blank");
			selAuthor.focus();
			return false;
		}
		if(trim(ArticleSummary.value) == "")
		{
			alert("Article Summary cannot be left blank");
			ArticleSummary.focus();
			return false;
		}
		if(trim(ArticleDescription.value) == "")
		{
			alert("Article Desription cannot be left blank");
			ArticleDescription.focus();
			return false;
		}
		if(trim(ArticleText.value) == "")
		{
			alert("Article Text cannot be left blank");
			ArticleText.focus();
			return false;
		}
		if(trim(ArticlePoint1.value) == "")
		{
			alert("Article Point 1 cannot be left blank");
			ArticlePoint1.focus();
			return false;
		}
		if(trim(ArticlePoint2.value) == "")
		{
			alert("Article Point 2 cannot be left blank");
			ArticlePoint2.focus();
			return false;
		}
		if(trim(ArticlePoint3.value) == "")
		{
			alert("Article Point 3 cannot be left blank");
			ArticlePoint3.focus();
			return false;
		}
		if(trim(ArticlePoint4.value) == "")
		{
			alert("Article Point 4 cannot be left blank");
			ArticlePoint4.focus();
			return false;
		}
		if(trim(ArticlePoint5.value) == "")
		{
			alert("Article Point 5 cannot be left blank");
			ArticlePoint5.focus();
			return false;
		}
		if(trim(ArticleTags.value) == "")
		{
			alert("Article Tags cannot be left blank");
			ArticlePoint5.focus();
			return false;
		}
		if(trim(title.value) == "")
		{
			alert("Title cannot be left blank");
			title.focus();
			return false;
		}
		if(trim(keywords.value) == "")
		{
			alert("Keywords cannot be left blank");
			keywords.focus();
			return false;
		}
		if(trim(description.value) == "")
		{
			alert("Description cannot be left blank");
			description.focus();
			return false;
		}

	}
	return true;
}

function chkAddAuthor(thisform)
{

	with(thisform)
	{
		if(trim(txtAuthorName.value) == "")
		{
			alert("Author Name field left blank");
			txtAuthorName.focus();
			return false;
		}
	}
	return true;
}

function chkAddEditor(thisform)
{
with(thisform)
	{
		if(trim(txtEditorName.value) == "")
		{
			alert("Editor Name field left blank");
			txtEditorName.focus();
			return false;
		}
		if(trim(txtEditorEmail.value) == "")
		{
			alert("Editor Email field left blank");
			txtEditorEmail.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(txtEditorEmail.value.indexOf("@")<1 || txtEditorEmail.value.indexOf(".")<1)
				{	
					alert("Email Address is Invalid");
					txtEditorEmail.value="";
					txtEditorEmail.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((txtEditorEmail.value.lastIndexOf(".")-(txtEditorEmail.value.indexOf("@")))<3)
				{
					alert("Email Address is Invalid");
					txtEditorEmail.value="";
					txtEditorEmail.focus();
					return false;
				}
			 }
		if(trim(txtEditorUname.value) == "")
		{
			alert("Editor Username field left blank");
			txtEditorUname.focus();
			return false;
		}
		else 
		{	
			if(txtEditorUname.value.length < 6){
			alert("Editor Username should contain 6 charaters");
			txtEditorUname.focus();
			return false;
			}
		}
		if(trim(txtEditorPassword.value) == "")
		{
			alert("Editor Password field left blank");
			txtEditorPassword.focus();
			return false;
		}
		else 
		{
			if(txtEditorPassword.value.length < 6){
			alert("Editor password should contain 6 charaters");
			txtEditorPassword.focus();
			return false;
			}
		}
		if(trim(radRole.value) == "")
		{
			alert("Please select the Role");
			radRole.focus();
			return false;
		}
	}
	return true;
}

function insertPageBreak()
{
	
	 var articleText ;

	 articleText = document.getElementById("ArticleText").value;
	
	 appendString = "<pageBreak>";
	 article = articleText+appendString;
	 
	 document.getElementById("ArticleText").value = article;
}

function chkAddReview(thisForm)
{
	with(thisForm)
	{
		if(selCategory.value == "0")
		{
			alert("Please Select Category");
			selCategory.focus();
			return false;
		}
		if(trim(reviewTitle.value) == "")
		{
			alert("Review title field left blank");
			reviewTitle.focus();
			return false;
		}
		if(trim(AuthorName.value) == "")
		{
			alert("Author field left blank");
			AuthorName.focus();
			return false;
		}
		if(trim(publisher.value) == "")
		{
			alert("Publisher field left blank");
			publisher.focus();
			return false;
		}
		/*if(trim(price.value) == "")
		{
			alert("Price field left blank");
			price.focus();
			return false;
		}*/
		if(trim(ArticlePublishDate.value) == "")
		{
			alert("Please select the publish date");
			ArticlePublishDate.focus();
			return false;
		}
		if(trim(file.value) == "")
		{
			alert("Please upload the image");
			file.focus();
			return false;
		}
		if(trim(reviewSummary.value) == "")
		{
			alert("summary field left blank");
			reviewSummary.focus();
			return false;
		}
		if(trim(review.value) == "")
		{
			alert("Review field left blank");
			review.focus();
			return false;
		}
		
	}
}

function chkEditReview(thisForm)
{
	with(thisForm)
	{
		if(selCategory.value == "0")
		{
			alert("Please Select Category");
			selCategory.focus();
			return false;
		}
		if(trim(reviewTitle.value) == "")
		{
			alert("Review title field left blank");
			reviewTitle.focus();
			return false;
		}
		if(trim(AuthorName.value) == "")
		{
			alert("Author field left blank");
			AuthorName.focus();
			return false;
		}
		if(trim(publisher.value) == "")
		{
			alert("Publisher field left blank");
			publisher.focus();
			return false;
		}
	/*	if(trim(price.value) == "")
		{
			alert("Price field left blank");
			price.focus();
			return false;
		}*/
		if(trim(ArticlePublishDate.value) == "")
		{
			alert("Please select the publish date");
			ArticlePublishDate.focus();
			return false;
		}
		if(trim(reviewSummary.value) == "")
		{
			alert("summary field left blank");
			reviewSummary.focus();
			return false;
		}
		if(trim(review.value) == "")
		{
			alert("Review field left blank");
			review.focus();
			return false;
		}
		
	}
}

function chkAddNews(thisForm)
{
	with(thisForm)
	{
		if(trim(NewsTitle.value) == "")
		{
			alert("News title field left blank");
			NewsTitle.focus();
			return false;
		}
		if(trim(file.value) == "")
		{
			alert("Please upload the image");
			file.focus();
			return false;
		}
		
		if(trim(NewsSummary.value) == "")
		{
			alert("Summary field left blank");
			NewsSummary.focus();
			return false;
		}
		if(trim(NewsDesc.value) == "")
		{
			alert("News field left blank");
			NewsDesc.focus();
			return false;
		}
		if(trim(NewsPublishDate.value) == "")
		{
			alert("Please select the publish date");
			NewsPublishDate.focus();
			return false;
		}
		
	}
}

function chkEditNews(thisForm)
{
	with(thisForm)
	{
		if(trim(NewsTitle.value) == "")
		{
			alert("News title field left blank");
			NewsTitle.focus();
			return false;
		}
		if(trim(NewsSummary.value) == "")
		{
			alert("Summary field left blank");
			NewsSummary.focus();
			return false;
		}
		if(trim(NewsDesc.value) == "")
		{
			alert("News field left blank");
			NewsDesc.focus();
			return false;
		}
		if(trim(NewsPublishDate.value) == "")
		{
			alert("Please select the publish date");
			NewsPublishDate.focus();
			return false;
		}
		
	}
}

function chkEditHoroscope(thisForm)
{
	with(thisForm)
	{
		if(trim(HoroSummary.value) == "")
		{
			alert("Summary field left blank");
			HoroSummary.focus();
			return false;
		}
		if(trim(HoroDesc.value) == "")
		{
			alert("Description field left blank");
			HoroDesc.focus();
			return false;
		}
		
	}
}

//real weds validation


function showFormElements(oForm) {
  var cnt = 0;
  var msg = "Form with 'name' attribute='" + oForm.name + "'";
  var str = "\nThe elements are: \n\n";
  for (i = 0; i < oForm.length; i++) {
  cnt ++;
  str += oForm.elements[i].tagName + " with 'name' attribute='" + oForm.elements[i].name + "'\n";
  }

  msg += " has " + cnt + " elements. \n" + str;
  alert(msg);
}



	

function chkAddAdPartner(thisForm)
{
	with(thisForm)
	{
		if(trim(companyName.value) == "")
		{
			alert("Company Name field left blank");
			companyName.focus();
			return false;
		}
		/*if(trim(address.value) == "")
		{
			alert("Address field left blank");
			address.focus();
			return false;
		}*/
		if(trim(website.value) == "")
		{
			alert("Website field left blank");
			website.focus();
			return false;
		}
		/*if(trim(phone.value) == "")
		{
			alert("Phone field left blank");
			website.focus();
			return false;
		}
		if(trim(email.value) == "")
		{
			alert("email field left blank");
			email.focus();
			return false;
		}
		*/
		if(trim(file.value) == "")
		{
			alert("Please upload the image");
			file.focus();
			return false;
		}
		
		if(trim(ArticleSummary.value) == "")
		{
			alert("Summary field left blank");
			ArticleSummary.focus();
			return false;
		}
		if(trim(ArticleText.value) == "")
		{
			alert("Text field left blank");
			ArticleText.focus();
			return false;
		}
		if(trim(adStartDate.value) == "")
		{
			alert("Please select the start date");
			adStartDate.focus();
			return false;
		}
		if(trim(adEnddate.value) == "")
		{
			alert("Please select the end date");
			adEnddate.focus();
			return false;
		}
			
	}
}

function chkEditAdPartner(thisForm)
{
	with(thisForm)
	{
		if(trim(companyName.value) == "")
		{
			alert("Company Name field left blank");
			companyName.focus();
			return false;
		}
		/*if(trim(address.value) == "")
		{
			alert("Address field left blank");
			address.focus();
			return false;
		}*/
		if(trim(website.value) == "")
		{
			alert("Website field left blank");
			website.focus();
			return false;
		}
	/*	if(trim(phone.value) == "")
		{
			alert("Phone field left blank");
			website.focus();
			return false;
		}
		if(trim(email.value) == "")
		{
			alert("email field left blank");
			email.focus();
			return false;
		}*/
		if(trim(ArticleSummary.value) == "")
		{
			alert("Summary field left blank");
			ArticleSummary.focus();
			return false;
		}
		if(trim(ArticleText.value) == "")
		{
			alert("Text field left blank");
			ArticleText.focus();
			return false;
		}
		if(trim(adStartDate.value) == "")
		{
			alert("Please select the start date");
			adStartDate.focus();
			return false;
		}
		if(trim(adEnddate.value) == "")
		{
			alert("Please select the end date");
			adEnddate.focus();
			return false;
		}
			
	}
}
function chkAddEvent(thisForm)
{
	with(thisForm)
	{
		if(trim(eventTitle.value) == "")
		{
			alert("Event title field left blank");
			eventTitle.focus();
			return false;
		}
		/*if(trim(file.value) == "")
		{
			alert("Please upload the image");
			file.focus();
			return false;
		}*/
		
		if(trim(eventSummary.value) == "")
		{
			alert("Summary field left blank");
			eventSummary.focus();
			return false;
		}
		/*if(trim(ArticleText.value) == "")
		{
			alert("Text field left blank");
			ArticleText.focus();
			return false;
		}*/
		var oEditor = FCKeditorAPI.GetInstance('ArticleText');
		var articletext = oEditor.GetHTML();
		if(articletext == '')
		{
			alert("Text field left blank");
			return false;
		}
		if(trim(eventLocation.value) == "")
		{
			alert("Event location field left blank");
			eventLocation.focus();
			return false;
		}
		if(trim(eventStartDate.value) == "")
		{
			alert("Please select the start date");
			eventStartDate.focus();
			return false;
		}
		if(trim(eventEndDate.value) == "")
		{
			alert("Please select the end date");
			eventEndDate.focus();
			return false;
		}
		if(trim(eventStartTime.value) != "")
		{
			if(selStartTime.value == "0")
			{
				alert("Please select the time");
				selStartTime.focus();
				return false;
			}
			
		}
		if(trim(eventEndTime.value) != "")
		{
			if(selEndTime.value == "0")
			{
				alert("Please select the time");
				selEndTime.focus();
				return false;
			}
			
		}
		
	}
}

function chkEditEvent(thisForm)
{
	with(thisForm)
	{
		if(trim(eventTitle.value) == "")
		{
			alert("Event title field left blank");
			eventTitle.focus();
			return false;
		}
		if(trim(eventSummary.value) == "")
		{
			alert("Summary field left blank");
			eventSummary.focus();
			return false;
		}
		if(trim(ArticleText.value) == "")
		{
			alert("Text field left blank");
			ArticleText.focus();
			return false;
		}
		if(trim(eventLocation.value) == "")
		{
			alert("Event location field left blank");
			eventLocation.focus();
			return false;
		}
		if(trim(eventStartDate.value) == "")
		{
			alert("Please select the start date");
			eventStartDate.focus();
			return false;
		}
		if(trim(eventEndDate.value) == "")
		{
			alert("Please select the end date");
			eventEndDate.focus();
			return false;
		}
		if(trim(eventStartTime.value) != "")
		{
			if(selStartTime.value == "0")
			{
				alert("Please select the time");
				selStartTime.focus();
				return false;
			}
			
		}
		if(trim(eventEndTime.value) != "")
		{
			if(selEndTime.value == "0")
			{
				alert("Please select the time");
				selEndTime.focus();
				return false;
			}
			
		}
		
	}
}
function enableImpressions(str)
{
	
	if(document.getElementById("unlimited").checked == true)
	{
		document.getElementById("unlimited").disabled =false;
		document.getElementById("impressions").disabled = true;
	}
	else
	{
		document.getElementById("unlimited").disabled =false;
		document.getElementById("impressions").disabled = false;
	}
}
function chkAddBanner(thisForm)
{
	with(thisForm)
	{
		if(trim(bannerName.value) == "")
		{
			alert("Name field left blank");
			bannerName.focus();
			return false;
		}
		if(selSection.value == "")
		{
			alert("Please Select Section");
			selSection.focus();
			return false;
		}
		if(selPosition.value == "0")
		{
			alert("Please Select Position");
			selPosition.focus();
			return false;
		}
		if(selType.value == "")
		{
			alert("Please Select Type");
			selType.focus();
			return false;
		}
		if(selType.value == "js")
			{
				if(trim(jsCode.value) == "")
				{
					alert("Code cannot be left blank");
					jsCode.focus();
					return false;
				}
			}
			else if(selType.value == "image")
				{
					if(trim(file.value) == "")
					{
						alert("Please upload the image");
						file.focus();
						return false;
					}
					else
					{

						if(isValidImage(trim(file.value)) == false)
						{
							alert("Please upload image in right format.");
							file.focus();
							return false;
						}
					}

					if(checkURL(trim(bannerUrl.value)) == false)
				{
						alert("Invalid Url");
						bannerUrl.focus();
						return false;
				}
				} 
				else if(selType.value == "image")
					{
						if(trim(file.value) == "")
						{
							alert("Please upload the image");
							file.focus();
							return false;
						}
						else
						{
							if(isValidFlash(trim(file.value)) == false)
							{
								alert("Please upload flash file in right format.");
								file.focus();
								return false;
							}
						}

						if(checkURL(trim(bannerUrl.value)) == false)
						{
							alert("Invalid Url");
							bannerUrl.focus();
							return false;
						}

					}
				else {}
		
		
		if(unlimited.checked == false)
		{
			
			if(IsNumeric(impressions) ==false)
			{
				alert("Invalid Impressions");
				impressions.focus();
				return false;
			}
		}
		if(trim(bannerStartDate.value) == "")
		{
			alert("Please select the start date");
			bannerStartDate.focus();
			return false;
		}
		if(trim(bannerEndDate.value) == "")
		{
			alert("Please select the Expiry date");
			bannerEndDate.focus();
			return false;
		}
		
	}
}

function chkEditBanner(thisForm)
{
	with(thisForm)
	{
		if(trim(bannerName.value) == "")
		{
			alert("Name field left blank");
			bannerName.focus();
			return false;
		}
		if(selSection.value == "")
		{
			alert("Please Select Section");
			selSection.focus();
			return false;
		}
		if(selPosition.value == "0")
		{
			alert("Please Select Position");
			selPosition.focus();
			return false;
		}
		if(selType.value == "")
		{
			alert("Please Select Type");
			selType.focus();
			return false;
		}
		if(selType.value == "js")
			{
				if(trim(jsCode.value) == "")
				{
					alert("Code cannot be left blank");
					jsCode.focus();
					return false;
				}
			}
			else if(selType.value == "image")
				{
					if(isValidImage(trim(file.value)) == false)
						{
							alert("Please upload image in right format.");
							file.focus();
							return false;
						}
					
				} 
				else if(selType.value == "image")
					{
					if(isValidFlash(trim(file.value)) == false)
							{
								alert("Please upload flash file in right format.");
								file.focus();
								return false;
							}
						

					}
				else {}
		
		if(checkURL(trim(bannerUrl.value)) == false)
		{
			alert("Invalid Url");
			bannerUrl.focus();
			return false;
		}
		if(unlimited.checked == false)
		{
			
			if(IsNumeric(impressions) ==false)
			{
				alert("Invalid Impressions");
				impressions.focus();
				return false;
			}
		}
		if(trim(bannerStartDate.value) == "")
		{
			alert("Please select the start date");
			bannerStartDate.focus();
			return false;
		}
		if(trim(bannerEndDate.value) == "")
		{
			alert("Please select the Expiry date");
			bannerEndDate.focus();
			return false;
		}
		
	}
}

function sectionblock()
{
	/*var sectionName = document.getElementById("secName").value;
	content = '<table border="0"><tr><td colspan="4">Publish this article to the '+sectionName+'  Homepage?&nbsp;<select name="selsectionBlock"><!--<option value="0">No</option><option value="1">Main Block</option>--><option value="2">Block 1</option><option value="3">Block 2</option><!--<option value="4">Block 3</option><option value="5">Block 4</option>--></select></tr></table>';
	document.getElementById("homeDiv").innerHTML=content;*/
}

function myrealPopup(email,realid,name) {
//	dev.universalmediacentre.com.au/
//alert(bname);
url =  "http://"+domain+"/php/popup.php?email="+email+"&id="+realid+"&bname="+name+"&type=1";
window.open(url, "Send_The_Business_Email", "status = 1, height = 300, width = 350, resizable = 0" )
}

function myPopup2(email,listid,bname) {
//	dev.universalmediacentre.com.au/
//alert(bname);
url =   "http://"+domain+"/php/popup.php?email="+email+"&id="+listid+"&bname="+bname+"&type=2";
window.open(url, "Send_The_Business_Email", "status = 1, height = 300, width = 350, resizable = 0" )
}


function mygalleryPopup(email,realid,name,secname) {
//	dev.universalmediacentre.com.au/
//alert(bname);
url = "http://"+domain+"/php/popup.php?email="+email+"&id="+realid+"&bname="+name+"&type=3&secname="+secname;
window.open(url, "Send_The_Business_Email", "status = 1, height = 300, width = 350, resizable = 0" )
}

function printreport(compid,date) {
//	dev.universalmediacentre.com.au/
//alert(bname);
url =  "http://www.completewedding.com.au/admin/print_report.php?compid="+compid+"&date="+date;
window.open(url, "Print Report", "status = 1, height = auto, width = auto, resizable = 0" )
//alert(url);
}
function printpdf(compid,date) {
//	dev.universalmediacentre.com.au/
//alert(bname);
//url =  "http://www.completewedding.com.au/admin/print_pdf.php?compid="+compid+"&date="+date;
url =  "http://www.completewedding.com.au/admin/index.php?hidAction=html2pdf&compid="+compid+"&date="+date;
window.open(url, "Print Report", "status = 1, height =auto,width = auto, resizable = 0" )
//alert(url);
}
function chksendmail1(thisForm)
{
	with(thisForm)
	{
		if(trim(send_name.value) == "")
		{
			alert("Sender Name is left blank");
			send_name.focus();
			return false;
		}
		if(trim(send_email.value) == "")
		{
			alert("Sender Email is left blank");
			send_email.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(send_email.value.indexOf("@")<1 || send_email.value.indexOf(".")<1)
				{	
					alert("Email Address is Invalid");
					send_email.value="";
					send_email.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((send_email.value.lastIndexOf(".")-(send_email.value.indexOf("@")))<3)
				{
					alert("Email Address is Invalid");
					send_email.value="";
					send_email.focus();
					return false;
				}
			 }
		if(trim(send_phone.value) == "")
		{
			alert("Sender Phone is left blank");
			send_phone.focus();
			return false;
		}
		if(trim(txtMessage.value) == "")
		{
			alert("Message is left blank");
			txtMessage.focus();
			return false;
		}
		sendername = send_name.value;
		senderEmail = send_email.value;
		senderPhone = send_phone.value;
		sendermessage = txtMessage.value;
        toE = toEmail.value;
		listingId = businessId.value;
		type = type1.value;
		artname = bname.value;
		secnamenew = secname.value
		funcall1(sendername,senderEmail,senderPhone,sendermessage,toE,listingId,type,artname,secnamenew);
//		funcall1(name,email,phone,msg,toE,listingId,type,artname)
		return false;
	}
}

function chksendmail(thisForm)
{
	with(thisForm)
	{
		if(trim(send_name.value) == "")
		{
			alert("Sender Name is left blank");
			send_name.focus();
			return false;
		}
		if(trim(send_email.value) == "")
		{
			alert("Sender Email is left blank");
			send_email.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(send_email.value.indexOf("@")<1 || send_email.value.indexOf(".")<1)
				{	
					alert("Email Address is Invalid");
					send_email.value="";
					send_email.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((send_email.value.lastIndexOf(".")-(send_email.value.indexOf("@")))<3)
				{
					alert("Email Address is Invalid");
					send_email.value="";
					send_email.focus();
					return false;
				}
			 }
		if(trim(send_phone.value) == "")
		{
			alert("Sender Phone is left blank");
			send_phone.focus();
			return false;
		}
		if(trim(txtMessage.value) == "")
		{
			alert("Message is left blank");
			txtMessage.focus();
			return false;
		}

		//alert(send_name.value);
		sendername = send_name.value;
		senderEmail = send_email.value;
		senderPhone = send_phone.value;
		sendermessage = txtMessage.value;
		toE = toEmail.value;
		listingId = businessListingId.value;
		type = typeid.value;
		artname = articleName.value;
		funcall(sendername,senderEmail,senderPhone,sendermessage,toE,listingId,type,artname);
		return false;
	}
}
function funcall1(name,email,phone,msg,toE,listingId,type,artname,secnamenew)
{
	xmlHttp=GetXmlHttpObject();
//	dev.universalmediacentre.com.au/completewedding/
	var url="http://"+domain+"/php/sendmail.php";
	url=url+"?name="+name+"&email="+email+"&phone="+phone+"&msg="+msg+"&toE="+toE+"&id="+listingId+"&type="+type+"&artname="+artname+"&secname="+secnamenew;
	
	xmlHttp.onreadystatechange=MsgContent;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	return false;
	
}
function MsgContent()
{
	
	document.getElementById("send1").innerHTML = "Thank you for sending an email.<a href='#' onclick='window.close();'>Close</a>";
}
function funcall(name,email,phone,msg,toE,listingId,type,artname)
{
	xmlHttp=GetXmlHttpObject();
	var url="http://"+domain+"/php/sendmail.php";
	url=url+"?name="+name+"&email="+email+"&phone="+phone+"&msg="+msg+"&toE="+toE+"&id="+listingId+"&type="+type+"&artname="+artname;
	alert(url);
	xmlHttp.onreadystatechange=test;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	return false;
}
function test()
{
	document.frmmail.send_name.value="";
	document.frmmail.send_email.value="";
	document.frmmail.send_phone.value="";
	document.frmmail.txtMessage.value="";
	
	url =  "http://"+domain+"/php/thanksPopup.php";
	window.open(url, "Send The Business Email", "status = 1, height = 300, width = 550, resizable = 0" )
	
}
// GetXmlHttpObject function
	function GetXmlHttpObject()
	{
		var xmlHttp=null;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		return xmlHttp;
	}
function chkLogin(thisform)
{

	with(thisform)
	{
		if(trim(email.value) == "")
		{
			alert("Please enter your email address");
			email.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(email.value.indexOf("@")<1 || email.value.indexOf(".")<1)
				{	
					alert("Email Address is Invalid");
					email.value="";
					email.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((email.value.lastIndexOf(".")-(email.value.indexOf("@")))<3)
				{
					alert("Email Address is Invalid");
					email.value="";
					email.focus();
					return false;
				}
			 }
		if(trim(password.value) == "")
		{
			alert("Password field left blank");
			password.focus();
			return false;
		}
		
		
	}
	return true;
}
function validateUser(thisForm)
{
	with(thisForm)
	{
		if(trim(forename.value) == "")
		{
			alert("FirstName field left blank");
			forename.focus();
			return false;
		}
		if(trim(surname.value) == "")
		{
			alert("Surname field left blank");
			surname.focus();
			return false;
		}
		if(trim(email.value) == "")
		{
			alert("Email field left blank");
			email.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(email.value.indexOf("@")<1 || email.value.indexOf(".")<1)
				{	
					alert("Email Address is Invalid");
					email.value="";
					email.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((email.value.lastIndexOf(".")-(email.value.indexOf("@")))<3)
				{
					alert("Email Address is Invalid");
					email.value="";
					email.focus();
					return false;
				}
			 }
		 if(trim(password.value) == "")
		{
			alert("Password field left blank");
			password.focus();
			return false;
		}
		else 
		{
			if(password.value.length < 6){
			alert("Password should contain 6 charaters");
			password.focus();
			return false;
			}
		}
		if(trim(confirm.value) == "")
		{
			alert("Confirm Password field left blank");
			confirm.focus();
			return false;
		}

		if(trim(confirm.value) != trim(password.value))
		{
			alert("Confirm password should match");
			confirm.focus();
			return false;
		}
		if(trim(business_name.value) == "")
		{
			alert("Business Name field left blank");
			business_name.focus();
			return false;
		}
		if(trim(address1.value) == "")
		{
			alert("Address field left blank");
			address1.focus();
			return false;
		}
		if(trim(town.value) == "")
		{
			alert("Town field left blank");
			town.focus();
			return false;
		}
		if(trim(postcode.value) == "")
		{
			alert("PostCode field left blank");
			postcode.focus();
			return false;
		}
		if(trim(tel.value) == "")
		{
			alert("Telephone field left blank");
			tel.focus();
			return false;
		}
		if(trim(mobile.value) == "")
		{
			alert("Mobile field left blank");
			mobile.focus();
			return false;
		}
		if(terms.checked == false)
		{
			alert("Please Read & accept Terms & conditions");
			terms.focus();
			return false;
		}
	
	}
}
function openChangeDiv(divId)
{
	if(document.getElementById(divId).style.visibility == "hidden"){
	document.getElementById(divId).style.visibility="visible";
	document.getElementById(divId).style.display="block";
	}else{
	document.getElementById(divId).style.visibility="hidden";
	document.getElementById(divId).style.display="none";
	}

}

function wordCounter(field, countfield, maxlimit) {
wordcounter=0;
for (x=0;x<field.value.length;x++) {
      if (field.value.charAt(x) == " " && field.value.charAt(x-1) != " ")  {wordcounter++}  // Counts the spaces while ignoring double spaces, usually one in between each word.
      if (wordcounter > 250) {field.value = field.value.substring(0, x);}
      else {countfield.value = maxlimit - wordcounter;}
      }
   }
  function citydisplay(state,divid)
{
	for(c=0;c<city.length;c=c+2)
	{
		//alert(city);
		if(city[c+1] == state)
		{
			var cityOptions = cityOptions+"<option value='"+city[c]+"'>"+city[c]+"</option>";
		}
	}
	//alert(cityOptions);
	var citySelect = '<select name=\'bus_city\' style="width:135px">'+cityOptions+'</select>';
	document.getElementById(divid).innerHTML = citySelect;

}

function showAddress()
{
  var ni = document.getElementById('businessAddress');
  var numi = document.getElementById('theValue');
  document.getElementById('theValue').value = parseInt(document.getElementById('theValue').value) + parseInt(1);
  var num = document.getElementById('theValue').value;

  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = 'business'+num;
  newdiv.setAttribute('id',divIdName);
  var countryOptions = "<option value=''></option>";
  for(j=0;j<country.length;j=j+2)
	{
	  if(country[j] == "AU")
		{
		  var selectoption = "selected";
		}
		else
		{
			var selectoption = "";
		}
	  countryOptions = countryOptions+"<option value='"+country[j]+"' "+selectoption+">"+country[j+1]+"</option>";
	 
	}
	stateOptions = "<option value=''>Select State</option>"
	for(s=0;s<state.length;s++)
	{

	  var stateOptions = stateOptions+"<option value='"+state[s]+"'>"+state[s]+"</option>";
	 
	}
	
	var cityid = 'bus_city'+num;
  newdiv.innerHTML = '<table width="85%" style="margin-top:20px"><tr><td>Address:</td><td><input name=\'address'+num+'\' type="text" value="" /></td></tr><tr><td>Postcode:</td><td><input name=\'postcode'+num+'\' type="text" size="4" maxlength="4" /></td></tr><tr><td>Country:</td><td><select name=\'country'+num+'\' style="width:135px">'+countryOptions+'</select></td></tr><tr><td>State:</td><td><select name=\'state'+num+'\' style="width:135px" onchange=\'citydisplay1(this.value,"'+cityid+'","'+num+'");\'>'+stateOptions+'</select></td></tr><tr><td>City:</td><td id="bus_city'+num+'"><select name=\'city'+num+'\' style="width:135px"><option value="">Select City</option></select></td></tr><tr><td colspan="2"><p class="edit_btn"><a href=\'#\' onclick=\'removeElement("'+divIdName+'")\'>Delete</a></p></td></tr></table>';
  ni.appendChild(newdiv);
}
function addElement() {
  var ni = document.getElementById('businessAddress');
  var numi = document.getElementById('theValue');
//  var num = (document.getElementById('theValue').value -1)+2;
  //var num = (document.getElementById('theValue').value -1);
  document.getElementById('theValue').value = parseInt(document.getElementById('theValue').value) + parseInt(1);
  var num = document.getElementById('theValue').value;
//  alert(num);
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = 'business'+num;
  newdiv.setAttribute('id',divIdName);
  var countryOptions = "<option value=''></option>";
  for(j=0;j<country.length;j=j+2)
	{
	  if(country[j] == "AU")
		{
		  var selectoption = "selected";
		}
		else
		{
			var selectoption = "";
		}
	  countryOptions = countryOptions+"<option value='"+country[j]+"' "+selectoption+">"+country[j+1]+"</option>";
	 
	}
	stateOptions = "<option value=''>Select State</option>"
	for(s=0;s<state.length;s++)
	{

	  var stateOptions = stateOptions+"<option value='"+state[s]+"'>"+state[s]+"</option>";
	 
	}
	
	var cityid = 'bus_city'+num;
  newdiv.innerHTML = '<table style="margin-top:20px"><tr><td>Title:</td><td><input name=\'bus_title'+num+'\' type="text" value="" />e.g. Sydney Office</td></tr><tr><td>Address:</td><td><input name=\'bus_address'+num+'\' type="text" /></td></tr><tr><td>Postcode:</td><td><input name=\'bus_postcode'+num+'\' type="text" size="4" maxlength="4" /></td></tr><tr><td>Country:</td><td><select name=\'bus_country'+num+'\' style="width:135px">'+countryOptions+'</select></td></tr><tr><td>State:</td><td><select name=\'bus_state'+num+'\' style="width:135px" onchange=\'citydisplay1(this.value,"'+cityid+'","'+num+'");\'>'+stateOptions+'</select></td></tr><tr><td>Suburb:</td><td id="bus_city'+num+'"><select name=\'bus_city'+num+'\' style="width:135px"><option value="">Select City</option></select></td></tr><tr><td>Daytime telephone: </td><td><input name=\'bus_phone'+num+'\' type="text" /></td></tr> <tr><td>Mobile telephone: </td><td><input name=\'bus_mobile'+num+'\' type="text" /></td></tr><tr><td>Fax: </td><td><input name=\'bus_fax'+num+'\' type="text" /></td></tr><tr><td colspan="2"><p class="edit_btn"><a href=\'#\' onclick=\'removeElement("'+divIdName+'")\'>Delete</a></p></td></tr></table>';
  ni.appendChild(newdiv);
}
function citydisplay1(state,divid,num)
{
//	alert(city.length);
	var cityOptions = "<option value=''></option>";
	for(c=0;c<city.length;c=c+2)
	{
		//alert(city);
		if(city[c+1] == state)
		{
			cityOptions = cityOptions+"<option value='"+city[c]+"'>"+city[c]+"</option>";
		}
	}
	//alert(cityOptions);
	var citySelect = '<select name=\'bus_city'+num+'\' style="width:135px">'+cityOptions+'</select>';
	document.getElementById(divid).innerHTML = citySelect;

}
function removeElement(divNum) {
	
  var d = document.getElementById('businessAddress');
  var olddiv = document.getElementById(divNum);
 d.removeChild(olddiv);
}
function checkOnlineBusiness()
{
	
	if(document.getElementById("online_bus").checked == true)
	{
		document.getElementById("businessAddress").style.display = "none";
	}
	else
	{
		document.getElementById("businessAddress").style.display = "block";
	}
	
}

function openPractitionerDiv(catId)
{
	if(catId ==4)
	{
	document.getElementById('practitionersDiv').style.visibility = "visible";
	document.getElementById('practitionersDiv').style.display = "block";
	}
}
function openDiv()
{
	var ni = document.getElementById('practitionersDiv');
	var numi = document.getElementById('PracValue');
	var num = (document.getElementById('PracValue').value -1)+2;

	numi.value = num;
	var newdiv = document.createElement('div');
	var divIdName = 'practitioner'+num;
	newdiv.setAttribute('id',divIdName);
  
	
  newdiv.innerHTML = '<table width="42%" border="0" cellspacing="0" cellpadding="0"><tr><td>Practitioners Name/Personal</td><td><input type="text" name=\'txtpractitioner'+num+'\' value=""></td></tr><tr><td colspan="2"><p class="edit_btn"><a href=\'#\' onclick=\'removePractitionerDiv("'+divIdName+'")\'>Delete</a></p></td></tr></table>';
  ni.appendChild(newdiv);
	
}

function removePractitionerDiv(divNum) {
	
  var d = document.getElementById('practitionersDiv');
  var olddiv = document.getElementById(divNum);
 d.removeChild(olddiv);
}
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}


function chkPaidListing(thisForm)
{
	with(thisForm)
	{	
		if((txtBusinessName.value) == "")
		{
			alert("Company Name field left blank");
			txtBusinessName.focus();
			return false;
		}
	/*	if((email_addr0.value) == "")
		{
			alert("Email Address field left blank");
			email_addr0.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(email_addr0.value.indexOf("@")<1 || email_addr0.value.indexOf(".")<1)
				{	
					alert("Email Address is Invalid");
					email_addr0.value="";
					email_addr0.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((email_addr0.value.lastIndexOf(".")-(email_addr0.value.indexOf("@")))<3)
				{
					alert("Email Address is Invalid");
					email_addr0.value="";
					email_addr0.focus();
					return false;
				}
			 }*/
		if((selCategory1.value) == "")
		{
			alert("Category 1 field left blank");
			selCategory1.focus();
			return false;
		}
		if((businessSummary.value) == "")
		{
			alert("Company Summary field left blank");
			businessSummary.focus();
			return false;
		}
		var EditorInstance = FCKeditorAPI.GetInstance('businessDesc') ; //message is name of field to be validate
		editor_content = EditorInstance.EditorDocument.body.innerHTML;
		editor_content = editor_content.replace("<p><br></p>","");
		//editor_content = editor_content.replace("\<p\>\<\/p\>","");
		//editor_content = editor_content.replace("\<p\>\<\/p\>","");
		newText = editor_content.replace(/\<\/p\>/gi, '');
		newText = newText.replace(/\<p\>/gi, '');
		newText = newText.replace(/&nbsp;/gi,'');
		newText = newText.replace(/_fckxhtmljob=/gi, '');
		newText = newText.replace(/\<p/gi, '');
		//newText = newText.replace(/\"/gi, '');
		newText = newText.replace(/\>/gi, '');
		newText = newText.replace(/[0-9\.-]/gi, '');
		if(newText.length =='0' || newText.length =='3')
		{
			alert("Company Description field left blank");
			EditorInstance.EditorDocument.body.focus();
			return false;
		}
		/*if((business_logo.value) == "")
		{
			alert("Main Image field left blank");
			business_logo.focus();
			return false;
		}*/
}
		if(subscription.checked == true)
		{
			if(trim(txtClientName.value) == "")
		{
			alert("Client Name field cannot be left blank");
			txtClientName.focus();
			return false;
		}
		}
		if(promotional.checked == true)
		{
			if(trim(txtClientName.value) == "")
		{
			alert("Client Name field cannot be left blank");
			txtClientName.focus();
			return false;
		}
		}
	}


function showHideArticle(thisValue){
	with(thisValue){
		document.getElementById("showArticle").style.display='none';
		document.getElementById("showDirectory").style.display='none';

		if(thisValue=="article"){
			document.getElementById("showArticle").style.display='block';
			document.getElementById("showDirectory").style.display='none';
		}else if(thisValue=="directory"){
			document.getElementById("showDirectory").style.display='block';
			document.getElementById("showArticle").style.display='none';
		}else{
			document.getElementById("showArticle").style.display='none';
			document.getElementById("showDirectory").style.display='none';
		}
		

/*
if(document.getElementById(divId).style.visibility == "hidden"){
	document.getElementById(divId).style.visibility="visible";
	document.getElementById(divId).style.display="block";
	}else{
	document.getElementById(divId).style.visibility="hidden";
	document.getElementById(divId).style.display="none";
	}
*/

	}


}

function showHideDirectory(thisForm){
	with(thisForm){
if(document.getElementById(divId).style.visibility == "hidden"){
	document.getElementById(divId).style.visibility="visible";
	document.getElementById(divId).style.display="block";
	}else{
	document.getElementById(divId).style.visibility="hidden";
	document.getElementById(divId).style.display="none";
	}
	}
}

function showHideEditArticle(thisValue){
	with(thisValue){
		if(thisValue=="article1"){
//			alert("hi");
			document.getElementById("selArticle1").style.display='block';
			document.getElementById("showcompetition1").style.display='none';
		}
	}
}
function showHideArticle1(thisValue){
	with(thisValue){
		document.getElementById("showArticle1").style.display='none';
//		document.getElementById("showDirectory1").style.display='none';
		document.getElementById("showcompetition1").style.display='none';
		document.getElementById("showgallery1").style.display='none';
		document.getElementById("showreal1").style.display='none';

		if(thisValue=="article1"){
			document.getElementById("showArticle1").style.display='block';
			document.getElementById("showDirectory1").style.display='none';
			document.getElementById("showgallery1").style.display='none';
			document.getElementById("showreal1").style.display='none';
		}
		else if(thisValue=="directory1"){
			document.getElementById("showDirectory1").style.display='block';
			document.getElementById("showArticle1").style.display='none';
		}
		else if(thisValue=="competition"){
			document.getElementById("showcompetition1").style.display='block';
			document.getElementById("showArticle1").style.display='none';
			document.getElementById("showgallery1").style.display='none';
			document.getElementById("showreal1").style.display='none';
		}
		else if(thisValue=="gallery"){
			document.getElementById("showgallery1").style.display='block';
			document.getElementById("showcompetition1").style.display='none';
			document.getElementById("showArticle1").style.display='none';
			document.getElementById("showreal1").style.display='none';
		}
		else if(thisValue=="realweds"){
			document.getElementById("showreal1").style.display='block';
			document.getElementById("showgallery1").style.display='none';
			document.getElementById("showcompetition1").style.display='none';
			document.getElementById("showArticle1").style.display='none';
		}
		else{
			document.getElementById("showArticle1").style.display='none';
//			document.getElementById("showDirectory1").style.display='none';
			document.getElementById("showcompetition1").style.display='none';
			document.getElementById("showreal1").style.display='none';
			document.getElementById("showgallery1").style.display='none';
		}

	}
}

function showHideArticle2(thisValue){
	with(thisValue){
		document.getElementById("showArticle2").style.display='none';
//		document.getElementById("showDirectory2").style.display='none';
		document.getElementById("showcompetition2").style.display='none';
		document.getElementById("showreal2").style.display='none';
		document.getElementById("showgallery2").style.display='none';

		if(thisValue=="article2"){
			document.getElementById("showArticle2").style.display='block';
			document.getElementById("showDirectory2").style.display='none';
			document.getElementById("showgallery2").style.display='none';
			document.getElementById("showreal2").style.display='none';
		}else if(thisValue=="directory2"){
			document.getElementById("showDirectory2").style.display='block';
			document.getElementById("showArticle2").style.display='none';
		}
		else if(thisValue=="competition2"){
			document.getElementById("showcompetition2").style.display='block';
			document.getElementById("showArticle2").style.display='none';
			document.getElementById("showgallery2").style.display='none';
			document.getElementById("showreal2").style.display='none';
		}
		else if(thisValue=="gallery2"){
			document.getElementById("showgallery2").style.display='block';
			document.getElementById("showcompetition2").style.display='none';
			document.getElementById("showArticle2").style.display='none';
			document.getElementById("showreal2").style.display='none';
		}
		else if(thisValue=="realweds2"){
			document.getElementById("showreal2").style.display='block';
			document.getElementById("showgallery2").style.display='none';
			document.getElementById("showcompetition2").style.display='none';
			document.getElementById("showArticle2").style.display='none';
		}
		else{
			document.getElementById("showArticle2").style.display='none';
//			document.getElementById("showDirectory2").style.display='none';
			document.getElementById("showcompetition2").style.display='none';
			document.getElementById("showreal2").style.display='none';
			document.getElementById("showgallery2").style.display='none';
		}

	}
}

function showHideArticle3(thisValue){
	with(thisValue){
		document.getElementById("showArticle3").style.display='none';
//		document.getElementById("showDirectory3").style.display='none';
		document.getElementById("showcompetition3").style.display='none';
		document.getElementById("showreal3").style.display='none';
		document.getElementById("showgallery3").style.display='none';

		if(thisValue=="article3"){
			document.getElementById("showArticle3").style.display='block';
			document.getElementById("showDirectory3").style.display='none';
			document.getElementById("showreal3").style.display='none';
			document.getElementById("showgallery3").style.display='none';
		}else if(thisValue=="directory3"){
			document.getElementById("showDirectory3").style.display='block';
			document.getElementById("showArticle3").style.display='none';
		}
		else if(thisValue=="competition3"){
			document.getElementById("showcompetition3").style.display='block';
			document.getElementById("showArticle3").style.display='none';
			document.getElementById("showreal3").style.display='none';
			document.getElementById("showgallery3").style.display='none';
		}
		else if(thisValue=="gallery3"){
			document.getElementById("showgallery3").style.display='block';
			document.getElementById("showcompetition3").style.display='none';
			document.getElementById("showArticle3").style.display='none';
			document.getElementById("showreal3").style.display='none';
		}
		else if(thisValue=="realweds3"){
			document.getElementById("showreal3").style.display='block';
			document.getElementById("showgallery3").style.display='none';
			document.getElementById("showcompetition3").style.display='none';
			document.getElementById("showArticle3").style.display='none';
		}
		else{
			document.getElementById("showArticle3").style.display='none';
			document.getElementById("showreal3").style.display='none';
			document.getElementById("showgallery3").style.display='none';
			document.getElementById("showcompetition3").style.display='none';
		}

	}
}

function showHideArticle4(thisValue){
	with(thisValue){
		document.getElementById("showArticle4").style.display='none';
		document.getElementById("showreal4").style.display='none';
		document.getElementById("showgallery4").style.display='none';
		document.getElementById("showcompetition4").style.display='none';

		if(thisValue=="article4"){
			document.getElementById("showArticle4").style.display='block';
			document.getElementById("showDirectory4").style.display='none';
			document.getElementById("showreal4").style.display='none';
			document.getElementById("showgallery4").style.display='none';
		}else if(thisValue=="directory4"){
			document.getElementById("showDirectory4").style.display='block';
			document.getElementById("showArticle4").style.display='none';
			document.getElementById("showreal4").style.display='none';
			document.getElementById("showgallery4").style.display='none';
		}
		else if(thisValue=="competition4"){
			document.getElementById("showcompetition4").style.display='block';
			document.getElementById("showArticle4").style.display='none';
			document.getElementById("showreal4").style.display='none';
			document.getElementById("showgallery4").style.display='none';
		}
		else if(thisValue=="gallery4"){
			document.getElementById("showgallery4").style.display='block';
			document.getElementById("showcompetition4").style.display='none';
			document.getElementById("showArticle4").style.display='none';
			document.getElementById("showreal4").style.display='none';
		}
		else if(thisValue=="realweds4"){
			document.getElementById("showreal4").style.display='block';
			document.getElementById("showgallery4").style.display='none';
			document.getElementById("showcompetition4").style.display='none';
			document.getElementById("showArticle4").style.display='none';
		}
		else{
			document.getElementById("showArticle4").style.display='none';
			document.getElementById("showreal4").style.display='none';
			document.getElementById("showgallery4").style.display='none';
			document.getElementById("showcompetition4").style.display='none';
		}

	}
}

function showHideArticle5(thisValue){
	with(thisValue){
		document.getElementById("showArticle5").style.display='none';
		document.getElementById("showreal5").style.display='none';
		document.getElementById("showgallery5").style.display='none';
		document.getElementById("showcompetition5").style.display='none';

		if(thisValue=="article5"){
			document.getElementById("showArticle5").style.display='block';
			document.getElementById("showDirectory5").style.display='none';
			document.getElementById("showreal5").style.display='none';
			document.getElementById("showgallery5").style.display='none';
		}else if(thisValue=="directory5"){
			document.getElementById("showDirectory5").style.display='block';
			document.getElementById("showArticle5").style.display='none';
			document.getElementById("showreal5").style.display='none';
			document.getElementById("showgallery5").style.display='none';
		}
		else if(thisValue=="competition5"){
			document.getElementById("showcompetition5").style.display='block';
			document.getElementById("showArticle5").style.display='none';
			document.getElementById("showreal5").style.display='none';
			document.getElementById("showgallery5").style.display='none';
		}
		else if(thisValue=="gallery5"){
			document.getElementById("showgallery5").style.display='block';
			document.getElementById("showcompetition5").style.display='none';
			document.getElementById("showArticle5").style.display='none';
			document.getElementById("showreal5").style.display='none';
		}
		else if(thisValue=="realweds5"){
			document.getElementById("showreal5").style.display='block';
			document.getElementById("showgallery5").style.display='none';
			document.getElementById("showcompetition5").style.display='none';
			document.getElementById("showArticle5").style.display='none';
		}
		else{
			document.getElementById("showArticle5").style.display='none';
			document.getElementById("showreal5").style.display='none';
			document.getElementById("showgallery5").style.display='none';
			document.getElementById("showcompetition5").style.display='none';
		}

	}
}
/*--*/
var k,count;
function chkAddVideo(thisForm)
{
	with(thisForm)
	{
		var oEditor = FCKeditorAPI.GetInstance('videoDescription');
		var videodesc = oEditor.GetHTML();
		if(videodesc == '')
		{
			alert("Description field left blank");
			videoDescription.focus();
			return false;
		}
		else if(trim(videoName.value) == "")
		{
			alert("Name field left blank");
			videoName.focus();
			return false;
		}
		/*else if(trim(videoDescription.value) == "")
		{
			alert("Description field left blank");
			videoDescription.focus();
			return false;
		}*/
		else
		{		
			var videovalue1=$("#videoCode1").val();
			var videovalue2=$("#videoCode2").val();
			var videovalue3=$("#videoCode3").val();
			var videovalue4=$("#videoCode4").val();
			var videovalue5=$("#videoCode5").val();
			if(videovalue1 != "" || videovalue2 != "" || videovalue3 != "" || videovalue4 != "" || videovalue5 != "")
			{
				return true;
			}
			else
			{
				alert("Enter at least one code");
				return false;
			}
		}
		/*if(unlimited.checked == false)
		{
			
			if(IsNumeric(impressions) ==false)
			{
				alert("Invalid Impressions");
				impressions.focus();
				return false;
			}
		}
		if(trim(bannerStartDate.value) == "")
		{
			alert("Please select the start date");
			bannerStartDate.focus();
			return false;
		}
		if(trim(bannerEndDate.value) == "")
		{
			alert("Please select the Expiry date");
			bannerEndDate.focus();
			return false;
		}*/
		
	}
}
function chkAddPoll(thisForm)
{
	var option1=$("#option1").val();
	var option2=$("#option2").val();
	var option3=$("#option3").val();
	
	with(thisForm)
	{
		if(trim(title.value) == "")
		{
			alert("title field left blank");
			title.focus();
			return false;
		}
		else if(trim(question.value) == "")
		{
			alert("question field left blank");
			question.focus();
			return false;
		}
		else if(trim(pollstartDate.value) == "")
		{
			alert("poll start date left blank");
			pollstartDate.focus();
			return false;
		}
		else if(trim(pollendDate.value) == "")
		{
			alert("poll end date left blank");
			pollendDate.focus();
			return false;
		}
		else
		{		
			if(option1 != "" || option2 != "" || option3 != "" )
			{
				return true;
			}
			else
			{
				alert("Enter at least one option");
				return false;
			}
		}
		
	}
}

function chkGalleryData(thisForm)
{
	with(thisForm)
	{	
		/*if((txtClientName.value) == "")
		{
			alert("Client Name field left blank");
			txtClientName.focus();
			return false;
		}*/

		if((selCategory1.value) == "")
		{
			alert("Category field left blank");
			selCategory1.focus();
			return false;
		}

		/*
		if((email_addr.value) == "")
		{
			alert("Email Address field left blank");
			email_addr.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(email_addr.value.indexOf("@")<1 || email_addr.value.indexOf(".")<1)
				{	
					alert("Email Address is Invalid");
					email_addr.value="";
					email_addr.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((email_addr.value.lastIndexOf(".")-(email_addr.value.indexOf("@")))<3)
				{
					alert("Email Address is Invalid");
					email_addr.value="";
					email_addr.focus();
					return false;
				}
			 }
		*/

		if((main_img.value) == "")
		{
			alert("Main Image field left blank");
			main_img.focus();
			return false;
		}
 }
}

function chkbefeatured(thisForm)
{
	with(thisForm)
	{	
		if((txtName.value) == "")
		{
			alert("Name field left blank");
			txtName.focus();
			return false;
		}
		if((datepicker.value) == "")
		{
			alert("Date field left blank");
			datepicker.focus();
			return false;
		}
		if((selstate.value) == "")
		{
			alert("State field left blank");
			selstate.focus();
			return false;
		}
		if((txtVenue.value) == "")
		{
			alert("Venue field left blank");
			txtVenue.focus();
			return false;
		}
		if((txtguest.value) == "")
		{
			alert("Number of guests field left blank");
			txtguest.focus();
			return false;
		}
		if((txtPhoto.value) == "")
		{
			alert("Wedding Photographer field left blank");
			txtPhoto.focus();
			return false;
		}
		if((radio1[0].checked == false) && (radio1[1].checked == false))
		{
			alert("Select a Radio Button");
			return false;
		}
		if((txtMemorable.value) == "")
		{
			alert("Most memorable moment field left blank");
			txtMemorable.focus();
			return false;
		}
		if((txtTheme.value) == "")
		{
			alert("Wedding Theme field left blank");
			txtTheme.focus();
			return false;
		}
		if((txtSuppliers.value) == "")
		{
			alert("Wedding Suppliers field left blank");
			txtSuppliers.focus();
			return false;
		}
		if((txtmail.value) == "")
		{
			alert("Email field left blank");
			txtmail.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(txtmail.value.indexOf("@")<1 || txtmail.value.indexOf(".")<1)
				{	
					alert("Email is Invalid");
					txtmail.value="";
					txtmail.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((txtmail.value.lastIndexOf(".")-(txtmail.value.indexOf("@")))<3)
				{
					alert("Email is Invalid");
					txtmail.value="";
					txtmail.focus();
					return false;
				}
			 }
		if((txtNo.value) == "")
		{
			alert("Number field left blank");
			txtNo.focus();
			return false;
		}
		if((img1.value) == "")
		{
			alert("Image field left blank");
			img1.focus();
			return false;
		}
		if((img2.value) == "")
		{
			alert("Image field left blank");
			img2.focus();
			return false;
		}
	}
}

function chkRegisterData(thisForm)
{
	with(thisForm)
	{	
		if((txtname.value) == "")
		{
			alert("Name field left blank");
			txtname.focus();
			return false;
		}
		if((txtadd.value) == "")
		{
			alert("Address field left blank");
			txtadd.focus();
			return false;
		}
		if((txtSuburb.value) == "")
		{
			alert("Suburb field left blank");
			txtSuburb.focus();
			return false;
		}
		if((txtpost.value) == "")
		{
			alert("Post Code field left blank");
			txtpost.focus();
			return false;
		}

		if((state.value) == "0")
		{
			alert("Select a State");
			state.focus();
			return false;
		}
		
		if((txtphone.value) == "")
		{
			alert("Phone field left blank");
			txtphone.focus();
			return false;
		}

		if((txtemail.value) == "")
		{
			alert("Email field left blank");
			txtemail.focus();
			return false;
		}
		else
			 {
				//Check for '@' and '.' in Field Email
				if(txtemail.value.indexOf("@")<1 || txtemail.value.indexOf(".")<1)
				{	
					alert("Email is Invalid");
					txtemail.value="";
					txtemail.focus();
					return false;
				}
				//Check if index of '@' < '.' in Field Email
				if((txtemail.value.lastIndexOf(".")-(txtemail.value.indexOf("@")))<3)
				{
					alert("Email is Invalid");
					txtemail.value="";
					txtemail.focus();
					return false;
				}
			 }
		

		if(!chk.checked)
		{
			alert("Select the checkbox");
			chk.focus();
			return false;
		}
 }
}

var xml_http;
function updateBnListProfileCount(businessListingId,type,page){
			
	try{
		// Firefox, Opera 8.0+, Safari
		xml_http=new XMLHttpRequest();
	}catch (e){
		// Internet Explorer
		try{
			xml_http=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			xml_http=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	var url="http://www.completewedding.com.au/listingreport.php";
	url=url+"?businessListingId="+businessListingId+"&type="+type+"&page="+page;
//	alert(url);		
	xml_http.onreadystatechange=setBusinessOutput;
	xml_http.open("GET",url,true);
	xml_http.send(null);
	//return false;
		
	}
	function setBusinessOutput()
	{

	}

function printreport(compid,date) {
//	dev.universalmediacentre.com.au/
//alert(bname);
url =  "http://www.completewedding.com.au/admin/print_report.php?compid="+compid+"&date="+date;
window.open(url, "Print Report", "status = 1, height = 300, width = 350, resizable = 0" )
//alert(url);
}
function printpdf(compid,date) {
//	dev.universalmediacentre.com.au/
//alert(bname);
url =  "http://www.completewedding.com.au/admin/print_pdf.php?compid="+compid+"&date="+date;
window.open(url, "Print Report", "status = 1, height =auto,width = auto, resizable = 0" )
//alert(url);
}

/*function fetchCompEmail(id)
{
	xmlHttp=GetXmlHttpObject();
	var url="http://"+domain+"/admin/php/listCompetitionEmail.php";
	url=url+"?id="+id;

	xmlHttp.onreadystatechange=retrieve;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	return false;
}
function retrieve()
{
	url =  "http://"+domain+"/php/thanksPopup.php";
	window.open(url, "Send The Business Email", "status = 1, height = 300, width = 550, resizable = 0" )
	
}*/
