function fncCheckAll(lstname,chkname)
		{
			var i;

			for (i=0;i<=document.getElementById(lstname).length -1;i++)
			{
		
			if (document.getElementById(chkname).checked == true)
			{
			document.getElementById(lstname).item(i).selected = true;
			}
			else
			{
			document.getElementById(lstname).item(i).selected = false;
			}	
			}

		}


		function fncFileName(sName,stxtname,filctrl,divupl,divonl)
	  	{		
	  		if (sName != undefined)
			{			
			document.getElementById(stxtname).value = sName;
			document.getElementById(filctrl).value = '';
			document.getElementById(divupl).style.display = 'none';
			document.getElementById(divonl).style.display = '';
			}			
	  	}
	  	function fncUploadFile(stxtname,filctrl,divupl,divonl)
	  	{
	  		document.getElementById(filctrl).value = '';
	  		document.getElementById(stxtname).value = '';
	  		document.getElementById(divupl).style.display = '';
			document.getElementById(divonl).style.display = 'none';
	  	}

function fncValFormNC()
{   
    if (fncValUserDet2() == false)
    {
		return false;
    }
    if (validateEmail(document.getElementById('ctl00_ctl04_txtEmailID').value) == false)
    {		
		document.getElementById('ctl00_ctl04_txtEmailID').focus();
		return false;
    }	 
    if (fncValQuestion2("divPriBus") == false)
    {
        alert('primary job function is required');
        document.getElementById("divPriBus").focus;
        return false;        
        
    }    
}

function fncValUserDet2()
{
	if (document.getElementById('ctl00_ctl04_txtFName').value.length == 0)
	{
		alert('First name is required');
		document.getElementById('ctl00_ctl04_txtFName').focus();
		return false;
	}
	if (document.getElementById('ctl00_ctl04_txtLName').value.length == 0)
	{
		alert('Last name is required');
		document.getElementById('ctl00_ctl04_txtLName').focus();
		return false;
	}
	if (document.getElementById('ctl00_ctl04_txtEmailID').value.length == 0)
	{
		alert('Email address is required');
		document.getElementById('ctl00_ctl04_txtEmailID').focus();
		return false;
	}
	if (document.getElementById('ctl00_ctl04_txtLocation').value.length == 0)
	{
		alert('Location is required');
		document.getElementById('ctl00_ctl04_txtLocation').focus();
		return false;
	}
}

function fncValQuestion2(pnlname)
{
    var objpanel = document.getElementById(pnlname);
    var d;
    var i;
    var c;
    var bValid = false;
        
    d = objpanel.getElementsByTagName("input");
    c = objpanel.getElementsByTagName("textarea");
    
    	for (i=0;i<d.length;i++)
        {
        if (d[i].type == "radio")
        {
           if (d[i].checked == true)
           {
           	bValid = true;
           }
        }    
    	if (d[i].type == "text")
        {
           if (d[i].value.length > 0)
           {
           	bValid = true;
           }
        }       
        }
        
        if (bValid == true)
        {
        	return true;
        }
        else
        {
        	return false;
        }        
}

function fncValForm()
{   
	if (fncValUserDet() == false)
    {
		return false;
    }
    if (validateEmail(document.getElementById('ctl00_ctl04_txtEmailID').value) == false)
    {		
		document.getElementById('ctl00_ctl04_txtEmailID').focus();
		return false;
    }	 
    if (fncValQuestion("divPriBus") == false)
    {
        alert('primary business is required');
        document.getElementById("divPriBus").focus;
        return false;        
        
    }    
}

function validateEmail(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    var splitted = email.match("^(.+)@(.+)$");
    
    if(splitted == null) 
	{
	alert("Email Address seems incorrect");
	return false;
	}
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) 
	{
	alert("Email Address seems incorrect");
	return false;
	}
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) 
		{
	alert("Email Address seems incorrect");
	return false;
	}
      }// if
      return true;
    }

//alert("Email Address seems incorrect");
return true;
}

