//flash printer
var agent = navigator.userAgent.toLowerCase();
var myVersion = parseFloat(navigator.appVersion);
var isIE = ((agent.indexOf('msie') != -1) && (agent.indexOf('opera') == -1));
var isOP = (agent.indexOf('opera') != -1);
var isNN = (navigator.appName.toLowerCase() == 'netscape');
var isWin = ((agent.indexOf("win") != -1) || (agent.indexOf("16bit") != -1));
var ieVersion = 0;
if(navigator.appVersion.indexOf("MSIE") !=- 1) {
	temp = navigator.appVersion.split("MSIE");
	ieVersion = parseFloat(temp[1]);
}
var a, s, i;
var maxFade = 70;
function pswf(f, w, h, p) {
	if(p ==  undefined) p = '';
	var out = '<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">';
	out += '<param name="movie" value="'+mypath+'themes/hires2/images/'+f+'.swf'+p+'" />';
	out += '<param name="quality" value="high" />';
	out += '<param name="menu" value="false" />';
	out += '<param name="wmode" value="transparent" />';
	out += '<embed wmode="transparent" width="'+w+'" height="'+h+'" src="'+mypath+'themes/hires2/images/'+f+'.swf'+p+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" type="application/x-shockwave-flash"></embed>';
	out += '</object>';
	
	document.write(out);
}
function getSource() {
	var im = new Image();
	im.src = s;
	document.fullImage.src = im.src;
}
function loadImage() {
	setImagePane();
	correctPng();
	//
	var imagePane = document.getElementById('imagePane');
	imagePane.style.display = 'block';
	//
	var imageFade = document.getElementById('imageFade');
	var winxy = getWinXY();
	imageFade.style.width = winxy[0];
	imageFade.style.height = winxy[1];
	imageFade.style.display = 'block';
	if(isIE) imageFade.style.filter = 'Alpha(opacity='+maxFade+')';
	else imageFade.style.opacity = (maxFade / 100);
	//
	clearTimeout(a);
	a = setTimeout("getSource()", 100);
}
function clearImage() {
	var imagePane = document.getElementById('imagePane');
	imagePane.style.display = 'none';
	var imageFade = document.getElementById('imageFade');
	imageFade.style.display = 'none';
	//
	if((isIE) || (isOP)) document.fullImage.outerHTML = '<img name="fullImage" src="'+mypath+'themes/hires2/frame/loadingimage.gif" />';
	else document.fullImage.src = mypath+'themes/hires2/frame/loadingimage.gif';
}
function correctPng() {
	if((isIE) && (ieVersion < 7)) {
		for(var i = 0; i < document.images.length; i ++) {	
			var img = document.images[i];
			var imgName = img.src.toUpperCase();
			if(imgName.substring(imgName.length-3, imgName.length) == "PNG") {
				var imgID = (img.id) ? ' id="' + img.id + '" ' : '';
				var imgTitle = (img.title) ? img.title : img.alt;
				var imWidth = (img.width) ? img.width : '100%';
				var imHeight = (img.height) ? img.height : '100%';
				var strNewHTML = '<img' + imgID + ' src="'+mypath+'themes/hires2/images/spacer.gif" width="'+imWidth+'" height="'+imHeight+'" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + img.src + '\', sizingMethod=\'scale\');" alt="' + imgTitle + '" />';
				img.outerHTML = strNewHTML;
				i -= 1;
			}
		}
	}
}
function getWinXY() {
	var _x = document.body.scrollWidth;
	var _y = (isIE) ? document.body.scrollHeight : document.documentElement.scrollHeight;
	var x = (_x == 0) ? '100%' : _x + 'px';
	var y = (_y == 0) ? '100%' : _y + 'px';
	return new Array(x, y, _x, _y);
}
function setImagePane() {
	var imageArray, classArray;
	var images = new Array (
		'<img src="'+mypath+'themes/hires2/images/spacer.gif" width="33" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/images/spacer.gif" width="1" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/images/spacer.gif" width="33" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/images/spacer.gif" width="33" height="1" alt="" />',
		'<img src="'+mypath+'themes/hires2/images/spacer.gif" width="33" height="1" alt="" />',
		'<img src="'+mypath+'themes/hires2/images/spacer.gif" width="33" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/images/spacer.gif" width="1" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/images/spacer.gif" width="33" height="33" alt="" />'
	);
	var imagesIE = new Array (
		'<img src="'+mypath+'themes/hires2/frame/tl.png" width="33" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/frame/t.png" width="100%" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/frame/tr.png" width="33" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/frame/l.png" width="33" height="100%" alt="" />',
		'<img src="'+mypath+'themes/hires2/frame/r.png" width="33" height="100%" alt="" />',
		'<img src="'+mypath+'themes/hires2/frame/bl.png" width="33" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/frame/b.png" width="100%" height="33" alt="" />',
		'<img src="'+mypath+'themes/hires2/frame/br.png" width="33" height="33" alt="" />'
	);
	
	var cssClass = new Array(' class="c1"',' class="c2"',' class="c3"',' class="c4"',' class="c5"',' class="c6"',' class="c7"',' class="c8"');
	var cssClassIE = new Array(' class="c0"',' class="c0"',' class="c0"',' class="c0"',' class="c0"',' class="c0"',' class="c0"',' class="c0"');
	if(isIE) {
		imageArray = imagesIE;
		classArray = cssClassIE;
	} else {
		imageArray = images;
		classArray = cssClass;
	}
	var p = '<table border="0" cellpadding="0" cellspacing="0" align="center">';
	p += '<tr>';
	p += '<td'+classArray[0]+' width="33" height="33">'+imageArray[0]+'</td>';
	p += '<td'+classArray[1]+' height="33">'+imageArray[1]+'</td>';
	p += '<td'+classArray[2]+' width="33" height="33">'+imageArray[2]+'</td>';
	p += '</tr>';
	p += '<tr>';
	p += '<td'+classArray[3]+' width="33" height="100%">'+imageArray[3]+'</td>';
	p += '<td id="pane"><img name="fullImage" src="'+mypath+'themes/hires2/frame/loadingimage.gif"></td>';
	p += '<td'+classArray[4]+' width="33" height="100%">'+imageArray[4]+'</td>';
	p += '</tr>';
	p += '<tr>';
	p += '<td'+classArray[5]+' width="33" height="33">'+imageArray[5]+'</td>';
	p += '<td'+classArray[6]+' height="33">'+imageArray[6]+'</td>';
	p += '<td'+classArray[7]+' width="33" height="33">'+imageArray[7]+'</td>';
	p += '</tr>';
	p += '<tr>';
	p += '<td id="close" colspan="3"><img src="'+mypath+'themes/hires2/frame/cls.png" width="88" height="23" alt="Zamknij" title="" /></td>';
	p += '</tr>';
	p += '</table>';
	var d = document.getElementById('imagePane');
	if(d) d.innerHTML = p;
}
function preloadImages() {
	var mi = new Array();
	var pi = new Array(
		mypath+'themes/hires2/frame/loadingimage.gif',
		mypath+'themes/hires2/frame/tl.png',
		mypath+'themes/hires2/frame/t.png',
		mypath+'themes/hires2/frame/tr.png',
		mypath+'themes/hires2/frame/l.png',
		mypath+'themes/hires2/frame/r.png',
		mypath+'themes/hires2/frame/bl.png',
		mypath+'themes/hires2/frame/b.png',
		mypath+'themes/hires2/frame/br.png',
		mypath+'themes/hires2/frame/cls.png'
	);
	for(var i = 0; i < pi.length; i++) {
		mi[i] = new Image();
		mi[i].src = pi[i];
	}
}
function s() {
	var db = document.getElementsByTagName('body');
	if(db) db[0].style.overflowY = 'scroll';
}