/********************************************************************************************
 *
 * 					            CLASS EDIT CALLOUT
 *
 ********************************************************************************************
 *
 * Edit callout is a blank popup with a title bar in which four (as of 3 April 2009) tools
 * see variable _possible_tools and edit_callout_template.php can be turned on (or embedded).
 *
 * When it comes to altering the look and feel of the callout for example embedding buttons,
 * presenting new fields and/or new tools, class edit_callout is responsible. If the tasks are
 * very application and/or emporis template specific and not tool specific, the tasks will be
 * spread to more application specific logic which will be identically named after the emporis
 * application. For example building logic will be under building.js
 *
 * WARNING: Even in the development of a new tool, this class is not meant to be used externally.
 * It is used by the edit_tool_factory which is used by editor which is used by the publisher.
 * New tool design begins with insertion of a tool template in edit_callout_template then
 * programming the publisher and editor and javascript to recognize the new tool.
 *
 *  @author Rhonda Kammer
 *
 ********************************************************************************************
 *
 * NOTES:
 * (1) Private class variables begin with underscore
 * (2) Public variables begin with "this"
 *
 ********************************************************************************************/


function edit_callout_class( url, element_id, tools_list ){

		
	/** ****** private class variables *********** */
	
	var _possible_tools 	= new Array('singleTextArea','searchPanel','tabsContainer','pinpoint', 'dropdown', 'upload'); //based on tools located in edit_callout_template.php
	var _tool_name 			= "";
	var _tool_purpose 		= "";
	var _tool_task 			= "";
	var _original_url  		= url;
	var _jq_orig_element_id = "";
	var _orig_html_id		= element_id;
	var _edit_object 		= "";		//sent through publisher url
	var _object_property 	= "";       //sent through publisher url
	var _object_id 			= "";		//sent through publisher url
	var _session_id 		= "";
	var _script_uri 		= "";
	var _tools_to_include 	= tools_list;
	var _callout_title 		= "";
 	var _callout_width		= 375;
	var _callout_height 	= 531;
	var _callout_xpos 		= "";
	var _callout_ypos 		= "";
	var _x_click_pos 		= 0;
	var _y_click_pos 		= 0;
	var _web_string_ts_0 	= "";
	var _web_string_ts_1	= "";
	var _ajax_ret 			= new Array();
	var _incoming_data		= "";
	var _nav_template		= "";
	var _nav_id				= "";	
	var _user_language 		= "";
	var _ec_iterations		= 0;
	var _ec_resized			= false;
	var _ec_dragged 		= false;
	var _web_string_eng 	= '';
	var _old_highlight_color = '';
	var _old_text_color 	= '';
	var _edit_value			= "";
	var _edit_value_source	= '';
	var _data_id			= '';
	var _label_history		= new Array();
	var _largest_callout_height = "";
	var _page_url				= document.URL;
	var _last_unix_timestamp	= 1251981166954;
	var _last_search_text		= '';
	var _input_finished			= false;
	var _edit_source_changed   	= false;
	var _html_id_propname		= '';
	var _html_id_ooid			= '';
	var _dropdown_image			= '';
	var _new_div_id 			= '';
	var _publisher_call			= '';
	var _ajax_test_url			= '';
	

	//*************************************
	//*****  constructor actions  *********
	//*************************************
	set_class_variables( url );
	dismantle_html_id();	
	
	//these (2) can only happen after vars set above
	var _webstring_html_id = '#webstring_' + _object_property + '_' + _object_id;
	var _readable_property_name = $(_webstring_html_id).html();
	//alert( "Edit callout: url: " + url );		

	//*******************************************************************
	//********************  PUBLIC METHODS  *****************************
	//*******************************************************************

	/** ************ public method MAKE EDIT CALLOUT  *************
	 * General edit callout tool in which can be embedded
	 * other tools. This is the edit callout initialising method
	 * @param data optional data input in the case that something needs
	 * 			to be retrieved prior to displaying tool
	 */
	edit_callout_class.prototype.make_edit_callout = function ( _incoming_data ){   	
		load_tool_libraries( _tools_to_include );		
		clean_callout();		
		set_callout_title();		
		set_callout_position();
		//required order: 1. fill 2. configure  3. display
		fill_callout();
		get_callout_data();
		configure_tabs();
		//TODO find out what commenting display_edit_callout fixed
		//because commenting it out breaks add building on city page.
		display_edit_callout(); //do not uncomment
		//get_callout_data();
		highlight_edit_field();
		set_cursor_focus(); //transferred to edit callout
		return true;
	};//fun mec


	/** *********** public method RESIZE EDIT CALLOUT  *************
	 * Used by other tools to resize the callout when it needs to be
	 * reduced or enlarged. Closes callout and opens with a new size.
	 * Content is not destroyed.
	 * @param height
	 * @param width
	 * @return boolean true if callout resized
	 */
	edit_callout_class.prototype.resize_edit_callout = function ( hgt, wth, item ){
		
		//alert('edit callout: resize: ' + item);
		
		if( typeof epp == 'object' && item == 'selectmenu' ){		
			if( _ec_resized == true ){				
				_callout_height = $("#editCallout_innerContainer").height() + 17;
				_callout_width = $("#editCallout_innerContainer").width() + 25;
			}else{
				_callout_height = _callout_height;
				_callout_width = _callout_width; 
			}
		}else if( typeof epp == 'object' && item == 'selectbutton' ){
			if( _ec_resized == true ){
				_callout_height = $("#editCallout_innerContainer").height() + 17;
				_callout_width = $("#editCallout_innerContainer").width() + 25;		
			}else{
				_callout_height = _callout_height;
				_callout_width = _callout_width; 
			}
		}else{								
			_callout_height = hgt;
			_callout_width  = wth;
			set_callout_position();		
		}		
		redisplay_edit_callout();
		return true;
	};


	/** ************ public method GET ADD OBJECT BUTTON
	 * used by embedded tools to make an add button
	 * I do not think this is used anymore
	 * @return string add_button_text
	 */
	edit_callout_class.prototype.get_add_object_button = function ( ){
		if( _tool_purpose == "portfolio"){ portfolio.add_object_link(); }
		return true;
	};

	edit_callout_class.prototype.embed_tabs_in_callout = function(){
		if( _tool_purpose == "portfolio" ){	portfolio.embed_tabs_in_callout(); }
	};

	edit_callout_class.prototype.get_tool_purpose = function(){
		//alert("tool purpose called!");
		return _tool_purpose;
	};


	edit_callout_class.prototype.get_edit_object = function(){
		//alert("get edit obj called");
		return _edit_object;
	};

	/** ************ public method GET JQ ORIGINAL ELEMENT ID
	 * returns the orinal input element_id with # prepended for use with
	 * jQuery functions
	 * @return string _jq_orig_element_id
	 */
	edit_callout_class.prototype.get_jq_original_element_id = function(){
		return _jq_orig_element_id;
	};

	/** *********** public method GET SCRIPT URI
	 * calls edit tool utilities function get_script_uri
	 * to parse the script uri from the original url sent by php class editor
	 * @return string script_uri
	 */
	edit_callout_class.prototype.get_script_uri = function(){		
		script_uri = get_script_uri( _original_url );
		return script_uri;
	};

	edit_callout_class.prototype.get_session_id = function(){
		return _session_id;
	};

	edit_callout_class.prototype.hide_search_in_callout = function(){
		$("#editCallout_searchPanel").css({ "display":"none" });
	};

	edit_callout_class.prototype.set_callout_title = function( title ){
		_callout_title = title;
	};

	edit_callout_class.prototype.process_tab_cancel = function(){
		$("#editCallout_innerContainer").dialog( "close" );
	};

	edit_callout_class.prototype.get_object_id = function(){
		return _object_id;
	};

	edit_callout_class.prototype.get_property_name = function(){
		return _object_property;
	};

	edit_callout_class.prototype.embed_result_in_html = function(){
		return true;
	};

	edit_callout_class.prototype.get_element_id = function(){
		return _orig_html_id;
	};

	edit_callout_class.prototype.close_edit_callout = function(){
		//alert( "edit callout close called" );
		close_edit_callout();
		return true;
	};

	edit_callout_class.prototype.get_ws_timestamp0 = function(){
		return _web_string_ts_0;
	};

	edit_callout_class.prototype.get_ws_timestamp1 = function(){
		return _web_string_ts_1;
	};

	//**************************BEGIN TAB METHODS  ***************************
	
	edit_callout_class.prototype.process_tab_save = function(){
		
		//alert( "edit callout: pro tab sv");
		
		if( _tool_purpose == "addFact" ){
			editvalue.process_tab_save();
		}
		if( _tool_purpose == "webstring" && _edit_object == "translation" ){
			translation.process_tab_save();
		}
		if( _tool_purpose == "valueEdit" ){
			editvalue.process_tab_save();			
		}
		if( _tool_purpose == "realEstate" && _object_property == "addListing" ){

			var realestate_title = $("#editCallout_tabsContainer_editTabValue1").val();
			re_url = _script_uri + '?session_id=' + encodeURIComponent(_session_id);
			re_url += '&tool_purpose=realEstate';
			re_url += '&nav_id=' + encodeURIComponent(_nav_id);
			re_url += '&object_id='
			re_url += '&pub_task=edit_callout';
			re_url += '&property_name=' + encodeURIComponent(_object_property);
			re_url += '&listing_title=' + encodeURIComponent(realestate_title);

			ajax_launcher( re_url, "", "edit_callout", "get_ajax_response" );
			//alert( "Real Estate title: " + realestate_title );
		}
		return true;
	};
	
	edit_callout_class.prototype.process_tab_delete = function(){
		if( _tool_purpose == 'valueEdit' ){
			editvalue.process_tab_delete();
		}		
	};
	
	edit_callout_class.prototype.process_history_tab_click = function(){
		if( _edit_object == 'translation' ){
			translation.get_history();
		}	
		if( _tool_purpose == 'valueEdit'){
			editvalue.get_history();	
		}
	};

	edit_callout_class.prototype.process_tab_cancel = function(){
		close_edit_callout();
		return true;
	};
	//**************************END TAB METHODS  ***************************
	
	//****************** SINGLE TEXT AREA METHODS  ********************
	edit_callout_class.prototype.process_textarea_save_click = function(){
		//alert( "edit callout: pro sin save" );
		return true;
	};

	edit_callout_class.prototype.get_nav_template = function(){
		return _nav_template;
	};

	edit_callout_class.prototype.get_ws_timestamp0 = function(){
		return _web_string_ts_0;
	};

	edit_callout_class.prototype.get__ws_timestamp1 = function(){
		return _web_string_ts_1;
	};

	edit_callout_class.prototype.set_ws_timestamp0 = function( timestamp_0 ){
		_web_string_ts_0 = timestamp_0;
		return true;
	};

	edit_callout_class.prototype.set_ws_timestamp1 = function( timestamp_1 ){
		_web_string_ts_1 = timestamp_1;
		return true;
	};

	//TODO get_ajax_response is bad name. Should be set_response_status_message()
	edit_callout_class.prototype.get_ajax_response = function( response ){
		//alert( "Edit callout: status: " + response[0].status );		
		if( response != false ){
			var message = '';

			if( response[0].status == 2 || response[0].status == 3 ){
				//alert("edit callout ajax: " + response );
				if( _tool_purpose == "realEstate" && _object_property == "addListing" ){
					url  = _script_uri + '?nav=rel_object_details&lng=3&id=' + _nav_id;
					window.location.href = url;
					return true;
				}			
			}
			if( response[0].status == 0 || response[0].status == 1 || response[0].status == 4 || response[0].status == 5 ){
				set_ajax_response_message( response );				
				return true;
			}			
		}
		return true;
	};

	edit_callout_class.prototype.get_nav_id = function( ){
		return _nav_id;
	};

	edit_callout_class.prototype.get_user_language = function( ){
		return _user_language;
	};

	edit_callout_class.prototype.refresh_page = function( response ){
		//alert( "edit callout: refresh page called!" );
		if( _tool_purpose == 'portfolio' ){
			new_url = _script_uri + '?nav=portfolio';
			//alert( "Edit callout reload page: " + new_url);
			window.location.href = new_url;
		}else{
			window.location.href = _page_url;
		}
		return true;
	};
	
	edit_callout_class.prototype.get_web_string_english = function(){
		return _web_string_eng;
	};
	
	edit_callout_class.prototype.set_ajax_response_message = function( response ){
		set_ajax_response_message( response );
		return true;
	};
	
	edit_callout_class.prototype.get_data_id = function(){
		return _data_id;
	};
	
	edit_callout_class.prototype.configure_tabs = function(){
		configure_tabs();
		return true;
	};
	
	edit_callout_class.prototype.get_largest_callout_height = function(){
		return _largest_callout_height;
	};
	
	edit_callout_class.prototype.get_readable_property_name = function(){
		return _readable_property_name;
	};
	
	edit_callout_class.prototype.get_tool_task = function(){
		return _tool_task;
	};
	
	edit_callout_class.prototype.set_tool_task = function( tool_task ){
		_tool_task = tool_task;
		return true;
	};
	
	edit_callout_class.prototype.clean_callout = function(){
		clean_callout();
		return true;
	};
	
	edit_callout_class.prototype.show_ajax_debug = function( ajax_url, ajax_response ){				
		
		var bgcolor = '';
		var count = 0;
		var debug_output = '<table border="1" bgcolor="#9EB9FF"><tr><td>Ajax call INPUT</td><td>&nbsp;</td></tr>';
		debug_output += '<tr><td><b>variable</b></td><td><b>value</b></td></tr>';
		if(!is_set(ajax_url)){
			ajax_url = _ajax_test_url;
		}
		//alert( "edit callout: url: " + _ajax_test_url );

   		var first = ajax_url.split("?");
   	//alert( "edit callout: f1: " + first[1]);
		var vars = first[1].split("&");	
		for( var i = 0; i < vars.length; i++ ){
			if( count % 2 == 0 ) bgcolor = '#D8E8FF';
			else bgcolor = '#FFFFFF';
    		var pair = vars[i].split("=");    		
    		debug_output += '<tr bgcolor="' + bgcolor + '">';
    		debug_output += '<td>' + pair[0] + '</td>';
    		debug_output += '<td>' + pair[1] + '</td>';
    		debug_output += '</tr>';
    		count++;
  		}	
		debug_output += '</table>';
		
		count = 0;
		var response_count = 0;
		debug_output += '<table border="1" bgcolor="#FFE0A8"><tr><td>Ajax call OUTPUT</td><td>&nbsp;</td></tr>';
		debug_output += '<tr><td><b>variable</b></td><td><b>value</b></td></tr>';
		
		//alert("edit callout: show debug: " + typeof ajax_response );

		$.each( ajax_response, function(){
						debug_output += '<tr><td><b>' + response_count + '</b></td><td>&nbsp;</td></tr>';
						response_count++;
						$.each(this, function(k, v){
							
							if( count % 2 == 0 ) bgcolor = '#FBFF87';
							else bgcolor = '#FFFFFF';    		   		
				    		debug_output += '<tr bgcolor="' + bgcolor + '">';
				    		debug_output += '<td>' + k + '</td>';
				    		debug_output += '<td>' + v + '</td>';
				    		debug_output += '</tr>';
				    		count++;							
					
						});
		});//each	
  			
		debug_output += '</table>';						
				
		//$('#editCallout_debugMessage').html(debug_output);
		var frog = window.open("","wildebeast","width=400,height=500,scrollbars=1,resizable=1")
		frog.document.open()
		frog.document.write(debug_output)
		
	};
			
	 edit_callout_class.prototype.set_callout_message = function( message, color ){
		$("#editTool_Message").css({ "color":color });
		$("#editTool_Message").html( message );
		return message;
	};//scm
	
	edit_callout_class.prototype.get_last_unix_timestamp = function(){		
		return _last_unix_timestamp;
	};//glut
	
	edit_callout_class.prototype.set_last_unix_timestamp = function( unix_timestamp ){
		_last_unix_timestamp = unix_timestamp;
		return true;
	};//slut
	
	edit_callout_class.prototype.get_last_search_text = function(){
		return _last_search_text;
	};//glst

	edit_callout_class.prototype.set_last_search_text = function( search_text ){
		_last_search_text = search_text;
		return true;
	};//slst
	
	/**
	 * Not used?
	 */
	edit_callout_class.prototype.get_input_finished = function(){
		return _input_finished;
	};

	edit_callout_class.prototype.get_source_changed = function(){
		return _edit_source_changed;		
	};//gsc
	
	edit_callout_class.prototype.set_source_changed = function( source_changed ){
		//alert( "edit callout: set source: " + source_changed );
		if( source_changed ){
			_edit_source_changed = true;
			$('#editCallout_tabsContainer_editTabSource1').unbind('click');
		}else{
			_edit_source_changed = false;
		}
		return true;
	};//ssc
	
	edit_callout_class.prototype.get_callout_height = function(){
		return _callout_height;
	};//gch
	
	edit_callout_class.prototype.get_callout_width = function(){
		return _callout_width;
	};//gcw
	
	edit_callout_class.prototype.refresh_multivalue = function( key, value ){
		refresh_multivalue( key, value );
		return true;
	};//rmv
	
	edit_callout_class.prototype.set_dropdown_image = function( img_text ){
	//alert('edit callout: img: ' + img_text );
		_dropdown_image = img_text;
		return true;
	};

	edit_callout_class.prototype.set_edit_value = function( edit_value ){
		_edit_value = edit_value;
		return true;
	};
	
	edit_callout_class.prototype.get_ajax_test_url = function(){		
		return _ajax_test_url;
	}
	
	// *******************************************************************
	// ********************  PRIVATE METHODS  ***************************
	// *******************************************************************

	/** ***********private function SET CLASSVARS *********************
	 * Function initialises all the class varibles based on the
	 * key/value pairs in the input url
	 *
	 * @param string url passed in by publisher
	 * @return boolean
	 * */
	function set_class_variables( url ){
		_script_uri 		= get_script_uri(url);
		_tool_name			= get_url_variable("pub_task", url);
		_tool_purpose		= get_url_variable("tool_purpose", url);
		_edit_object 		= get_url_variable("edit_object", url);
	    _object_id 			= get_url_variable("object_id", url);
	    _object_property 	= get_url_variable("property_name", url);
	    _nav_template		= get_url_variable("pub_template", url);
		_session_id 		= get_url_variable("session_id", url);
		_web_string_ts_0 	= get_url_variable("web_string_ts_0", url);
		_web_string_ts_1 	= get_url_variable("web_string_ts_1", url);
		_web_string_eng		= get_url_variable("web_string_eng", url);
		_nav_id				= get_url_variable("nav_id", url);
		_user_language		= get_url_variable("user_lang" , url);
		_data_id 			= get_url_variable("data_id" , url);
		_tool_task			= get_url_variable("tool_task", url);
		
		_jq_orig_element_id  = "#" + element_id;
		_old_highlight_color = $(_jq_orig_element_id).css('backgroundColor');
		_old_text_color      = $(_jq_orig_element_id).css('color');
		
		//alert("edit callout tool purp: " + _tool_purpose );
	}//scv


	/*********** private function SET CALLOUT SIZE *******************
	 * Function sets the initial callout size according to the tools requested
	 * in the tools_list array brought in at the constructor
	 */
	function set_callout_size( tools ){		
		//set for special purposes
		if( _tool_purpose == "portfolio" && _object_property == "addBuildingAddress" ){
			_callout_height = 180;
		}else if( _edit_object == "translation" ){
			_callout_height = 265; 
		}else{
			//alert("edit callout set size: h: " + _callout_height + " w: " + _callout_width );
			var co_size = compute_callout_size( tools );
			_callout_width = co_size['width'];
			_callout_height = co_size['height'];			
		}
	    
	}//fun scs
	
	
	/************ private function COMPUTE CALLOUT SIZE **************
	 * Function computes how large the callout must be to accomodate
	 * requested tools.
	 *
	 * @uses array _tools_to_include
	 * @return array height and width
	 */
	function compute_callout_size( tools ){		
		var total_height = 0;
		var total_width = _callout_width;
		
		for( one in tools ){
			var html_id = "#editCallout_" + tools[one];
			var tool_height = 0;
			//alert("edit callout: compute size: tool length: " + tools.length + " tool: " + tools[one] );
					
			//when only tabs in tool configure_tabs() determines position based on varying content
			if( tools.length == 1 && tools[one] == 'tabsContainer' ){
				var donothing = "";
			}else{
				set_callout_position();
			}
			//gets height info from edit_callout_template.php (width info not collected up to now)
			tool_height = $(html_id).css("height").split("px");
			tool_height = parseInt(tool_height);
			total_height += tool_height;			
		}
		//alert(  "edit callout compute size: h: " + total_height + " w: " + total_width);
			
	    var tool_size = new Array( );
	    tool_size['height'] = total_height;
	    tool_size['width'] = total_width;
		return tool_size;
	}//ccs	


	/*********** private function SET CALLOUT POSITION *********************
	 * Function sets the initial callout position according to tool purpose
	 */
	function set_callout_position( ){

	    //find element position	get_element_position located in edit_tool_utilities.js
		var _element_position = get_element_position(element_id);				
		
		_x_click_pos = _element_position['posX'];
		_y_click_pos = _element_position['posY'];
		
		if(_ec_dragged == false ){			
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) + 39;
			_callout_xpos = _x_click_pos + 220;			
		}
		if( _tool_purpose == "searchPanel" && _object_property == 'companyconnection' ){
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) - 8;
			_callout_xpos = _x_click_pos + 180;
		}
