	Photos = {
		url : 'modules/Portfolio/ajax.php',
		rootpath : '',
		saveChanges : function(form,propertyid)
		{	showLoadingDialog();
			dojo.xhrPost({ 	url: this.url,
							form: form,				
							content: {
								"dataset" 	: "photoInfo",
								"propertyid": propertyid,
								"savechanges": 1
							},
							load: function(data){ 
								dojo.xhrGet({									
									url: url,
									content:{"fetch" : "photoInfo","propertyid" : propertyid},
									handle: function(tab_data){ 
										dojo.byId("tabWindow_" + propertyid).innerHTML = tab_data;
									},							
									error:function(data){showRequestErrorBox();}
								});
								hideLoadingDialog();
							},							
							error:function(data){showRequestErrorBox();}
						 });
			return false;
		},
		deletePhoto : function(photoid,galleryid,propertyid)
		{	if	(!confirm("Do you want to delete the photo?"))
				return false;
			showLoadingDialog();
			dojo.xhrGet({	url: this.url,
							content:{"fetch": "deletephoto","propertyid": propertyid,
								"galleryid"	: galleryid,"photoid": photoid},
							load: function(data) { 
								dojo.xhrGet({								
									url: url,
									content:{"fetch" : "photoInfo","propertyid" : propertyid},
									handle: function(tab_data){dojo.byId("tabWindow_" + propertyid).innerHTML = tab_data;},							
									error:function(data){showRequestErrorBox();}
								});
								hideLoadingDialog();
							},							
							error:function(data){showRequestErrorBox();}
						 });
			return false;
		},
		//using on propertydetails page, invokes in thumscroller.js (onclick of image-anchor tags)
		showPhotoDetails : function(rootpath,photouserid,propertyid,photoid)
		{   if(!photouserid)
                {
                   loadArticleImage(photoid);
                   return;
                }
			showLoadingDialog();
			dojo.xhrGet({
						url: rootpath+'modules/Portfolio/ajax.php',
						content:{"photouserid":photouserid,"propertyid": propertyid,
							"photoid":photoid,"fetch":"showphotodetails"},
						load: function(data){
							dojo.byId('div_photodetails' ).innerHTML = data;
							hideLoadingDialog();
						},							
						error:function(data){showRequestErrorBox();}
					});
		},
		//using on propertydetails page (onclick of feature-anchor tags)
		showPhotosUnderCategory : function(rootpath,photouserid,propertyid,featureid)
		{	showLoadingDialog();
			dojo.xhrGet({
						url: rootpath+'modules/Portfolio/ajax.php',
						content:{"photouserid":photouserid,"propertyid": propertyid,
							"featureid":featureid,"fetch":"showphotoundercategory"},
						load: function(data){
							//splitting the response data and taking the main photo id from that.
							var startindex 	= data.indexOf("MAINPHOTOID::");
							var endindex 	= data.indexOf("::MAINPHOTOID");
							var mainphotoid	= data.substring(startindex+13,endindex);//extracting mainphotoid
							var newcontent = data.replace("MAINPHOTOID::"+mainphotoid+"::MAINPHOTOID","");//remove
							dojo.byId('microImagesImageRow' ).innerHTML = newcontent;
							Photos.showPhotoDetails(rootpath,photouserid,propertyid,mainphotoid);
							hideLoadingDialog();
						},							
						error:function(data){showRequestErrorBox();}
					});
		},
		//using on propertydetails page (onclick of feature-anchor tags)
		showImagesAndThumbScrollerLightBox : function(rootpath,photouserid,propertyid,defaultphotoid)
		{
			this.rootpath = rootpath;
			showLoadingDialog();
			dojo.xhrGet({
						url: rootpath+'modules/Portfolio/ajax.php',
						content:{"photouserid":photouserid,"propertyid": propertyid,
							"defaultphotoid":defaultphotoid,"fetch":"showimagelightbox"},
						load: function(data){showDialogBox('Photo Gallery',data);},							
						error:function(data){showRequestErrorBox();}
					});
		},
		//using on propertydetails-image lightbox, onclick of image-anchor tags
		showFullPhoto : function(rootpath,photouserid,propertyid,photoid)
		{	dijit.byId('dialog1').show();
			showLoadingDialog();
			dojo.xhrGet({
						url: rootpath+'modules/Portfolio/ajax.php',
						content:{"photouserid":photouserid,"propertyid": propertyid,
							"defaultphotoid":photoid,"fetch":"showimagelightbox"},
						load: function(data){showDialogBox('Photo Gallery',data);},							
						error:function(data){showRequestErrorBox();}
					});
		},
		//using on profile page - for uploading profile photo
		showUploadProfilePhotoBox : function(rootpath,uploadfor)
		{	
			this.rootpath = rootpath;
			var url = 'modules/Profile/ajax.php';
			showLoadingDialog();
			dojo.xhrGet({
						url: rootpath+url,
						content: {"operation" : "showuploadprofilephotobox", "uploadfor" : uploadfor},
						load: function(data){showDialogBox('Upload Your Profile Photo',data);},							
						error:function(data){showRequestErrorBox();}
					});
		},
		saveProfilePhoto : function (formNode,userUrl)
		{	
			showLoadingDialog();
			var rootpath = this.rootpath; 
			var url = this.rootpath+'modules/Profile/ajax.php';	
			dojo.require("dojo.io.iframe");
			dojo.io.iframe.send({
				url: url,
				form: formNode,
				method: "post",
				content: { "operation":"saveuploadprofilephoto"},
				timeoutSeconds: 300,
				preventCache: true,
				handleAs: "text/plain",
				handle: function(data){
					if ( data.match('<ul>') )
						showDialogBox('Upload Your Profile Photo',data);
					else//if the images are uploaded successfully then reload the photomanagement tab again
					{	
						gototheurl(data);
						//showing successfull message in a lightbox
						var result = '<div style="padding:5px 20px"><b><i>Image Uploaded Successfully!!</i></b><br><br><center><button style="background-color:#FFFFFF;color:#444444;padding:0px;width:98px;" type="button" onclick="hideTitleLessDialogBox();"><img src="images/ok_button.gif" width="98" height="42" alt="OK"></button></center></div>';
						showDialogBoxWithoutTitle(result);
					}
					hideLoadingDialog();
				},							
				error:function(data){showRequestErrorBox();}
			});
		}
	}


	//using in admin-groupdetails disable/enable group
	function setGroupStatus(groupid,divname) {
		if (divname == 'btnenablegroup' )
			operation = 'Enable';
		else if (divname == 'btndisablegroup' )
			operation = 'Disable';
		dojo.xhrGet({	url:'groupdetails.html',
						content: {"groupid":groupid,"operation":operation},
						load: function(data,ioargs){
							dojo.byId(divname).innerHTML = data;
							gototheurl('groupdetails.html');//just to confirm the button is working fine..
						},							
						error:function(data){showRequestErrorBox();}
					});
	}	
	
	AdminGroupDetails =
	{	url: 'modules/AdminGroupDetails/ajax.php',
		rootpath: '',
		groupid: '',
		editGroupDetails:function(rootpath,groupid,groupname,grouptype,groupmanager,url,website,phone,email,about)
		{	showLoadingDialog();
			dojo.xhrGet({	url:	rootpath+this.url,
							content: {"invitationid":invitationid,"inviteename":inviteename,
										"inviteeemail":inviteeemail,"inviteepropertycount":inviteepropertycount,
										"inviteeucredits":inviteeucredits,"operation":"editinvitation_notsent"},
							load:function(data)
							{
								//inorder to place the responsecontent to the table-row, call this
								//arguments:- responsecontent, tableid, corresponding row's id
								//the source's and destination's td count should be same
								replaceTableRowContent(data,'tblnotsent','divinvitation_notsent_'+invitationid);
								hideLoadingDialog();
							},							
							error:function(data){showRequestErrorBox();}
						});
		}
	}

	ManageGroups=
	{	url:'modules/ManageGroups/ajax.php',
		rootpath:'',
		memberid:'',
		removeMember:function (rootpath,memberid)
		{	if(!confirm("Do you really want to remove the member?"))
				return false;
			showLoadingDialog();
			this.rootpath 	=	rootpath;
			this.memberid	=	memberid;
			dojo.xhrGet({ 	url:	rootpath+this.url,
							content:{"memberid":memberid,"operation":"removemember"},
							load:function(data)
							{	hideLoadingDialog();
								gototheurl('managegroups.html');
							},							
							error:function(data){showRequestErrorBox();}
						});
		},
		deleteInvitation:function (rootpath,invitationid)
		{	if(!confirm("Do you really want to delete the invitation?"))
				return false;
			showLoadingDialog();
			this.rootpath 		=	rootpath;
			this.invitationid	=	invitationid;
			dojo.xhrGet({	url:	rootpath+this.url,
							content:{"invitationid":invitationid,"operation":"denymember"},
							load:function(data)
							{	hideLoadingDialog();
								gototheurl('managegroups.html');
							},							
							error:function(data){showRequestErrorBox();}
						 });
		},
		approveInvitation:function (rootpath,invitationid)
		{	showLoadingDialog();
			this.rootpath 		=	rootpath;
			this.invitationid	=	invitationid;
			dojo.xhrGet({ 	url:	rootpath+this.url,
							content:{"invitationid":invitationid,"operation":"approvemember"},
							load:function(data)
							{	hideLoadingDialog();
								gototheurl('managegroups.html');
							},							
							error:function(data){showRequestErrorBox();}
						});
		}
	}
	
	//using in Admin-market-setup page
	MarketSetup	=	{
		url:'modules/AdminMarketSetup/ajax.php',
		rootpath:'',
		marketid:'',
		marketname:'',
		showMarketSetupBox:function (rootpath,marketid,marketname)
		{	showLoadingDialog();
			this.rootpath = rootpath;
			this.marketname = marketname;
			dojo.xhrGet({ 	url:	this.rootpath+this.url,
							content:{"marketid":marketid,"operation":"showbox"},
							load:function(data){showDialogBox(marketname,data);},							
							error:function(data){showRequestErrorBox();}
						});
		},
		//during the selection of a county-checkbox
		selectCounty:function (marketid,countyid)
		{
			showLoadingDialog();
			marketname = this.marketname;
			dojo.xhrGet({ 	url:	this.rootpath+this.url,
							content:{"marketid":marketid,"countyid":countyid,"operation":"selectcounty"},
							load:function(data)
							{	showDialogBox(marketname,data);
								dijit.byId('dialog1').closeButtonNode.onclick=function(){gototheurl('marketsetup.html');};//after clicking the close button of the dialog box the page has to go for refresh.
							},							
							error:function(data){showRequestErrorBox();}
						 });
		},
		//during the click(unselection) of a selected-county-checkbox
		unSelectCounty:function (marketid,countyid)
		{
			showLoadingDialog();
			marketname = this.marketname;
			dojo.xhrGet({	url:	this.rootpath+this.url,
							content:{"marketid":marketid,"countyid":countyid,"operation":"unselectcounty"},
							load:function(data)
							{	showDialogBox(marketname,data);
								dijit.byId('dialog1').closeButtonNode.onclick=function(){gototheurl('marketsetup.html');};//after clicking the close button of the dialog box the page has to go for refresh.
							},							
							error: function (data) {showRequestErrorBox();}
						 });
		}
	}

	//For Admin Operations subdomain
	AdminOperationsMarketSalesTracking = {
		url:'modules/AdminOperationsMarketSalesTracking/ajax.php',
		rootpath:'',brokerid:'',realtorid:'',
		getMarketSalesTrackingInfo : function(rootpath,dropdown) {
			showLoadingDialog();
			var contrl =document.getElementsByName(dropdown);
			var marketid = contrl[0][contrl[0].selectedIndex].value;
			dojo.xhrGet({	url:rootpath+this.url,
							content:{"marketid":marketid,"operation":"getmarketsalestrackinginfo"},
							load: function(data){
								dojo.byId('marketsalestracking_maindiv').innerHTML = data;
								hideLoadingDialog();
							},							
							error:function(data){showRequestErrorBox();}
						});
		}	
	}

	//Shows the Error!!! Could not complete request Box.
	function showRequestErrorBox()
	{
		var error_response 	= '<br><center><b><i>We\'re sorry, but this plugin is taking too long to load.<br> Your session expired.Please try loggin again.</i></b></center><br>';
		error_response	+= '<center><button style="background-color:#FFFFFF;color:#444444;padding:0px;width:98px;" type="button" ';
		error_response	+= 'onclick="hideTitleLessDialogBox();"><img src="images/ok_button.gif" width="98" height="42" alt="OK"></button></center>';
		hideLoadingDialog();
		showDialogBoxWithoutTitle(error_response);
	}
	function gototheurl(url) {
		window.location.href = url;
	}
	function swap (it) {
		var filename = it.src;
		switch (filename.indexOf('o.jpg')) {
			case -1:
				it.src = filename.replace('.jpg', 'o.jpg');
				break;
			default:
				it.src = filename.replace('o.jpg', '.jpg');
				break;
		}
	}
	function transfer (nameValues) {
		if (!nameValues) return;

		var form = document.createElement('form');
		form.method = 'post';

		for (varName in nameValues) {
			var input = document.createElement('input');
			input.type = 'hidden';
			input.name = varName;
			input.value = nameValues[varName];
			form.appendChild(input);
		}
		document.body.appendChild(form);
		form.submit();
	}
	function charLimit(input, limit) {
		var text = input.value;
		if (text.length > limit)
			input.value = text.substring(0, limit);
	}
	//checkbox-selectall   
	//TODO  Remove this and replace with cbxSelectall function - Prince,  22 Jan 2010
	function selectall()
	{ 
			t=document.forms[0].length;
			for(i=0; i<t; i++)
			document.forms[0][i].checked=document.forms[0][0].checked;				
	}
	
	//hide/show using in Accounting module
	function showOrHideDiv (dropdown,divname,value)
	{	
		if (dropdown.selectedIndex == value)
			document.getElementById(divname).style.display = "";
		else
			document.getElementById(divname).style.display = "none";
	}
	// generic text counter for text areas: 	
	function textCounter(field,cntfield,maxlimit) {
		if (field.value.length > maxlimit) // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
		else
			cntfield.value = maxlimit - field.value.length;
	}	
	// Auto tab for text box - phones, faxes
	function autotab(original,destination){
		 if (original.getAttribute&&original.value.length==original.getAttribute("maxlength")) 
			destination.focus();
	}
	
	//It allows only number-keys to be entered..can be used for phonenumbers, IDs, ZipCodes
	function isNumberKey(ev)
	{		
		ev || (ev = window.event);
		var charCode = (ev.keyCode ? ev.keyCode: (ev.charCode ? ev.charCode: ev.which));
		if (charCode == 37 || charCode == 39) // allow left & right arrow
			return true;		
		if (charCode > 31 && (charCode < 48 || charCode > 57))
			return false;
		return true;
	}
	//It allows only number-keys+backspace+commas+dots to be entered..can be used for currency fields
	function isNumberKeyOrCommaOrDot(ev)
	{
		var charCode = (ev.keyCode ? ev.keyCode: (ev.charCode ? ev.charCode: ev.which));
		if (charCode == 37 || charCode == 39 || charCode == 46) // allow left & right arrow, delete key
			return true;		
		if (charCode!=8 && charCode > 31 && (charCode < 44 || charCode > 57 || charCode==45 || charCode==47))
			return false;
		return true;
	}
	//Removes the commas from the text box value..can be used for currency fields
	function replaceCommas(value)
	{
		var ReplacedNumber = value.replace(/\,/g,'');
		return(ReplacedNumber); 
	}
	//Removes the leading Zeros..can be used for the zipcode textboxes.
	function replaceZeros(nForm,textbox)
	{
		nForm[textbox].value = nForm[textbox].value.replace(/^[0]+/g,"");
	}
	//uses in groupdetails page 'remove' click..
	function confirmDelete(delUrl) {
	  if (confirm("Are you sure you want to delete?")) {
		document.location = delUrl;
	  }
	}
	//shows the loading image..
	function showLoadingDialog()
	{
		document.getElementById("loadingdiv").style.display = '';
		var pageSizeArray = getPageSize();//First element is width; second is height;
		document.getElementById("loadingdiv").style.height = pageSizeArray[1]+20+"px";
		document.getElementById("loadingdivInnerDiv").style.marginLeft=screen.availWidth/2 - 400+"px";
		document.getElementById("loadingdivInnerDiv").style.marginTop=screen.availHeight/2 - 50+"px";
		var obj = document.getElementById('loadingdiv');
        obj.scrollTop = obj.scrollHeight;
		if (document.getElementById("dialog1"))//if dialog box is created already
			dijit.byId('dialog1').hide();		
	}	
	function hideLoadingDialog()
	{
		document.getElementById("loadingdiv").style.display = 'none';
	}
	//shows the main dialog box, and hides the loading dialog box
	function showDialogBox(title,data)
	{
		dojo.require("dijit.Dialog");
		if (!dijit.byId('dialog1'))
		{
			var dialog1=new dijit.Dialog({ widgetId:"dialog1", id:"dialog1", loadingMessage:"Loading..."});
			dialog1.startup();
		}
		dijit.byId('dialog1').setContent(data);
		dijit.byId('dialog1').titleNode.innerHTML = title;
		dijit.byId('dialog1').closeButtonNode.onclick=function(){dijit.byId("dialog1").setContent("");dijit.byId("dialog1").hide();dijit.byId("dialog1").destroy();};
		dijit.byId('dialog1').show();
		hideLoadingDialog();
	}
	//closes the main dialog box upon clicking the cancel button
	function closeDialogBox()
	{
		dijit.byId("dialog1").setContent("");
		dijit.byId("dialog1").hide();
		dijit.byId("dialog1").destroy();
	}
	//shows the main dialog box, and hides the loading dialog box
	function showDialogBoxWithoutTitle(data)
	{
		dojo.require("dijit.Dialog");
		if (!dijit.byId('title_less_dialog'))
		{
			var title_less_dialog=new dijit.Dialog({ widgetId:"title_less_dialog", id:"title_less_dialog", loadingMessage:"Loading..."});
			title_less_dialog.startup();
		}
		dijit.byId("title_less_dialog").setContent(data);
		dijit.byId('title_less_dialog').titleBar.style.display = 'none';
		dijit.byId("title_less_dialog").show();
		hideLoadingDialog();
	}
	function hideDialogBox()//hides the main dialog box
	{
		dijit.byId('dialog1').hide();
	}
	function hideTitleLessDialogBox()//hides the title less dialog
	{
		dijit.byId('title_less_dialog').hide();
	}
	function getFlashMovieObject(movieName)
	{
	  if (window.document[movieName]) 
	  {
		  return window.document[movieName];
	  }
	  if (navigator.appName.indexOf("Microsoft Internet")==-1)
	  {
		if (document.embeds && document.embeds[movieName])
		  return document.embeds[movieName]; 
	  }
	  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	  {
		return document.getElementById(movieName);
	  }
	  // swLiveConnect="true
	}
	//inorder to place a string(contains <td></td>s alone) to the table-row, call this
	//arguments:- responsecontent, tableid, corresponding row's id
	//the count of <td> should be same in both destination and source
	function replaceTableRowContent(data,tableid,tablerowid)
	{
		//fetching the rows from the destination table
		var rows=document.getElementById(tableid).rows;
		
		//looping thru each row..
		for(i=0;i<rows.length;i++)
		{
			//checking the id of <tr> (is the same row?)
			if(rows[i].id==tablerowid)//if the same row is found
			{
				//taking all the td of the row (destination)
				var cells =	rows[i].cells;
				
				//splitting the source content's data using <td,
				//inorder to get every <td> element
				//splits by using '<td' (have to consider various style attributes of td)
				var sourcetd	=	data.split('<td');
				if (sourcetd == data){
					var capstd = true;sourcetd = data.split('<TD');
				}
				//slicing the resultant array to remove extra elements
				//(here avoiding the first element)
				sourcetd = sourcetd.slice(1,sourcetd.length);
				//if source is empty, make the destination tds' as void
				if (sourcetd == '') {
					for(j=0;j<cells.length;j++) {
						//emptying destination tds' content
						cells[j].innerHTML	=	'';
					}//for each td
				}//if source is empty
				//looping both the cells(destination's) array & the sourcetd (source's) array
				for(j=0;j<sourcetd.length;j++)
				{
					//replace destination's td content with source's td content
					
					//below are the steps taken to remove the style attributes of td,if any
					var index = sourcetd[j].indexOf(">");//got the position of '>'
					var startingsubstr=sourcetd[j].substring(0,index+1);//string till '>'
					newtabledata = sourcetd[j].replace(startingsubstr,"");//removing scraps till '>'
					
					//removes the </td> and places the content to the destination
					newtabledata	=	newtabledata.replace('</td>','');//removing </td>
					if (capstd){newtabledata	=	newtabledata.replace('</TD>','');}
					cells[j].innerHTML	=	newtabledata;
					
				}//<td> for loop
			}//if rowid check
		
		}//<tr> for loop
	}
	//Returns the page height and width
	function getPageSize()
	{
		if( window.innerHeight && window.scrollMaxY ) // Firefox 
		{
			var pageWidth = window.innerWidth + window.scrollMaxX;
			var pageHeight = window.innerHeight + window.scrollMaxY;
		}
		else if( document.body.scrollHeight > document.body.offsetHeight ) // all but Explorer Mac
		{
			var pageWidth = document.body.scrollWidth;
			var pageHeight = document.body.scrollHeight;
		}
		else // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		{	
			var pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
			var pageHeight = document.body.offsetHeight + document.body.offsetTop; 
		}
		var pageSizeArray = new Array(pageWidth,pageHeight);
		return pageSizeArray;
	}

    function loadArticleImage(photourl)
    {
        showLoadingDialog();
        document.getElementById('div_photodetails' ).innerHTML = '<a href="'+ photourl +'" target="_blank"><img src="'+ photourl +'" style="margin-bottom: 10px;" alt="main130.jpg"/> </a>';
        hideLoadingDialog();
    }
	//optimized method to use dojo GET
	function sendRequest(url, content, function_content, showloadingoverlay)
	{
		if ('delete_operation' in content)
			if (!confirm('Do you really want to delete this?'))
				return false;
		if(!showloadingoverlay)
			showLoadingDialog();
		for(var content_element in content) { 
			if (content_element=="operation")
			{	var operation = content[content_element];
				switch(operation)
				{
					case 'adminsystememail_showeditableemailofcategory':
						var emailid = content['emailid'];
						dojo.require('dijit.Editor');
						dojo.require("dijit._editor.plugins.FontChoice");  // 'fontName','fontSize','formatBlock'
  						dojo.require("dijit._editor.plugins.TextColor");
						dojo.require("dijit._editor.plugins.LinkDialog");
						dojo.require("dijit._editor.plugins.AlwaysShowToolbar");
						//dojo.require("dijit._editor.plugins.EnterKeyHandling");
						AdminSystemEmails.email_div_content[emailid] = document.getElementById('category_email_div_'+emailid).innerHTML;
						break;
						
					case 'adminsystememail_addnewemail':
						dojo.require('dijit.Editor');
						dojo.require("dijit._editor.plugins.FontChoice");  // 'fontName','fontSize','formatBlock'
  						dojo.require("dijit._editor.plugins.TextColor");
						dojo.require("dijit._editor.plugins.LinkDialog");
						dojo.require("dijit._editor.plugins.AlwaysShowToolbar");
						//dojo.require("dijit._editor.plugins.EnterKeyHandling");
						break;
						
					case 'adminMarketSalesTracking_insertrealtorcreatemail':
						dojo.require('dijit.Editor');
						break;
						
					case 'check_email':
						//hideLoadingDialog();
						//if(content['flag'] == 1) 
						//	dijit.byId('dialog1').show();
						break;
					case 'activate_ads':
						if	(!confirm("Activation deducts UCredits!\nDo you want to continue?"))
						{
								hideLoadingDialog();
								return false;
						}
						else
						{
							var amount = content['amount'];
							var ccid = content['ccid'];
							if(amount < 2)
							{
								var purchase = 2 - amount;
								var content='<div class="box" style="border:1px solid #99cc33;font-size:.8em;width:610px;">';
								content +='<p>Oops, you have ' +amount+ ' Ucredits right now and you need '+purchase+' more to complete this purchase !</p>';
								if(ccid != 0)
									content += '<center><button type="button" onclick=gototheurl("udollars.html") alt="Purchase Ucredit">Purchase Ucredit</button></center></div>';	
								else
									content += '<center><button type="button" onclick=gototheurl("ccprocessing.html") alt="Add Credit Card">Add Credit Card</button></center></div>';	
								showDialogBox("Purchase Ucredit",content);
								return false
							}
						}	
						break;
					case 'adminMarketSalesTracking_insertbrokercreatemail':
						dojo.require('dijit.Editor');
						break;
						
						dojo.require('dijit.Editor');
						break;
					case 'adminMarketSalesTracking_deleteproperty':
						hideLoadingDialog();
						dijit.byId('dialog1').show();
						break;
					case 'showallzipcodes':
						hideLoadingDialog();
						document.getElementById('zipcodeselector_div').innerHTML = document.getElementById('showprocessingimage').innerHTML;
						break;
					
				}//closing of switch
			}//closing of if-operation?
		}//closing of for loop
		dojo.xhrGet({
						url:url,content:content,
						load:function_content,
						error:function(data){showRequestErrorBox();}
					});
	}
	function postForm(formNode,url,content,function_content,showloadingoverlay)//optimized method to use dojo POST
	{
		if(!showloadingoverlay)
			showLoadingDialog();
		for(var content_element in content) { 
			if (content_element=="operation")
			{	var operation = content[content_element];
				switch(operation)
				{
					case 'adminsystememail_saveemailofcategory':
						var emailid = content['emailid'];
						document.getElementById('mailcontent_'+emailid).value = dijit.byId('txtareahtmlmessage_'+emailid).getValue();
						break;
				}//closing of switch
			}//closing of if-operation?
		}//closing of for loop
		dojo.xhrPost({ 	url:url,form: formNode,content:content,
						load:function_content,
						error:function(data){showRequestErrorBox();}
					});
		return false;
	}

	function postFiles(formNode,url,content,function_content,showloadingoverlay)
	{
		if(!showloadingoverlay)
			showLoadingDialog();
		for(var content_element in content) { 
			if (content_element=="operation") {	
				var operation = content[content_element];
				switch(operation) {
					default:
							break;
				}//closing of switch
			}//closing of if-operation?
		}//closing of for loop
		dojo.require("dojo.io.iframe");
		dojo.io.iframe.send({ 
						method :'post', handleAs:'text/plain', timeOutSeconds:300,
						url:url, form: formNode, content:content, preventCache: true,
						load:function_content,
						error:function(error){showRequestErrorBox();}
					});
		return false;
	}
	function selectAll(cntl, sel)//on admin-newsletter tool page; multiple ddl "Select All"
	{
		if(sel == 0)
			for(i=0;i<cntl.options.length;i++)
				cntl.options[i].selected = "true";
	}
	
	function showMessageBox (message, size)
	{
		var width = (size) ? size : 200;
		var mail_response 	= '<div style="width:'+width+'px"><br><center><b><i>'+message+'</i></b></center><br>';
		mail_response	+= '<br><center><button style="background-color:#FFFFFF;';
		mail_response	+= 'color:#444444;padding:0px;width:98px;" ';
		mail_response	+= 'type="button" onclick="hideTitleLessDialogBox();">';
		mail_response	+= '<img src="images/ok_button.gif" width="98" height="42" ';
		mail_response	+= 'alt="OK"></button></center></div>';
		showDialogBoxWithoutTitle(mail_response);
	}
	
	function urlRegExpMatch (url)
	{
		var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
		
		if(RegExp.test(url))
			return true;
		else
			return false;
	}
	function checkEmailValidation(inputvalue){	
		var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
		if(pattern.test(inputvalue)){         
			return true;   
		}else{   
			return false; 
		}
	}
	//Used in Closing Manager - Document details
	function doPlusOrMinusWipingAnimation(linkId, divId, imagePath)
	{
		showLoadingDialog();
		dojo.require("dojo.fx");
		hideLoadingDialog();
		if (dojo.byId(linkId).name == 'dowipein') {
			dojo.byId(linkId).name = 'dowipeout';
			var minusSign = '<img src="'+imagePath+'minus-sign.jpg" alt="Hide details" align="bottom" height="11">';
			dojo.byId(linkId).innerHTML = minusSign;
			dojo.fx.wipeIn({
				node: divId,
				duration: 700
			}).play();
		}
		else  {
			dojo.byId(linkId).name = 'dowipein';
			var plusSign = '<img src="'+imagePath+'plus-sign.jpg" alt="Show details" align="bottom" height="11">';
			dojo.fx.wipeOut({
				node: divId,
				duration: 700,
				onEnd: function(){
					dojo.byId(linkId).innerHTML = plusSign;
				}
			}).play();
		}
	}
	function buttonMouseOverStyle(control)
	{
		
		if(window.navigator.appName == 'Microsoft Internet Explorer')
			control.style.color == '#99cc33' ? control.style.color = '#000000' : control.style.color = '#99cc33';
		else
			control.style.color == 'rgb(153, 204, 51)' ? control.style.color = 'rgb(0, 0, 0)' : control.style.color = 'rgb(153, 204, 51)';
		   
	}
	
	function deleteConfirm(message)
	{
		if (!confirm(message))
			return false;
		else
			return true;
	}
	
	// Function to manage the ups left tab css
	// Author: Prince <incubator136@hotmail.com>
	/*function upsTabMouseOver(div, color)
	{ 
		if(div.className != 'tabSelectedOrange' && div.className != 'pianoKeySelected')
			div.className = (color != null && color=='green') ? 'tabHoverGreen' : 'tabHoverOrange';
	}
	
	function upsTabMouseOut(div)
	{
		if(div.className != 'tabSelectedOrange' && div.className != 'pianoKeySelected')
			div.className = 'tabHoverOut';	
	}
	//if(pianoKeys[i].className == 'tabSelectedOrange' || pianoKeys[i].className == 'pianoKeySelected')
	//	div.className = (color != null) ? 'pianoKeySelected' : 'tabSelectedOrange';	
	*/
	// piano key click, set the current key as selected and others as non selected
	function upsTabOnClick(div)
	{
		var initClass  = div.className;
		var pianoKeys = document.getElementById('propertyUpsLinks').getElementsByTagName('div');
		for(var i=0; i<pianoKeys.length; i++)
		{	//alert(	pianoKeys[i].className);	
			if (pianoKeys[i].className == 'smallPianoKey' || pianoKeys[i].className == 'smallPianoKeySelected') {			
				pianoKeys[i].className = 'smallPianoKey';
			} else {
				pianoKeys[i].className = '';
			}
		} 
		div.className = initClass.indexOf("mallPianoKey") > 0 ? 'smallPianoKeySelected': 'pianoKeySelected';
		//alert(	div.className);
	}
	
	//TODO selctAll function above can be replaced with this one, this is more generic
	// @Author: Prince <incubator136@hotmail.com>  Date: <22 Jan 2010>	
	// Param1: The selct all checkbox id
	// Param2: The container id, in which input controls has to be searched, ex: div, form
	function cbxSelectall(toggler, container)
	{
		chkBoxes = document.getElementById(container).getElementsByTagName('input');
		for(var i=0; i<chkBoxes.length; i++)
			if(chkBoxes[i].type == 'checkbox') {
				chkBoxes[i].checked = document.getElementById(toggler).checked;	
			}
	}

	// @param1: scrollerItem int , if multiple scrollers item number
	// @param 2 : sroll direction for left click or right click
	function doScroll(scrollerItem, dir) 
	{	
		divScroller  = document.getElementsByName('divScroller')[scrollerItem]; // images container
		imgCount     = divScroller.getElementsByTagName('img').length;	// images count in the container
		imgwidth     = parseInt( divScroller.getElementsByTagName('img')[0].width ); // get the width of one thumbnail
		varient 	 = 9 * imgCount;  // space compensaton for image borders, spacing, etc
		innerWidth   = parseInt( divScroller.style.width ) + varient;	//inner div, which is longer, most of it may be hidden
		outerWidth   = parseInt( document.getElementsByName('divScrollerContainer')[scrollerItem].style.width );		
		currentMagin = parseInt( divScroller.style.marginLeft.match(/\d+/) );	// get the current margin
		//alert('images cont:' +imgCount+ '\n imgwidth:'+ imgwidth + '\n innerWidth:' +innerWidth + '\n outerWidth:' + outerWidth);
		// Left arrow click
		if(dir == 'left') {
			maxMargin    = innerWidth - outerWidth;
			setMargin    =  currentMagin + 2*imgwidth;
			if( setMargin > maxMargin)
				setMargin = maxMargin;
		}
		
		
		// Right arrow click
		if(dir == 'right')
		{ 
			//alert( 'currentMagin:' + currentMagin+ '\n varient' + varient);
			if( currentMagin <= varient )
				setMargin = 0;
			else 
				setMargin = currentMagin - 2*imgwidth;		
		}
		//alert(setMargin);
		//alert(divScroller.style.marginLeft);
		divScroller.style.marginLeft = -setMargin+'px';	// set the new margin
		//alert(divScroller.style.marginLeft);
	}	
	
	function showUpsVideoLightbox()
	{
		var video  = '<embed src="http://www.youtube.com/v/R70ndjVjKGs&hl=en_US&fs=1&" '
		    video += 'type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" '
			video += 'width="581" height="340"></embed>';
		showDialogBox('Watch Uvestor Productivity Suite Video!!!', video);
	}
	
	function showProductFeatures(feature, imgSrc)
	{		
		var html  = '<img src="images/'+ imgSrc+'" alt="'+feature+'" width="960" height="610" />';
		showDialogBox('Product Features - '+feature, html);
	}

	// MAIN TAB - Mouse over event
	function mainNavMouseOver(control, imgName)
	{ 
		var currentSrc	= control.src.substring(control.src.lastIndexOf('/')+1); // get curent image name
		var hoverSrc = imgName + '_on.gif'; //  hover image name
		if(currentSrc != hoverSrc) // if not an active tab change src
		{
			control.src = control.src.replace(currentSrc, hoverSrc); // set full image path
			control.onmouseout = function () { mainNavMouseOut(control, imgName) };
			
		}
	}
	
	function mainNavMouseOut(control, imgName)
	{
		var currentSrc	= control.src.substring(control.src.lastIndexOf('/')+1); // get curent image name
		var mOutSrc 	= imgName + '_off.gif'; 
		control.src = control.src.replace(currentSrc, mOutSrc);	
	}

	// For showing the vendor request proof gallery
	function showProofPhoto(ajax_url, propertyId, vendorReqId, proofType)
	{
		sendRequest(ajax_url, {'operation':'showProofPhoto', 'propertyId':propertyId, 'vendorReqId':vendorReqId, 'proofType':proofType}, 					
			function(data){showDialogBox('Proof photos ' + proofType, data); hideLoadingDialog();});
	}	

	//The following twofucntions addAnotherItem() and  showPriceTotal(controlName, controlName2) 
	//is used for Create Invoice form. Code previously in profile template file
	//Moved by Sreekar on April 1 2010
	function addAnotherItem(items)
	{
		var categoryItems = items.split(',');
		var html = '';
		html  = '<table cellpadding="0" cellspacing="0" width="100%" class="tableLines">';
		html += '<tr>';
		html += '<td width="60">Item Type:</td>';
		html += '<td width="50">';
		html += '<select name="ddlRepairItem[]">';
		for(var i = 0; i < categoryItems.length ; i++)
			html += '<option value='+ i +'>'+ categoryItems[i] +'</option>';
		html += '</select>';
		html += '</td>';
		html += '<td width="60">Item Description:</td>';
		html += '<td width="270"><input type="text" name="txtItemDescription[]" value=""  style="width:270px;" /></td>';
		html += '<td width="40">&nbsp; Price:</td>';
		html += '<td>$<input type="text" name="txtPrice[]" style="width:50px;" ';
		html += 'onkeypress="return isNumberKeyOrCommaOrDot(event);" '; 
		html += 'onkeyup="showPriceTotal(this.name, \'txtTaxDue\');"  ';
		html += 'onchange="this.value=replaceCommas(this.value);showPriceTotal(this.name, \'txtTaxDue\');"';
		html += 'onblur="if(!parseInt(this.value)){this.value=\'\';}" /></td>';
		html += '</tr>';
		html += '</table>';
		var newDiv = document.createElement('div');
		newDiv.innerHTML = html;
		document.getElementById('divAddExtraBidItem').appendChild(newDiv);	
		var textboxes = document.getElementsByName('txtItemDescription[]');
		textboxes[textboxes.length-1].focus();	// set focus to the new text box
	}
	
	// calculate the sum of input fields with same name
	// param: input name
	function showPriceTotal(controlName, controlName2)
	{//alert(document.getElementsByName(controlName).length+ ' --- '+ document.getElementById(controlName2).value);
		var total = 0;
		var priceInputs = document.getElementsByName(controlName);
		for(x=0; x < priceInputs.length; x++ ) {
			if(priceInputs[x].value != 0)
			total = eval(total) + eval(priceInputs[x].value.replace(/^[0]+/g,'').replace(/\,/g,''));
		}
		if( document.getElementById(controlName2).value > 0 )
			total = eval(total) + eval(document.getElementById(controlName2).value.replace(/^[0]+/g,'').replace(/\,/g,''));
		document.getElementById('showTotal').innerHTML = total.toFixed(2);
	}
	
	function toggleDisplay(showControl, hideControl)
	{
		if (showControl)
			document.getElementById(showControl).style.display = '';
		if (hideControl)
			document.getElementById(hideControl).style.display = 'none';
	}
	/*editCustomField
	* called in UpsDefaultPortFolioView Class while editing custom data bloack field
	* id =>  id in 
	*/
	function editCustomField(id, fieldname)
	{
		document.getElementById('customDataField_txtbx').value = fieldname;
		document.getElementById('edit_add_customField_txtbx').value = "edit";
		document.getElementById('add_edit_customField_span').innerHTML = "Save";
		document.getElementById('customFieldId_txtbx').value = id;
	}
	//general wipein or wipeout animation
	function doWipeInOrOut(id, linkId, parentContainer, newContainer, ajaxurl, content, linkContentAfterWipeIn, linkContentAfterWipeOut)
	{  
		//showLoadingDialog();
		dojo.require('dojo.fx'); 
		//hideLoadingDialog();
						
		function1 = function(data){
			dojo.byId(newContainer+id).innerHTML=data;
			dojo.parser.parse(newContainer+id);
			//hideLoadingDialog();
		};	
			
		if (parentContainer == 'divToolBar') {
			if (content.operation == 'showAddPropertyBox') { 
				dojo.byId(newContainer).className = "main_outer_box sel";
			} else {
				dojo.byId(newContainer).className = "box notice";
			}
			if (content.propertyId == '') {
				document.getElementById('hdnCurrentAjaxUrl').value = ajaxurl;
				document.getElementById('hdnCurrentOperation').value = content.operation;
				document.getElementById('hdnCurrentFrom').value =  content.from;
			}
			var ctrl = document.getElementById('hdnCurrentUpsId');
			content.upsModuleId = ctrl ? ctrl.value : '';
			dojo.require('dijit.form.DateTextBox');
			var lnkTabs = document.getElementById('divToolBar').getElementsByTagName('a');
			for (lnk = 0; lnk < lnkTabs.length; lnk++) {
				if (lnkTabs[lnk].name == 'dowipeout' && lnkTabs[lnk].id != linkId) {
					lnkTabs[lnk].name = 'dowipein';				
					break;						
				}
			}
		}
		/*if (parentContainer == 'divGroups_'+id) { 
			if (dojo.byId(linkId).innerHTML == 'Collapse') { 
				dojo.byId(linkId).style.color = '#99CC33';
			} else {
				dojo.byId(linkId).style.color = '#808080';
			}
		}*/
		if (dojo.byId(linkId).name == 'dowipein') {
			 dojo.byId(newContainer+id).style.display='';
			 dojo.byId(linkId).name = 'dowipeout'; 
			 if(linkContentAfterWipeIn)
			 	dojo.byId(linkId).innerHTML = linkContentAfterWipeIn; 
			 if (parentContainer == 'divGroups_'+id) { 
				 dojo.byId(linkId).style.color = '#808080';
			 }
			 if (newContainer == 'tdShowcontactDetails_') {
				 dojo.byId(newContainer+id).className = 'contactDisplay';
			 }
			 sendRequest(ajaxurl, content, function1, 1);
			 dojo.fx.wipeIn({ node : newContainer+id, duration : 700}).play(); 
		} else {
			 dojo.byId(linkId).name = 'dowipein'; 
			 if(linkContentAfterWipeOut)
				 dojo.byId(linkId).innerHTML = linkContentAfterWipeOut;
			 if (parentContainer == 'divGroups_'+id) {
			 	dojo.byId(linkId).style.color = '#99CC33';
			 }
			 dojo.fx.wipeOut({ node : newContainer+id, duration : 700, onEnd:function (){dojo.byId(newContainer+id).style.display='none';}}).play();
		}
	}
	
	// related to setPropertyId_UpsModuleId function
	function onPropertyChange(propertyId)
	{
		document.getElementById('hdnPropertyId').value = propertyId;
		ajaxurl    = document.getElementById('hdnCurrentAjaxUrl').value;
		operation  = document.getElementById('hdnCurrentOperation').value;
		from	   = document.getElementById('hdnCurrentFrom').value;	
		content    = {'operation':operation, 'propertyId':propertyId, 'from':from};
		function1 = function(data){
			dojo.byId('divToolBarOutput').innerHTML = data;
			dojo.parser.parse('divToolBarOutput');
		};		
		sendRequest(ajaxurl, content, function1, 1);
	}
	
	// related to setPropertyId_UpsModuleId function
	function onUpsModuleChange(url, upsModuleId, propertyId, tool)
	{
		document.getElementById('hdnupsModuleId').value = upsModuleId;
		if (tool == 'task' || tool == 'newtask') { 
			content = {'operation':'upsmodule_addTodoTask', 'upsModuleId': upsModuleId, 'propertyId':propertyId, 'from' : tool};
			afterFn = function(data){	
						dojo.byId('divToolBarOutput').innerHTML = data;
						dojo.parser.parse('divToolBarOutput');
						}; 
			sendRequest(url, content, afterFn, 1);	
		} else if (tool == 'doc') { 
			content = {'operation':'show_datafield_documentuploadbox', 'upsModuleId': upsModuleId, 'propertyId':propertyId, 'from':'tool'};
			afterFn = function(data){	
						dojo.byId('divToolBarOutput').innerHTML = data;
						dojo.parser.parse('divToolBarOutput');
						}; 
			sendRequest(url, content, afterFn, 1);	
		}
	}
	
	// surround a string with li to format display
	function addLi(str)
	{
		return '<li>' + str + '</li>';	
	}
	
	// JS validation display
	function showErrors(errors) {
		var html = '<div class="notice"><ul>' + errors + '</ul></div>';
		return html;
	}

	// Clear the value of the input control, if it contains non int
	function clearString(ctrl)
	{
		if (!parseInt(ctrl.value) && parseInt(ctrl.value)!= '0') 
		{
			ctrl.value='';
		}
	}
	
	//checks a form for any inputs(data) entered
	function checkFormContainsData(form)
	{
		for (var i = 0; i<form.elements.length; i++) { 
			if (form.elements[i].type == 'text' && form.elements[i].value)
				return true;
			if (form.elements[i].type == 'select-one' && form.elements[i].value != '')
				return true;	
			if (form.elements[i].type == 'checkbox' && form.elements[i].checked)
				return true;	
			if (form.elements[i].type == 'radio' && form.elements[i].checked)
				return true;	
			if (form.elements[i].type == 'file' && form.elements[i].value)
				return true;	
		}
		return false;
	}

	function addAnotherWorkOrderItem(items)
	{
		var categoryItems = items.split(',');
		var html = '';
		html  = '<table cellpadding="0" cellspacing="0" width="100%">';
		html += '<tr>';
		html += '<th>Item:</td>';
		html += '<td>';
		html += '<select name="ddlRepairItem[]">';
		for (var i = 0; i < categoryItems.length ; i++) {
		   html += '<option value='+ i +'>'+ categoryItems[i] +'</option>';
		}
		html += '</select>';
		html += '</td>';
		html += '</tr>';
		html += '<tr>';
		html += '<th>Description:</th>';
		html += '<td><textarea cols="65" rows="2" name="taVendorRequestDesc[]" value=""></textarea></td>';
		html += '</tr>';
		html += '<tr>';
		html += '<th>Date:</th>';
		html += '<td><input type="text" style="height:19px;width:100px;" name="vendorRequestDate[]" dojoType="dijit.form.DateTextBox" /> ';
		html += '</td>';
		html += '</tr>';
		html += '<tr>';
		html += '<th>Set Price:</th>';
		html += '<td><input type="text" name="txtPrice[]" />';
		html += '</td>';
		html += '</tr>';
		html += '<tr>';
		html += '<th style="padding-right:28px;">Proof of Work:</th>';
		html += '<td><input style="width:50px;" type="text" name="txtBefore[]" /> Before<input style="width:50px;" type="text" name="txtAction[]" /> Action<input style="width:50px;" type="text" name="txtAfter[]" /> After';
		html += '</td>';
		html += '</tr>';
		html += '</table>';
		var textareas = document.getElementsByName('taVendorRequestDesc[]');
		var itemCount = textareas.length;
		var itemDiv   = 'divNewWorkOrder'+itemCount;
		var mainDiv   = 'divAddExtraVendorRequestItem';
		html += '<center>';
		html += '<button style="background:none;color:#99cc33" type="button" name="btnCancel" ';
		html += 'onclick="document.getElementById(\''+mainDiv+'\').removeChild(document.getElementById(\''+itemDiv+'\'));">Remove Item</button></center>';
		var newDiv = document.createElement('div');
		newDiv.setAttribute('id', 'divNewWorkOrder'+itemCount);
		newDiv.innerHTML = html;
		document.getElementById('divAddExtraVendorRequestItem').appendChild(newDiv);	
		dojo.parser.parse('divAddExtraVendorRequestItem');
		var textareas = document.getElementsByName('taVendorRequestDesc[]');
		textareas[textareas.length-1].focus();	// set focus to the new text area
	}
	
	function addAnotherBidItem(items)
	{
		var categoryItems = items.split(',');
		var html = '';
		html  = '<table cellpadding="0" cellspacing="0" width="100%">';
		html += '<tr>';
		html += '<th style="padding-right:80px;">Item:</th>';
		html += '<td>';
		html += '<select name="ddlRepairItem[]">';
		for(var i = 0; i < categoryItems.length ; i++)
		   html += '<option value='+ i +'>'+ categoryItems[i] +'</option>';
		html += '</select>';
		html += '</td>';
		html += '</tr>';
		html += '<tr>';
		html += '<th>Description:</th>';
		html += '<td><textarea cols="65" rows="2" name="taBidRequestDesc[]" value=""></textarea></td>';
		html += '</tr>';
		html += '</table>';
		
		var textareas = document.getElementsByName('taBidRequestDesc[]');
		var itemCount = textareas.length;
		var itemDiv   = 'divNewBidRequest'+itemCount;
		var mainDiv   = 'divAddExtraBidRequestItem';
		html += '<center>';
		html += '<button style="background:none;color:#99cc33" type="button" name="btnCancel" ';
		html += 'onclick="document.getElementById(\''+mainDiv+'\').removeChild(document.getElementById(\''+itemDiv+'\'));">Remove Item</button></center>';
		var newDiv = document.createElement('div');	
		newDiv.setAttribute('id', 'divNewBidRequest'+itemCount);
		newDiv.innerHTML = html;
		document.getElementById('divAddExtraBidRequestItem').appendChild(newDiv);	
		dojo.parser.parse('divAddExtraBidRequestItem');
		textareas[textareas.length-1].focus();	// set focus to the new text area
	}
	
	function checkToDoTask(frmNode, url)
	{
		var str = '';
		if (dojo.byId('hdnupsModuleId') && dojo.byId('hdnupsModuleId').value=='') { 
			str = addLi('Select any usp module');
		}
		if (dojo.byId('txttaskname') && dojo.byId('txttaskname').value=='') {
			str +=addLi('Every task must have a title');
		} 
		if (dojo.byId('ddlMembers').selectedIndex == 0) {
			str +=addLi('Select responsible person');
		} 
		if(str != '') {
			dojo.byId('divErrors').innerHTML = showErrors(str);
			return false;
		} 		
		var fromPage	= dojo.byId('hdnPageType').value;
		var upsModuleId	= dojo.byId('hdnupsModuleId').value;
		var propertyId  = dojo.byId('hdnPropertyId').value
		addTaskSaveContent	= {'operation':'upsmodule_saveTodoTask', 'fromPage':fromPage};			
		addTaskSaveFunction	= function(data) {
			var container	= 'propertydetails'; /*'show_tasks_workoder_bid_div';*/
			if (dojo.byId('hdnPageType').value == 'myhome') {
				container = 'divControlPanel';	
				//dojo.byId(container).innerHTML=data;
			}
			dojo.byId(container).innerHTML=data;
			// select the tab
			if (dojo.byId('divPianoUpsModule_'+upsModuleId)) {
				document.getElementById('hdnCurrentUpsId').value = upsModuleId;
				dojo.byId('divPianoUpsModule_'+upsModuleId).className = 'pianoKeySelected';
				dojo.byId('divOverview').className = '';
			}
			dojo.byId('divToolBarOutput').style.display='none';
			hideLoadingDialog();
		} 
		return postForm(frmNode, url, addTaskSaveContent, addTaskSaveFunction);
	}
	function showComposeUmail(url)
	{				
		function umailAjaxDataHandler(data){document.getElementById('divComposeEmail').innerHTML = data;};
		sendRequest(url, {'operation':'showComposeUmail'}, function(data) {umailAjaxDataHandler(data);});
		hideLoadingDialog();
	}	
	// inline ajax validation for Username
	function serverValidateUvestorId(uvestorId, url)
	{
		afterFn	=	function (data){document.getElementById('showUvestorIdValidation').innerHTML = data;};
		content	=	{'operation':'validate_uvestor_id', 'uvestorId':uvestorId};
		sendRequest(url, content, afterFn, 1);
	}

	// inline ajax validation fr email
	function serverValidateEmail(email, url, from)
	{ 
		if (from != 'contact') {
			afterFn	=	function (data){document.getElementById('showEmailValidation').innerHTML = data;};
		} else {
			afterFn	= 	function (data){
							var temp	= 	new Array();
							temp		= 	data.split(':::');
							document.getElementById('showEmailValidation').innerHTML = temp[0];
							if (temp[1]) { // if the userid id is returning
								 //assigimng it to hdnSearchedEmployeeId
								document.getElementById('hdnSearchedEmployeeId').value = temp[1];
								//hiding the invitation div
								document.getElementById('tdAddtoVendorDirectory').style.display = 'none';
							} else {
								document.getElementById('tdAddtoVendorDirectory').style.display = '';
							}
						};
		}
		content	=	{'operation':'validate_email', 'email':email, 'from':from};
		sendRequest(url, content, afterFn, 1);
	}
	
	// Piano click event handler
	function pianoKeyClick(sender, titleContainer, outputContainer, url, content) 
	{	
		upsTabOnClick(sender.getElementsByTagName('div')[0]);
		dojo.byId(titleContainer).innerHTML = sender.rel;
		sendRequest(url, content, function (data) {pianoKeyClick_ajaxHandler(outputContainer, data)});
	}

	// ajax output handler for piano key click
	function pianoKeyClick_ajaxHandler(outputContainer, data) 
	{
		dojo.byId(outputContainer).innerHTML = data;
		hideLoadingDialog();
	}
	// Main navgiation bar mouse over/out effects
	function onMouseOverMouseOut(tab, bgColor, textColor)
	{
		tab.parentNode.className = tab.parentNode.className == '' ? 'main_default_nav_selected' : '';
	}	
	/**
	 * used for dijit-filtering select (Company - AddEmployee)
	 * @author Haroon
	 */
	function suggestTextBoxValue (url, operation, txtBox)
	{
		var value = dojo.trim(txtBox.getDisplayedValue());
		if (value.length > 0) {
			var content = { 'operation' : operation, 'searchText' : value };
			dojo.xhrGet({
				url:url, handleAs:'json', content:content, 
				load:function(emailJson){ 
				if (emailJson){
					var itemStore = new dojo.data.ItemFileReadStore({ data: emailJson });
					txtBox.store = itemStore;
				}},
				error:function(error){console.debug(error);}
			});
		}
	}

	// Myhome- settings- change account type - if new account needs arb profile and if it not exist
	function showAddCreditCardText(domain)
	{
		document.getElementById('btnChangeAccount').disabled = true;
		var html = '<img src="images/x-bullet.gif" align="left" />You don\'t have any payment profile created.<br />';
		html += 'Click <a href="'+ domain +'/ccprocessing.html?redirect=myhome.html-tab=Account-action=changeAccount">here</a> ';
		html += 'to add a credit card and create a profile.';
		document.getElementById('divMessage').innerHTML = '<div class="notice" style="padding:10px;">' + html + '</div>';
	}	
	
	// Myhome clear the contents of the container id passed
	function clearContent(container) 
	{
		if (document.getElementById('btnChangeAccount'))
			document.getElementById('btnChangeAccount').disabled = false;
		document.getElementById(container).innerHTML = '';
	}
	function postMessageComment(parentDivId, propertyId, upsModuleId, upsBlockId, messageId, url, control) 
	{
		function postMessageCommentAjaxDataHandler(data) 
		{
			if (data.match('<div class=\'notice\'>') && data.match('<ul><li>')) {
				if(document.getElementById('spanCommentErrors')) {
					var errSpan = document.getElementById('spanCommentErrors');
					errSpan.parentNode.removeChild(errSpan);
				}
				spanTag = "<span id='spanCommentErrors' title='Invalid comment' class='requiredField'><b>*</b></span>";
				control.parentNode.innerHTML += spanTag;
			} else {
				dojo.byId(parentDivId).innerHTML = data;
			}
		}	
		content={'operation':'post_comment', 'messageId':messageId, 'propertyId':propertyId, 'upsModuleId':upsModuleId, 'upsBlockId':upsBlockId}
		return postForm(control.form, url, content, function(data) {postMessageCommentAjaxDataHandler(data);}, 1);
	}
	

/*************************************************************/