/*
function Get_object_absolute_position( obj_html_tag )
function Get_object_absolute_coords( obj_html_tag )
function Set_object_opacity( obj_object, n_opacity )
function Check_text( obj_input, n_min_length, str_error_message, b_ignore, b_display_alert )
function AddToFavorite( str_url, str_description )
function Reset_quick_search()
function Display_MDI_frame( str_frame_id, obj_label )
function Display_MDI_page( str_title, str_url, n_width, n_height, str_PID )
function Hide_MDI_frame()
function Hide_MDI_page()
function window_resize_MDI()
function Display_MDI_frame_splash( str_frame_id, n_width, n_height )
function Display_MDI_frame_XY( str_frame_id, n_X, n_Y )
function Resize_MDI_shadow()
function Set_MDI_frame( str_frame_id, n_left, n_top, n_width, n_height )
function Fade_MDI_frame( n_opacity_start, n_opacity_end, n_step, n_timer )
function MDI_frame_mouse( b_mouseover, str_frame_id, n_timeout, obj_label )
function MDI_frame_mouse_timer( str_frame_id, n_X, n_Y )
function Combos_visibility( b_visible )
function PrintIframe( str_iframe_id )
function Get_element_style( obj_tag, str_style_name )
function IsEmail( str_email )
function GetScrollLeft()
function GetScrollTop()
function Set_object_class( obj_element, str_new_class )
function Check_image_size( obj_image, n_width_max, n_height_max )
function PutCookie( str_name, str_value, n_days )
function GetCookie( str_name )
function DelCookie( str_name )
function Initialize_MDI_frame( str_id_of_displayer, str_id_mdi_displayed )
function autoGrow( objTextarea )
function Trim( str_expression )
function UCase( str_expression )
function LCase( str_expression )
function Move_frame_to_center( str_frame_id )
function Search_parent_tag( obj_child, str_parent_tag_name )
function Checkbox_onClick( str_type_id, str_sub_type_id, str_join_sub_type_id )
function Disabled_frame( obj_to_hide )
function Enabled_frame()
function Set_tab( n_tab )
function Val( str_expression )
function Initialize_frame_buttons_link()
function Get_form_query_string( obj_form )
function Snow()

*/
var m_str_DICO_close = "";
var m_str_DICO_new_window = "";
var m_str_DICO_copy_url = "";
var m_str_DICO_modify = "";
var m_str_DICO_server_connection_failure = "";
var m_str_DICO_retry = "";
var m_str_DICO_reload = "";

var m_str_active_MDI_frame_id = "";
//var m_n_MDI_frame_opacity = -1;
var m_str_MDI_frame_mouseover_frame_id = "";
var m_b_combo_invisibility = false;

var m_str_global_ressources;

function Get_object_absolute_position( obj_html_tag )
{
	var obj_parent = obj_html_tag.offsetParent;
	var n_loop = 0;
	var n_offSet_left = obj_html_tag.offsetLeft;
	var n_offSet_top = obj_html_tag.offsetTop;

	while(obj_parent.tagName != null && obj_parent.tagName != "BODY" && n_loop < 100)
	{
		n_offSet_left += obj_parent.offsetLeft;
		n_offSet_top += obj_parent.offsetTop;
		if(obj_parent.offsetParent)
		{
			obj_parent = obj_parent.offsetParent;
		}
		else
		{
			obj_parent = null;
			break;
		}
		n_loop++;
	}
	if(obj_parent)
	{
		n_offSet_left += obj_parent.offsetLeft;
		n_offSet_top += obj_parent.offsetTop;
	}
	return(n_offSet_left + ";" + n_offSet_top);
}

function Get_object_absolute_coords( obj_html_tag )
{
	var obj_coords = new Object();
	var n_top = 0;
	var n_left = 0;
	while(obj_html_tag)
	{
		n_top += obj_html_tag.offsetTop;
		n_left += obj_html_tag.offsetLeft;
		obj_html_tag = obj_html_tag.offsetParent;
	}
	obj_coords.left = n_left;
	obj_coords.top = n_top;
	return(obj_coords);
}

function Set_object_opacity( obj_object, n_opacity )
{
	var err;
    if(navigator.appName.indexOf("Netscape") != -1 && parseInt(navigator.appVersion) >=5)
	{
		try
		{
			obj_object.style.MozOpacity = n_opacity / 100;
			obj_object.style.KhtmlOpacity = n_opacity / 100;
		}
		catch(err) {}
	}
	else if(navigator.appName == "Microsoft Internet Explorer")
	{
		try
		{
			obj_object.filters.alpha.opacity = n_opacity;
		}
		catch(err) {}
	}
	else
	{
		try
		{
			obj_object.style.Opacity = n_opacity / 100;
			obj_object.style.opacity = n_opacity / 100;
		}
		catch(err) {}
	}
}

function Check_text( obj_input, n_min_length, str_error_message, b_ignore, b_display_alert )
{
	var b_result = true;
	if(!b_ignore)
	{
		b_result = (obj_input.value.length >= n_min_length);
		if(obj_input.name.search("mail") > 0)
		{
			b_result = IsEmail(obj_input.value);
		}

		if(!b_result)
		{
			if(b_display_alert)
			{
				alert(str_error_message);
				obj_input.focus();
			}
		}
	}
	return(b_result);
}

function AddToFavorite( str_url, str_description )
{
	var b_result = true;
	try
	{
		if(window.sidebar)
		{
			// Mozilla Firefox Bookmark	
			window.sidebar.addPanel(str_description, str_url,"");
		}
		else if(window.external)
		{
			// IE Favorite
			window.external.AddFavorite(str_url, str_description);
		}
	}
	catch(err)
	{
		b_result = false;
	}
	if(!b_result)
	{
		alert("Can't add to favorites");
	}
}