function fncValUserDet()
{
	if (document.getElementById('ctl00_ctl04_txtFName').value.length == 0)
	{
		alert('First name is required');
		document.getElementById('ctl00_ctl04_txtFName').focus();
		return false;
	}
	if (document.getElementById('ctl00_ctl04_txtLName').value.length == 0)
	{
		alert('Last name is required');
		document.getElementById('ctl00_ctl04_txtLName').focus();
		return false;
	}
	if (document.getElementById('ctl00_ctl04_txtEmailID').value.length == 0)
	{
		alert('Email address is required');
		document.getElementById('ctl00_ctl04_txtEmailID').focus();
		return false;
	}
	if (document.getElementById('ctl00_ctl04_txtLocation').value.length == 0)
	{
		alert('Location is required');
		document.getElementById('ctl00_ctl04_txtLocation').focus();
		return false;
	}
}

function fncValQuestion(pnlname)
{
    var objpanel = document.getElementById(pnlname);
    var d;
    var i;
    var c;
    var bValid = false;
        
    d = objpanel.getElementsByTagName("input");
    c = objpanel.getElementsByTagName("textarea");
    
    	for (i=0;i<d.length;i++)
        {
        if (d[i].type == "checkbox")
        {
           if (d[i].checked == true)
           {
           	bValid = true;
           }
        }    
    	if (d[i].type == "text")
        {
           if (d[i].value.length > 0)
           {
           	bValid = true;
           }
        }       
        }
        
        if (bValid == true)
        {
        	return true;
        }
        else
        {
        	return false;
        }        
}

function getRandomNum(lbound, ubound)
{
	return (Math.round(Math.random() * (ubound - lbound)) + lbound);
}

// AUTHOR:		Jason Noftall
// DATE:		Aug. 16, 2003
// DESCRIPTION:	Trims any leading/trailing spaces from the incoming string.
// PARAMETERS:	strIn = string that needs to be trimmed
// RETURNS:		String, input string less any leading/trailing spaces.
function trimString(strIn)
{
	var strOut = new String(strIn);						// Return value

	// If there are trailing spaces, instantiate a new
	// String object with the original string less the spaces...
	while (strOut.charAt(strOut.length - 1) == ' ')
	{
		strOut = new String(strOut.substring(0, strOut.length - 1));
	}

	// If there are leading spaces, instantiate a new
	// String object with the original string less the spaces...
	while (strOut.charAt(0) == ' ')
	{
		strOut = new String(strOut.substring(1, strOut.length));
	}

	return strOut;
}

// AUTHOR:		Jason Noftall
// DATE:		Aug. 16, 2003
// DESCRIPTION:	Validates strings to check for certain numeric attributes.
// PARAMETERS:	strIn = string that needs numeric validation
//				intFormat = numeric value indicating the type of
//				validation to perform.
// 				1 = Whole numbers, positive only
// 				2 = Whole numbers, positive and negative
// 				3 = Decimal numbers, positive only
// 				4 = Decimal numbers, positive and negative
// RETURNS:		Boolean, True if valid...False if otherwise.
function ensureNumeric(strIn, intFormat)
{
	blnReturn = false;					// Return value
	strNew = trimString(strIn);				// Trim spaces from input string
	var strChar;						// Get 1 char at a time
	var intDecCount = 0;					// Decimal count

	// intFormat
	// ---------
	// 1 = Whole numbers, positive only
	// 2 = Whole numbers, positive and negative
	// 3 = Decimal numbers, positive only
	// 4 = Decimal numbers, positive and negative

	for (var i=0; i < strNew.length; i++)
	{
		// Get 1 char at a time...
		strChar = strNew.substring(i,i+1);

		switch (intFormat)
		{
			case 1:
			{
				// whole positive numbers only
				switch (strChar)
				{
					case "0":
					case "1":
					case "2":
					case "3":
					case "4":
					case "5":
					case "6":
					case "7":
					case "8":
					case "9":
						blnReturn = true;
						break;
					default:
						return false;
				} // switch (strChar)

				break;
			} // case 1:

			case 2:
			{
				// whole positive or negative numbers only
				switch (strChar)
				{
					case "0":
					case "1":
					case "2":
					case "3":
					case "4":
					case "5":
					case "6":
					case "7":
					case "8":
					case "9":
						blnReturn = true;
						break;
					case "-":
						if (i == 0)
						{
							blnReturn = true;
							break;
						}
						else
						{
							return false;
						}
					default:
						return false;
				} // switch (strChar)

				break;
			} // case 2:

			case 3:
			{
				// decimal positive numbers only
				switch (strChar)
				{
					case "0":
					case "1":
					case "2":
					case "3":
					case "4":
					case "5":
					case "6":
					case "7":
					case "8":
					case "9":
						blnReturn = true;
						break;
					case ".":
						intDecCount++;
						if (intDecCount == 1)
						{
							blnReturn = true;
							break;
						}
						else
						{
							return false;
						}
					default:
						return false;
				} // switch (strChar)

				break;
			} // case 3:

			case 4:
			{
				// decimal positive numbers only
				switch (strChar)
				{
					case "0":
					case "1":
					case "2":
					case "3":
					case "4":
					case "5":
					case "6":
					case "7":
					case "8":
					case "9":
						blnReturn = true;
						break;
					case "-":
						if (i == 0)
						{
							blnReturn = true;
							break;
						}
						else
						{
							return false;
						}

					case ".":
						intDecCount++;
						if (intDecCount == 1)
						{
							blnReturn = true;
							break;
						}
						else
						{
							return false;
						}
					default:
						return false;
				} // switch (strChar)

				break;
			} // case 4:

		} // switch (intFormat)
	} // (var i=0; i < strNew.length; i++)

	return blnReturn;
}

