﻿var the_cookie = "users_screen_width="+ screen.width;
var the_cookie = the_cookie;
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 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 ShowToolbar(id1) {
	if (document.getElementById) {
		itm1 = document.getElementById(id1);
	} else if (document.all){
		itm1 = document.all[id1];
	} else if (document.layers){
		itm1 = document.layers[id1];
	}
	if (!itm1) {
		// do nothing
	} else {
		itm1.style.display = "";
	}
}
function HideToolbar(id1) {
	if (document.getElementById) {
		itm1 = document.getElementById(id1);
	} else if (document.all){
		itm1 = document.all[id1];
	} else if (document.layers){
		itm1 = document.layers[id1];
	}
	if (!itm1) {
		// do nothing
	} else {
		itm1.style.display = "none";
	}
}
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';

	if (document.getElementById) {
		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);
	} else if (document.all){
		itm1 = document.all[id1];
		itm2 = document.all[id2];
		itm3 = document.all[id3];
		itm4 = document.all[id4];
		itm5 = document.all[id5];
		itm6 = document.all[id6];
		itm7 = document.all[id7];
		itm8 = document.all[id8];
	} else if (document.layers){
		itm1 = document.layers[id1];
		itm2 = document.layers[id2];
		itm3 = document.layers[id3];
		itm4 = document.layers[id4];
		itm5 = document.layers[id5];
		itm6 = document.layers[id6];
		itm7 = document.layers[id7];
		itm8 = document.layers[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 = "";
	}
}

