function printWindow()
{
	this.print();
}

function closeWindow()
{
	if ('dmz' != 'stage')
	{
		self.opener.window.status = '';
	}
	self.close();
	return false;
}

/* Browser (Default) */

var pageContentLarge = new Array();
var pageContentSmall = new Array();
var imgSmallString = '-s.';
var imgLargeString = '-l.';
var imgID = 0;
var movieID = '';
var largeMovieID = 'largeClip';
var largeWinID = 0;

var imgWidth = 0;
var imgHeight = 0;

var popUpWin = '';
var popUpIcon = '<img src="icon-popup.gif" width="11" height="11" alt="Popup window" title="Popup window" border="0" />';

// Style 0: Standard
// Style 1: Sales.View
// Style 2: Debugging
// Style 3: Standard with Scrollbar

var newWindowStyle = new initArray
	(
		"toolbar=0,scrollbars=0,status=0,menubar=0,resizable=0,location=0",
		"toolbar=0,scrollbars=0,status=0,menubar=0,resizable=1,location=0",
		"toolbar=0,scrollbars=0,status=1,menubar=1,resizable=1,location=1",
		"toolbar=0,scrollbars=1,status=0,menubar=0,resizable=0,location=0",
		"toolbar=0,scrollbars=1,status=0,menubar=1,resizable=0,location=0"
	);

// Define a new object type
function webPage(src)
{
	this.src = src;
}

function initArray()
{
	for (var i = 0; i < initArray.arguments.length; i++)
	{
		this[i] = initArray.arguments[i];
	}
	this.length = initArray.arguments.length;
}

function preLoadImages(num, imgSmallURL)
{
	var imgSRC = imgSmallURL.split(imgSmallString);
	var imgLargeURL = imgSRC[0] + imgLargeString + imgSRC[1];

	if (document.images && imgSmallURL)
	{
		pageContentLarge[num] = new Image();
		pageContentLarge[num].src = imgLargeURL;
		pageContentSmall[num] = new Image();
		if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4)
		{
			while (!pageContentSmall[num].complete)
			{
				pageContentSmall[num].src = imgSmallURL;
				//window.status = 'Please wait while loading image ' + pageContentSmall[num].src;
			}
		}
		else
		{
			for (var i = 0; i < 1000; i++)
			{
				pageContentSmall[num].src = imgSmallURL;
				//window.status = 'Please wait while loading image ' + pageContentSmall[num].src;
			}
		}
		//window.status = '';
	}
}

function preLoadPage(num, imgURL)
{
	pageContentLarge[num] = new webPage();
	pageContentLarge[num].src = imgURL;
}

function preLoadObj(num, imgURL)
{
	pageContentLarge[num] = new Image();
	pageContentLarge[num].src = imgURL;
}

function getImageSize(imgOBJ)
{
	imgWidth = imgOBJ.width;
	imgHeight = imgOBJ.height;
}

function stopAnim()
{
	movieID.StopPlay();
	return false;
}

function playAnim()
{
	movieID.Play();
	return false;
}

function rewindAnim()
{
	movieID.Rewind();
	playAnim();
	return false;
}

function setMovieValue(selfcall)
{
	if (selfcall == null)
	{
		setTimeout("setMovieValue(1)", 300);
	}
	else
	{
		if (navigator.appName.indexOf("Microsoft") != -1)
		{
			movieID = clip;
		}
		else
		{
			movieID = document.clip;
		}
	}
}

function setLinkTitle(linkTitle)
{
	if (linkTitle)
	{
		return ' title="' + linkTitle + '" onmouseover="window.status=\'' + linkTitle + '\';return true;" onmouseout="window.status=\'\';return true;"';
	}
	else
	{
		return '';
	}
}

function writeOnClickPrintPage(imgID, pageContentLargeSrc, winTitle, winStyle, linkType, winX, winY)
{
	var tmpStrg = "return makePopUpWin(" + imgID + ",'" + pageContentLargeSrc + "','" + winTitle + "'," + winStyle + "," + linkType + ",";
	if (winX && winY)
	{
		tmpStrg += winX + "," + winY + ");";
	}
	else
	{
		tmpStrg += "'', '');";
	}

	return tmpStrg;
}

