/**
    $Id: Maxpho Commerce, v 8.5.0, Tue 04 Dec 2007 04:53:24 PM CET $

    Maxpho Company, Web application company
    http://www.maxpho.com

    Copyright (c) 2008 Maxpho, Co.
    All right reserved.
*/


function getObject(name) { 	
	if (document.layers) return eval('document.' + name);
	if (document.getElementById) return document.getElementById(name);
	if (document.all) return eval('document.all.' + name);
	return false; 
}

var http;

function loadXMLDochttp(url, functionCall) {
  http = getHTTPObject();

  if (http) {
    http.onreadystatechange = functionCall;
    http.open("GET", url, true);
    http.send("");
  }
}
function loadXMLDoc(url, functionCall, http) {
	if (http) {
		http.open("GET", url, true);
		http.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");
		http.send(null);
		http.onreadystatechange = function(){
			if (http.readyState == 4 && http.status == 200) { 
				eval(functionCall);
			}
		}
	}
}

function loadXMLDocPost(url, functionCall, http, postValue) {
	if (http) {
		http.open("POST", url, true);
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http.setRequestHeader("Content-length", postValue.length);
		http.setRequestHeader("Connection", "close");
		http.send(postValue);
		http.onreadystatechange = function(){
			if (http.readyState == 4 && http.status == 200) { 
				eval(functionCall);
			}
		}
	}
}

function getHTTPObject() {
  var xmlhttp;

  // Internet Explorer
  try{
	  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e){
	  try{
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	  catch (e){
		  xmlhttp = false;
	  }
  }

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	  try {
		  xmlhttp = new XMLHttpRequest();
	  } catch (e) {
		  xmlhttp = false;
	  }
  }

  return xmlhttp;
}

function getKeyCode(evt) {
  if (evt) {
    return evt.keyCode;
  }

  if (window.event) {
    return window.event.keyCode;
  }
}

function getEventSource(evt) {
  if (evt) {
    return evt.target;
  }

  if (window.event) {
    return window.event.srcElement;
  }
}

function cancelEvent(evt) {
  if (evt) {
    evt.preventDefault();
    evt.stopPropagation();
  }

  if (window.event) {
    window.event.returnValue = false;
  }
}

function hideDiv(obj) {
  if (obj.style.visibility == 'visible') {
    obj.style.visibility = 'hidden';
    obj.style.display = 'none';
  }
}

function showDiv(obj) {
  if (obj.style.visibility != 'visible') {
    obj.style.visibility = 'visible';
    obj.style.display = 'inline';
  }
}

function isDivVisible(obj) {
  return (obj.style.visibility == 'visible');
}

function urlEncode(string) {
  if (window.encodeURIComponent) {
    return encodeURIComponent(string);
  }

  return escape(string);
}

function urlDecode(string) {
  if (window.decodURIComponent) {
    return decodeURIComponent(string);
  }

  return unescape(string);
}
