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 SetParamSet(id) {
	var id1='param_lnk_'+id;
	var id2='param_set_'+id;

	var id3='param_lnk_def';
	var id4='param_set_def';
	var id5='param_lnk_pas';
	var id6='param_set_pas';
	var id7='param_lnk_act';
	var id8='param_set_act';

	itm1 = document.getElementById(id1);
	itm2 = document.getElementById(id2);
	itm3 = document.getElementById(id3);
	itm4 = document.getElementById(id4);
	itm5 = document.getElementById(id5);
	itm6 = document.getElementById(id6);
	itm7 = document.getElementById(id7);
	itm8 = document.getElementById(id8);

	if (!itm1) {
		// do nothing
	} else {
		// Reset all
		itm3.style.fontWeight = "normal";
		itm5.style.fontWeight = "normal";
		itm7.style.fontWeight = "normal";
		itm4.style.display = "none";
		itm6.style.display = "none";
		itm8.style.display = "none";
		// Set new
		itm1.style.fontWeight = "bold";
		itm2.style.display = "";
	}
}
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);
}