//		if(_tool_purpose == "searchPanel" && _nav_template == "building" ){
//			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) - 7;			
//		}		
		if( _tool_purpose == "dropdown" ){
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) - 7;
			_callout_xpos = _x_click_pos + 110;
		}
		if( _tool_purpose == "register" ){ 
			_callout_xpos = _x_click_pos + 133;
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) - 198;
		}
		if( _tool_purpose == "portfolio" && _ec_dragged == false ){		
			_callout_xpos = _x_click_pos + 180; 
		}
		if( _tool_purpose == "realEstate" && _nav_template == "building" ){
			//alert( "edit callout: set co pos x: " + _callout_xpos  + " pos y: " + _callout_ypos);
			_callout_xpos = _x_click_pos + 130;
		}
		if( _tool_purpose == "realEstate" && _nav_template == "rel_object_details" ){
			var listh = $("#realestateListings").height();
			//alert("Size of listings: js: " + th + " or: " + tabh);
			_callout_ypos = _callout_ypos + listh + 621;
			_callout_xpos = _x_click_pos + 300;
		}
		if( _tool_purpose == "valueEdit" && _nav_template == "rel_object_details" ){
			_callout_xpos = _x_click_pos + 70;			
		}
		if(  _tool_purpose == "searchPanel" && _nav_template == "company" ){			
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) - 7;
			_callout_xpos = _x_click_pos + 260;
			//alert("edit callout position x: " + _callout_xpos + " y: " + _callout_ypos + " tp: " + _tool_purpose + " y click: " + _y_click_pos );
		}

		if( _edit_object == "translation" ){
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) + 49;
			_callout_xpos = _x_click_pos + 142;
		}