function writeImgPrintPage(iconURL, imgX, imgY, winTitle)
{
	return '<img src="' + iconURL + '" width="' + imgX + '" height="' + imgY + '" alt="' + winTitle + '" title="' + winTitle + '" border="0" align="absmiddle" \/>';
}

function scriptOnPopUpWindow(linkType)
{
	var returnStr = new String();
	returnStr += '<script type="text/javascript" language="JavaScript">\n';
	returnStr += 'function closeWindow() {\n';
	if (linkType == 4) 
	{
		returnStr += ' opener.movieID.Play()\;\n';
	}
	returnStr += ' //opener.window.status = \'\'\;\n';
	returnStr += ' self.close()\;\n';
	returnStr += ' return false\;\n';
	returnStr += '}\n';
	if (linkType == 2)
	{
		returnStr += 'function changeWindowSize() {\n';
		returnStr += ' var dx = screen.availWidth-20;\n';
		returnStr += ' var dy = screen.availHeight-40;\n';
		returnStr += ' self.resizeTo(dx, dy);\n';
		returnStr += ' self.moveTo(10, 10);\n';
		returnStr += ' resizeWindow(dx-20, dy-75);\n';
		returnStr += ' return false\;\n';
		returnStr += '}\n';
		returnStr += 'function resizeWindow(ox, oy) {\n';
		returnStr += ' var elem = document.getElementById("AdobeAcrobatReader");\n';
		returnStr += ' elem.style.width = ox+"px";\n';
		returnStr += ' elem.style.height = oy+"px";\n';
		returnStr += '}\n';
	}
	returnStr += '<\/script>\n';

	return returnStr;
}

function writePopUpWindow(popUpWin, winTitle, num, ix, iy, linkType)
{
	var baseRef = 'http://www.hubersuhnerinc.com/co-ca-us';
	var docBaseRef = new String('<he' + 'ad><base hr' + 'ef="' + baseRef + '/"></head>');

	winTitle = "'" + escape(winTitle) + "'";
	baseRef = "'" + escape(baseRef) + "'";

	popUpWin.document.open();
	popUpWin.document.writeln('<html>');
	popUpWin.document.writeln(docBaseRef);
	popUpWin.document.writeln('<body onload="opener.updateWindow('+winTitle+', '+num+', '+ix+', '+iy+', '+linkType+', '+baseRef+')" onunload="opener.track=0;">');
	popUpWin.document.writeln('<\/body>');
	popUpWin.document.writeln('<\/html>');
	popUpWin.document.close();
}
	
