var start = document.cookie.indexOf(cookieName);
if (start == -1){
  var cookieName = 'roStat';
  document.cookie = cookieName+'='+screen.colorDepth+"|"+screen.width+'; path=/';
}

function changeClass (elem) {
  if (elem.className != 'elemh') {
    elem.className="elemv";
  } else {
    elem.className="elemh";
  }
}

function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
	map.setCenter(new GLatLng(50.084849, 19.903107), 15);
	map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
	var marker = new GMarker(new GLatLng(50.083849, 19.901900)); // obiekt szpilki
	map.addOverlay(marker); // postawienie szpilki na mapie
	var info =  "<b>ROBOBAT joint-venture sp. z o.o.</b><br>ul. Radzikowskiego 47A<br>31-315 Krak&#243w";
 	GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(info);});
 	map.addOverlay(marker);

 }}

function changepane (paneno,time) {
 
  for(var i = 0; i < 2; i++) {
    tab = document.getElementById('tab'+(i+1)); 
    pane = document.getElementById('pane'+(i+1)); 
    if (i+1 == paneno) {
      tab.className = 'tabact';
      pane.className = 'elemv';
    } else {
      tab.className = 'tab';
      pane.className = 'elemh';
    }
  }
  
}

var histold = 1;

function histshow(nr) {
  nr = parseFloat(nr);

  if (histold != nr) {
    tab_new = document.getElementById('histtab_'+nr);
    pan_new = document.getElementById('hist_'+nr);
    
    tab_new.className = 'histyearact';
    pan_new.className = 'histvisible';

    tab_old = document.getElementById('histtab_'+histold);
    pan_old = document.getElementById('hist_'+histold);
  
    tab_old.className = 'histyear';
    pan_old.className = 'histhidden';
  }
  histold = nr;
}

function putFlash( path, width, height) {
  document.write( "<object width=\""+ width +"\" height=\""+ height +"\" data=\""+ path +"\" type=\"application/x-shockwave-flash\">");
  document.write( "<param value=\""+ path +"\" name=\"movie\" />");
  document.write( "<param value=\"high\" name=\"quality\" />");
  document.write( "<param value=\"transparent\" name=\"wmode\" /></object>");
}

function OpenVideo ( sPath, dx, dy, lang) {
  if(sPath.substring(0, 3)=="all") {
    if(sPath.split("_")[1]!="rcad") {
      var prod = sPath.split("_")[1];
    } else if(sPath.split("_")[1]=="rcad") {
      var prod = sPath.split("_")[1]+"_"+sPath.split("_")[2];
    }
    var name = sPath.split("/")[1];
    var sPath = prod+"/"+name;
  }
  var frm = document;
  var str = new String(document.URL);
  try {
    parent.window.external.ShellExecute('bin/CamPlay.exe', "/MX /M /T /S ../film_avi/"+lang+"/"+sPath+'.avi');
  } catch(er) {
    var oImgView = open("http://www.robotoffice.com/film_str/"+lang+"/0"+lang+"_player_swf.htm?"+sPath+','+dx +','+dy, '', 'Left = 0, Top = 0, Width = ' + dx + ', Height = ' + dy + ', ScrollBars = no, status=no, Toolbar = no, titlebar = no, resizable = no;');
    oImgView.focus();
  }
  return false;
}

function shDesc (elem) {
  var expanded = document.getElementById(elem); 
  if (expanded.className != 'sho_desc') {
    expanded.className="sho_desc";
  } else {
    expanded.className="hid_desc";
  }
}

function showDesc (elem) {
  var expanded = document.getElementById(elem); 
  expanded.className="sho_desc";
}

function hideDesc (elem) {
  var expanded = document.getElementById(elem); 
  expanded.className="hid_desc";
}

function updatestate(countryid) {
  var url = '/n/xml/regions/'+countryid;
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
      http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
      http_request.overrideMimeType('text/xml');
    }
  } else if (window.ActiveXObject) { // IE
    try {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  if (!http_request) {
    alert('Giving up :( Cannot create an XMLHTTP instance');
    return false;
  }
  http_request.onreadystatechange = alertContents;
  http_request.open('GET', url, true);
  http_request.send(null);
}
function alertContents() {
  if (http_request.readyState == 4) {
    if (http_request.status == 200) {
      var xmldoc = http_request.responseXML;
      var root_node = xmldoc.getElementsByTagName('regions')[0];
      var opt = document.FormRegisterFreware.f_state.options;
      var sel = document.FormRegisterFreware.f_state;
      var selstate = document.FormRegisterFreware.f_stateid_h.value;

      var tmpArayVal = new Array(2);
      var tmpArayTxt = new Array(2);
      var l = opt.length;
      if (l > 0) {
        tmpArayVal[0] = opt[0].value;
        tmpArayTxt[0] = opt[0].text;

        tmpArayVal[1] = opt[l-1].value;
        tmpArayTxt[1] = opt[l-1].text;
        
      }

      opt.length=0;
      //opt.length++;
      opt[0]= new Option(tmpArayTxt[0],tmpArayVal[0]);
      for(var i = 0; i < root_node.childNodes.length; i++) {
        //opt.length++;
        opt[i+1]= new Option(root_node.childNodes[i].firstChild.nodeValue,root_node.childNodes[i].attributes[0].nodeValue);
        if (selstate == root_node.childNodes[i].attributes[0].nodeValue) opt[i+1].selected = true;
      }
      //opt.length++;
      opt[i+1]= new Option(tmpArayTxt[1],tmpArayVal[1]);
      document.FormRegisterFreware.f_stateoth.disabled = true;
      document.FormRegisterFreware.f_stateoth.value = '';
    } else {
      alert('There was a problem with the request.');
    }
  }
}
function othstate() {
  var opt = document.FormRegisterFreware.f_state.options;
  if (opt[document.FormRegisterFreware.f_state.selectedIndex].value == "00") {
    document.FormRegisterFreware.f_stateoth.disabled = false;
    document.FormRegisterFreware.f_stateoth.focus();
  } else {
    document.FormRegisterFreware.f_stateoth.disabled = true;
    document.FormRegisterFreware.f_stateoth.value = '';
  }
}

function ukryj (x)
{
   _txt = document.getElementById(x);
   
   if (_txt.className=="widoczny")
   {
      _txt.className="ukryty";
   } 
   else
   { 
      _txt.className="widoczny";
   } 
}


