
document.writeln( "<form name=\"virtualLoginForm\" method=\"post\" >"+
"<input type=\"hidden\" id=\"user_login_inmyform\" name=\"login\" value=\"\">"+
"<input type=\"hidden\" id=\"user_password_inmyform\" name=\"password\" value=\"\">"+
"</form>" );
/*
 ********************************************************
 * FUNCTION: sessionTimer()
 *********************************************************
 */
function sessionTimer() {
  // session timeout in milliseconds (30 min)
  sessionTimeout = 1800000;
  setTimeout("processLogout()",sessionTimeout);
}


function processLogout() {
  parent.location.href=getContextPath()+'/admin/adminLogout.do';
}

function publicSessionTimer() {
  // session timeout in milliseconds (30 min)
  sessionTimeout = 1800000;
  setTimeout("processPublicLogout()",sessionTimeout);
}


function processPublicLogout() {
	parent.location.href= getContextPath()+'/logout.do';
}
/*
 ********************************************************
 * FUNCTION: setInnerHTML(id,value)
 *
 *set innerHTML for element identified by id
 *********************************************************
 */

function setInnerHTML(id,value){
	if(document.getElementById(id)){
		document.getElementById(id).innerHTML = value;
	}
}

function setValueHTML(id,value){
	if(document.getElementById(id)){
		document.getElementById(id).value = value;
	}
}

function initRequest(req) {
  if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  return req;
}

function getElementValue(element,valName) {
  if (element.getElementsByTagName(valName)[0].firstChild != null) {
    retValue =  element.getElementsByTagName(valName)[0].firstChild.data;
  }else {
    retValue =  "";
  }
  return retValue;
}

function getValue(req,valName) {
  if (req.responseXML.getElementsByTagName(valName)[0].firstChild != null) {
    retValue =  req.responseXML.getElementsByTagName(valName)[0].firstChild.data;
  }else {
    retValue =  "";
  }
  return retValue;
}

function hideDiv(id) {
	if (document.getElementById(id)) {
  	document.getElementById(id).style.visibility = "hidden";
  }
}

var mouseXPos = 0;
var mouseYPos = 0;
document.onmousemove = mouseMoved;
// MouseMovement-Event-Handler
function mouseMoved(e)
{
  var indexBrowser = ""+getNavigatorIndex();
  switch (indexBrowser)
  {
  case "1" : {
              // Internet-Explorer:
              var isStrictMode = document.compatMode && document.compatMode != 'BackCompat' ? true : false;
              var scrollX = isStrictMode ? document.documentElement.scrollLeft : document.body.scrollLeft;
              var scrollY = isStrictMode ? document.documentElement.scrollTop : document.body.scrollTop;
              mouseXPos = window.event.clientX + scrollX;
              mouseYPos = window.event.clientY + scrollY;
              break;
              }
  case "2" : {
              //Netscape
              mouseXPos = e.pageX;
              mouseYPos = e.pageY;
              break;
              }
  case "3" : {
              //Opera
              var isStrictMode = document.compatMode && document.compatMode != 'BackCompat' ? true : false;
              var scrollX = isStrictMode ? document.documentElement.scrollLeft : document.body.scrollLeft;
              var scrollY = isStrictMode ? document.documentElement.scrollTop : document.body.scrollTop;
              mouseXPos = window.event.clientX;
              mouseYPos = window.event.clientY;
              break;
              }
  default : alert("Navigateur non reconnu !");
            break;
  }
}
//return navigator index used to get cursor coordinates
// 1 : Internet Explorer
// 2 : Netscape
function getNavigatorIndex() {
  var browser = ""+navigator.appName;
  if (browser.indexOf("Microsoft") > -1) {
    return 1;
  }
  if (browser.indexOf("Netscape") > -1) {
    return 2;
  }
  if (browser.indexOf("Opera") > -1) {
    return 3;
  }
}
/**
* Returns the absolute X and Y positions of an object.
* @param {HTMLObject} obj HTML Object.
* @return {Object} Returns an accessor with .x and .y values.
*/
function getXY(obj){
	var curleft = 0;
	var curtop = 0;
	var border;
	var padding;
	if (obj.offsetParent){
		do
		{
		// XXX: If the element is position: relative we have to add borderWidth
			if (getStyle(obj, 'position') != 'absolute'){
				if (border = getStyle(obj, 'border-top-width')) curtop += parseInt(border);
				if (border = getStyle(obj, 'border-left-width')) curleft += parseInt(border);
				
				if (padding = getStyle(obj, 'padding-top')) curtop += parseInt(padding);
				if (padding = getStyle(obj, 'padding-left')) curleft += parseInt(padding);
			}
		curleft += obj.offsetLeft;
		curtop += obj.offsetTop;
		}while (obj = obj.offsetParent)
	}
	else if (obj.x){
		curleft += obj.x;
		curtop += obj.y;
	}
	return {'x': curleft, 'y': curtop};
}
/**
 * Returns the specified computed style on an object.
 * @param {HTMLObject} obj HTML Object
 * @param {String} styleProp Property name.
 * @return {Mixed} Computed style on object.
 */