function updateWindow(winTitle, num, ix, iy, linkType, baseRef)
{
	var docBaseRef = new String('<he' + 'ad><base hr' + 'ef="' + unescape(baseRef) + '/"><li' + 'nk rel="icon" hr' + 'ef="favicon.ico" type="image/x-ico"></head>');

	pageContentLarge[num].src = unescape(pageContentLarge[num].src);

	popUpWin.document.open();

	if (linkType != 6)
	{
		popUpWin.document.writeln('<html>');
		popUpWin.document.writeln(docBaseRef);

		popUpWin.document.writeln('<style>');
		popUpWin.document.writeln(' p, div    {font-family:Arial, Helvetica, Sans Serif; font-size:9pt; color:#000000; text-align:center; vertical-align:middle;}');
		popUpWin.document.writeln(' div       {margin:6px 0;}');
		popUpWin.document.writeln(' .elem     {margin:2px 15px 2px 15px; padding:2px 4px;}');
		popUpWin.document.writeln(' a         {font-weight:bold; padding:2px;}');
		popUpWin.document.writeln(' a:link    {color:#006699; text-decoration:none;}');
		popUpWin.document.writeln(' a:visited {color:#006699; text-decoration:none;}');
		popUpWin.document.writeln(' a:active  {color:#006699; text-decoration:none;}');
		popUpWin.document.writeln(' a:hover   {color:#123456; background-color:#819CC3; text-decoration:none;}');
		popUpWin.document.writeln(' a span    {padding:0 4px;}');
		popUpWin.document.writeln('<\/style>');
		popUpWin.document.writeln(scriptOnPopUpWindow(linkType));
		popUpWin.document.writeln('<body marginwidth="0" marginheight="0" topmargin="4" leftmargin="4" rightmargin="4">');

		if (linkType == 2)
		{
			popUpWin.document.bgColor = '#d4d0c8';
		}
		else if (linkType == 4)
		{
			popUpWin.document.bgColor = '#777c8f';
		}
		else
		{
			popUpWin.document.bgColor = '#efefef';
		}

		popUpWin.document.title = ': ' + unescape(winTitle);

		popUpWin.document.writeln('<div id="nav">');
		if (linkType == 2)
		{
			popUpWin.document.writeln('<span class="elem">');
			popUpWin.document.writeln('<a href="#" onclick="return changeWindowSize();">Enlarge window <span><img src=\"ico_enlarge.gif\" width=\"14\" height=\"11\" alt=\"\" title=\"\" border=\"0\" /><\/span><\/a>');
			//popUpWin.document.writeln('<a href="#" onclick="return changeWindowSize();"><\/a>');
			popUpWin.document.writeln('<\/span>');
		}
		popUpWin.document.writeln('<span class="elem">');
		popUpWin.document.writeln('<a href="#" onclick="return closeWindow();">Close window <span><img src="ico_close.gif" width="13" height="13" alt="Close window" title="Close window" border="0" /><\/span><\/a>');
		//popUpWin.document.writeln('<a href="#" onclick="return closeWindow();"><\/a>');
		popUpWin.document.writeln('<\/span>');
		popUpWin.document.writeln('<\/div>');
		popUpWin.document.writeln('<div id="cnt">');

		if ((linkType == 0) || (linkType == 1))
		{
			popUpWin.document.writeln('<a href="#" onclick="return closeWindow();"><img src="' + pageContentLarge[num].src + '" width="'+ ix + '" height="'+ iy + '" alt="' + unescape(winTitle) + " &#171;Click to image to close the window&#187;\" border=\"0\" \/><\/a>");
		}
		else
		{
			switch (linkType)
			{
				case 2:
				{
					popUpWin.document.writeln('<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" id="AdobeAcrobatReader" type="application/pdf" style="width:' + ix + 'px; height:' + iy + 'px;">');
					popUpWin.document.writeln('<param name="src" value="' + pageContentLarge[num].src + '" \/>');
					//popUpWin.document.writeln('<embed id="AdobeAcrobatReader" src="' + pageContentLarge[num].src + '" style="width:' + ix + 'px; height:' + iy + 'px;">');
					break;
				}
				case 4:
				{
					popUpWin.document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + largeMovieID + '" codebase="<a href="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" title=""></a>" type="application/x-shockwave-flash" style="width:' + ix + 'px; height:' + iy + 'px;">');
					popUpWin.document.writeln('<param name="src" value="' + pageContentLarge[num].src + '" \/>');
					popUpWin.document.writeln('<param name="quality" value="high">');
					//popUpWin.document.writeln('<embed src="' + pageContentLarge[num].src + '" width="' + ix + '" height="' + iy + '" quality="high" type="application/x-shockwave-flash" pluginspage="<a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" title=""></a>" name="' + largeMovieID +'">');
					break;
				}
				case 7:
				{
					popUpWin.document.writeln('<object id="SVG" codebase="" type="image/svg+xml" style="width:' + ix + 'px; height:' + iy + 'px;">');
					popUpWin.document.writeln('<param name="src" value="' + pageContentLarge[num].src + '" \/>');
					//popUpWin.document.writeln('<embed src="' + pageContentLarge[num].src + '" width="' + ix + '" height="' + iy + '" type="image/svg+xml">');
					break;
				}
			}

			//popUpWin.document.writeln('<noembed><p align="center">Your browser does not support embedded objects.<br /><br />Open requested document: <a href="' + pageContentLarge[num].src + '">' + winTitle + '<\/a><\/p><\/noembed>');
			//popUpWin.document.writeln('<\/embed>');
			popUpWin.document.writeln('<\/object>');
		}

		popUpWin.document.writeln('<\/div>');
		popUpWin.document.writeln('<\/body>');
		popUpWin.document.writeln('<\/html>');

	}
	else
	{
		popUpWin.location = pageContentLarge[num].src;
	}

	popUpWin.document.close();
}

