var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
cm=null;
hide_delay=100;
tstat=0;
// Определяем браузер пользователя
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;
var System=
	{
		object_del:function (name)
							{
								document.body.removeChild(document.getElementById(name));
							},
		SerchElement:function (id)
							{
								if(document.getElementById) return document.getElementById(id);
								if(document.all) return document.all(id);
								if(document.layers) return document.layers(id);
							},
		object_position:function (object)
						{
							if(typeof object != 'object')var object = System.SerchElement(object);
							var ww = object.offsetWidth
							var hh = object.offsetHeight;
							for (var xx = 0,yy = 0; object != null; xx += object.offsetLeft,yy += object.offsetTop,object = object.offsetParent);
							return {Left:xx, Top:yy, Right:xx + ww, Bottom:yy + hh}
						},
		LoadPage:function(url,data,panel)
			{
								var desk_panel=System.SerchElement(panel);
								var request=Ajax.getTransport();
								
								if(!request) return false;
								
								request.onreadystatechange  = function() 
																	{
																	desk_panel.innerHTML=request.status;	
																	if (request.readyState == 4)
																		{
																		if (request.status == 200)
																	    	{
																				desk_panel.innerHTML=request.responseText;
																			}
																	   		else
																	    		{
																	    		if(request.status==404)Dialog.alert("ERROR 404", 
               {windowParameters: {className: "alphacube", width:300, height:100}, okLabel: "close", 
                ok:function(win) {debug("validate alert panel"); return true;}, cancel:function(win) {debug("validate cancel panel"); return true;}});
																				}
																		request.abort();		
																		}
																	};
																
    							request.open('POST', url, true);
    							if (request.setRequestHeader) 
									{
										request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
										request.setRequestHeader("Referer",location.href);
									}
    						request.send(data);
							}
	}
// время
var Date_Time=
	{
		timestr:"00:00:00",
		tid:0,
		pause:0,
		to:null,
		bcount:null,
		tcount:null,
		time:function (rotate_time) 
		{
			tid=window.setTimeout("Date_Time.time(1)",to);
			today = new Date()
			if(today.getMinutes()<10)pad = "0";
			else pad = "";
			if(today.getSeconds()<10)pads = "0";
			else pads = "";
			timestr=today.getHours()+":"+pad+today.getMinutes()+":"+pads+today.getSeconds();
			System.SerchElement("time_blok").innerHTML = timestr;
			window.clearTimeout(tid);
			tid=window.setTimeout("Date_Time.time()",to);
		},
		cleartids:function () {window.clearTimeout(tid);},
		start:function (start_time)
		{
			f=start_time;
			to=60;
			Date_Time.time(start_time);
		}
	
	}

var blok_sharp_top,blok_sharp_left;
function blok_sharp(block,comand,img)
{
	if(System.SerchElement(block).style.position=="")
	{
	blok_sharp_left = System.object_position(block).Left;
		blok_sharp_top = System.object_position(block).Top;	
	//	System.SerchElement("m_x").value=System.SerchElement(block).style;
		System.SerchElement(block).style.position="absolute";
		System.SerchElement(block).style.top=System.object_position("main_tab").Top+"px";;
		System.SerchElement(block).style.left=System.object_position("main_tab").Left+"px";
		System.SerchElement(block).style.width=System.object_position("main_tab").Right+"px";
		System.SerchElement(block).style.height=System.object_position("main_tab").Bottom+"px";;
		img.src="engine/images/sim.png";	
	}
	else
	{
		blok_sharp_left = System.object_position(block).Left;
		blok_sharp_top = System.object_position(block).Top;	
	//	System.SerchElement("m_x").value=System.SerchElement(block).style;
		System.SerchElement(block).style.position="";
		System.SerchElement(block).style.top=blok_sharp_top;
		System.SerchElement(block).style.left=blok_sharp_left;
		System.SerchElement(block).style.width="100%";
		System.SerchElement(block).style.height="100%";
		img.src="engine/images/slim.png";	
	}
    	
		

		
		
}





