function showpic(lay) {
var width  = 1;
var height = 1;
var scrolly = 1;

if (document.documentElement && document.documentElement.scrollTop) {
scrolly = document.documentElement.scrollTop;
} else if(document.body && document.body.scrollTop) {
scrolly = document.body.scrollTop;
}

if (typeof(window.innerWidth)=='number'){
width  = window.innerWidth;
height = window.innerHeight;
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
width  = document.documentElement.clientWidth;
height = document.documentElement.clientHeight;
} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
width  = document.body.clientWidth;
height = document.body.clientHeight;
}

document.getElementById(lay).style.top=height/2+scrolly-50;
document.getElementById(lay).style.left= 10; // width/2-100;
document.getElementById(lay).style.visibility = 'visible';
}
function hidepic(lay) {
document.getElementById(lay).style.visibility = 'hidden';
}

function upweb_ajax(file){

	this.AjaxFailedAlert = "Error brouser function";
	this.requestFile = file;
	this.method = "POST";
	this.URLString = "";
	this.encodeURIString = true;
	this.loading_fired = 0;

showpic("loading");
this.createAJAX = function() {

try {
this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (err) {
this.xmlhttp = null;
}
}
if(!this.xmlhttp && typeof XMLHttpRequest != "undefined")
this.xmlhttp = new XMLHttpRequest();
if (!this.xmlhttp){
this.failed = true; 
}
};

this.encVar = function(name, value){
	var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
return varString;
}

this.setVar = function(name, value){
if (this.URLString.length < 3){
this.URLString = name + "=" + value;
} else {
this.URLString += "&" + name + "=" + value;
}
}
	
this.encodeURLString = function(string){
varArray = string.split('&');
return varArray.join('&');
}

this.encodeVAR = function(url){
url = url.toString();
var regcheck = url.match(/[\x90-\xFF]/g);
if ( regcheck )	{
for (var i = 0; i < i.length; i++) {
url = url.replace(regcheck[i], '%u00' + (regcheck[i].charCodeAt(0) & 0xFF).toString(16).toUpperCase());
}
}
return escape(url).replace(/\+/g, "%2B");
}

this.runAJAX = function(urlstring){

if(this.failed && this.AjaxFailedAlert){ 
if(ajax.method=='GET') {
location=ajax.requestFile;
} else {
alert(this.AjaxFailedAlert);
}
return true;
} else {
if (urlstring){ 
if (this.URLString.length){
this.URLString = this.URLString + "&" + urlstring; 
} else {
this.URLString = urlstring; 
}
}
if(this.encodeURIString){
var timeval = new Date().getTime();
this.URLString = this.encodeURLString(this.URLString);
this.setVar("rndval", timeval);
}

if(this.element) {
this.elementObj = document.getElementById(this.element);
}

if(this.xmlhttp) {
var self = this;
if (this.method == "GET") {
var totalurlstring = this.requestFile + "?" + this.URLString;
this.xmlhttp.open(this.method, totalurlstring, true);
} else {
this.xmlhttp.open(this.method, this.requestFile, true);
}
if(this.method == "POST"){
this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
}

this.xmlhttp.send(this.URLString);
this.xmlhttp.onreadystatechange = function() {
if(self.xmlhttp.readyState==4){
self.response = self.xmlhttp.responseText;
if (self.elementObj) {
var elemNodeName = self.elementObj.nodeName;
elemNodeName.toLowerCase();
if (self.response == 'error') {
alert('Error page');
} else {
self.elementObj.innerHTML = self.response;
}
}
hidepic("loading");
self.URLString = "";
}
};
}
}

};

this.createAJAX();
}