function makePopUpWin(num, imgURL, winTitle, winStyle, linkType, imgX, imgY)
{
	var windowID = 'largeImage' + largeWinID;

	if (linkType == 3)
	{
		window.open(imgURL, windowID, newWindowStyle[winStyle] + ',left=10,top=10', false);
	}
	else if (linkType == 5)
	{
		window.open(imgURL, windowID, newWindowStyle[winStyle] + ',width=300,height=230,left=10,top=10', false);
	}
	else
	{
		//window.status = 'Please wait, opening popup window (' + imgURL + ').';

		if ((linkType == 0) || (linkType == 1))
		{
			getImageSize(pageContentLarge[num]);
			var ix = imgWidth;
			var iy = imgHeight;
		}
		else if (linkType == 4)
		{
			var ix = screen.availWidth - 150;
			var iy = parseInt(ix/1.33,10);
			stopAnim();
		}
		else
		{
			if (imgX && imgY)
			{
				var ix = imgX;
				var iy = imgY;
			}
			else
			{
				var ix = 950;
				var iy = 650;
			}
		}
		var wx = ix + 14;
		var wy = iy + 40;

		if (winStyle == 3)
		{
			wx = wx + 16;
		}
		if (wx > 1000)
		{
			wy = 1000;
		}
		if (wy > 700)
		{
			wy = 700;
		}

		if (popUpWin && !popUpWin.closed)
		{
			popUpWin.close(windowID);
		}

		popUpWin = window.open('', windowID, 'name=' + windowID + newWindowStyle[winStyle] + ',width=' + wx + ',height=' + wy + ',left=10,top=10');
		writePopUpWindow(popUpWin, winTitle, num, ix, iy, linkType);

		if (!popUpWin.opener)
		{
			popUpWin.opener = self;
		}
		//window.status = 'Popup window successfully opened.';

		try
		{
			dcsMultiTrack('DCS.dcsuri', imgURL, 'WT.ti', winTitle);
		}
		catch(e) {}
	}

	return false;
}

function printThumbnail(imgURL, winTitle, winStyle, imgBorder, imgClick, linkTitle)
{
	if (imgURL) {
		imgID = imgID + 1;

		var linkType = 0; // fuer Enlarge-Images

		preLoadImages(imgID, imgURL);
		getImageSize(pageContentSmall[imgID]);
		var tx = imgWidth;
		var ty = imgHeight;

		document.write('<p align="center" class="enlarge">');

		if (imgClick == true)
		{
			document.write('<a href="'+ imgURL + '" onclick="return makePopUpWin(' + imgID + ',\''+ imgURL + '\',\'' + winTitle + '\', ' + winStyle + ', ' + linkType + ', \'\', \'\');">');
		}

		document.write(' <img src="'+ pageContentSmall[imgID].src + '" width="' + tx + '" height="' + ty + '" border="' + imgBorder + '" style="border:solid ' + imgBorder + 'px #cccccc\;" alt="' + winTitle + '" title="' + winTitle + '" \/>');

		if (imgClick == true)
		{
			document.write('<\/a>');
		}

		document.write('<br />');
		document.write('<a href="'+ imgURL + '" onclick="return makePopUpWin(' + imgID + ',\''+ imgURL + '\',\'' + winTitle + '\', ' + winStyle  + ', ' + linkType + ', \'\', \'\');"', setLinkTitle(linkTitle), '><i>' + "Enlarge picture" + '</i></a> ');
		document.write('<a href="'+ imgURL + '" onclick="return makePopUpWin(' + imgID + ',\''+ imgURL + '\',\'' + winTitle + '\', ' + winStyle + ', 0, \'\', \'\');"><img src="ico_enlarge.gif" width="14" height="11" alt="Enlarge picture" border="0" align="bottom" \/><\/a><\/p>');
	}
}