function Reset_quick_search()
{
	var obj_form_quick_search = document.getElementById("obj_form_quick_search");
	obj_form_quick_search.Types.value = "";
	obj_form_quick_search.Loc.value = "";
	obj_form_quick_search.Key.value = "";
}

function Display_MDI_frame( str_frame_id, obj_label )
{
	var str_list_coords = Get_object_absolute_position(obj_label).split(";");
	m_str_MDI_frame_mouseover_frame_id = "";
	Display_MDI_frame_XY(str_frame_id, parseInt(str_list_coords[0]), parseInt(str_list_coords[1]));
}

function Display_MDI_page( str_title, str_url, n_width, n_height, str_PID )
{
	var obj_frame_mdi = document.getElementById("frame_mdi");
	var str_HTML = "";
	document.documentElement.style.overflow = "hidden";
	document.body.style.marginRight = "17px";

	obj_frame_mdi.style.display = "block";
	obj_frame_mdi.style.padding = "8px";
	obj_frame_mdi.style.width = n_width + "px";
	obj_frame_mdi.style.height = n_height + "px";
	
	str_HTML = "<DIV ID=frame_header_iframe_mdi>";
	str_HTML += "<table><tr>";
	str_HTML += "<td><span>" + str_title + "</SPAN></td>";
	str_HTML += "<td align=right>";
	str_HTML += "<table CLASS=C_FRAME_BUTTONS_LINKS><tr>";
	//str_HTML += "<BUTTON ONCLICK=\"document.getElementById('iframe_mdi').src='" + str_url + "';\" STYLE=\"WIDTH: 24px;\"><IMG SRC=\"/images2/reload-12x12.gif\"></BUTTON>";
	str_HTML += "<td><a href=\"javascript:\" ONCLICK=\"document.getElementById('iframe_mdi').src='" + str_url + "';return(false);\" STYLE=\"WIDTH: 20px;\"><span class=C_ICON_RELOAD_16x16></span></a></td>";
	//str_HTML += "<BUTTON ONCLICK=\"PrintIframe('iframe_mdi');\" STYLE=\"WIDTH: 24px;\"><IMG SRC=\"/images2/printer-12x12.gif\"></BUTTON>";
	str_HTML += "<td><a href=\"javascript:\" ONCLICK=\"PrintIframe('iframe_mdi');return(false);\"><span class=C_ICON_PRINT_16x16></span></a></td>";
	if(str_PID != "" && str_PID != null && m_str_DICO_modify != "")
	{
		//str_HTML += "<BUTTON ONCLICK=\"top.location='/accountpro/PRO_posting_edit.asp?PID=" + str_PID + "';\" STYLE=\"WIDTH: 80px;\"><IMG SRC=\"/images2/pen-12x12.gif\"> " + m_str_DICO_modify + "</BUTTON>";
		str_HTML += "<td><a href=\"javascript:\" ONCLICK=\"top.location='/accountpro/PRO_posting_edit.asp?PID=" + str_PID + "';return(false);\" STYLE=\"WIDTH: 80px;\"><span class=C_ICON_PEN_16x16></span> " + m_str_DICO_modify + "</a></td>";
	  	if(window.navigator.appName == "Microsoft Internet Explorer")
	  	{
			//str_HTML += "<BUTTON ONCLICK=\"window.clipboardData.clearData();window.clipboardData.setData('text', '" + str_url + "');\" STYLE=\"WIDTH: 100px;\"><IMG SRC=\"/images2/copy-12x12.gif\"> " + m_str_DICO_copy_url + "</BUTTON>";
			str_HTML += "<td><a href=\"javascript:\" ONCLICK=\"window.clipboardData.clearData();window.clipboardData.setData('text', '" + str_url + "');return(false);\" STYLE=\"WIDTH: 100px;\"><span class=C_ICON_COPY_16x16></span> " + m_str_DICO_copy_url + "</a></td>";
		}
	}
	//str_HTML += "<BUTTON ONCLICK=\"window.open('" + str_url.replace("&gui=0", "").replace("&NoGui=1", "") + "');\" STYLE=\"WIDTH: 124px;\"><IMG SRC=\"/images2/window-normal.gif\"> " + m_str_DICO_new_window + "</BUTTON>";
	str_HTML += "<td><a href=\"javascript:\" ONCLICK=\"window.open('" + str_url.replace("&gui=0", "").replace("&NoGui=1", "") + "');return(false);\" STYLE=\"WIDTH: 124px;\"><span class=C_ICON_NORMAL_SIZE_12x12></span> " + m_str_DICO_new_window + "</a></td>";
	//str_HTML += "<BUTTON ONCLICK=\"Hide_MDI_page();\"><IMG SRC=\"/images2/close-12x12.gif\"> " + m_str_DICO_close + "</BUTTON>";
	str_HTML += "<td><a href=\"javascript:\" ONCLICK=\"Hide_MDI_page();return(false);\" STYLE=\"WIDTH: 64px;\"><span class=C_ICON_CLOSE_BLUE_12x12></span> " + m_str_DICO_close + "</a></td>";
	str_HTML += "</tr></table>";
	str_HTML += "</td>";
	str_HTML += "</tr></table>";
	str_HTML += "</div>";
	str_HTML += "<IFRAME ID=iframe_mdi SRC=\"" + str_url + "\" SCROLLING=YES FRAMEBORDER=NO STYLE=\"BORDER: 0px; WIDTH: " + n_width + "px; HEIGHT: " + n_height + "px;\"></IFRAME>"
	
	obj_frame_mdi.innerHTML = str_HTML;
	Display_MDI_frame_XY("frame_mdi", n_width, n_height);
	window.onresize = window_resize_MDI;
	window_resize_MDI();
	Combos_visibility(false);
	setTimeout("document.ondblclick = Hide_MDI_page;", 400);
}