// AUTHOR:		Jason Noftall
// DATE:		Aug. 16, 2003
// DESCRIPTION:	Counts the number of occurences of one string within another.
// PARAMETERS:	1. strText = String to be searched
//				2. strChar = Character/String to be found
// RETURNS:		int, count of number of occurences found.
function countChars(strText, strChar)
{
	var ptr = strText.indexOf(strChar);			// Pointer to current character
	var i = 0;						// Iteration
	
	while (ptr != -1)
	{
		ptr = strText.indexOf(strChar, ptr + 1);
		i++;
	}
	
	return i;
}

// AUTHOR:		Jason Noftall
// DATE:		Aug. 16, 2003
// DESCRIPTION:	Validates a string for a valid e-mail address.
// PARAMETERS:	strIn = e-mail address to be validated
// RETURNS:		bool, true for valid address...false if otherwise.
function validEmail(strIn)
{
	var strEmail = trimString(strIn);			// Trim the e-mail address
	var intLen = strEmail.length;				// Get the length of e-mail
	var intAtCount = countChars(strEmail, "@");		// Count occurences of "@"
	var intAtLoc = strEmail.indexOf("@");			// Find a "@"
	var intDotLoc = strEmail.lastIndexOf(".");		// Find the last "."
	var blnReturn = true;					// Return value
	
	if (intLen == 0)
	{
		// No e-mail address specified...
		blnReturn = false;
	}
	else if (intAtLoc == 0)
	{
		// Ensure the "@" is not the first character in the string...
		blnReturn = false;
	}
	else if (intAtCount > 1)
	{
		// More than 1 "@" symbol found...
		blnReturn = false;
	}
	else if (intAtCount == 0)
	{
		// More than 1 "@" symbol found...
		blnReturn = false;
	}
	else if (intAtCount == 0)
	{
		// More than 1 "@" symbol found...
		blnReturn = false;
	}
	else if (intDotLoc == -1)
	{
		// Ensure the last "." is located after the "@"...
		blnReturn = false;
	}

	return blnReturn;
}

// AUTHOR:		Jason Noftall
// DATE:		Aug. 20, 2003
// DESCRIPTION:	Updates a hidden textfield based on a checkbox click.
// PARAMETERS:	1. chk = reference to the checkbox object
//				2. txtfield = reference to the hidden textrfield to update.
//				3. onvalue = string representing the "checked" value.
//				4. offvalue = string representing the "not checked" value.
// RETURNS:		<void>
function SetHiddenWithCheckbox(chk, txtfield, onvalue, offvalue)
{
	if (chk.checked)
	{
		// Checked value...
		txtfield.value = onvalue;
	}
	else
	{
		// Not Checked value...
		txtfield.value = offvalue;
	}
}