function getStyle(obj, styleProp)
{
  if (obj.currentStyle)
    return obj.currentStyle[styleProp];
  else if (window.getComputedStyle)
    return document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp);
}

function setBackgroundColor(id , color) {
	oldColor = document.getElementById(id).bgColor;
	document.getElementById(id).bgColor = color;
	setTimeout("resetBackgroundColor('"+id+"','"+oldColor+"')",400);
}

function resetBackgroundColor(id , color) {
	document.getElementById(id).bgColor = color;
}

function setFontColor(id , color) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.color = color;
	}
}

function showEndDiv(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.visibility = "visible";
	}
}

function showDivWithMousePosition(id) {
		if (document.getElementById(id)) {
			with ( document.getElementById(id).style )
			{
				left = mouseXPos + "px";
				top  = mouseYPos + "px";
				visibility = "visible";
			}
		}
}
document.writeln( "<div id=\"zoom\">leer</div>" );

with ( document.getElementById("zoom").style )
{
  width = "700px"; height= "250px" ; top = "0px"; left = "0px"; zIndex = 99999; 
  visibility = "hidden"; position = "absolute";overflow = "auto";
  backgroundColor = "#FFFFFF"; color = "#000000"; cursor ="pointer";  paddingTop = "3px";
  border = "1px solid #000000"; fontSize = "8pt"; fontFamily = "Verdana,Arial";
}

var req;

function getDescription(param) {
  var now = new Date();
  var url =getContextPath()+"/DescriptionAuctionServlet?now="+now+"&auction_id="+param;
  req = initRequest();
  req.onreadystatechange = showDescription;
  req.open("GET", url, true);
  req.send(null);
}
function showDescription() {
  if (req.readyState == 4) {
    if (req.status == 200) {
      if (req.responseXML.getElementsByTagName("description")[0] != null) {
        retValue =  getValue(req,'description');
				document.getElementById("zoom").innerHTML = (retValue);
				Tip(document.getElementById("zoom").innerHTML,WIDTH, 632, SHADOW, true, FADEIN, 50, FADEOUT, 50, STICKY, 1, CLOSEBTN, true, CLICKCLOSE, false);
			}
    }
  }
} 

function showBigImage(url) {
	document.getElementById("zoom").innerHTML = "<img src=\""+url+"\">";
	Tip(document.getElementById("zoom").innerHTML,WIDTH, 400, SHADOW, true, FADEIN, 50, FADEOUT, 50, STICKY, 1, CLOSEBTN, true, CLICKCLOSE, false);
}
var ajax_path;
function getAnnounceDetails(param) {
var now = new Date();
  var url =getContextPath()+"/AnnounceDetailsServlet?now="+now+"&announce_id="+param;
  ajax_path="/showDescription_Announce?announce_id="+param;
  req = initRequest();
  req.onreadystatechange = showAnnounceDescription;
  
  req.open("GET", url, true);
  req.send(null);
}
function showAnnounceDescription() {
  if (req.readyState == 4) {
    if (req.status == 200) {
     if (req.responseXML.getElementsByTagName("description")[0] != null) {
        acceleration = new Array();
        retValue =  getValue(req,'description');
        Tip(retValue,WIDTH, 632, SHADOW, true, FADEIN, 50, FADEOUT, 50, STICKY, 1, CLOSEBTN, true, CLICKCLOSE, false);
		pageTracker._trackPageview(ajax_path); 
		}
    }
  }
}


function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