function Hide_MDI_frame()
{
	Combos_visibility(true);
	if(m_str_active_MDI_frame_id != "")
	{
		document.getElementById("frame_mdi_shadow").style.visibility = "hidden";
		document.getElementById(m_str_active_MDI_frame_id).style.visibility = "hidden";
		m_str_active_MDI_frame_id = "";
	}
	//m_n_MDI_frame_opacity = -1;
}

function Hide_MDI_page()
{
	window.onresize = null;
	document.onclick = null;
	document.ondblclick = null;
	Combos_visibility(true);
	document.getElementById("frame_mdi_shadow").style.display = "none";
	document.documentElement.style.overflow = "";
	document.body.style.marginRight = "";
	Fade_MDI_frame(100, 0, -15, 20);
}

function window_resize_MDI()
{
	var frame_shadow = document.getElementById("frame_mdi_shadow");
	var frame_mdi = document.getElementById("frame_mdi");
	var obj_iframe = frame_mdi.getElementsByTagName("iframe")[0];;
	var n_width = frame_mdi.clientWidth;
	var n_height = frame_mdi.clientHeight;
	var n_left;
	var n_top;
	var n_default_width = frame_mdi.getAttribute("DefaultWidth");
	var n_default_height = frame_mdi.getAttribute("DefaultHeight");
	var str_iframe_mdi_src = frame_mdi.getAttribute("iframesource");
	var n_frame_mdi_padding_x = (frame_mdi.style.paddingLeft.replace("px", "") * 1) + (frame_mdi.style.paddingRight.replace("px", "") * 1);
	var n_frame_mdi_padding_y = (frame_mdi.style.paddingTop.replace("px", "") * 1) + (frame_mdi.style.paddingBottom.replace("px", "") * 1);

	if(obj_iframe)
	{
		if(str_iframe_mdi_src != obj_iframe.src)
		{
			n_default_width = "";
			n_default_height = "";
			str_iframe_mdi_src = obj_iframe.src;
			frame_mdi.setAttribute("iframesource", str_iframe_mdi_src);
			//alert(obj_iframe.src + "\n" + str_iframe_mdi_src);
		}

		if(n_default_width == "" || n_default_width == null) { frame_mdi.setAttribute("DefaultWidth", n_width); n_default_width = n_width; }
		if(n_default_height == "" || n_default_height == null) { frame_mdi.setAttribute("DefaultHeight", n_height); n_default_height = n_height; }
		
		if((1 * n_default_width) + 16 > document.documentElement.clientWidth)
		{
			n_width = document.documentElement.clientWidth - 16 - 16;
		}
		else if(n_default_width != n_width)
		{
			n_width = n_default_width;
		}
		if((1 * n_default_height) + 16 > document.documentElement.clientHeight)
		{
			n_height = document.documentElement.clientHeight - 16;
		}
		else if(n_default_height != n_height)
		{
			n_height = n_default_height - n_frame_mdi_padding_y;
		}

		n_left = (GetScrollLeft() + ((document.documentElement.clientWidth - n_width) / 2));
		n_top = (GetScrollTop() + ((document.documentElement.clientHeight - n_height) / 2));
		if(n_left < GetScrollLeft() + 8) { n_left = GetScrollLeft() + 8; }
		if(n_top < GetScrollTop() + 8) { n_top = GetScrollTop() + 8; }


		frame_mdi.style.width = (n_width - n_frame_mdi_padding_x) + "px";
		//frame_mdi.style.height = (n_height - n_frame_mdi_padding_y) + "px";
		obj_iframe.style.width = (n_width - n_frame_mdi_padding_x) + "px";
		obj_iframe.style.height = (n_height - n_frame_mdi_padding_y - 26) + "px";
		//obj_iframe.style.display = "none";

		frame_shadow.style.left = (n_left - 8) + "px";
		frame_shadow.style.top = (n_top - 8) + "px";
		frame_shadow.style.width = (n_width + 16) + "px";
		frame_shadow.style.height = (n_height + 16) + "px";
		frame_mdi.style.left = n_left + "px";
		frame_mdi.style.top = n_top + "px";
	}
}

function Display_MDI_frame_splash( str_frame_id, n_width, n_height )
{
	var obj_frame_mdi_frame = document.getElementById(str_frame_id);
	var n_left;
	var n_top;
	var b_resize_frame = (n_width >= 0) || (n_height >= 0);

	obj_frame_mdi_frame.style.position = "absolute";
	obj_frame_mdi_frame.style.display = "block";

	n_width = (n_width != -1) ? n_width : obj_frame_mdi_frame.clientWidth;
	n_height = (n_height != -1) ? n_height : obj_frame_mdi_frame.clientHeight
	n_left = GetScrollLeft() + (document.documentElement.clientWidth - n_width) / 2;
	n_top = GetScrollTop() + (document.documentElement.clientHeight - n_height) / 2;

	if(b_resize_frame)
	{
		obj_frame_mdi_frame.style.width = n_width + "px";
		obj_frame_mdi_frame.style.height = n_height + "px";
	}

	Hide_MDI_frame();
	m_str_active_MDI_frame_id = str_frame_id;
	Set_MDI_frame(str_frame_id, n_left, n_top, n_width, n_height);
	Set_object_opacity(document.getElementById(str_frame_id), 100);
}