// AUTHOR:		Jason Noftall
// DATE:		Aug. 21, 2003
// DESCRIPTION:	Replaces a specified character with one (or more) character(s).
// PARAMETERS:	1. strOriginal = original string containing characters to replace.
//				2. strChar = character being sought.
//				3. strReplace = character(s) to replace occurences of "strChar" with.
// RETURNS:		string, original string with all occurences of "strChar" replaced with "strReplace".
function replaceChar(strOriginal, strChar, strReplace)
{
	return strOriginal.split(strChar).join(strReplace);
}

// <summary>
// Displays a url in a popup window.
// </summary>
// <param name="url">string, url to display in the window.</param>
// <param name="handleName">string, a handle name to assign to the window.</param>
// <param name="height">int, height (in pixels) of the window.</param>
// <param name="width">int, width (in pixels) of the window.</param>
// <param name="appearance">string, window's options, i.e. scrollbars, etc.  If this value isn't specified, default options are used.</param>
function PopupWindow(url, handleName, height, width, appearance)
{
	// If "appearance" hasn't been defined, use the default one below...
	if (typeof(appearance) == "undefined")
	{
		appearance = "scrollbars=yes,status=no,toolbar=no,menubar=no,resizable=yes";
	}

	// Pop up a window...
	var win = window.open(url, handleName, "width=" + width + ",height=" + height + "," + appearance);
	win.window.focus();
}

// <summary>
// Builds either an <img> or <a> element based on file extension.
// </summary>
// <param name="fileName" type="string">The filename for which to build an HTML element for.</param>
// <returns type="string">A fully-qualified <img> or <a> element based on specified file extension.</returns>
function GetHtmlElementFromFile(fileName)
{
	// Get the location of the last "." (if present)...
	var token = fileName.lastIndexOf(".");
	var htmlElement;

	// Was a "." found?
	if (token != -1)
	{
		// Parse the filename at the last "."...
		var extension = fileName.substring(token + 1).toLowerCase();
		switch (extension)
		{
			// Images...
			case "jpg":
			case "jpeg":
			case "gif":
			case "png":
			case "bmp":
			{
				htmlElement = "<img src=\"" + fileName + "\" border=\"0\" />";
				break;
			}
			// All other file types...
			default:
			{
				htmlElement = "<a href=\"" + fileName + "\">" + fileName + "</a>";
				break;
			}
		} // switch (extension)
	}
	else
	{
		// No file extension found, assume it is a file.
		htmlElement = "<a href=\"" + fileName + "\">" + fileName + "</a>";
	}

	return htmlElement;
}

// <summary>
// Parses an Internal Link string (generated in FreeTextBox)
// and just returns the last item following separator (if present).
// </summary>
// <param name="internalLinkTitle" type="string">The fully qualified internal link string (i.e parent/child/grandchild names).</param>
// <param name="separator" type="string">The separator of each item.</param>
// <returns type="string">The last page name (following the separator).</returns>
function GetLastPageName(internalLinkTitle, separator)
{
	// Get the location of the last separator (if present)...
	var token = internalLinkTitle.lastIndexOf(separator);

	// Was a separator found?
	if (token != -1)
	{
		// Parse the page name at the last separator...
		return trimString(internalLinkTitle.substring(token + 1));
	}
	else
	{
		// Separator not found, return original string...
		return trimString(internalLinkTitle);
	}
}

// <summary>
// Depending on browser type, displays either the Printer dialog or
// and alert instructing the user how to display the Printer dialog.
// </summary>
function printThisPage()
{
	var browserName = navigator.appName;
	if (window.print)
	{
		window.print();
	}
	else if (browserName.indexOf("mac") != -1)
	{
		alert("To print this page, press Command-P.");
	}
	else
	{
		alert("To print this page press Control-P.")
	}
}

function fncViewCommentResults(cid)
{
	var arrt;	
	window.open('CommentDet.aspx?cid=' + cid, 'CommentResults', 'width=400,height=300');	
}
function fncViewPollResults2(qid)
{
	var arrt;	
	window.open('ViewPollResults.aspx?qid=' + qid, 'PollResults', 'width=200,height=200');	
}