function printLinkImg(imgURL, winTitle, winStyle, imgBorder, imgClick, linkTitle, linkStyle, iconURL, imgX, imgY, linkPara)
{
	if (imgURL)
	{
		imgID = imgID + 1;

		var linkType = 1; // fuer Images

		preLoadObj(imgID, imgURL);
		if (linkPara && linkPara > -1)
		{
			document.write('<p class="');
			if (!linkStyle || linkStyle.length == 0)
			{
				document.write('enlarge" align="center"');
			}
			else
			{
				document.write(linkStyle + '"');
			}
			document.write('>');
		}

		if (iconURL && (imgX > 0 && imgY > 0))
		{
			document.write('<a href="'+ pageContentLarge[imgID].src + '" onclick="return makePopUpWin(' + imgID + ',\''+ pageContentLarge[imgID].src + '\',\'' + winTitle + '\', ' + winStyle + ', ' + linkType + ', \'\', \'\');"', setLinkTitle(linkTitle), '>');
			document.write('<img src="' + iconURL + '" width="' + imgX + '" height="' + imgY + '" border="0" align="left" \/>');
			document.write('</a>&nbsp;');
		}

		document.write('<a href="'+ pageContentLarge[imgID].src + '" onclick="return makePopUpWin(' + imgID + ',\''+ pageContentLarge[imgID].src + '\',\'' + winTitle + '\', ' + winStyle + ', ' + linkType + ', \'\', \'\');"', setLinkTitle(linkTitle), '>' + winTitle + '<\/a> ' + popUpIcon);

		if (linkPara && linkPara > -1)
		{
			document.write('<\/p>');
		}
	}

}

function printLink(imgURL, winTitle, winStyle, linkTitle)
{
	if (imgURL)
	{
		imgID = imgID + 1;

		var linkType = 2; // fuer PDF

		preLoadObj(imgID, imgURL);
		document.write('<a href="'+ pageContentLarge[imgID].src + '" onclick="return makePopUpWin(' + imgID + ',\''+ pageContentLarge[imgID].src + '\',\'' + winTitle + '\', ' + winStyle + ', ' + linkType + ', \'\', \'\');"', setLinkTitle(linkTitle), '>' + winTitle + '<\/a> ' + popUpIcon);
	}
}

