var the_cookie = "users_screen_width="+ screen.width;
var the_cookie = the_cookie;
var toolbar_timer=new Array;
var toolbar_is_open=false;
document.cookie=the_cookie

function createnewXMLHttpRequest() {
	try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
	try { return new XMLHttpRequest(); } catch(e) {}
	alert("XMLHttpRequest not supported");
	return null;
}
function CreateMText(a1,a2,a3){
	document.write(a3+'@'+a2+'.'+a1);
}
function CreateMLink(a1,a2,a3){
	window.location='mailto:'+a3+'@'+a2+'.'+a1;
}
function ChangeNodeType(cid){
	var curent='tools_n_'+cid;
	var curent_val=itm1 = document.getElementById(curent).innerHTML;
	if (curent_val=="D") {
		var next_val="S";
	}
	if (curent_val=="S") {
		var next_val="M";
	}
	if (curent_val=="M") {
		var next_val="O";
	}
	if (curent_val=="O") {
		var next_val="D";
	}
	var resp = confirm('Vai mainīt elementam '+cid+' attēlošanas veidu no '+curent_val+' uz '+next_val+'?');
	if (resp) {
		window.location='index.php?cmd=chgnodetype&cid='+cid+'&tt='+next_val;
	}
}
/* Parbauda vai jatver dota adrese paradot doto tekstu */
function VerifyAction(vertxt,verurl) {
	var resp = confirm(vertxt);
	if (resp==true) {
		window.location=verurl;
	}
}
var _POPUP_FEATURES = 'location=0,scrollbars=1,statusbar=0,menubar=0,resizable=1,width=400,height=300';

function raw_popup(url) {
    features = _POPUP_FEATURES;
    target = '_blank';
  var theWindow =
    window.open(url, target, features);
  theWindow.focus();
  return theWindow;
}

function ShowToolbarDrop(cid){
	clearTimeout(toolbar_timer[cid]);
	$('#toolbar_cont_'+cid).show();
}
function HideToolbarDrop(cid){
	toolbar_timer[cid]=window.setTimeout(function() {
	$('#toolbar_cont_'+cid).hide();
	},200);
}
$(document).ready(function() {
	$('a.show_fancybox').fancybox({hideOnContentClick: false,frameWidth:800,frameHeight:600,titleShow:false});
	if ($.browser.msie && $.browser.version.substr(0,1)<8) {
		var zIndexNumber = 1000;
		$('span.toolbar, span.toolbarp').each(function() {
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
	}
});
