	
	function callEditor(formfield)
	{
		var QueryString = "FieldName=" + formfield.name;
		var cWidth = "width=" + screen.availWidth  + ",";
		var cHeight = "height=" + screen.availHeight + ",";
		var WindowPara = cWidth + cHeight + "menubar=no,resizable=yes,scrollbars=no,status=no,top=0,left=0";
		var WinName = "Editor" + document.getElementById("hiddenSessionID").value;
		WindowName = window.open("Editor.aspx?"+QueryString,WinName,WindowPara);
	}

	function callGraphicsSelect(formfield)
	{
		
		var edit={}
		
		var gravalue;
		
		gravalue= window.showModalDialog("SelectGraphics.aspx",formfield.value,"dialogWidth:400px;dialogHeight:200px;help:no;status:no;scroll:no;resizable:yes;")
		
		if(gravalue !="undefined" && gravalue != null)
				formfield.value=gravalue;
		
		
	}
	//4881.PRS.Add.Start
	function callStaticSelect(formfield)
	{
		var edit={}		
		var gravalue;
		
		gravalue= window.showModalDialog("SelectStaticPage.aspx",formfield.value,"dialogWidth:500px;dialogHeight:450px;help:no;status:no;scroll:yes;resizable:yes;")
		
		if(gravalue !="undefined" && gravalue != null)
				formfield.value=gravalue;
	}
	//4881.PRS.Add.End

	function showLinks(formfield)
	{
		var winfile="SelectLinks.aspx";
		var selfile = window.showModalDialog(winfile, "", "dialogWidth:600px;dialogHeight:450px;help:no;status:no;scroll:Yes;resizable:no;")

		if(selfile !="undefined" && selfile != null)
		{
			formfield.value = selfile;
		}
	}
	
	// 13389/PRS.Add.Start
	function showMenuLinks(formfield)
	{
		var winfile="SelectLinks.aspx";
		var selfile = window.showModalDialog(winfile, "", "dialogWidth:600px;dialogHeight:450px;help:no;status:no;scroll:Yes;resizable:no;")
		
		if(selfile !="undefined" && selfile != null)
		{
			document.getElementById(formfield).value = "BaseRenderer.aspx?MenuId=" + selfile;
		}
	}
	
	function showStaticPageLinks(formfield)
	{
		var winfile="SelectStaticPage.aspx";
		var selfile = window.showModalDialog(winfile, "", "dialogWidth:600px;dialogHeight:450px;help:no;status:no;scroll:Yes;resizable:no;")
		
		if(selfile !="undefined" && selfile != null)
		{
			document.getElementById(formfield).value = selfile;
		}
	}
	// 13389/PRS.Add.End
	function showTopMenu(formfield)
	{
				var winfile="SelectTopMenu.aspx";
				
				var selfile = window.showModalDialog(winfile, "", "dialogWidth:400px;dialogHeight:350px;help:no;status:no;scroll:Yes;resizable:no;")
				if(selfile !="undefined" && selfile != null)
				{
					formfield.value = selfile;
				}
	
	}
		
	function showLinkGroup(formfield)
	{
				var winfile="SelectLinkGroup.aspx";
				
				var selfile = window.showModalDialog(winfile, "","dialogWidth:400px;dialogHeight:250px;help:no;status:no;scroll:Yes;resizable:no;")
				if(selfile !="undefined" && selfile != null)
				{
					formfield.value = selfile;
				}
	
	}	

	function showColors(formfield)   
	{
		var winfile="SelectColor.aspx";
		var selfile = window.showModalDialog(winfile, "", "dialogWidth:296px;dialogHeight:253px;help:no;status:no;scroll:Yes;resizable:no;")
			
		if(selfile !="undefined" && selfile != null)
		{
			formfield.value = selfile;
		}
	}
	
	function showMenu(formfield)
	{
				var winfile="MenuListPopup.aspx";
				
				var selfile = window.showModalDialog(winfile, "","dialogWidth:400px;dialogHeight:250px;help:no;status:no;scroll:Yes;resizable:no;")
				if(selfile !="undefined" && selfile != null)
				{
					formfield.value = selfile;
				}
	
	}
	function showLeftMenuList(formfield)
	{
				var winfile="LeftMenuListPopup.aspx";
				
				var selfile = window.showModalDialog(winfile, "","dialogWidth:400px;dialogHeight:250px;help:no;status:no;scroll:Yes;resizable:no;")
				if(selfile !="undefined" && selfile != null)
				{
					formfield.value = selfile;
				}
	
	}	
	function showTopMenuItem(formfield)
	{
				var winfile="SelectTopMenuItem.aspx";
				
				var selfile = window.showModalDialog(winfile, "","dialogWidth:550px;dialogHeight:350px;help:no;status:no;scroll:Yes;resizable:no;")
				if(selfile !="undefined" && selfile != null)
				{
					formfield.value = selfile;
				}
	
	}
	function Trim(TRIM_VALUE){
		if(TRIM_VALUE.length < 1){
		return"";
		}
		TRIM_VALUE = RTrim(TRIM_VALUE);
		TRIM_VALUE = LTrim(TRIM_VALUE);
		if(TRIM_VALUE==""){
		return "";
		}
		else{
		return TRIM_VALUE;
		}
	} 

	function RTrim(VALUE)
	{
		var w_space = String.fromCharCode(32);
		var v_length = VALUE.length;
		var strTemp = "";
		if(v_length < 0){
		return"";
		}
		var iTemp = v_length -1;

		while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
		strTemp = VALUE.substring(0,iTemp +1);
		break;
		}
		iTemp = iTemp-1;

		} 
		return strTemp;

	} 

	function LTrim(VALUE)
	{
		var w_space = String.fromCharCode(32);
		if(v_length < 1){
		return"";
		}
		var v_length = VALUE.length;
		var strTemp = "";

		var iTemp = 0;

		while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
		strTemp = VALUE.substring(iTemp,v_length);
		break;
		}
		iTemp = iTemp + 1;
		} 
		return strTemp;
	} 
	
	function callSelectCategory()
	{
		var CategoryList;
		CategoryList = window.showModalDialog("SelectMultipleCategory.aspx","","dialogWidth:325px;dialogHeight:450px;help:no;status:no;scroll:no;resizable:yes;")			
		return CategoryList;
	}
	
	function EnableDisableUserType(orignator,target)
	{
		if(orignator == null)
			return;
		if(orignator.value == "No")
		{
			target.selectedIndex = -1;
			target.disabled = true;				
		}
		else
		{
			target.disabled = false;
		}
	}
	function callSelectContentItemGroup(formfield)
	{
		var ContentItemGroup = window.showModalDialog("SelectContentItemGroup.aspx","","dialogWidth:400px;dialogHeight:450px;help:no;status:no;scroll:yes;resizable:yes;");
		if(ContentItemGroup !="undefined" && ContentItemGroup != null)
			formfield.value=ContentItemGroup;
	}
	function ShowHideImageSettingsLink(AllowImageSettings,ImageAttributeLink)
	{
		if(AllowImageSettings == "Yes")
			ImageAttributeLink.style.visibility = "visible";
		else
			ImageAttributeLink.style.visibility = "hidden";
	}
	
	// 13389/PRS.Add.Start
	function ShowHideBreadCrumbSettingsLink(BreadCrumbSettings,BreadCrumbAttributeLink)
	{
		if(BreadCrumbSettings == "Yes")
			BreadCrumbAttributeLink.style.visibility = "visible";
		else
			BreadCrumbAttributeLink.style.visibility = "hidden";
	}	
	// 13389/PRS.Add.End
	
	function callOpenImageAttribute(AddContentItemForm)
	{
		var ContentType = document.getElementById("hiddenContentType");
		var QueryString = "ContentType=" + ContentType.value;
		var ContentItemGroup = window.showModalDialog("EditContentItemAttributes.aspx?"+QueryString,AddContentItemForm,"dialogWidth:650px;dialogHeight:450px;help:no;status:no;scroll:yes;resizable:yes;");		
	}

	// 11549/PRS.Add.Start
	
	// 13389/PRS.Add.Start
	function callOpenBreadCrumbAttribute(AddContentItemForm)
	{
		var ContentItem = document.getElementById("hiddenContentItem");
		var QueryString = "ContentItem=" + ContentItem.value;
		var ContentItemGroup = window.open("ManageBreadCrumb.aspx?" + QueryString,"BreadCrumbPopUp","width=750,height=500,scrollbars=yes,resizable=no");
	}
	// 13389/PRS.Add.End
	
	String.prototype.replaceAll = function(strTarget,strSubString)
	{
		var strText = this;
		var intIndexOfMatch = strText.indexOf( strTarget );
		while (intIndexOfMatch != -1)
		{
			strText = strText.replace( strTarget, strSubString )
			intIndexOfMatch = strText.indexOf( strTarget );
		}
		return( strText );
	}

	function callOpenSearchAttribute(AddContentItemForm)
	{
	
		// code to get category items
		var selectedCategoryValues = "";
		var obj = document.getElementById("CategoryType");
		var category = obj.value;
		var totalvalues = obj.length;
						
		for(var i=0; i< totalvalues ;i++)
		{
			if(obj.options(i).selected == true)
			{
				selectedCategoryValues = selectedCategoryValues + obj.options(i).value + ",";
			}
		}
		
		selectedCategoryValues = selectedCategoryValues.replaceAll("+","*Plus");
		
		var ContentType = document.getElementById("hiddenContentItem");
		var QueryString = "ContentItem=" + ContentType.value + "&CategoryName=" + selectedCategoryValues;
		var ContentItemGroup = window.open("CategorizeSearchPriority.aspx?" + QueryString,"CategorizePopUp","width=750,height=500,scrollbars=yes,resizable=no");
	}
	// 11549/PRS.Add.End
	
	function SelectBackgroundGraphics(formfield)
	{
		var edit={}
		var gravalue;
		gravalue= window.showModalDialog("SelectBackgroungGraphics.aspx",formfield.value,"dialogWidth:400px;dialogHeight:200px;help:no;status:no;scroll:no;resizable:yes;")
		if(gravalue !="undefined" && gravalue != null)
				formfield.value=gravalue;
	}

	function showContentItem(ContentTypeField,ContentItemField)
	{
		ContentType = ContentTypeField.value;
		var winfile="ListContentItem.aspx?contenttype=" + ContentType;
		var ContentItem = window.showModalDialog(winfile, "","dialogWidth:500px;dialogHeight:500px;help:no;status:no;scroll:Yes;resizable:no;")
		if(ContentItem !="undefined" && ContentItem != null)
		{
			ContentItemField.value = ContentItem;
		}
	}
	
	function CheckEditorOpen()
	{						
		if(WindowName && WindowName.open && !WindowName.closed)
		{
			WindowName.focus();
			return false;
		}
		else
		{
			return true;
		}
	}
	
	function URLEncode(plaintext)
	{
		var SAFECHARS = "0123456789" +					// Numeric
						"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
						"abcdefghijklmnopqrstuvwxyz" +
						"-_.!~*'()";					// RFC2396 Mark characters
		var HEX = "0123456789ABCDEF";

		var encoded = "";
		for (var i = 0; i < plaintext.length; i++ )
		{
			var ch = plaintext.charAt(i);
			if (ch == " ")
			{
				encoded += "+";
			}
			else if (SAFECHARS.indexOf(ch) != -1)
			{
				encoded += ch;
			}
			else
			{
				var charCode = ch.charCodeAt(0);
				if (charCode > 255)
				{
					alert( "Unicode Character '" 
							+ ch 
							+ "' cannot be encoded using standard URL encoding.\n" +
							"(URL encoding only supports 8-bit characters.)\n" +
							"A space (+) will be substituted." );
					encoded += "+";
				}
				else
				{
					encoded += "%";
					encoded += HEX.charAt((charCode >> 4) & 0xF);
					encoded += HEX.charAt(charCode & 0xF);
				}
			}
		} // for
		return encoded;
	}
	//2655/PRS.Add.Start
	function ShowRSSDialog()
	{
		//3940/PRS/Modify
		var MyWindow;
		var Attribute;
		Attribute = "top=" + (screen.availHeight - 350)/2 + ",left=" + (screen.availWidth-500)/2 +",width="+500+",height="+350+",toolbar=no,scrollbars=no"
		MyWindow = window.open('AddEditRSSFeedURL.aspx',"",Attribute);
	}
	//2655/PRS.Add.End
	//3906/PRS.Add.Start
	function ShowHideInputs()
	{
		if(document.getElementById("OpenIn").selectedIndex == 2)
		{
			document.getElementById("tdHeight").innerText = "Height :";
			document.getElementById("tdWidth").innerText = "Width :";
			document.getElementById("Height").style.display = 'block'
			document.getElementById("Width").style.display = 'block'
			document.getElementById("Height").style.visibility = 'visible'
			document.getElementById("Width").style.visibility = 'visible'
		}
		else
		{
			document.getElementById("tdHeight").innerText = "";
			document.getElementById("tdWidth").innerText = "";
			document.getElementById("Height").style.display = 'none'
			document.getElementById("Width").style.display = 'none'
			document.getElementById("Height").style.visibility = 'hidden'
			document.getElementById("Width").style.visibility = 'hidden'
			document.getElementById("Height").value = '';
			document.getElementById("Width").value = '';
		}
	}
	function ValidateNum(id)
	{
		var flag;
		var NumberValue = '';
		var control;
		var CtrlValue = document.getElementById(id).value;
		if(CtrlValue == '0')
		{
			alert('Please enter value greater then '+'0'+' for '+id);
			return ValidateMessage(id);
		}
		if(CtrlValue.length == 0)
		{
			alert('Please enter value for '+id);
			return ValidateMessage(id);
		}
		if(CtrlValue.length != 0)
		{
			for(i=0;i<CtrlValue.length;i++)
			{
				var Ascii = CtrlValue.charCodeAt(i);
				Number = new Array();
				//numeric, arrorows,backspace,delete and tab
				if((Ascii >= 48 && Ascii <= 57) || (Ascii >= 37 && Ascii <=40) || Ascii == 8 || Ascii == 46 || Ascii == 9)
				{
					Number[i] = CtrlValue.charAt(i);
					NumberValue = NumberValue + Number[i];
				}
				else
				{
					flag = 1;
				}
			}
		}
		if(flag == 1)
		{
			alert('Please enter only positive numeric value');
			//get control to set focus on it
			return ValidateMessage(id);
		}
	return true;
	}
	function ValidateMessage(id)
	{
		var control = document.getElementById(id);
		control.focus();		
		return false;
	}
	//3906/PRS.Add.End
	//3940/PRS.Add.Start
	function EnableTidbit()
	{	
		if(document.getElementById("ddlAdvertising").value == 'Yes')
		{
			document.getElementById("ddlRSSTidbit").disabled = false;
		}
		else
			document.getElementById("ddlRSSTidbit").disabled = true;
	}
	function HideRSSLink(SelectedVal)
	{
		if(SelectedVal == 1)
			document.getElementById('lblRSS').style.visibility = 'hidden';
		else
		{
			if(document.all('ddlPurpose').value == "Common Content" || document.all('ddlPurpose').value == "Error Content")
			{
				document.getElementById('lblRSS').style.visibility = 'hidden';
			}
			else
			{
				document.getElementById('lblRSS').style.visibility = 'visible';
			}
		}
	}
	//3940/PRS.Add.End
	//3949/PRS.Add.Start
	function ValidateInt()
	{
		if(event.keyCode >=48 && event.keyCode <=57 )
			event.returnValue =  true;
		else
			event.returnValue = false;
	}
	//3949/PRS.Add.End
	
	
   //Keep user from entering more than maxLength characters
   
   // Added by nshava1 on 12th Feb 2008
	function doKeypress(control){
		maxLength = control.attributes["maxLength"].value;	
		value = control.value;	
		 if(maxLength && value.length > maxLength-1){
			  event.returnValue = false;
			  maxLength = parseInt(maxLength);
		 }
	}

	// Cancel default behavior
	function doBeforePaste(control){
		maxLength = control.attributes["maxLength"].value;
		 if(maxLength)
		 {
			  event.returnValue = false;
		 }
	}
	
	// Cancel default behavior and create a new paste routine
	function doPaste(control){
		maxLength = control.attributes["maxLength"].value;
		value = control.value;
		 if(maxLength){
			  event.returnValue = false;
			  maxLength = parseInt(maxLength);
			  var oTR = control.document.selection.createRange();
			  var iInsertLength = maxLength - value.length + oTR.text.length;
			  var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
			  oTR.text = sData;
		 }
	}
	// ended by nshava1 on 12th Feb 2008
	
	// 10325.PRS.Add.Start
		function EnableCaptureFieldInfo()
		{	
			if(document.getElementById("ddlCaptureInformation").value == 'Yes')
			{
				document.getElementById("txtCaptureField").disabled = false;
			}
			else
				document.getElementById("txtCaptureField").disabled = true;
		}
	// 10325.PRS.Add.End