function printAnimation(imgURL, winTitle, winStyle, navButton)
{
	if (imgURL)
	{
		imgID = imgID + 1;

		var linkType = 4; // fuer Shockwave/Flash

		preLoadPage(imgID, imgURL);
		setMovieValue();
		document.write('<span class="cont-t">Enjoy the animation in ');
		document.write('<a href="'+ pageContentLarge[imgID].src + '" onclick="return makePopUpWin(' + imgID + ',\''+ pageContentLarge[imgID].src + '\',\'' + winTitle + '\', ' + winStyle + ', ' + linkType + ', \'\', \'\');">full screen view<\/a> ');
		document.write('<a href="'+ imgURL + '" onclick="return makePopUpWin(' + imgID + ',\''+ imgURL + '\',\'' + winTitle + '\', ' + winStyle + ', ' + linkType + ', \'\', \'\');"><img src="ico_enlarge.gif" width="14" height="11" alt="Enlarge clip" border="0" align="bottom" \/><\/a>.');
		if (!navButton || navButton == 0)
		{
			document.write('<img src="spacer.gif" width="240" height="1" \/>');
			document.write('<a href="#" onclick="return stopAnim();"><img src="ico_stop.gif" width="21" height="21" border="0" alt="Stop" align="middle" \/><\/a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
			document.write('<a href="#" onclick="return playAnim();"><img src="ico_play.gif" width="21" height="21" border="0" alt="Play" align="middle" \/><\/a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
			document.write('<a href="#" onclick="return rewindAnim();"><img src="ico_replay.gif" width="21" height="21" border="0" alt="Replay" align="middle" \/><\/a><\/span>');
		}
	}
}

function printPage(imgURL, winTitle, winStyle, iconURL, imgX, imgY, noIcon, noPopUp, linkTitle, winX, winY, linkType, linkIcon, buttonStyle, buttonClass, wrapperClass, cssSpriteClass)
{
	var stdIconUrl = '<img src="icon-arrow-small-right.gif" width="12" height="9" alt="" title="" border="0" />';
	if (imgURL)
	{
		imgID = imgID + 1;

		if (!linkType)
		{
			linkType = 6; // fuer HTML-Seite

			var filePattern = /^.*\.svg(z)?/gi;
			if (filePattern.test(imgURL))
			{
				linkType = 7; // fuer SVG / SVGZ-Seite
			}
		}

		preLoadPage(imgID, imgURL);
		document.write('<span class="' + ((wrapperClass) ? wrapperClass : 'cont-t') + '">');
		if (buttonStyle && buttonStyle == true)
		{
			document.write('<button type="button" class="' + buttonClass + '" style="width:25px" onclick="' + writeOnClickPrintPage(imgID, pageContentLarge[imgID].src, winTitle, winStyle, linkType, winX, winY) + '"', setLinkTitle(linkTitle), '>');

			if ((!noIcon) && ((iconURL == null || iconURL == '') && imgX == 0 && imgY == 0))
			{
				document.write(stdIconUrl);
			}
			else
			{
				document.write(writeImgPrintPage(iconURL, imgX, imgY, winTitle));
			}
			document.write('</button>')
		}
		else
		{
			if ((!noIcon) && ((iconURL == null || iconURL == '') && imgX == 0 && imgY == 0))
			{
				document.write(stdIconUrl);
			}
			if (!noPopUp || noPopUp == false)
			{
				document.write('<a href="'+ pageContentLarge[imgID].src + '" onclick="' + writeOnClickPrintPage(imgID, pageContentLarge[imgID].src, winTitle, winStyle, linkType, winX, winY) + '"', setLinkTitle(linkTitle), '>');

				if (iconURL && imgX && imgY)
				{
					document.write(writeImgPrintPage(iconURL, imgX, imgY, winTitle));
				}
				else
				{
					document.write(((cssSpriteClass) ? '<span class="'+cssSpriteClass+'"></span>' : '')+winTitle);
				}
				document.write('<\/a>');
				if (linkIcon && linkIcon == true && (!iconURL || !imgX || !imgY))
				{
					document.write(' ' + popUpIcon);
				}
			}
			else
			{
				largeWinID++;
				if (pageContentLarge[imgID].src.indexOf('?') == -1)
				{
					pageContentLarge[imgID].src += '?popup=' + noPopUp;
				}
				else
				{
					pageContentLarge[imgID].src += '&popup=' + noPopUp;
				}
				document.write('<a href="'+ pageContentLarge[imgID].src + '" onclick="return makePopUpWin(' + imgID + ',\''+ pageContentLarge[imgID].src + '\',\'' + winTitle + '\', ' + winStyle + ', ' + linkType + ', ')
				if (winX && winY)
				{
					document.write(winX + ', ' + winY + ');');
				}
				else
				{
					document.write('\'\', \'\');');
				}
				document.write('">');
				if (iconURL && imgX && imgY)
				{
					document.write(writeImgPrintPage(iconURL, imgX, imgY, winTitle));
				}
				else
				{
					document.write(((cssSpriteClass) ? '<span class="'+cssSpriteClass+'"></span>' : '')+winTitle);
				}
				document.write('<\/a>');
				if (linkIcon && linkIcon == true && (!iconURL || !imgX || !imgY))
				{
					document.write(' ' + popUpIcon);
				}
			}
		}
		document.write('<\/span>');
	}
}