//alert( "edit callout: set pos: h: " + _tool_purpose );
		if( _tool_purpose == "valueEdit" && _nav_template == "building" ){			
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) + 45;
			_callout_xpos = _x_click_pos + 125;
		}
		if( _tool_purpose == "valueEdit" && _nav_template == "building" && _object_property == 'fact'){	
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) + 45;
			_callout_xpos = _x_click_pos + 300;
		}
		if( _nav_template == "building" && (_object_property == 'addPinpoint' || _object_property == 'editPinpoint' )){
			_callout_ypos = _y_click_pos - Math.round( _callout_height/2) - 7;
			if( _object_property == 'addPinpoint' ){
				_callout_xpos = _x_click_pos + 150;
			}
		}		
		if( BrowserDetect.browser == 'Chrome' || BrowserDetect.browser == 'Safari' ){    		
    		_callout_ypos = _y_click_pos - Math.round( _callout_height/2) - 7;
    	}
		
		//compensate for scrolling
		var scroll_height = compensate_for_scrolling();
		_callout_ypos = _callout_ypos - scroll_height;

		//alert( "Callout click position x: " + _x_click_pos + " y: " + _y_click_pos);
		return true;
	}//fun scp
	
	function compensate_for_scrolling(){		
		var scrollH = "";
		var bt = BrowserDetect.browser;
		if( bt == "Explorer"){
			scrollH = document.documentElement.scrollTop;
		}else{
			scrollH = window.pageYOffset;
		}
		return scrollH;
	}


	/********** private function SET CALLOUT TITLE *****************/
	function set_callout_title( ){
		//alert( "Edit callout sct: " + _tool_purpose );
		switch(_tool_purpose){
			case "register"     : _callout_title = _edit_object + " helper";
			break;
			case "portfolio"  : _callout_title = "Portfolio " + _edit_object + " search";
			break;
			case "valueEdit" : _callout_title = "Emporis editor";			
			break;
			case "dropdown" : _callout_title = "Emporis editor";
			break;
			case "cityPage" : _callout_title = "City: Add Building";
			break;	
		}
		if( _edit_object == "translation" ){ _callout_title = "Emporis Translation"; }
		if( _edit_object == "building" &&  _object_property == "addFact"){ _callout_title = "Add Building Fact"; }
		if( _edit_object == "building" &&  _object_property == "addPinpoint"){ _callout_title = "Add Building Nearby"; }
		if( _tool_purpose == 'searchPanel' && _object_property == "tcompanylinkedtcityid" ){ _callout_title = "City Finder"; }
		if( _tool_purpose == 'searchPanel' && _object_property == "companyconnection" ){ _callout_title = "Company Connection"; }
		
		
	}//fun sct


	/************ private function CLEAN CALLOUT *******************
	 * clears callout of old tools in between clicks
	 */
	function clean_callout(){
		$("#editTool_Message").html('');
		$("#editCallout_translation").html('');
		for(each in _possible_tools){
			var html_id = "#editCallout_" + _possible_tools[each];
			$(html_id).css({ "display":"none" });
			//alert("edit callout clean callout " + html_id );
		}
		if( _tool_purpose != 'valueEdit' ){
			$('#editCallout_tabsContainer_deleteTab').hide();			
			$('#editCallout_tabsContainer_deleteTab_li').hide();
		}
				
		$("#editCallout_searchPanel").hide();
		$('#editCallout_debugMessage').html('');
		$('#editCallout_tabsContainer_deleteTab').hide();		
		$('#editCallout_tabsContainer_editTabSource1').val('');
		$('#editCallout_tabsContainer_editTabLabel2').hide();
		$('#editCallout_tabsContainer_editTabSource1').hide();
		$('#editCallout_tabsContainer_historyTab').html('');
		$("#editCallout_searchPinpoint_objectList").hide();
		$('#editCallout_searchPanel_saveButton').hide();
		$("#editCallout_searchPinpoint_selectButton").hide();
		$("#editCallout_searchPinpoint_selectButton").html('');
		$("#editCallout_searchPinpoint").hide();		
		$("#editCallout_tabsContainer_editTabValue1").val('');
		$("#editCallout_translatedText").hide();
	}//fun cc


	/************ private function FILL CALLOUT *******************
	 * Loops through _tools_to_include and turns on for display
	 * the corresponding divs in edit_callout_template
	 */
	function fill_callout(){

		for(each in _tools_to_include){
			//alert("Fill callout: " + _tools_to_include[each]);
			var html_id = "#editCallout_" + _tools_to_include[each];

			if(_tools_to_include[each] == 'tabsContainer'){
				if( _tool_purpose == "portfolio" ){
					portfolio.embed_tabs_in_callout();
				}else{
					embed_tabs_in_callout();
				}
			}else if(_tools_to_include[each] == 'pinpoint'){
				embed_pinpoint_in_callout();
			}else if(_tools_to_include[each] == 'dropdown'){								
				embed_dropdown_in_callout();
			}else if(_tools_to_include[each] == 'searchPanel'){
				embed_search_in_callout();
			}else{
				if( _object_property == "searchField" ){
					embed_search_in_callout();
				}else{
					//will embed old style edit search etc.
					$(html_id).css({ "display":"inline" });

				}
			}
		}
		//alert("edit callout fill callout: " + _tools_to_include );
		return true;
	}//fun fc

	function embed_dropdown_in_callout(){
		this.edd = new edit_dropdown_class( );
		edd.embed_dropdown_in_callout();
	}

	function embed_search_in_callout(){		
		this.es = new edit_search_class( );
		es.embed_search_in_callout();		
		return true;
	}//fun esic

	function embed_pinpoint_in_callout(){
		
		if( typeof es != "object" ){
			this.es = new edit_search_class();
		}
		this.epp = new edit_pinpoint_class();
		if( _tool_purpose == "portfolio" ){ 
			portfolio.embed_pinpoint_in_callout(); 
		}else if( _tool_purpose == "cityPage" ){
			//alert( "edit callout: embed pp: " + typeof citypage );
			citypage.embed_pinpoint_in_callout(); 
		}else{
            //alert('here to run pinpoint');
			epp.run_pinpoint();
		}
	}//fun epic


	function embed_tabs_in_callout(){		
		$("#editCallout_tabsContainer").tabs( );
		$("#editCallout_tabsContainer").show();
		//future - class allready to go
//		this.tabs = new edit_tabs_class();
//		tabs.embedd_tabs_in_callout();
	}//fun etic


	function load_tool_libraries( tools ){				

		//load template library one per edit_callout object		
		if( _tool_purpose == "portfolio"){
			$("#last_js_library").append('<script type="text/javascript" src="/htmldata/js/emporis/templates/portfolio.js"></script>');
			this.portfolio = new portfolio();
		}
		if(  _tool_purpose == "cityPage" || ( _tool_purpose == "building" && _object_property == "addPinpoint" )){
			$("#last_js_library").append('<script type="text/javascript" src="/htmldata/js/emporis/templates/city_page.js"></script>');			
			this.citypage = new city_page();			
		}
		if( _edit_object == "translation" ){
			$("#last_js_library").append('<script type="text/javascript" src="/htmldata/js/emporis/templates/translation.js"></script>');
			this.translation = new edit_translation_class();
		}
		if( _tool_purpose == "valueEdit" || _tool_purpose == "addFact" || _object_property == 'companyconnection'
		      || _object_property == 'tbuildinglinkedtprojectid'){
			$("#last_js_library").append('<script type="text/javascript" src="/htmldata/js/emporis/templates/edit_value.js"></script>');
			this.editvalue = new edit_value_class();			
		}

		//load requested tool libraries
		for( one in tools ){
			if( tools[one] == "searchPanel" || tools[one] == "pinpoint" || tools[one] == "search" ){
				$("#last_js_library").append('<script type="text/javascript" src="/htmldata/js/emporis/edit/edit_search/edit_search.js"></script>');
				$("#last_js_library").append('<script type="text/javascript" src="/htmldata/js/emporis/edit/edit_search/edit_search_class.js"></script>');
			}
			if(tools[one] == "dropdown"){
				$("#last_js_library").append('<script type="text/javascript" src="/htmldata/js/emporis/edit/edit_dropdown/edit_dropdown_class.js"></script>');
			}
		}

	}//fun ltl


	function configure_tabs(){
		
		//alert('edit callout: conf tabs: ');

		$('#editCallout_tabsContainer_viewTab').tabs({ disabled: [0] });
		
        if( _tool_purpose == "addFact" || _tool_purpose == "valueEdit" ){
			editvalue.configure_tabs();
			return true;
			
//now called by tranlation			
//		}else if( _tool_purpose == "webstring" && _edit_object == "translation" ){
//			translation.configure_tabs();
//			return true;
			
		}else if( _tool_purpose == "realEstate" ){        	
			$("#editCallout_tabsContainer_editTabValue0").html('<b><font color="blue">Real Estate Listing</font></b>');
			$("#editCallout_tabsContainer_editTabLabel1").html("title: ");
			$("#editCallout_tabsContainer_editTabValue1").show().val('').focus();
			$("#editCallout_tabsContainer").tabs( 'select', 1 );
			return true;
		}else{
			return false;
		}
		
	}//fun ct
	

	function highlight_edit_field(){		
			
//        $(_jq_orig_element_id).css({ "borderBottom":"1px solid #183961" });
//        $(_jq_orig_element_id).css({ "borderRight":"1px solid #183961" });
//        $(_jq_orig_element_id).css({ "borderLeft":"1px solid #819DC0" });
//        $(_jq_orig_element_id).css({ "borderTop":"1px solid #819DC0" });
		$(_jq_orig_element_id).css({ "backgroundColor":"#CCD2DA" });
	}

	function unhighlight_edit_field(){
//		$(_jq_orig_element_id).css({ "borderBottom":"0px solid #183961" });
//        $(_jq_orig_element_id).css({ "borderRight":"0px solid #183961" });
//        $(_jq_orig_element_id).css({ "borderLeft":"0px solid #819DC0" });
        $(_jq_orig_element_id).css({ "borderTop":"0px solid #819DC0" });
                
		//alert( 'edit callout: unhighlight: ' + _old_highlight_color );

        $(_jq_orig_element_id).css({ "color": _old_text_color });
		$(_jq_orig_element_id).css({ "backgroundColor": _old_highlight_color });
		//$("#editCallout_innerContainer").dialog( "destroy" );
		
		//maybe all unbinds could be put here
		$('#editCallout_dropdown_button').unbind('click');
	}

	function set_cursor_focus(){
		if( _edit_object == "translation" ){
			$("editCallout_translatedText").focus();
		}
		//alert("edit callout: set cursor: " + typeof es );
		if( typeof es == 'object' ){			
			$("#editCallout_searchPanel_searchTextInputField1").focus();
		}
		return true;
	}//scf

	function close_edit_callout(){
		$("#editCallout_innerContainer").dialog( "destroy" );
		unhighlight_edit_field();
		return true;
	}//fun cec

	/**
	 * Allows the checking of translation from time page opened to time callout opened
	 */
	function get_callout_data(){
		if( _edit_object == "translation" ){
			var url = _original_url + '&translated_text=&tool_task=fill';
			_ajax_test_url = url;
			//alert("edit callout: get callout data: " + _ajax_text_url );
			ajax_launcher( url, '', 'edit_translation', 'translation.compare_timestamps')
		}
       
		return true;
	}//fun gcd

	/**
	 * used if a specific position is needed
	 */
	function reposition_edit_callout( x_pos, y_pos ){
		if( x_pos == undefined && y_pos != undefined ){
			_callout_ypos = y_pos;
			set_callout_position();
		}else if( y_pos == undefined && x_pos != undefined ){
			_callout_xpos = x_pos;
			set_callout_position();
		}else{
			_callout_xpos = x_pos;
			_callout_ypos = y_pos;
			set_callout_position();
		}
		//alert( "edit callout repos: x: " + x_pos + " y: " + y_pos );
		return true;
	}//fun rec


	function redisplay_edit_callout(){
		$("#editCallout_innerContainer").dialog( "destroy" );
		display_edit_callout();
	}//fun rec

	function display_edit_callout(){
		highlight_edit_field();
		//alert("edit callout display ec");		
		_ec_iterations = _ec_iterations + 1;
		_ec_resized = false;	
				
		var temp_title = _callout_title + " ch: " +  _callout_height + " cw: " + _callout_width;
		
		$("#editCallout_innerContainer").dialog({ 	position: [_callout_xpos,_callout_ypos],
													width: _callout_width,
													height: _callout_height,
													resizeable: true,
													hide: 'slide',
													title: _callout_title,													
													modal: true,
													close: function(event, ui) { unhighlight_edit_field(); },													
													resizeStop: function(event, ui) { adjust_callout_height(); },
													dragStop: function(event, ui) { get_callout_size(); },
													stack: true
	 											}
		);
		
	}//fun dec

	/**
	 * Called when anytime edit callout is resized.
	 * This method is only called by display edit callout
	 */
	function get_callout_size(){
		if( typeof epp == 'object' ){			
			var nhgt = Math.round($("#editCallout_innerContainer").height() - 160 );
			var nwth = Math.round($("#editCallout_innerContainer").width() - 18 );
			
			if (map) {
				$("#editCallout_searchPinpoint").css({"width" : nwth, "height" : nhgt});
				map.checkResize();
			}else{
				epp.enlarge_map( nhgt, nwth );				
			}
		}
		//alert( "get callout size: " + $("#editCallout_innerContainer").height() );
		return true;
	}//gcs
	
	
	/**
	 * Called when resizing edit callout has stopped
	 * This method is only called by display_edit_callout() method
	 */
	function adjust_callout_height(){
				
		_ec_resized = true;
		_ec_dragged = true;
		
		get_callout_size();
		
		var object_list_status = $("#editCallout_searchPinpoint_objectList").css('display');
		var select_button_status = $("#editCallout_searchPinpoint_selectButton").css('display');
		
		//alert( "edit callout: adj co height: obj List: " + object_list_status + " sel butt: " + select_button_status );
		 if( select_button_status == 'block'){
			ec.resize_edit_callout( 490, 375, 'selectbutton' );
		 }
		 if( object_list_status == 'inline'){
			 ec.resize_edit_callout( 490, 375, 'selectmenu' );
		 }
	}//ach
	
	
	/**
	 * This method is only called by display edit callout
	 */
	function adjust_callout_position(){
		_ec_dragged = true;   
		var _element_position = get_element_position('editCallout_innerContainer');
		
		//alert( "edit callout: set co pos: x:" + _element_position['posX']  + " y: " + _element_position['posY'] );

		_callout_xpos = _element_position['posX'];
		_callout_ypos = _element_position['posY'];
		
		//compensate for scrolling
		var scroll_height = compensate_for_scrolling();
		_callout_ypos = _callout_ypos - scroll_height;	
	}//acp
	
	
	/**
	 * Displays user feedback message according to value of status in
	 * response array. Status is set when updating, adding or deleting edit value.
	 * See edit_ajax_processor.php lines @ 190 - 218
	 */
	function set_ajax_response_message( response ){
		var mess = '';				
		
		if( response[0].status == 0 ){
			mess = 'Error: ';
			if( response[0].error ){
				mess += '<font color="red">' + response[0].error + '</font>';
			}
		}
		if( response[0].status == 1 ){
			mess = 'Object is not yet in emporis database. Try later.';
		}
		if( response[0].status == 4 ){
			mess  = 'Thank you for your submission. ';
			mess += 'Your data was stored, but its quality is not sufficient to replace the existing data.';
			mess += 'Please read this page to find out how Emporis Data Ranking works.';				
		}	
		$('#editCallout_translation').html(mess);
		return true;
	}//sarm
	
	
	/**
	 * This method is not used. Will erase during cleanup.
	 * 
	 */
	function configure_single_text_area(){
		if( _edit_object == "building" &&  _object_property == "addFact" ){
			$('#editCallout_singleTextArea_saveButton').click(function(){ ec.process_single_text_area_save( ); });
		}
		return true;
	}
	
	/**
	 * Called by public method process_edit_tab_click()
	 * 
	 */
	function resize_edit_callout(hgt,wth){
		_callout_height = hgt;
		_callout_width  = wth;
		set_callout_position();
		redisplay_edit_callout();
		return true;		
	}
	
	/**
	 * Method adds page elements when process returns successfully
	 * from ajax database multivalue add
	 * @param data_id
	 * @param value
	 * @return boolean
	 */
    function refresh_multivalue( data_id, value ){
    	
    	//alert( 'edit callout: val: ' + value );    	

    	if( is_set(_tool_task) && _tool_task == 'deleteValue' ){   		
    		delete_multivalue( data_id );
    	}    	    	
    	
		//refresh_multivalue
    	var clicked_button_type = $(_jq_orig_element_id).text();
		var clicked_div_id = $(_jq_orig_element_id).attr('id');
		var clicked_div_class = $(_jq_orig_element_id).attr('class');
		var selector = "div[id^='" + clicked_div_id + "']:first";		
		var div_html = '';
		
		set_new_div_id(data_id);
		
		_publisher_call = make_publisher_text( data_id );
		
		//alert('edit callout: data_id: ' + data_id + ' obj pro: ' + _object_property + ' val: ' + value );

		//----------------Make fact div-------------------------
    	if( clicked_button_type == '[add]' && _object_property == 'fact'){
    							
			var clicked_div_td = $(selector).parent();			
			var clicked_div_tr = $(clicked_div_td).parent();			
			var tr_bgcolor = $(clicked_div_tr).attr('bgcolor');
			var new_tr_bgcolor = '';
			if( tr_bgcolor == '#cccccc' ) new_tr_bgcolor = '#eeeeee';
			else new_tr_bgcolor = '#cccccc';									
			div_html = '<tr id="' + _object_property + '_tr" valign="top" height="20" bgcolor="' + new_tr_bgcolor + '">';
			div_html += '<td><div id="' + _new_div_id + '" onclick="' + _publisher_call + '">';
			div_html += $('#editCallout_translatedText').val() + '</div></td></tr>';
			
			$(clicked_div_tr).parent().prepend(div_html);
			
			//(1)Collect all facts trs
	   		var fact_selector = "tr[id^='" + _object_property + "_tr']";
    		var all_trs = $(fact_selector).slice(0);
	
		//----------------Make features and amenities div----------------		
    	}else if( clicked_button_type == '[add]' && _object_property == 'tbuildingproperty' ){    									

			if( !is_set( value ) ) value = '';
			
			div_html = make_multivalue_div(value);
			$(selector).parent().prepend(div_html);						
			
		//----------------Make multi multivalue div---------------------			
    	}else if(  clicked_button_type == '[add]' && ( _object_property == 'tbuildingusage'                    
    		        || _object_property == 'tbuildingsideusage'        || _object_property == 'tbuildinglinkedtopenablewindowsid'  			    	
    		        || _object_property == 'tbuildingstructsystem'     || _object_property == 'tbuildingstructmaterial'    		        	
    		        || _object_property == 'tbuildingfoundationsystem' || _object_property == 'tbuildingfacadematerial'     		        	
    		        || _object_property == 'tbuildingfacadecolor'      || _object_property == 'tbuildinglinkedtheatingtypeid'     
    		        || _object_property == 'tbuildingfacadesystem'     || _object_property == 'tbuildingtextotherspublic' 
    		        || _object_property == 'tbuildingreconstruction') ){			    	
    		
    		//alert('edit callout: data_id: ' + data_id + ' obj pro: ' + _object_property + ' val: ' + value );
    		//TODO why am i doing this here and not above
			if( !is_set( value ) ) value = '';
		
			div_html = make_multivalue_div(value);			
			//prependTo and parent prepend will not work here, otherwise i would have done it
			$(selector).before(div_html);			    	
						    		
		//---------------------Make single multivalue div--------------------
			
//   	}else if(  clicked_button_type == '[edit]' &&  _object_property != 'tbuildingproperty' && _object_property == 'fact'){			
    	}else if( clicked_button_type == '[edit]' && ( _object_property == 'tbuildingroofsystem'        || _object_property == 'tbuildingfootprinttype' 
    		                                         || _object_property == 'tbuildinglinkedtstatusid'   || _object_property == 'tbuildinglinkedtbuildingtypeid'
    		                                         || _object_property == 'tbuildingfoundationsystem'  || _object_property == 'tbuildinglinkedtstyleid' )){
    	    	    	
			div_html = make_multivalue_div(value);
    		$(_jq_orig_element_id).replaceWith(div_html);
    		
    		//change bgcolor back to white
    		if( _object_property == 'tbuildinglinkedtbuildingtypeid' || _object_property == 'tbuildinglinkedtstatusid' ){
    			var jq_id = '#webstring_' + _object_property + '_' + _html_id_ooid ;
    			$(jq_id).css({'background-color':'white'});    		
    		}
    								
    	}else if( clicked_button_type != '[edit]' && clicked_button_type != '[add]' ){    		    	    	   			
    			$(_jq_orig_element_id).text(value);   		
    	}
    	close_edit_callout();
    	return true;
   }//rmv
    
    function make_multivalue_div( content ){
    	var html = '';
    	
		if( _object_property == 'tbuildingproperty' ){
			html = '<div class="emporis_value_list" id="' + _new_div_id + '" onclick="';
			html += _publisher_call + '">' + content + '</div>';
			return html;			
		}else{    	
	    	html = '<div class="emporis_value" id="' + _new_div_id + '" onclick="';
	    	//alert('edit_callout: make div: ' + is_set(_dropdown_image) );	    	
			if( is_set(_dropdown_image)){
				html += _publisher_call + '"><img src="' + _dropdown_image + '">&nbsp;' + content + '</div>';
			}else{
				html += _publisher_call + '">' + content + '</div>';
			}
			return html;   
		}
    }
    
    function delete_multivalue( data_id ){
    	var div_html = '';
    	set_new_div_id( data_id );
    	
    	//for facts
    	if( _object_property == 'fact' ){
    		
    		//(1)Get nodes to remove
    		var clicked_div_td = $(_jq_orig_element_id).parent();
    		var clicked_div_tr = $(clicked_div_td).parent();    		
    		var to_del_tr = $(clicked_div_tr).attr('id');
    		
    		//alert('tr to rem: ' + $(clicked_div_tr).attr('id') ); 
    		
    		//(2)remove nodes
    		$(_jq_orig_element_id).remove();
    		$(clicked_div_td).remove();
    		$(clicked_div_tr).remove();    		
    		    		
    		//(3)Get all fact div trs
    		var selector = "tr[id^='" + _object_property + "_tr']";
    		var all_trs = $(selector).slice(0);
 		    	
    		var count = 0;
    		//(5)Recolor each one
    		for( each in all_trs ){    			
    			if( all_trs[each] == '[object HTMLTableRowElement]' ){    				
    				//alert( 'tr: key: ' + ( each % 2 ) );    				
    				if( count % 2 == 0 ){
    					//TODO below jQuery commands do not work. Had to resort to native Javascript command. Find out why.
	    				//$(all_trs[each].id).css({'background-color':'#CCCCCC'});
    					all_trs[each].bgColor = '#CCCCCC';	    				 			
	    			}
    				if( count % 2 == 1 ){    					
	    				//$(all_trs[each].id).css({'background-color':'#EEEEEE'});	    				
	    				all_trs[each].bgColor = '#EEEEEE';	    				  
	    			}
    				count++;
    			}else{    				
    				continue;
    			}
    		}    		
    		
    	//replace single multivalues with [edit]
    	}else if(   _object_property == 'tbuildinglinkedtbuildingtypeid' || _object_property == 'tbuildingfootprinttype' 
    		      || _object_property == 'tbuildingroofsystem'            || _object_property == 'tbuildinglinkedtstatusid' 
    		      || _object_property == 'tbuildingfoundationsystem'      || _object_property == 'tbuildinglinkedtstyleid' ){
    		
    		_tool_task = '';
    		_publisher_call = make_publisher_text( data_id);  		
    		div_html = make_multivalue_div('[edit]');
    		$(_jq_orig_element_id).replaceWith(div_html);
    		
    	//delete div	
    	}else{
	    	//for tbuildingproperty and ...
	    	$(_jq_orig_element_id).hide();	    	
    	}
    }//dmv
    
    function set_new_div_id( data_id ){
		if( is_set(data_id) ){
			_new_div_id = _html_id_propname + '_' + _html_id_ooid + '_' + data_id;
		}else{
			_new_div_id = _html_id_propname + '_' + _html_id_ooid;
		}
		return true;
    }
    
    function make_publisher_text( data_id ){    	

	   var tool_url = "'";
	   tool_url +=  _script_uri + "?";
	   tool_url += 'pub_task=edit_callout';
	   tool_url += '&session_id=' + encodeURIComponent(_session_id);
	   if( is_set( _edit_object ) ){
		   tool_url += '&edit_object=' + encodeURIComponent(_edit_object);
	   }
	   if( is_set(_tools_to_include) ){
		   tool_url += '&tool_list=' + encodeURIComponent(_tools_to_include);
	   }
	   if( is_set(_tool_task) ){
		   tool_url += '&tool_task=' + encodeURIComponent(_tool_task);
	   }
	   if( is_set(_tool_purpose) ){
		   tool_url += '&tool_purpose=' + encodeURIComponent(_tool_purpose);
	   }
	   if( is_set(_object_property) ){
		   tool_url += '&property_name=' + encodeURIComponent(_object_property);
	   }
	   if( is_set(_object_id) ){
		   tool_url += '&object_id=' + encodeURIComponent(_object_id);
	   }
	   if( is_set(data_id) ){
		   tool_url += '&data_id=' + encodeURIComponent(data_id);
	   }
	   if( is_set(_nav_template) ){
		   tool_url += '&pub_template=' + encodeURIComponent(_nav_template);			
	   }
	   if( is_set(_nav_id) ){
		   tool_url += '&nav_id=' + encodeURIComponent(_nav_id);
	   }
	   tool_url += "'";
	   
	   //alert( "call toolmaker: div: " + tool_url );
	   
	   //make_tool( tool_url, _new_div_id );
	   
	   var publisher_text = "make_tool(" + tool_url + " ,'" + _new_div_id + "');";
	   
	   return publisher_text;
   }
    
   function dismantle_html_id(){			
		parts = _orig_html_id.split('_');
		_html_id_propname = parts[0];
		_html_id_ooid = parts[1];
		return true;
   }

}//cl ecc