function Display_MDI_frame_XY( str_frame_id, n_X, n_Y )
{
	var obj_frame_mdi_frame = document.getElementById(str_frame_id);
	var n_width = obj_frame_mdi_frame.clientWidth;
	var n_height = obj_frame_mdi_frame.clientHeight;
	var n_left = n_X - (n_width / 2);
	var n_top = n_Y + 16;

	if((n_left + obj_frame_mdi_frame.offsetWidth + 16) > (GetScrollLeft() + document.documentElement.clientWidth))
	{
		n_left = GetScrollLeft() + document.documentElement.clientWidth - obj_frame_mdi_frame.offsetWidth - 16;
	}

	if(n_left < 0) { n_left = 0; }
	if(n_top < 0) { n_top = 0; }

	Hide_MDI_frame();
	Set_MDI_frame(str_frame_id, n_left, n_top, n_width, n_height);
	if(n_width == 0)
	{
		setTimeout("Resize_MDI_shadow();", 200);
	}
	m_str_active_MDI_frame_id = str_frame_id;
	Fade_MDI_frame(0, 100, 15, 20);
}

function Resize_MDI_shadow()
{
	var obj_frame_mdi_shadow = document.getElementById("frame_mdi_shadow");
	var obj_frame_mdi_frame = document.getElementById(m_str_active_MDI_frame_id);
	var n_width = obj_frame_mdi_frame.clientWidth;
	var n_height = obj_frame_mdi_frame.clientHeight;
	var n_left;
	obj_frame_mdi_shadow.style.width = (n_width + 16) + "px";
	obj_frame_mdi_shadow.style.height = (n_height + 16) + "px";
	
	if((obj_frame_mdi_frame.offsetLeft + obj_frame_mdi_frame.offsetWidth + 16) > (GetScrollLeft() + document.documentElement.clientWidth))
	{
		n_left = GetScrollLeft() + document.documentElement.clientWidth - obj_frame_mdi_frame.offsetWidth - 16;
		obj_frame_mdi_frame.style.left = n_left + "px";
		obj_frame_mdi_shadow.style.left = (n_left - 8) + "px";
	}
	
}

function Set_MDI_frame( str_frame_id, n_left, n_top, n_width, n_height )
{
	var obj_frame_mdi_shadow = document.getElementById("frame_mdi_shadow");
	var obj_frame_mdi_frame = document.getElementById(str_frame_id);
	
	obj_frame_mdi_shadow.style.left = (n_left) + "px";
	obj_frame_mdi_shadow.style.top = (n_top) + "px";
	obj_frame_mdi_frame.style.left = (n_left + 8) + "px";
	obj_frame_mdi_frame.style.top = (n_top + 8) + "px";

	obj_frame_mdi_shadow.style.width = (n_width + 16) + "px";
	obj_frame_mdi_shadow.style.height = (n_height + 16) + "px";

	obj_frame_mdi_shadow.style.visibility = "visible";
	obj_frame_mdi_frame.style.visibility = "visible";
	obj_frame_mdi_shadow.style.display = "block";
	obj_frame_mdi_frame.style.display = "block";
}

function Fade_MDI_frame( n_opacity_start, n_opacity_end, n_step, n_timer )
{
	if(n_opacity_end == 100)
	{
		document.getElementById(m_str_active_MDI_frame_id).style.display = "block";
		return;
	}
	else if(n_opacity_end == 0)
	{
		document.getElementById(m_str_active_MDI_frame_id).style.display = "none";		
		return;
	}
	Fade_object(m_str_active_MDI_frame_id, n_opacity_start, n_opacity_end, n_step, n_timer, -1);
}

var m_b_fade_allowed = true;

function Fade_object( str_object_id, n_opacity_start, n_opacity_end, n_step, n_timer, n_object_opacity )
{
	var obj_object = document.getElementById(str_object_id);

	if(!m_b_fade_allowed) { return; }

	if(n_object_opacity == -1)
	{
		n_object_opacity = n_opacity_start;
	}
	else
	{
		n_object_opacity += n_step;
	}
	if(((n_step > 0) && (n_object_opacity >= n_opacity_end)) || ((n_step < 0) && (n_object_opacity <= n_opacity_end)))
	{
		n_object_opacity = n_opacity_end;
		n_step = 0;
	}
	//window.status = n_object_opacity + " -- " + Math.abs(n_object_opacity) + " / " + Math.abs(n_opacity_end);
	
	if(str_object_id != "")
	{
		if(obj_object)
		{
			Set_object_opacity(obj_object, n_object_opacity);
			if(n_step != 0)
			{
				setTimeout("Fade_object('" + str_object_id + "'," + n_opacity_start + "," + n_opacity_end + "," + n_step + "," + n_timer + "," + n_object_opacity + ")", n_timer);
			}
			else
			{
				if(n_object_opacity <= 0)
				{
					obj_object.style.display = "none";
				}
				n_object_opacity = -1;
			}
		}
		else
		{
			str_object_id = "";
		}
	}
}

function MDI_frame_mouse( b_mouseover, str_frame_id, n_timeout, obj_label )
{
	var str_list_coords = Get_object_absolute_position(obj_label).split(";");
	if(b_mouseover)
	{
		m_str_MDI_frame_mouseover_frame_id = str_frame_id;
		setTimeout("MDI_frame_mouse_timer('" + str_frame_id + "'," + str_list_coords[0] + "," + str_list_coords[1] + ");", n_timeout);
	}
	else
	{
		if(str_frame_id == m_str_MDI_frame_mouseover_frame_id)
		{
			m_str_MDI_frame_mouseover_frame_id = "";
		}
 	}
}

function MDI_frame_mouse_timer( str_frame_id, n_X, n_Y )
{
	if(str_frame_id == m_str_MDI_frame_mouseover_frame_id)
	{
		Display_MDI_frame_XY(m_str_MDI_frame_mouseover_frame_id, n_X, n_Y);
		m_str_MDI_frame_mouseover_frame_id = "";
	}
}

