function ml(str, op){
	var key = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890-_.@';
	var temp = '';
	var j = Math.round(str.length / 2)
	for (var i = 0; i < str.length; i++){
		var k = key.indexOf(str.charAt(i));
		temp += k >= 0 ? key.charAt((66 + k - j) % 66) : str.charAt(i);
		j++;
	}
	if (op == 1) location.href = 'mailto:' + temp;
	else document.writeln(temp);
}
function ShowFoto(img){
	var foto1= new Image();
	var sc = 0;
	if (img.src.indexOf('sc_shadow.gif') > 0) return;
	if (img.src.indexOf('sc_v') > 0) {sc = 1; foto1.src = img.src.replace(/s.gif$/, '.gif');
		if (img.src.indexOf('sc_v107') > 0){
			foto1.width = 360; foto1.height = 277;
		}
		else {
			foto1.width = 400; foto1.height = 277;
		}
	}
	else foto1.src = img.src;
	if(sc || (foto1.width != 0)&&(foto1.height != 0) && (foto1.width > img.width || foto1.height != img.height)){
		width=foto1.width;
		height=foto1.height;
		var scroll = '';
		if (width > screen.width) {width = screen.width; scroll = ',scrollbars=yes';}
		if (height > (screen.height - 80)) {height = screen.height - 80; scroll = ',scrollbars=yes';}
		size="width="+width+",height="+height+scroll+", resizeable=yes, status=no"
		newwin=window.open('',"",size);
		newwin.document.title = img.alt ? 'Sypex: ' + img.alt : 'Sypex';
		newwin.document.body.style.margin = '0px';
		newwin.document.body.innerHTML = '<DIV STYLE="width: 100%; height: 100%; overflow: auto;"><IMG SRC=' + foto1.src + '></DIV>';
	}
}

function CheckFoto(img){
	var foto1= new Image();
	foto1.src = img.src;
	if((foto1.width != 0)&&(foto1.height != 0) && (foto1.width > img.width || foto1.height != img.height)){
		img.style.cursor = 'pointer';
	}
}
var ajax = {
	post: function(url, onload, data, sync){
		sync = sync || true;
		data = data || null;
		onload = onload || function(){};
		var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : null);
		if (!xhr){
			alert('Not work Ajax');
		}
		else{
	        xhr.open('POST', url, sync);
			xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	        if (sync) {
	            xhr.onreadystatechange = function(){
					if (xhr.readyState == 4) {
						if (xhr.status == 200) {
							eval(xhr.responseText);
							onload.call(xhr);
						}
					}
				}
	        }
	        xhr.send(obj2php(data));
        }
	}
};
function obj2php(obj, depth){
	var s = '';
	depth = depth || '';
	for(var o in obj){
		s += typeof obj[o] == 'object' ? obj2php(obj[o], depth + '[' + o + ']') : 'ajax'+ depth + '[' + o + ']=' + encodeURIComponent(obj[o]) + '&';
	}
	return s;
}
