// 6.50

///////////////////
// externallinks.js

function ExternalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0;i<anchors.length;i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href")&&anchor.getAttribute("rel")) {
       if (anchor.getAttribute("rel").match(/(external([a-zA-Z0-9_-]+))/i)) {
          var _target=anchor.getAttribute("rel").match(/(external([a-zA-Z0-9_-]+))/i);
          anchor.target = _target[2];
       }
    }
  }
}


///////////////
// event.js

function attachEventListener(target, eventType, functionRef, capture) {
	if (typeof target.addEventListener != 'undefined') {
	   target.addEventListener(eventType, functionRef, capture);
	} else
	if (typeof target.attachEvent != 'undefined') {
	   target.attachEvent('on' + eventType, functionRef);
	} else {
	   return false;
	}
	return true;
}

function removeEventListener(target, eventType, functionRef, capture){
	if (target.removeEventListener){
	   target.removeEventListener(eventType, functionRef, capture);
	   return true;
	} else if (target.detachEvent){
	   var r = target.detachEvent("on"+eventType, functionRef);
	   return r;
	} else {
	   return false;
	}
}

//////////////
// showhide.js

function ShowHideDiv(div_id, span) {
  var _style=(span===true) ? 'inline' : 'block';
  var obj=document.getElementById(div_id);
  obj.style.display=(obj.style.display=='none') ? _style : 'none';
  return ((obj.style.display=='none') ? false : true);
}

function ShowDiv(div_id, span) {
  var _style=(span===true) ? 'inline' : 'block';
  document.getElementById(div_id).style.display=_style;
}

function HideDiv(div_id) {
  document.getElementById(div_id).style.display='none';
}


/////////////
// cookie.js

function SetCookie(name,value,minutes) {
  if (minutes) {
    var date = new Date();
    date.setTime(date.getTime()+(minutes*60*1000));
    var expires = "; expires="+date.toGMTString();
  } else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}


//////////////
// bookmark.js

function SetBookmark(title,url) {
  // firefox
  if (window.sidebar) window.sidebar.addPanel(title, url, ""); else
  // opera
  if (window.opera && window.print) {
     var elem = document.createElement('a');
     elem.setAttribute('href',url);
     elem.setAttribute('title',title);
     elem.setAttribute('rel','sidebar');
     elem.click();
  } else
  // msie, wie
  if (document.all) window.external.AddFavorite(url, title);
}


///////////////////
// pop up functions

function pop(plik,w,h) {
	var okno = null;
	if (window.screen) {
		var aw = screen.availWidth;
		var ah = screen.availHeight;
	} else {
		var aw=640;
		var ah=480;
	}
	var dane="width="+w+",height="+h+",left="
	+(aw-w)/2+",top="
	+(ah-h)/2
	+",toolbar=no,location=no,directories=no,"
	+"status=no,menubar=no,"
	+"scrollbars=yes,resizable=no";
	okno=window.open(plik, 'pop', dane);
}

function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+' onclick="self.close()">');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function openFlashWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH='+imageWidth+' HEIGHT='+imageHeight+'>');
	newWindow.document.write('  <PARAM NAME=movie VALUE='+imageName+'>');
	newWindow.document.write('  <PARAM NAME=quality VALUE=high>');
//	newWindow.document.write('  <PARAM NAME=wmode VALUE=transparent>');
	newWindow.document.write('  <PARAM NAME=bgcolor VALUE=#FFFFFF>');
	newWindow.document.write('  <EMBED src='+imageName+' quality=high wmode=transparent bgcolor=#FFFFFF  WIDTH='+imageWidth+' HEIGHT='+imageHeight+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
	newWindow.document.write('</OBJECT>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}


////////////////
// attach events

attachEventListener(window, "load", ExternalLinks, false);