function Combos_visibility( b_visible, obj_frame )
{
	var obj_selects;
	var i;
	var obj_IMG;
	var obj_frame_container;
	var obj_select;
	var obj_parent;
	
  	if(window.navigator.appName == "Microsoft Internet Explorer")
	{
		if(window.navigator.appVersion.search("6.0") > 0)
		{
			obj_selects = (obj_frame) ? obj_frame.getElementsByTagName("select") : document.getElementsByTagName("select");
			if(!b_visible && m_b_combo_invisibility)
			{
				Combos_visibility(true);
			}
			m_b_combo_invisibility = !b_visible;
			for(i=0; i<obj_selects.length;i++)
			{
				if(obj_selects[i])
				{
					obj_frame_container = obj_selects[i].parentNode;
					if(b_visible)
					{
						if(document.getElementById("virtual_select_" + i))
						{
							obj_parent = document.getElementById("virtual_select_" + i).parentNode;
							obj_parent.removeChild(document.getElementById("virtual_select_" + i));
						}
					}
					else
					{
						obj_IMG = document.createElement("img");
						obj_IMG.className = "C_VIRTUAL_SELECT";
						obj_IMG.id = "virtual_select_" + i;
						if(obj_selects[i].clientWidth > 38)
						{
							obj_IMG.style.width = (obj_selects[i].clientWidth - 38) + "px";
						}
						obj_IMG.style.height = "0px";
						obj_IMG.style.marginTop = Get_element_style(obj_selects[i], "marginLeft");
						obj_IMG.style.marginRight = Get_element_style(obj_selects[i], "marginRight");
						obj_IMG.style.marginBottom = Get_element_style(obj_selects[i], "marginBottom");
						obj_IMG.style.marginLeft = Get_element_style(obj_selects[i], "marginLeft");
						obj_IMG.src = "about:blank";
						obj_frame_container.insertBefore(obj_IMG, obj_selects[i]);
					}
				}
				obj_selects[i].style.display = b_visible ? "" : "none";
			}
		}
	}
}

var m_obj_window_popup;

function PrintIframe( str_iframe_id )
{
	var obj_iframe = document.getElementById(str_iframe_id);
	//var obj_body = obj_iframe.contentWindow.document.body;
	//var str_HTML = new String(obj_body.innerHTML);
	//var b_frameset_detected = (str_HTML.toUpperCase().indexOf("<FRAME") >= 0);
	// A GERER SI b_frameset_detected ! ...

    m_obj_window_popup = window.open();
    m_obj_window_popup.document.location = obj_iframe.src;
	setTimeout("Check_window_popup_for_print();", 500);
}

function Get_element_style( obj_tag, str_style_name )
{
	var str_result = "";
	
	if(obj_tag.currentStyle)
	{
		str_result = obj_tag.currentStyle[str_style_name];
	}
	else if(window.getComputedStyle)
	{
		str_result = document.defaultView.getComputedStyle(obj_tag, null).getPropertyValue(str_style_name);
	}
	return(str_result);
}

function IsEmail( str_email )
{
	var obj_RegExp = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,4}$/;
	//var obj_RegExp = /^(([^<>()[\]\\.,;:\s@""]+(\.[^<>()[\]\\.,;:\s@""]+)*)|("".+""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	// Les 2 RegExp marchent mais le premier semble plus simple...
	return(obj_RegExp.exec(str_email) != null)
}

function GetScrollLeft()
{
	return(window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft);
}
function GetScrollTop()
{
	return(window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop);
}

function Set_object_class( obj_element, str_new_class )
{
	if(obj_element.className != str_new_class)
	{
		obj_element.className = str_new_class;
	}
}

function Check_image_size( obj_image, n_width_max, n_height_max )
{
	var n_width;
	var n_height;
	
	n_width = obj_image.width;
	n_height = obj_image.height;

	if( obj_image.width > n_width_max )
	{
		obj_image.width = n_width_max;
		if( obj_image.height > n_height_max )
		{
			obj_image.height = n_height_max;
			obj_image.width = n_width * n_height_max / n_height;
		}
	}
	else
	{
		if( obj_image.height > n_height_max )
		{
			obj_image.height = n_height_max;
			if( obj_image.width > n_width_max )
			{
				obj_image.width = n_width_max;
				obj_image.height = n_height * n_width_max / n_width;
			}
		}
	}
}

function PutCookie( str_name, str_value, n_days )
{
	if(n_days)
	{
		var obj_date = new Date();
		obj_date.setTime(obj_date.getTime() + (n_days * 24 * 60 * 60 * 1000));
		var str_expires = "; expires=" + obj_date.toGMTString();
	}
	else
	{
		var str_expires = "";
	}
	document.cookie = str_name + "=" + str_value + str_expires + "; path=/";
}

function GetCookie( str_name )
{
	var str_name_EQ = str_name + "=";
	var obj_list_cookies = document.cookie.split(";");
	for(var i=0; i < obj_list_cookies.length; i++)
	{
		var str_cookie = obj_list_cookies[i];
		while(str_cookie.charAt(0) == " ")
		{
			str_cookie = str_cookie.substring(1, str_cookie.length);
			if(str_cookie.indexOf(str_name_EQ) == 0)
			{
				return(str_cookie.substring(str_name_EQ.length, str_cookie.length));
			}
		}
	}
	return(null);
}

function DelCookie( str_name )
{
	PutCookie(str_name, "", -1);
}