function fncViewPollResults()
{
	var arrt;
	var i;
	arrt = document.getElementById("divPollQuest").getElementsByTagName("input");
	for(i=0;i<=arrt.length-1;i++)
	{
		if(arrt[i].type=="radio" && arrt[i].checked == true)
		{
		window.open('ViewPollResults.aspx?qid=' + arrt[i].value, 'PollResults', 'width=200,height=200');
		}	
	}
}

function fncDeActivate()
{
	var i;
	i = window.confirm('Are you sure you want to de-activate?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncApprove()
{
	var i;
	i = window.confirm('Are you sure you want to Approve?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncDisApprove()
{
	var i;
	i = window.confirm('Are you sure you want to Disapprove?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncDelete()
{
	var i;
	i = window.confirm('Are you sure you want to Delete?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncActivate()
{
	var i;
	i = window.confirm('Are you sure you want to Activate?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncReStartPoll()
{
	var i;
	i = window.confirm('Are you sure you want to Restart this poll?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncResetPoll()
{
	var i;
	i = window.confirm('Are you sure you want to reset this poll results?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncDeletePoll()
{
	var i;
	i = window.confirm('Are you sure you want to delete this poll?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncResetComments()
{
	document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtComment').value = '';
	document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtFName').value = '';
	document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtLName').value = '';
	document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtCity').value = '';
	document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtEmail').value = '';
	document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtCompany').value = '';
}

function fncValComments()
{
	if (document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtComment').value.length == 0)
	{
		alert('Comments is required');
		document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtComment').focus();
		return false;
	}
	if (document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtFName').value.length == 0)
	{
		alert('First name is required');
		document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtFName').focus();
		return false;
	}
	if (document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtLName').value.length == 0)
	{
		alert('Last Name is required');
		document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtLName').focus();
		return false;
	}
	if (document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtCity').value.length == 0)
	{
		alert('City is required');
		document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtCity').focus();
		return false;
	}
	
	if (document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtEmail').value.length == 0)
	{
		alert('Email Address is required');
		document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtEmail').focus();
		return false;
	}
	if (document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtImgCode').value.length == 0)
	{
		alert('Please enter the verification code');
		document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtImgCode').focus();
		return false;
	}
	if (validateEmail(document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtEmail').value) == false)
    	{		
		document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtEmail').focus();
		return false;
    	}
	if (document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtComment').value.length > 500)
	{
		alert('Maximum characters allowed are 5000');
		document.getElementById('ctl00_RatingNComments1_ArtCommentsMain1_ArticleComments1_txtComment').focus();
		return false;
	}
}

function fncValRating()
{
	var arrt;
	var i;
	var bChecked = false;
	arrt = document.getElementById("Rating").getElementsByTagName("input");
	for(i=0;i<=arrt.length-1;i++)
	{
		if(arrt[i].type=="radio" && arrt[i].checked == true)
		{
			bChecked = true;
		}
	}
	
	if (bChecked == true)
	{
		return true;
	}
	else
	{
		alert('Please select a rating');
		return false;
	}
}

function fncUserArtComments(id)
{
	window.open('UserArtComments.aspx?Id=' + id);
}


function fncCloseUserComments()
{
	window.close();
}

function fncClose(spagelink)
{	
	var slinktext = spagelink.innerText;
	var iIndex = slinktext.lastIndexOf(">");	
	if (iIndex != -1)
	{
		slinktext = slinktext.substring(iIndex + 1);
	}
	slinktext = slinktext.trim();		
	var slink = spagelink.href;
	fncInsertLink(objEditor,slink,slinktext);
	//CuteEditor_GetEditor(objEditor).ExecCommand('PasteHTML',false,spagelink.href)";
}

function fncForArtWizard(spagelink)
{
	var slinktext = spagelink.innerText;
	var iIndex = slinktext.lastIndexOf(">");	
	if (iIndex != -1)
	{
		slinktext = slinktext.substring(iIndex + 1);
	}
	slinktext = slinktext.trim();		
	var PageID = spagelink.href;	
}

function fncGetVal(PageId, PageHeader)
{	
	var iStartIndex = PageId.lastIndexOf("/",PageId.length - 1);
	var PageId = PageId.substring(iStartIndex + 1);	
	iStartIndex = PageHeader.lastIndexOf(">",PageHeader.length - 1);
	if (iStartIndex != -1)
	{
		PageHeader = PageHeader.substring(iStartIndex + 2);
	}	
	document.getElementById('ArticleWizard1_PageHeader').value = PageHeader;
	document.getElementById('ArticleWizard1_PageID').value = PageId;
	Form1.submit();
}

function fncOpenLinkPopUp()
{
	window.open('PageLinksForSyn.aspx','pagelinkSyn','status=yes,location=no,resizable=yes,menubar=no,toolbar=no,scrollbars=yes,width=450,height=600');
	return false;
}

var objEditor;
function fncOpenLink(objEditor1)
{
	objEditor = objEditor1;	
	window.open('PageLinks.aspx','pagelink','status=yes,location=no,resizable=yes,menubar=no,toolbar=no,scrollbars=yes,width=450,height=600');
}

String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function fncPauseAd()
{
	var i;
	i = window.confirm('Are you sure you want to Pause this Ad?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncStartAd()
{
	var i;
	i = window.confirm('Are you sure you want to Start this Ad?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncStopAd()
{
	var i;
	i = window.confirm('Are you sure you want to Stop this Ad?');
	if(i==true)
	{
	return true;
	}
	else
	{
	return false;
	}
}

function fncEdit(lblName,txtName,hnlnkEditName,hlnkOKName)
    {
        if (document.getElementById(txtName).value == undefined)
            {
                document.getElementById(txtName).value = '';
            }
//        if (document.getElementById(lblName).value == undefined)
//            {
//                document.getElementById(lblName).value = '';
//            }        
        var lblContent = document.getElementById(lblName).innerText;        
        document.getElementById(txtName).value = lblContent;
        document.getElementById(lblName).style.display = 'none';
        document.getElementById(txtName).style.display = '';
        document.getElementById(hnlnkEditName).style.display = 'none';
        document.getElementById(hlnkOKName).style.display = '';        
    }
    function fncOK(lblName,txtName,hnlnkEditName,hlnkOKName)
    {
        if (document.getElementById(txtName).value == undefined)
            {
                document.getElementById(txtName).value = '';
            }        
//        if (document.getElementById(lblName).value == undefined)
//            {
//                document.getElementById(lblName).value = '';
//            }    
        var txtContent = document.getElementById(txtName).value;
        document.getElementById(lblName).innerText = txtContent;
        document.getElementById(txtName).style.display = 'none';
        document.getElementById(lblName).style.display = '';        
        document.getElementById(hnlnkEditName).style.display = '';
        document.getElementById(hlnkOKName).style.display = 'none';        
    }
    
    function fncCalcImpPercent(txtNewsSent, txtNewsOpened, lblPercent)
	{
		
	  var iNewsSent;
	  var iNewsOpened;
	  var iNewsPercent;
	  iNewsSent = 0;
	  iNewsOpened = 0;
	  iNewsPercent = 0;
		
	  //if (document.getElementById("ctl00_ctl06_txtNewsSent").value != undefined)
      //{
         iNewsSent = document.getElementById(txtNewsSent).value;
      //}
      //if (document.getElementById("ctl00_ctl06_txtNewsOpened").value != undefined)
      //{
         iNewsOpened = document.getElementById(txtNewsOpened).value;
      //}
      //if (document.getElementById("ctl00_ctl06_lblNewsPercent").value != undefined)    
      //{		
         document.getElementById(lblPercent).innerText = (iNewsOpened * 100) / iNewsSent;
         
         document.getElementById(lblPercent).innerText = document.getElementById(lblPercent).innerText + " %";
      //}
	}
	
	function fncCharCount()
    {
        var iMessLength = document.getElementById("ctl00_ctl06_Message").value.length;
        document.getElementById("txtCharCount").value = iMessLength;
    }
    
    function fncCloseWindow()
    {
		window.close();
    }
    
    function fncAddFormFields(chkName,divname)
    {	
		if (document.getElementById(chkName).checked == true)
		{
			document.getElementById(divname).style.display = '';
		}
		else
		{
			document.getElementById(divname).style.display = 'none';
		}
    }