function Initialize_MDI_frame( str_id_of_displayer, str_id_mdi_displayed )
{
	var obj_displayer = document.getElementById(str_id_of_displayer);
	var obj_mdi_displayed = document.getElementById(str_id_mdi_displayed);

	if(obj_displayer)
	{
		obj_displayer.style.cursor = "pointer";
		obj_displayer.onmouseover = new Function("MDI_frame_mouse(true,'" + str_id_mdi_displayed + "',1000,this);");
		obj_displayer.onmouseout = new Function("MDI_frame_mouse(false,'" + str_id_mdi_displayed + "',0,this);");

		if(str_id_mdi_displayed == "frame_mdi_search_by_reference") {
			obj_displayer.onclick = new Function("Display_MDI_frame('" + str_id_mdi_displayed + "',this);document.getElementById('obj_form_search_by_reference').PID.focus(); return(false);");
		}
		else if(str_id_mdi_displayed == "frame_mdi_searchTips")
		{
			obj_displayer.onclick = new Function("Display_MDI_frame('" + str_id_mdi_displayed + "',this);Combos_visibility(false);return(false);");
		}
		else
		{
			obj_displayer.onclick = new Function("Display_MDI_frame('" + str_id_mdi_displayed + "',this); return(false);");
		}
		obj_mdi_displayed.onmousedown = new Function('document.getElementsByTagName("html")[0].onmousedown = null');
		obj_mdi_displayed.onmouseout = new Function('document.getElementsByTagName("html")[0].onmousedown = Hide_MDI_frame');
	}
}

//var str_fisrt_width
function autoGrow( objTextarea )
{
	var objDiv = document.createElement("div");
	//var t = document.createElement("textarea");
	var str_html = objTextarea.value;
//	var objDebug = document.createElement("div");

	/*var tVal = t.value;			
	t.style.height = '0px';
	t.value = "W\nW\nW";
	var H3 = t.scrollHeight;
	t.value = "W\nW\nW\nW";
	var H4 = t.scrollHeight;
	var H = H4 - H3 + 1;*/

	//if (str_fisrt_width == null) str_fisrt_width = objTextarea.offsetWidth
		
	str_html = str_html.replace(/>/g, "&gt;");
	str_html = str_html.replace(/</g, "&lt;");
	str_html = str_html.replace(/\r\n/, '<br />');
	str_html = str_html.replace(/(\r\n|[\r\n])/g, "<br />");
	str_html = str_html.replace(/(\t|[\t])/g, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");

	objDiv.innerHTML = "&nbsp;" + str_html;

	objTextarea.parentNode.appendChild(objDiv);

	//objDebug.innerHTML =str_fisrt_width;
	//objTextarea.parentNode.appendChild(objDebug);
	
	//objTextarea.style.width = "10px";
	//objTextarea.parentNode.style.width = "10px";
	objTextarea.style.height = (objDiv.offsetHeight + 24) + "px";
	objTextarea.parentNode.removeChild(objDiv);
}

function Trim( str_expression )
{
  str_expression = str_expression.replace(/^\s+/g, "");
  return(str_expression.replace(/\s+$/g, ""));
}

function UCase( str_expression )
{
	return(str_expression.toUpperCase());
}

function LCase( str_expression )
{
	return(str_expression.toLowerCase());
}

function Move_frame_to_center( str_frame_id )
{
	var obj_frame = document.getElementById(str_frame_id);
	
	if(obj_frame.offsetWidth > 0)
	{
		obj_frame.style.position = "absolute";
		obj_frame.style.left = Math.round(((document.documentElement.clientWidth - obj_frame.offsetWidth) / 2)) + "px";
		obj_frame.style.top = Math.round((((document.documentElement.clientHeight / 2) - obj_frame.offsetHeight) / 2)) + "px";
	}
	else
	{
		setTimeout("Move_frame_to_center('" + str_frame_id + "');", 1000);
	}
}

function Search_parent_tag( obj_child, str_parent_tag_name )
{
	var obj_parent = obj_child.parentNode;
	var n_loop = 0;
	while(obj_parent.tagName.toLowerCase() != str_parent_tag_name.toLowerCase() && n_loop < 100)
	{
		obj_parent = obj_parent.parentNode;
		n_loop++;
	}
	return(obj_parent);
}

function CreateAttribute( str_name, str_value )
{
	var obj_attribute = document.createAttribute(str_name);
	obj_attribute.value = str_value;
	return(obj_attribute);
}

function Echo( str_message, b_view_html )
{
	var obj_frame_echo = document.getElementById("frame_echo");
	var obj_div_message = document.createElement("div");;

	if(!obj_frame_echo)
	{
		obj_frame_echo = document.createElement("div");
		obj_frame_echo.setAttributeNode(CreateAttribute("id", "frame_echo"));
		document.getElementsByTagName("body")[0].appendChild(obj_frame_echo);
		obj_frame_echo.style.position = "absolute";
		obj_frame_echo.style.left = "10px";
		obj_frame_echo.style.top = "10px";
		obj_frame_echo.style.border = "1px solid RED";
		obj_frame_echo.style.padding = "4px";
		obj_frame_echo.style.color = "#00CC00";
		obj_frame_echo.style.backgroundColor = "#000000";
		obj_frame_echo.style.width = "320px";
		obj_frame_echo.style.maxHeight = "640px";
		obj_frame_echo.style.overflowY = "scroll";
		obj_frame_echo.style.overflowX = "scroll";
		obj_frame_echo.style.fontSize = "12px";
	}
	
	if(b_view_html)
	{
		obj_div_message.appendChild(document.createTextNode(str_message));
	}
	else
	{
		obj_div_message.innerHTML = str_message;
	}
	obj_div_message.appendChild(document.createElement("hr"));
	obj_div_message.style.fontFamily = "Courier New";

	obj_frame_echo.appendChild(obj_div_message);
	obj_frame_echo.scrollTop = obj_frame_echo.clientHeight;
}

function PrintJob()
{
    try
    {
        if(document.location != top.document.location)
        {
            m_obj_window_popup = window.open();
            m_obj_window_popup.document.location = document.location;
            setTimeout("Check_window_popup_for_print();", 500);
        }
        else
        {
            window.print();
        }
    }
    catch (err)
    {
        window.print();
    }
}
function Check_window_popup_for_print()
{
	var n_div_count = 0;
	
	try
	{
		n_div_count = m_obj_window_popup.document.getElementsByTagName("div").length;
	}
	catch(err) {}
	
	if(n_div_count < 2)
	{
		setTimeout("Check_window_popup_for_print();", 100);
	}
	else
	{
		setTimeout("m_obj_window_popup.print();m_obj_window_popup.close();", 100);
	}
}

function SendToFriendPopup( str_url )
{
    var obj_window = window.open(str_url, "_blank", "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=520,height=520");
    obj_window.focus();
}

function Checkbox_onClick( str_type_id, str_sub_type_id, str_join_sub_type_id )
{
	var i;
	var str_list_sub_type_id = new Array();
	str_list_sub_type_id = str_join_sub_type_id.split(",");
	for(i=0; i<str_list_sub_type_id.length; i++)
	{
		if(str_list_sub_type_id[i] != "")
		{
			document.getElementById("JobType" + str_list_sub_type_id[i]).checked = false;
		}
	}
	document.getElementById("JobType" + str_type_id).checked = !document.getElementById("JobType" + str_type_id).checked;
	document.getElementById(str_sub_type_id).style.display = document.getElementById("JobType" + str_type_id).checked ? "block" : "none";
	if(document.getElementById("JobType" + str_type_id).checked)
	{
		document.getElementById("JobTypeExpend" + str_type_id).src = "/images/treeview-expended.gif";
	}
	else
	{
		document.getElementById("JobTypeExpend" + str_type_id).src = "/images/treeview-colapsed.gif";
	}
}

var m_disabled_obj_list = new Array();
function Disabled_frame( obj_to_hide )
{
	var obj_loading_disabled;
	var obj_div_disabled;
	var obj_coords = Get_object_absolute_coords(obj_to_hide);
	if(obj_to_hide)
	{
		m_disabled_obj_list.push(obj_to_hide);
		
		if  (obj_to_hide.offsetHeight > 60)
		{
			obj_loading_disabled = document.createElement("img");
			obj_loading_disabled.src = "/images2/loading-16x16.gif";
			obj_loading_disabled.className = "C_DISABLED_LOADING";
			obj_loading_disabled.id = "disable_frame_loading_img_" + m_disabled_obj_list.length;
			obj_loading_disabled.style.top = obj_coords.top + "px";
			obj_loading_disabled.style.left = obj_coords.left + "px";

			obj_loading_disabled.style.marginTop = obj_to_hide.offsetHeight / 2 - 16 + "px";
			obj_loading_disabled.style.marginLeft = obj_to_hide.offsetWidth / 2 - 16 + "px";
		
			document.getElementsByTagName("body")[0].appendChild(obj_loading_disabled);
		}
		obj_div_disabled = document.createElement("div");
		obj_div_disabled.className = "C_DISABLED_DIV";
		obj_div_disabled.id = "disable_frame_div_shadow_" + m_disabled_obj_list.length;
		obj_div_disabled.style.top = obj_coords.top + "px";
		obj_div_disabled.style.left = obj_coords.left + "px";
		
		obj_div_disabled.style.height = obj_to_hide.offsetHeight + "px";
		obj_div_disabled.style.width = obj_to_hide.offsetWidth + "px";

		document.getElementsByTagName("body")[0].appendChild(obj_div_disabled);
		
		Set_object_opacity(obj_to_hide, 30);
		Set_object_opacity(obj_div_disabled, 10);
	}
}

function Enabled_frame()
{
	var i;
	for (i=0; i<m_disabled_obj_list.length; i++)
	{
		Set_object_opacity(m_disabled_obj_list[i], 100);
		document.getElementById("disable_frame_loading_img");
		try { document.getElementsByTagName("body")[0].removeChild(document.getElementById("disable_frame_loading_img_" + (i + 1))); } catch (Error){}
		document.getElementsByTagName("body")[0].removeChild(document.getElementById("disable_frame_div_shadow_" + (i + 1)));
	}

	m_disabled_obj_list = new Array();
}

function Set_object_sail( obj_frame, str_frame_id, b_sailed, n_sail_opacity )
{
	var obj_sail = document.getElementById(str_frame_id);
	var obj_coords = Get_object_absolute_coords(obj_frame);
	
	if(!obj_sail)
	{
		obj_sail = document.createElement("div");
		obj_sail.setAttributeNode(CreateAttribute("id", str_frame_id));
		obj_sail.setAttributeNode(CreateAttribute("frameoverid", obj_frame.id));
		document.getElementsByTagName("body")[0].appendChild(obj_sail);
		obj_sail.className = "C_FRAME_SAIL";
	}
	if(b_sailed)
	{	
		obj_sail.style.left = obj_coords.left + "px";
		obj_sail.style.top = obj_coords.top + "px";
		obj_sail.style.width = obj_frame.clientWidth + "px";
		obj_sail.style.height = obj_frame.clientHeight + "px";
		obj_sail.style.display = "block";
		Set_object_opacity(obj_sail, 100 - n_sail_opacity);
	}
	else
	{
		obj_sail.style.display = "none";
	}
}

function Set_tab( n_tab, n_tabs_length )
{
	var obj_tab;

	if(n_tab < 0) { n_tab = 0; }
	if(n_tab > n_tabs_length) { n_tab = n_tabs_length; }

	for (i=0; i<n_tabs_length; i++)
	{
		try {
			document.getElementById("tab_" + i).className = "";
			document.getElementById("frame_tab_" + i).style.display = "none";
		} catch (Error){}
	}
	
	document.getElementById("tab_" + n_tab).className = "C_TAB_ON";
	document.getElementById("frame_tab_" + n_tab).style.display = "block";

	return(true);
}

function Val( str_expression )
{
	var n_result = 0;
	var str_string = new String();
	
	try
	{
		if(str_expression != "")
		{
			str_string = str_expression;
			str_string = str_string.replace("'", "");
			while(str_string.substr(0, 2) == "00" || (str_string.substr(0, 1) == "0" && str_string.length > 1))
			{
				str_string = str_string.substring(1);
			}
			n_result = (str_string.indexOf(".") >= 0) ? eval(str_string + "0") : eval(str_string + ".0");
		}
	}
	catch(err) { }
	return(n_result);
}

function Initialize_frame_buttons_link()
{	
	var i,j;
	var obj_divs = document.getElementsByTagName("*");
	
	for (i=0; i < obj_divs.length; i++)
	{
		if (obj_divs[i].className.indexOf("C_FRAME_BUTTONS_LINKS") >= 0)
		{
			obj_anchors = obj_divs[i].getElementsByTagName("a");
			for (j=0; j<obj_anchors.length; j++)
			{
				var str_overicon	= obj_anchors[j].getAttribute("overicon");
				var str_highlight	= obj_anchors[j].getAttribute("highlight");
				var obj_span		= obj_anchors[j].getElementsByTagName("span")[0];
				
				if (str_highlight == "1")
				{
					obj_anchors[j].className = Trim(obj_anchors[j].className + " C_FRAME_BUTTONS_LINKS_SELECTED");
				}
											
				if (obj_span)
				{
					if (str_highlight == "1")
					{
						obj_span.className = str_overicon;
					}
					else if ((str_overicon != "") && str_overicon)
					{
						obj_anchors[j].onmouseout = new Function("this.getElementsByTagName('span')[0].className = '" + obj_span.className + "';");
						obj_anchors[j].onmouseover = new Function("this.getElementsByTagName('span')[0].className = '" + str_overicon + "';");
					}							
				}
			}
		}
	}
}

function Get_form_query_string( obj_form )
{
	var obj_params = new Array;
	var obj_elements = obj_form.getElementsByTagName("*");
	var i;

	for(i=0; i<obj_elements.length; i++)
	{
		if(obj_elements[i].name)
		{
			if((obj_elements[i].type != "checkbox" && obj_elements[i].type != "radio") || obj_elements[i].checked)
			{
				obj_params.push(obj_elements[i].name + "=" + escape(obj_elements[i].value));
			}
		}
	}
	return(obj_params.join("&").replace(/\+/g, "%2B"));
}

var m_obj_flakes;

function Snow()
{
	var C_FLAKES_COUNT_MAX = 150;
	var obj_frame_cloud = document.getElementById("frame_cloud");
	var obj_flakes;
	var obj_flake;
	var i;
	
	if(!obj_frame_cloud)
	{
		obj_frame_cloud = document.createElement("div");
		obj_frame_cloud.setAttributeNode(CreateAttribute("id", "frame_cloud"));
		document.getElementsByTagName("body")[0].appendChild(obj_frame_cloud);
		
		
		m_obj_flakes = new Array();
		m_obj_flakes.length = 20 + Math.round(Math.random() * (C_FLAKES_COUNT_MAX - 20));
		for(i=0; i<m_obj_flakes.length; i++)
		{
			m_obj_flakes[i] = new Object();
			m_obj_flakes[i].top = 0;
			m_obj_flakes[i].left = Math.round((document.documentElement.clientWidth - 16) * Math.random());
			m_obj_flakes[i].speed = 1 + Math.round(Math.random() * 30) / 10;
			if(navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.indexOf("MSIE 7") >= 0 || navigator.appVersion.indexOf("MSIE 8") >= 0))
			{
				m_obj_flakes[i].size = 16;
			}
			else
			{
				m_obj_flakes[i].size = 5 + Math.round(Math.random() * 11);
			}

			obj_flake = document.createElement("img");
			obj_flake.setAttributeNode(CreateAttribute("src", "http://www.jobup-host.ch/website/JobUP/images2/snowflake-16x16.gif"));
			//obj_flake.setAttributeNode(CreateAttribute("src", "http://www.jobup-host.ch/website/JobUP/images2/dropofwater-16x16.gif"));
			obj_flake.setAttributeNode(CreateAttribute("class", "C_OPACITY50"));
			obj_flake.style.width = m_obj_flakes[i].size + "px";
			obj_flake.style.height = m_obj_flakes[i].size + "px";
			obj_flake.style.position = "absolute";
			obj_flake.style.top = "0px";
			Set_object_opacity(obj_flake, 0);
			obj_flake.style.visibility = "hidden";
			obj_frame_cloud.appendChild(obj_flake);
		}
	}
	obj_flakes = obj_frame_cloud.getElementsByTagName("img");
	for(i=0; i<obj_flakes.length; i++)
	{
		m_obj_flakes[i].top = m_obj_flakes[i].top + m_obj_flakes[i].speed;
		
		if(m_obj_flakes[i].top > 140 - m_obj_flakes[i].size)
		{
			m_obj_flakes[i].top = 0;
			m_obj_flakes[i].left = Math.round((document.documentElement.clientWidth - 16) * Math.random());
		}
		
		if(m_obj_flakes[i].top < 20)
		{
			Set_object_opacity(obj_flakes[i], Math.round(m_obj_flakes[i].top * 80 / 20));
		}
		else if(m_obj_flakes[i].top > (140 - m_obj_flakes[i].size - 50))
		{
			Set_object_opacity(obj_flakes[i], 80 - Math.round((m_obj_flakes[i].top - (140 - m_obj_flakes[i].size - 50)) * 80 / 50));
		}
		
		obj_flakes[i].style.top = Math.round(m_obj_flakes[i].top) + "px";
		obj_flakes[i].style.left = m_obj_flakes[i].left + "px";
		obj_flakes[i].style.visibility = "visible";
	}
	setTimeout("Snow()", 60);
}

