/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
//last update - 03/12/09
//version - 1.2.1.21
/////////////////////
var ISQBalloon = {}
/**************************************************
Paramters (inserted by server)
**************************************************/
ISQBalloon.Params = {
                                                            sessionId: '0 ',
		                                                    lang: 'en',
                                                            innerFrameUrl : '/ecommerce/ISQ_Frame.html',
		                                                    balloonTitle : 'Got a Question? Get an Answer here:',
		                                                    balloonTitleStyle : 'font-family:Arial;font-size:18px;font-weight:normal;color:SteelBlue;',
		                                                    balloonTitleTime : 5000,
                                                            balloonTitleTopMargin : 10,
		                                                    teaserText : 'Have Questions ?',
		                                                    teaserTextFont : 'font-family:Arial;font-size:14px;font-weight:bold;color:SteelBlue;',
		                                                    teaserTextPosition : 'top:7px;left:17px',
		                                                    teaserTextWidth : 90,
		                                                    server: 'http://server2.isqgroup.net/widget',			
		                                                    autoMinimize : 0,
		                                                    autoMaximize : false,
                                                            teaserImg : '/images/teaser.png',
                                                            collapseImg : '/images/balloon_collapse.png',
                                                            exapndImg : '/images/balloon_open.png',

                                                            tableWidth : 345,
                                                            BalloonTitleTableLeftPadding : 22,
                                                            BalloonTitleTableRightPadding : 2,
                                                            xImageVerticalAlign : 'top',
                                                            collapseImgIE6 : 'images/balloon_collapsed.gif',
                                                            exapndImgIE6 : '/images/balloon_open.gif'
	                                                    }

/**************************************************
Server
**************************************************/
ISQBalloon.server = ISQBalloon.Params.server ?  ISQBalloon.Params.server : 'http://server2.isqgroup.net';

/**************************************************
images
**************************************************/
ISQBalloon.openImg  = new Image();
ISQBalloon.closeImg  = new Image();
ISQBalloon.teaserImg  = new Image();
ISQBalloon.xImg  = new Image();

ISQBalloon.closeImgIE6 = null;
ISQBalloon.openImgIE6 = null;

ISQBalloon.setImgs = function()
{
	ISQBalloon.openImg.src = ISQBalloon.server + ISQBalloon.Params.exapndImg; //Fixes IE7 Cache Bug
	ISQBalloon.openImg.onload = ISQBalloon.loadBalancer;
	ISQBalloon.openImg.onerror = ISQBalloon.loadBalancer;
	ISQBalloon.openImg.src = ISQBalloon.server + ISQBalloon.Params.exapndImg;
		
	ISQBalloon.closeImg.src = ISQBalloon.server + ISQBalloon.Params.collapseImg; //Fixes IE7 Cache Bug
	ISQBalloon.closeImg.onload = ISQBalloon.loadBalancer;
	ISQBalloon.closeImg.onerror = ISQBalloon.loadBalancer;
	ISQBalloon.closeImg.src = ISQBalloon.server + ISQBalloon.Params.collapseImg;
	
	ISQBalloon.teaserImg.src = ISQBalloon.server + ISQBalloon.Params.teaserImg; //Fixes IE7 Cache Bug
	ISQBalloon.teaserImg.onload = ISQBalloon.loadBalancer;
	ISQBalloon.teaserImg.onerror = ISQBalloon.loadBalancer;
	ISQBalloon.teaserImg.src = ISQBalloon.server + ISQBalloon.Params.teaserImg;
	
	ISQBalloon.xImg.src = ISQBalloon.server+"/images/X.gif"; //Fixes IE7 Cache Bug
	ISQBalloon.xImg.onload = ISQBalloon.loadBalancer;
	ISQBalloon.xImg.onerror = ISQBalloon.loadBalancer;
	ISQBalloon.xImg.src = ISQBalloon.server+"/images/X.gif";
	
	if (ISQBalloon.browser == 'ie6')
	{
		ISQBalloon.closeImgIE6 = new Image();
		ISQBalloon.closeImgIE6.onload = ISQBalloon.loadBalancer;
		ISQBalloon.closeImgIE6.onerror = ISQBalloon.loadBalancer;
		ISQBalloon.closeImgIE6.src = ISQBalloon.server + ISQBalloon.Params.collapseImgIE6;
		
		ISQBalloon.openImgIE6 = new Image();
		ISQBalloon.openImgIE6.onload = ISQBalloon.loadBalancer;
		ISQBalloon.openImgIE6.onerror = ISQBalloon.loadBalancer;
		ISQBalloon.openImgIE6.src = ISQBalloon.server + ISQBalloon.Params.exapndImgIE6;
		
		ISQBalloon.numOfItems += 2;
	}
}

ISQBalloon.numOfItems = 4;
ISQBalloon.loadedItems = 0;
ISQBalloon.loadBalancer = function()
{
	++ISQBalloon.loadedItems;
	
	if (ISQBalloon.loadedItems === ISQBalloon.numOfItems)
	{
		// trying to fix IE6 background image caching bug //
		if (ISQBalloon.browser == 'ie6')
		{
			try
			{
				document.execCommand("BackgroundImageCache", false, true);
				
			}
			catch(e){}
			try
			{
				document.uniqueID("BackgroundImageCache", false, true);
			}
			catch(e){}
		}
		////
		
		//// Balloon switching titles ////
		ISQBalloon.Title.init();
		
		//// populating teaser div ////
		ISQBalloon.populateTeaserDiv();
		
		//// populating frame div ////
		ISQBalloon.populateFrameDiv();
		
		//// setting small frame div ////
		ISQBalloon.setFrameDivBG('small');
		
		//// setting positions ////
		ISQBalloon.setPositions();
		
		//// closing balloon ////
		ISQBalloon.closeballoon();
	}
}

/**************************************************
HTML creation - teaser Div
**************************************************/
ISQBalloon.teaserDivLeft = 3;
ISQBalloon.createTeaserDiv = function()
{
	var html = "<div id='ISQTeaserDiv' style='z-index:5000;border:0px;margin:0;padding:0;dir=\"ltr\"'></div>";
	document.write(html);
}
ISQBalloon.populateTeaserDiv = function()
{
	var _div = document.getElementById('ISQTeaserDiv');
	
	var positionStyle = '';
	if (ISQBalloon.positionSystem === 'absolute')
	{
		_div.style.position = "absolute";	
		_div.style.top = "0px";	
		//_div.style.visibility = "hidden";	
		_div.style.background = "none";
	}
	else
	{
		_div.style.position = "fixed";
		_div.style.bottom = ISQBalloon.bottomTeaserDiv + "px";
	}
	ISQBalloon.setLeftPosition();
	
	/**
	Setting width/height
	**/
	_div.style.height = ISQBalloon.teaserImg.height + "px";	
	_div.style.width = ISQBalloon.teaserImg.width + "px";	
	
	/**
	Setting onclick + cursor
	**/
	_div.onclick = function()
	{
		ISQBalloon.showBalloon();
	}
	_div.style.cursor = "pointer";
	
	
	/**
	Setting BG
	**/
	_div.style.background = "url("+ISQBalloon.teaserImg.src+") no-repeat";
	if (ISQBalloon.browser === 'ie6' && ISQBalloon.teaserImg.src.indexOf(".png") !== -1)
	{
		DD_belatedPNG.fixPng(_div);
	}
		
	
	
	_div.innerHTML = "\
	<form name='ISQTeaserForm' id='ISQTeaserForm'>\n\
		<input type='text' name='decoy' value='decoy' style='width:1px;height:1px;visibility:hidden'/>\n\
		<div style='display:none;backround:url("+ISQBalloon.teaserImg.src+") no-repeat;width:1px;height:1px'></div>\n\
	</form>\n\
	<div id='teasetText' style='text-align:center;position:absolute;"+ISQBalloon.Params.teaserTextPosition+";width:"+ISQBalloon.Params.teaserTextWidth+"px;"+ISQBalloon.Params.teaserTextFont+";'>\n\
		"+ISQBalloon.Params.teaserText+"\n\
	</div>\n\
	";
}

/**************************************************
HTML creation - frame Div
**************************************************/
ISQBalloon.createFrameDiv = function()
{
	//376 148
	var html = "<div id='ISQFrameDiv' style='visibility:visible;z-index:5000;overflow:hidden;border:0px;margin:0;padding:0;direction:ltr'></div>";
	document.write(html);
}

ISQBalloon.populateFrameDiv = function()
{
	/********************  [DIV STYLE] **********************/
	var _div = document.getElementById('ISQFrameDiv');
	var positionStyle = '';
	if (ISQBalloon.positionSystem === 'absolute')
	{
		_div.style.position = "absolute";
		_div.style.top = "0px";
		_div.style.left = "0px";
	}
	else
	{
		_div.style.position = "fixed";
		_div.style.bottom = ISQBalloon.bottomDivFrame + "px";
		//_div.style.left = ISQBalloon.leftDivFrame + "px";
		ISQBalloon.setLeftPosition();
	}
	
	_div.style.height = ISQBalloon.closeImg.height + "px";	
	_div.style.width = ISQBalloon.closeImg.width + "px";
	_div.style.display = "none";
	_div.style.border = "0px";
	_div.style.margin = "0px";
	_div.style.padding = "0px";
	
	
	/********************  [IFRAME SRC] **********************/
	var innerFrameUrl = ISQBalloon.getInnerFrameSrc();
	var iframeSrc = ISQBalloon.server+"/isqWidget.html?account=plimus&";
	iframeSrc += "sessionId="+ISQBalloon.Params.sessionId;
	iframeSrc += "&lang="+ISQBalloon.Params.lang;
	iframeSrc += "&innerFrameUrl=" + innerFrameUrl;
	iframeSrc += "&autoMaximizeBalloon="+ISQBalloon.Params.autoMaximize;
	
	/********************  [ALIGNMENT] **********************/
	var _align = 'left';
	if (ISQBalloon.Params.lang === 'he')
		_align = 'right';
		
	var direction = 'ltr';
	if (ISQBalloon.Params.lang === 'he')
		direction = 'rtl';	
	
	_div.innerHTML = "";
	
	// margins //
	var titleTopMargin = 7;
	if (typeof(ISQBalloon.Params.balloonTitleTopMargin) === 'number')
	{
		titleTopMargin = ISQBalloon.Params.balloonTitleTopMargin;
	}
	
	var BalloonTitleTableLeftPadding = 7;
	if (typeof(ISQBalloon.Params.BalloonTitleTableLeftPadding) === 'number')
	{
		BalloonTitleTableLeftPadding = ISQBalloon.Params.BalloonTitleTableLeftPadding;
	}
	
	var BalloonTitleTableRightPadding = 7;
	if (typeof(ISQBalloon.Params.BalloonTitleTableRightPadding) === 'number')
	{
		BalloonTitleTableRightPadding = ISQBalloon.Params.BalloonTitleTableRightPadding;
	}
	
	// X-image valign //
	var xImageValign = 'top'
	if (typeof(ISQBalloon.Params.xImageVerticalAlign) === 'string' && ISQBalloon.Params.xImageVerticalAlign !== '')
	{
		xImageValign = ISQBalloon.Params.xImageVerticalAlign;
	}
	
	// iFrame top //
	var iFrameTop = 33;
	if (ISQBalloon.browser === 'ie6')
		iFrameTop = 26;
	
	
	
	// html content //
	var html = "\
		<img id='ISQFrameDivIMG' src='"+ISQBalloon.openImg.src+"' style='position:absolute;top:0px;left:0px;display:none;direction:ltr' />\n\
		<div style='position:absolute;top:0px;left:0px;visibility:hidden;backround:url(\""+ISQBalloon.openImg.src+"\") no-repeat;width:1px;height:1px'></div>\n\
		<div style='position:absolute;top:0px;left:0px;visibility:hidden;backround:url(\""+ISQBalloon.closeImg.src+"\") no-repeat;width:1px;height:1px'></div>\n\
		<div id='ISQFrameDivBG' style='width:100%;height:100%;overflow:hidden;border:0px;margin:0px;padding:0px;direction:ltr;'>\n\
			<div style='width:100%;height:100%;position:static;border:0px; border-style:hidden;margin:0px;padding:0px;direction:ltr'>\n\
				<div style='width:100%;height:100%;position:static;border:0px;margin:0px;padding:0px;height:40px;direction:"+direction+"'>\n\
					<table width='"+ISQBalloon.Params.tableWidth+"px' cellpadding='0' cellspacing='0' style='border:0px;margin:0px;padding:0px;background:transparent;width:"+ISQBalloon.Params.tableWidth+"px' valign='top' align='"+_align+"' dir='"+direction+"'>\n\
						<tbody style='border:0px;margin:0px;padding:0px;' valign='top'>\n\
							<tr><td height='"+titleTopMargin+"px' style='border:0px;margin:0px;padding:0px;'></td></tr>\n\
							<tr>\n\
								<td width='"+BalloonTitleTableLeftPadding+"px' style='border:0px;margin:0px;padding:0px;font-size:1px'>&nbsp;</td>\n\
								<td valign='top' align='"+_align+"' style='border:0px;margin:0px;padding:0px;'>\n\
									<div style='background:transparent;border:0px;font-weight:normal;margin:0px;direction:"+direction+";"+ISQBalloon.Params.balloonTitleStyle+"' id='ISQBalloonTitle'>"+ISQBalloon.Title.titleArray[0]+"</div>\n\
								</td>\n\
								<td align='right' valign='"+xImageValign+"' width='20px' height='16px' style='border:0px;margin:0px;padding:0px;'><a href='javascript:ISQBalloon.closeballoon()'><img src='"+ISQBalloon.xImg.src+"' border='0' style='vertical-align:"+xImageValign+"'/></a></td>\n\
								<td width='"+BalloonTitleTableRightPadding+"px' style='border:0px;margin:0px;padding:0px;font-size:1px'>&nbsp;</td>\n\
							</tr>\n\
						</tbody>\n\
					</table>\n\
				</div>\n\
				<iframe id='ISQTeaserFrame' name='ISQTeaserFrame' src='"+iframeSrc+"' style='width: 371px; height: 371px;z-index: 5001;border:0px;position:absolute;top:"+iFrameTop+"px;left:4px;overflow:hidden' scrolling='no' allowtransparency='true' frameborder='no'></iframe>\n\
			</div>\n\
		</div>\n\
	";
	
	_div.innerHTML = html;
	
	// setting iframe source //
	ISQBalloon.setIFrameSrc(iframeSrc);
}

/**************************************************
Inner frame url source
**************************************************/
ISQBalloon.setIFrameSrc = function(_src)
{
	var _f = document.getElementById('ISQTeaserFrame');
	if (_f === null)
	{
		setTimeout(function(){ISQBalloon.setIFrameSrc(_src)}, 200);
		return;
	}
		
	_f.src = _src;
}

ISQBalloon.getInnerFrameSrc = function()
{
	//// this function takes the innerFrameUrl parameter, strip it to non-full-path (no http:// )
	//// and concatanate it with current page host.
	
	ISQBalloon.Params.innerFrameUrl = ISQBalloon.Params.innerFrameUrl || 'ISQ_frame.html';
	
	var colonIndex = window.location.href.indexOf("://") + 3;
	var slashIndex = window.location.href.indexOf("/", colonIndex);
	var host = window.location.href.substring(0, slashIndex);
	
	var iframeSrc = '';
	if (ISQBalloon.Params.innerFrameUrl.charAt(0) === '/')
	{
		iframeSrc = host + ISQBalloon.Params.innerFrameUrl;
	}
	else
	{
		colonIndex = ISQBalloon.Params.innerFrameUrl.indexOf("://");
		/// innerFrameUrl is a full path (http://....) ///
		if (colonIndex > -1)
		{
			colonIndex += 3;
			slashIndex = ISQBalloon.Params.innerFrameUrl.indexOf("/", colonIndex);
			iframeSrc = host + ISQBalloon.Params.innerFrameUrl.substring(slashIndex);
			
		}
		/// absolute path in the server (/javascript/frame.html) ///
		else
		{
			iframeSrc = host + '/' + ISQBalloon.Params.innerFrameUrl;
		}
	}
	
	return iframeSrc;
}

/**************************************************
Screen Size
**************************************************/
ISQBalloon.screenX = 0;
ISQBalloon.screenY = 0;

ISQBalloon.calculateScreenSize = function()
{
	if (self.innerHeight) // all except Explorer
	{
		ISQBalloon.screenX = self.innerWidth;
		ISQBalloon.screenY = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
	{
		ISQBalloon.screenX = document.documentElement.clientWidth;
		ISQBalloon.screenY = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		ISQBalloon.screenX = document.body.clientWidth;
		ISQBalloon.screenY = document.body.clientHeight;
	} 
}

/**************************************************
Document Type
**************************************************/
ISQBalloon.docType = '', 
ISQBalloon.getDocType = function()
{
	////////////	defining browser	//////////////////////
	var doctypeNode = "";
	var doctype = "loose";
	try
	{
		if (ISQBalloon.browser === "ie6" || ISQBalloon.browser === "ie7" || ISQBalloon.browser === "ie8")
			doctypeNode = window.document.firstChild.nodeValue;
		else
			doctypeNode = window.document.doctype.publicId;
		doctypeNode = doctypeNode.toLowerCase();
			
		if (doctypeNode != null)
		{
			if (doctypeNode.indexOf("xhtml") !== -1)
				docType = "xhtml";
			else if (doctypeNode.indexOf("strict") !== -1)
				doctype = "strict";
			else
				doctype = "loose";
		}
	}
	catch(e)
	{
		doctype = "loose";
	}
	
	ISQBalloon.docType = doctype;
},
	
/**************************************************
Browser info
**************************************************/
ISQBalloon.browser = '', 
ISQBalloon.getBrowser = function()
{
	////////////	defining browser	//////////////////////
	if (navigator.appVersion.indexOf("MSIE 6") !== -1)
		ISQBalloon.browser = "ie6";
	else if (navigator.appVersion.indexOf("MSIE 7") !== -1)
		ISQBalloon.browser = "ie7";
	else if (navigator.appVersion.indexOf("MSIE 8") !== -1)
		ISQBalloon.browser = "ie8";
	else if (navigator.appVersion.indexOf("Chrome") !== -1)
		ISQBalloon.browser = "chrome";
	else if (navigator.userAgent.indexOf("Firefox/3") !== -1)
		ISQBalloon.browser = "ff3"; 
	else if (navigator.userAgent.indexOf("Firefox/2") !== -1)
		ISQBalloon.browser = "ff2"; 
	else 
		ISQBalloon.browser = "ie7"; 	
}, 
	
/**************************************************
Position
**************************************************/
ISQBalloon.positionSystem = '',
ISQBalloon.setPositionSystem = function()
{
	switch (ISQBalloon.docType)
	{
		case "xhtml":
		case "strict":
			if (ISQBalloon.browser === 'ie6')
				ISQBalloon.positionSystem = 'absolute';
			else
				ISQBalloon.positionSystem = 'fixed';
			break;
		case "loose":
		case "transitional":
			if (ISQBalloon.browser === 'ie6' || ISQBalloon.browser === 'ie7' || ISQBalloon.browser === 'ie8')
				ISQBalloon.positionSystem = 'absolute';
			else
				ISQBalloon.positionSystem = 'fixed';
			break;
	}
}

ISQBalloon.isEventsSet = false;
ISQBalloon.lastTop = 0;
ISQBalloon.bottomDivFrame = 15;
ISQBalloon.leftDivFrame = 10;
ISQBalloon.bottomTeaserDiv = 10;
ISQBalloon.setPositions = function()
{
	if (ISQBalloon.positionSystem === 'absolute')
	{
		document.getElementById('ISQTeaserDiv').style.position = "absolute";
		var dTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		var newTop = (ISQBalloon.screenY - ISQBalloon.teaserImg.height - ISQBalloon.bottomTeaserDiv) + dTop;
		document.getElementById('ISQTeaserDiv').style.top = newTop + "px";
		
		ISQBalloon.setLeftPosition();
		
		
		if (!ISQBalloon.isOpen)
			document.getElementById('ISQTeaserDiv').style.visibility = "visible";
		
		///////// creating an events /////////
		if (!ISQBalloon.isEventsSet)
		{
			if (window.addEventListener)  //NOT IE 
				window.addEventListener('scroll', ISQBalloon.onScrollHandler, true);
			else if (window.attachEvent)
				window.attachEvent('onscroll', ISQBalloon.onScrollHandler);
				
			if (document.addEventListener)  //NOT IE 
			{
				window.addEventListener('resize', ISQBalloon.onResizeHandler, true);
				window.document.body.addEventListener('resize', ISQBalloon.onResizeHandler, true);
			}
			else if (document.attachEvent)
			{
				window.attachEvent('onresize', ISQBalloon.onResizeHandler);
			}
			
			ISQBalloon.isEventsSet = true;
		}
	}
	
	ISQBalloon.rePositionFrameDiv(ISQBalloon.frameDivCurrSize);
}


ISQBalloon.frameDivCurrSize = 'small';
ISQBalloon.rePositionFrameDiv = function(size)
{
	size = size || 'small';
	
	var imgHeight;
	if (size === 'big')
		imgHeight = ISQBalloon.openImg.height;
	else
		imgHeight = ISQBalloon.closeImg.height;
	
	if (ISQBalloon.positionSystem === 'absolute')
	{
		imgHeight += ISQBalloon.bottomDivFrame;
		
		var frameDiv = document.getElementById('ISQFrameDiv');
		var dTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		
		//alert(dTop);
		var newTop = dTop + (ISQBalloon.screenY - imgHeight);
		frameDiv.style.top = newTop + "px";
		
		//alert(newTop + "," + frameDiv.offsetTop);
		
		ISQBalloon.setLeftPosition();
	}
	
	ISQBalloon.frameDivCurrSize = size;	
}


ISQBalloon.setLeftPosition = function()
{
	var leftTeaser = ISQBalloon.teaserDivLeft;
	var leftFrame = ISQBalloon.leftDivFrame;
	//ISQBalloon.Params.leftReference = 'balloonReference';
	if (typeof(ISQBalloon.Params.leftReference) !== 'undefined' && ISQBalloon.Params.leftReference != '')
	{
		leftTeaser = leftFrame = ISQBalloon.ObjPos.ElementX(ISQBalloon.Params.leftReference);
	}
	leftTeaser += "px";
	leftFrame += "px";
	document.getElementById('ISQFrameDiv').style.left = leftFrame;
	document.getElementById('ISQTeaserDiv').style.left = leftTeaser;
}

/**************************************************
event handler
**************************************************/
ISQBalloon.isScroll = false;
ISQBalloon.onScrollHandler = function(event4FF)
{
	var e = event4FF || event;
	ISQBalloon.isScroll = true;
	ISQBalloon.setPositions();
}


ISQBalloon.onResizeHandler = function()
{
	ISQBalloon.calculateScreenSize();
	ISQBalloon.setLeftPosition();
	ISQBalloon.setPositions();
}


/**************************************************
GUI changes
**************************************************/
ISQBalloon.timeoutObject = null;
ISQBalloon.isOpen = false;
ISQBalloon.isFirstUse = false;
ISQBalloon.closeballoon = function()
{
	/**
	Animation
	**/	
	document.getElementById('ISQTeaserFrame').style.display = "block";
	document.getElementById('ISQFrameDivIMG').style.display = "block";
	document.getElementById('ISQFrameDivBG').style.display = "none";
	
	ISQBalloon.Animation.doneEvent = function()
	{
		document.getElementById('ISQTeaserDiv').style.display = "block";
		document.getElementById('ISQFrameDivIMG').style.display = "none";
		document.getElementById('ISQFrameDivBG').style.display = "none";
		ISQBalloon.isOpen = false;
		
		if (!ISQBalloon.isFirstUse)
			ISQBalloon.cancelAutoMinimize();
			
		// to cancel IE blinking cursor in empty text-box after auto-minimize //
		if (ISQBalloon.browser === 'ie6' || ISQBalloon.browser === 'ie7' || ISQBalloon.browser === 'ie8')
		{
			try
			{
				var decoy = document.forms['ISQTeaserForm'].decoy;
				decoy.style.visibility = "visible";
				decoy.focus();
				decoy.style.visibility = "hidden";
			}
			catch(e)
			{}
		}
		
		
		ISQBalloon.Title.stop_();
	}
	
	ISQBalloon.Animation.start('ISQFrameDiv', 0, 0, 'ISQFrameDivIMG', "close");
	ISQBalloon.isScroll = false;
}

ISQBalloon.showBalloon = function(toEnlargeFrame)
{
	toEnlargeFrame = toEnlargeFrame || false;
	
	/****
	Animation
	****/
	document.getElementById('ISQFrameDiv').style.display = "block";
	document.getElementById('ISQTeaserDiv').style.display = "none";
	document.getElementById('ISQFrameDivIMG').style.display = "block";
	document.getElementById('ISQFrameDivBG').style.display = "none";
	
	ISQBalloon.Animation.doneEvent = function()
	{
		document.getElementById('ISQTeaserFrame').style.display = "block";
		document.getElementById('ISQFrameDivIMG').style.display = "none";
		document.getElementById('ISQFrameDivBG').style.display = "block";
		ISQBalloon.onResizeHandler();
		
		if (ISQBalloon.isFirstUse)
			ISQBalloon.setAutoMinimize();
		ISQBalloon.isFirstUse = false;
		
		ISQBalloon.Title.go();
		
		if (toEnlargeFrame)
			ISQBalloon.enlargeFrame();
	}
	
	if (ISQBalloon.frameDivCurrSize === 'small')
		ISQBalloon.Animation.start('ISQFrameDiv', ISQBalloon.closeImg.width, ISQBalloon.closeImg.height, 'ISQFrameDivIMG', "open");
	else if (ISQBalloon.frameDivCurrSize === 'big')
		ISQBalloon.Animation.start('ISQFrameDiv', ISQBalloon.openImg.width, ISQBalloon.openImg.height, 'ISQFrameDivIMG', "open");
	
	ISQBalloon.isOpen = true;
	ISQBalloon.isScroll = false;
}

ISQBalloon.setAutoMinimize = function()
{
	if (typeof(ISQBalloon.Params.autoMinimize) == 'number')
	{
		if (ISQBalloon.Params.autoMinimize != 0)
			ISQBalloon.timeoutObject = setTimeout(function(){ISQBalloon.closeballoon()}, ISQBalloon.Params.autoMinimize);
	}
}

ISQBalloon.cancelAutoMinimize = function()
{
	clearTimeout(ISQBalloon.timeoutObject);		
}


ISQBalloon.enlargeFrame = function()
{
	ISQBalloon.rePositionFrameDiv('big');
	ISQBalloon.setFrameDivBG('big');
}

ISQBalloon.closeFrame = function()
{
	ISQBalloon.rePositionFrameDiv('small');
	ISQBalloon.setFrameDivBG('small');
}

ISQBalloon.lastState = 'small';

ISQBalloon.isPNGsettingSet = false;
ISQBalloon.setFrameDivBG = function(size)
{
	size = size || ISQBalloon.lastState;
	
	var _frameDivBg = document.getElementById('ISQFrameDivBG');
	if (size === 'big')
	{
		_frameDivBg.style.backgroundImage = "url(\""+ISQBalloon.openImg.src+"\")";
		_frameDivBg.style.backgroundRepeat = "no-repeat";
		_frameDivBg.style.backgroundPosition = "0px 0px";
		if (ISQBalloon.browser === 'ie6' && ISQBalloon.openImg.src.indexOf(".png") !== -1)
		{
			
		}
	}
		
	else if (size === 'small')
	{
		_frameDivBg.style.backgroundImage = "url(\""+ISQBalloon.closeImg.src+"\")";
		_frameDivBg.style.backgroundRepeat = "no-repeat";
		_frameDivBg.style.backgroundPosition = "0px 0px";
		if (ISQBalloon.browser === 'ie6' && ISQBalloon.closeImg.src.indexOf(".png") !== -1)
		{
			DD_belatedPNG.fixPng(_frameDivBg);
		}
	}

	if (size === 'big')
	{
		document.getElementById('ISQFrameDiv').style.width = ISQBalloon.openImg.width + "px";
		document.getElementById('ISQFrameDiv').style.height = ISQBalloon.openImg.height + 0 + "px";
		
		if (ISQBalloon.browser === 'ie6' && ISQBalloon.openImg.src.indexOf(".png") !== -1)
			document.getElementById('ISQFrameDivIMG').src = ISQBalloon.openImgIE6.src
		else
			document.getElementById('ISQFrameDivIMG').src = ISQBalloon.openImg.src;
		
	}
	else if (size === 'small')
	{
		document.getElementById('ISQFrameDiv').style.width = ISQBalloon.closeImg.width + "px";
		document.getElementById('ISQFrameDiv').style.height = ISQBalloon.closeImg.height + 0 + "px";
		
		if (ISQBalloon.browser === 'ie6' && ISQBalloon.closeImg.src.indexOf(".png") !== -1)
			document.getElementById('ISQFrameDivIMG').src = ISQBalloon.closeImgIE6.src
		else
			document.getElementById('ISQFrameDivIMG').src = ISQBalloon.closeImg.src;
	}
	
	if (size !== 'animation')
		ISQBalloon.lastState = size;
}

/**************************************************
ISQ componenet API (from component)
**************************************************/
ISQBalloon.API = {}
ISQBalloon.API.showBalloonOnload = function()
{
	var autoMax = ISQBalloon.Params.autoMaximize || false;
	if (autoMax)
	{
		ISQBalloon.isFirstUse = true;
		if (!ISQBalloon.isOpen)
			ISQBalloon.showBalloon();
	}
}
ISQBalloon.API.closeFrame = function()
{
	ISQBalloon.cancelAutoMinimize();
	ISQBalloon.closeFrame();
}
ISQBalloon.API.enlargeFrame = function()
{
	//alert("isOpen? : " + ISQBalloon.isOpen + ",State: " + ISQBalloon.Animation.state);
	if (!ISQBalloon.isOpen || ISQBalloon.Animation.state === "close")
	{
		ISQBalloon.showBalloon(true);
	}
	else
	{
		ISQBalloon.enlargeFrame();
	}
	
	ISQBalloon.cancelAutoMinimize();
}



/**************************************************
ANIMATION
**************************************************/
ISQBalloon.Animation = {
	
	priorTop : 0,
	priorLeft : 0,
	priorHeight : 0,
	priorWidth : 0,
	
	frameCount : 10,
	amoutOfWidthPixels : 5,
	amoutOfHeightPixels : 2,
	TTL : 10,
	hasStarted : false,
	state : "",
		
	getElemTop : function(elem)
	{
		var _top = elem.offsetTop;
		if ((ISQBalloon.positionSystem === 'absolute') && (ISQBalloon.isScroll) && (!ISQBalloon.isOpen) )
		{
			if (ISQBalloon.frameDivCurrSize === 'big')
				_top += ISQBalloon.openImg.height;	
			else
				_top += ISQBalloon.closeImg.height;	
			
			//alert(_top);
			elem.style.top = _top + "px";
		}
		return _top;
	},
	
	start : function(elem1, wantedWidth, wantedHeight, elem2, state)
	{
		if (ISQBalloon.Animation.hasStarted)
		{
			clearTimeout(ISQBalloon.Animation.timeoutObject);
			/*
			ISQBalloon.Animation.waitingObject = new Object();
			ISQBalloon.Animation.waitingObject._elem1 = elem1;
			ISQBalloon.Animation.waitingObject._wantedWidth = wantedWidth;
			ISQBalloon.Animation.waitingObject._wantedHeight = wantedHeight;
			ISQBalloon.Animation.waitingObject._elem2 = elem2;
			return;
			*/
		}
		
		// saving state //
		ISQBalloon.Animation.state = state;
		
		// flag //
		ISQBalloon.Animation.hasStarted = true;
		
		/////////// checking wantedWidth param ////////////////
		if (wantedWidth == null || wantedHeight == null)
			return
			
		/////////// checking elem1 ////////////////
		if (typeof(elem1) === 'string')
			elem1 = document.getElementById(elem1);
		else if (typeof(elem1) === 'object')
			elem1 = elem1;
		else
			return;
		
		/////////// checking elem2 ////////////////
		if (typeof(elem2) === 'string')
			elem2 = document.getElementById(elem2);
		else if (typeof(elem2) === 'object')
			elem2 = elem2;
		else
			elem2 = null;
		
		/////////// Calculating frames ////////////////
		var w1 = elem1.offsetWidth;
		var w2 = wantedWidth;
		if (w1 > w2)
			ISQBalloon.Animation.amoutOfWidthPixels = Math.floor(w1/ISQBalloon.Animation.frameCount);
		else
			ISQBalloon.Animation.amoutOfWidthPixels = Math.floor(w2/ISQBalloon.Animation.frameCount);
			
		var h1 = elem1.offsetHeight;
		var h2 = wantedHeight;
		if (w1 > w2)
			ISQBalloon.Animation.amoutOfHeightPixels = Math.floor(h1/ISQBalloon.Animation.frameCount);
		else
			ISQBalloon.Animation.amoutOfHeightPixels = Math.floor(h2/ISQBalloon.Animation.frameCount);
			
		/////////// saving attributes ////////////////
		ISQBalloon.Animation.priorTop = ISQBalloon.Animation.getElemTop(elem1);
		//document.getElementById('log').innerHTML += "Prior Top: " + ISQBalloon.Animation.priorTop + '<br/>';
		ISQBalloon.Animation.priorHeight = elem1.offsetHeight;
		ISQBalloon.Animation.priorWidth = elem1.offsetWidth;
		
		/////////// calling the actual switch function ////////////////
		ISQBalloon.Animation.changeSize(elem1, wantedWidth, wantedHeight, elem2);
	},
	
	timeoutObject : null,
	
	changeSize : function(elem1, wantedWidth, wantedHeight, elem2)
	{
		elem2 = elem2 || null;
		
		clearTimeout(ISQBalloon.Animation.timeoutObject);
		var currWidth = elem1.offsetWidth;
		var currHeight = elem1.offsetHeight;
		
		var isFurtherResizeNeeded = false;
		
		/**************
		Enlarge
		**************/
		if (currWidth <= wantedWidth && ISQBalloon.Animation.priorWidth <= wantedWidth)	
		{
			/**
			Width
			**/
			if (currWidth === wantedWidth)
			{
				//isFurtherResizeNeeded = false;
			}
			else
			{
				isFurtherResizeNeeded = true;				
				var largeAmount = ISQBalloon.Animation.amoutOfWidthPixels;
				var nextWidth = currWidth + largeAmount;
				while (nextWidth > wantedWidth)
				{
					nextWidth--;
				}
				elem1.style.width = nextWidth + "px";
				if (elem2 !== null)
					elem2.style.width = nextWidth + "px";
			}
			
			/**
			Height
			**/
			if (currHeight === wantedHeight)
			{
				//isFurtherResizeNeeded = false;
			}
			else
			{
				isFurtherResizeNeeded = true;				
				var largeAmount = ISQBalloon.Animation.amoutOfHeightPixels;
				var nextHeight = currHeight + largeAmount;
				while (nextHeight > wantedHeight)
				{
					largeAmount--;
					nextHeight = currHeight + largeAmount;
				}
				elem1.style.height = nextHeight + "px";
				if (elem2 !== null)
					elem2.style.height = nextHeight + "px";
				
				/**
				Changing Element's Top
				**/
				if (typeof(ISQBalloon) != 'undefined')
				{
					if (ISQBalloon.positionSystem === 'absolute')
					{
						var nH = elem1.offsetTop - largeAmount;
						elem1.style.top = nH + "px";
					}
					
				}
				
			}
			
			if (isFurtherResizeNeeded)
			{
				ISQBalloon.Animation.timeoutObject = setTimeout(function(){ISQBalloon.Animation.changeSize(elem1, wantedWidth, wantedHeight, elem2 )}, ISQBalloon.Animation.TTL);
			}
			else
			{
				ISQBalloon.Animation.doneEvent();
				ISQBalloon.Animation.state = "";
				ISQBalloon.Animation.hasStarted = false;
				//ISQBalloon.Animation.processWaiting();
			}
				
			
		}
			
		/**************
		Shrink
		**************/
		else if (currWidth >= wantedWidth && ISQBalloon.Animation.priorWidth >= wantedWidth)	
		{
			/**
			Width
			**/
			if (currWidth === wantedWidth)
			{
				//isFurtherResizeNeeded = false;
			}
			else
			{
				isFurtherResizeNeeded = true;				
				var largeAmount = ISQBalloon.Animation.amoutOfWidthPixels;
				var nextWidth = currWidth - largeAmount;
				while (nextWidth < wantedWidth)
				{
					nextWidth++;
				}
				elem1.style.width = nextWidth + "px";
				if (elem2 !== null)
					elem2.style.width = nextWidth + "px";
			}
			
			/**
			Height
			**/
			if (currHeight === wantedHeight)
			{
				//isFurtherResizeNeeded = false;
			}
			else
			{
				isFurtherResizeNeeded = true;				
				var largeAmount = ISQBalloon.Animation.amoutOfHeightPixels;
				var nextHeight = currHeight - largeAmount;
				while (nextHeight < wantedHeight)
				{
					largeAmount--;
					nextHeight = currHeight - largeAmount;
				}
				elem1.style.height = nextHeight + "px";
				if (elem2 !== null)
					elem2.style.height = nextHeight + "px";
				
				/**
				Changing Element's Top
				**/
				if (typeof(ISQBalloon) !== 'undefined')
				{
					if (ISQBalloon.positionSystem === 'absolute')
					{
						var nH = elem1.offsetTop + largeAmount;
						elem1.style.top = nH + "px";
					}
				}
				
			}
			
			if (isFurtherResizeNeeded)
			{
				ISQBalloon.Animation.timeoutObject = setTimeout(function(){ISQBalloon.Animation.changeSize(elem1, wantedWidth, wantedHeight, elem2)}, ISQBalloon.Animation.TTL);
			}
			else
			{
				ISQBalloon.Animation.doneEvent();
				ISQBalloon.Animation.state = "";
				ISQBalloon.Animation.hasStarted = false;
				//ISQBalloon.Animation.processWaiting();
			}
		}
	},
	
	
	doneEvent : function()
	{
		//will be implemented live
	}
	
	/*
	waitingObject : null,
	processWaiting : function()
	{
		if (ISQBalloon.Animation.waitingObject !== null)
		{
			ISQBalloon.Animation.start(waitingObject._elem1, waitingObject._wantedWidth, waitingObject._wantedHeight, waitingObject._elem2);
			ISQBalloon.Animation.waitingObject = null;
		}	
	}
	*/
}


/*********** SWITCHING TEXT ***************/
ISQBalloon.Title = {}

ISQBalloon.Title.titleArray = new Array();
ISQBalloon.Title.init = function()
{
	var titles = unescape(ISQBalloon.Params.balloonTitle);
	titles = titles.replace(/\&\#39\;/g, "\'");
	titles = titles.replace(/\&\#34\;/g, "\"");
	titles = titles.replace(/\&\lt\;/g, "<");
	titles = titles.replace(/\&gt\;/g, ">");
	ISQBalloon.Title.titleArray = titles.split("|");
	ISQBalloon.Title.time = ISQBalloon.Params.balloonTitleTime || 3000;
}

ISQBalloon.Title.currentTitle = -1;
ISQBalloon.Title.timeoutObject = null;
ISQBalloon.Title.time = 0;

ISQBalloon.Title.go = function()
{
	var l = ISQBalloon.Title.titleArray.length;
	if (l < 2)
		return;
		
	var next = ISQBalloon.Title.currentTitle+1;
	if (next == l)
		next = 0;
		
	document.getElementById('ISQBalloonTitle').innerHTML = ISQBalloon.Title.titleArray[next];	
	ISQBalloon.Title.currentTitle = next;
	
	ISQBalloon.Title.timeoutObject = setTimeout(function(){ ISQBalloon.Title.go() }, ISQBalloon.Title.time);
}

ISQBalloon.Title.stop_ = function()
{
	clearTimeout(ISQBalloon.Title.timeoutObject);
}




/**************************************************
OBJECT POSITION
**************************************************/
ISQBalloon.ObjPos = {};
ISQBalloon.ObjPos.ElementX = function(PdivId)
{
	//checking PdivId
	if (!PdivId)
		return 0;
	else if (typeof(PdivId) == 'string')
		divId = document.getElementById(PdivId);
	else if (typeof(PdivId) == 'object')
		divId = PdivId;
	else
		return 0;
		
	if (divId == null)
		return 0;
	
	var counterX = divId.offsetLeft;
	counterX -= divId.scrollLeft;
	divIdX = divId;
	while (divIdX.offsetParent)
	{
		counterX += divIdX.offsetParent.offsetLeft;
		if (divIdX != document.body)
			counterX -= divIdX.scrollLeft;
		
		divIdX = divIdX.offsetParent;
	}
	return counterX;	
}

ISQBalloon.ObjPos.ElementY = function(PdivId)
{
	//checking PdivId
	if (!PdivId)
		return 0;
	else if (typeof(PdivId) == 'string')
		divId = document.getElementById(PdivId);
	else if (typeof(PdivId) == 'object')
		divId = PdivId;
	else
		return 0;
	
	if (divId == null)
		return 0;
		
	var counterY = divId.offsetTop;
	counterY -= divId.scrollTop;
	
	divIdY = divId;
	while(divIdY.offsetParent)
	{
		counterY += divIdY.offsetParent.offsetTop;
		if (divIdY != document.body)
			counterY -= divIdY.scrollTop;
		divIdY = divIdY.offsetParent;
	}
	
	return counterY;
}



/**************************************************
executes the initial functions
**************************************************/
if (!ISQBalloon.Params)
{
	alert('NO ISQ PARAMS');
}
else
{
	ISQBalloon.getBrowser();
	ISQBalloon.getDocType();
	ISQBalloon.setPositionSystem();
	ISQBalloon.calculateScreenSize();
	ISQBalloon.createTeaserDiv();
	ISQBalloon.createFrameDiv();
	setTimeout(function(){ISQBalloon.setImgs();}, 200);
}




/*************************************************************************************
*************************************************************************************/
/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.8a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
*
* Example usage:
* DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
* DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement
**/
var DD_belatedPNG={ns:"DD_belatedPNG",imgSize:{},delay:10,nodesFixed:0,createVmlNameSpace:function(){if(document.namespaces&&!document.namespaces[this.ns]){document.namespaces.add(this.ns,"urn:schemas-microsoft-com:vml")}},createVmlStyleSheet:function(){var b,a;b=document.createElement("style");b.setAttribute("media","screen");document.documentElement.firstChild.insertBefore(b,document.documentElement.firstChild.firstChild);if(b.styleSheet){b=b.styleSheet;b.addRule(this.ns+"\\:*","{behavior:url(#default#VML)}");b.addRule(this.ns+"\\:shape","position:absolute;");b.addRule("img."+this.ns+"_sizeFinder","behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;");this.screenStyleSheet=b;a=document.createElement("style");a.setAttribute("media","print");document.documentElement.firstChild.insertBefore(a,document.documentElement.firstChild.firstChild);a=a.styleSheet;a.addRule(this.ns+"\\:*","{display: none !important;}");a.addRule("img."+this.ns+"_sizeFinder","{display: none !important;}")}},readPropertyChange:function(){var b,c,a;b=event.srcElement;if(!b.vmlInitiated){return}if(event.propertyName.search("background")!=-1||event.propertyName.search("border")!=-1){DD_belatedPNG.applyVML(b)}if(event.propertyName=="style.display"){c=(b.currentStyle.display=="none")?"none":"block";for(a in b.vml){if(b.vml.hasOwnProperty(a)){b.vml[a].shape.style.display=c}}}if(event.propertyName.search("filter")!=-1){DD_belatedPNG.vmlOpacity(b)}},vmlOpacity:function(b){if(b.currentStyle.filter.search("lpha")!=-1){var a=b.currentStyle.filter;a=parseInt(a.substring(a.lastIndexOf("=")+1,a.lastIndexOf(")")),10)/100;b.vml.color.shape.style.filter=b.currentStyle.filter;b.vml.image.fill.opacity=a}},handlePseudoHover:function(a){setTimeout(function(){DD_belatedPNG.applyVML(a)},1)},fix:function(a){if(this.screenStyleSheet){var c,b;c=a.split(",");for(b=0;b<c.length;b++){this.screenStyleSheet.addRule(c[b],"behavior:expression(DD_belatedPNG.fixPng(this))")}}},applyVML:function(a){a.runtimeStyle.cssText="";this.vmlFill(a);this.vmlOffsets(a);this.vmlOpacity(a);if(a.isImg){this.copyImageBorders(a)}},attachHandlers:function(i){var d,c,g,e,b,f;d=this;c={resize:"vmlOffsets",move:"vmlOffsets"};if(i.nodeName=="A"){e={mouseleave:"handlePseudoHover",mouseenter:"handlePseudoHover",focus:"handlePseudoHover",blur:"handlePseudoHover"};for(b in e){if(e.hasOwnProperty(b)){c[b]=e[b]}}}for(f in c){if(c.hasOwnProperty(f)){g=function(){d[c[f]](i)};i.attachEvent("on"+f,g)}}i.attachEvent("onpropertychange",this.readPropertyChange)},giveLayout:function(a){a.style.zoom=1;if(a.currentStyle.position=="static"){a.style.position="relative"}},copyImageBorders:function(b){var c,a;c={borderStyle:true,borderWidth:true,borderColor:true};for(a in c){if(c.hasOwnProperty(a)){b.vml.color.shape.style[a]=b.currentStyle[a]}}},vmlFill:function(e){if(!e.currentStyle){return}else{var d,f,g,b,a,c;d=e.currentStyle}for(b in e.vml){if(e.vml.hasOwnProperty(b)){e.vml[b].shape.style.zIndex=d.zIndex}}e.runtimeStyle.backgroundColor="";e.runtimeStyle.backgroundImage="";f=true;if(d.backgroundImage!="none"||e.isImg){if(!e.isImg){e.vmlBg=d.backgroundImage;e.vmlBg=e.vmlBg.substr(5,e.vmlBg.lastIndexOf('")')-5)}else{e.vmlBg=e.src}g=this;if(!g.imgSize[e.vmlBg]){a=document.createElement("img");g.imgSize[e.vmlBg]=a;a.className=g.ns+"_sizeFinder";a.runtimeStyle.cssText="behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;";c=function(){this.width=this.offsetWidth;this.height=this.offsetHeight;g.vmlOffsets(e)};a.attachEvent("onload",c);a.src=e.vmlBg;a.removeAttribute("width");a.removeAttribute("height");document.body.insertBefore(a,document.body.firstChild)}e.vml.image.fill.src=e.vmlBg;f=false}e.vml.image.fill.on=!f;e.vml.image.fill.color="none";e.vml.color.shape.style.backgroundColor=d.backgroundColor;e.runtimeStyle.backgroundImage="none";e.runtimeStyle.backgroundColor="transparent"},vmlOffsets:function(d){var h,n,a,e,g,m,f,l,j,i,k;h=d.currentStyle;n={W:d.clientWidth+1,H:d.clientHeight+1,w:this.imgSize[d.vmlBg].width,h:this.imgSize[d.vmlBg].height,L:d.offsetLeft,T:d.offsetTop,bLW:d.clientLeft,bTW:d.clientTop};a=(n.L+n.bLW==1)?1:0;e=function(b,p,q,c,s,u){b.coordsize=c+","+s;b.coordorigin=u+","+u;b.path="m0,0l"+c+",0l"+c+","+s+"l0,"+s+" xe";b.style.width=c+"px";b.style.height=s+"px";b.style.left=p+"px";b.style.top=q+"px"};e(d.vml.color.shape,(n.L+(d.isImg?0:n.bLW)),(n.T+(d.isImg?0:n.bTW)),(n.W-1),(n.H-1),0);e(d.vml.image.shape,(n.L+n.bLW),(n.T+n.bTW),(n.W),(n.H),1);g={X:0,Y:0};if(d.isImg){g.X=parseInt(h.paddingLeft,10)+1;g.Y=parseInt(h.paddingTop,10)+1}else{for(j in g){if(g.hasOwnProperty(j)){this.figurePercentage(g,n,j,h["backgroundPosition"+j])}}}d.vml.image.fill.position=(g.X/n.W)+","+(g.Y/n.H);m=h.backgroundRepeat;f={T:1,R:n.W+a,B:n.H,L:1+a};l={X:{b1:"L",b2:"R",d:"W"},Y:{b1:"T",b2:"B",d:"H"}};if(m!="repeat"||d.isImg){i={T:(g.Y),R:(g.X+n.w),B:(g.Y+n.h),L:(g.X)};if(m.search("repeat-")!=-1){k=m.split("repeat-")[1].toUpperCase();i[l[k].b1]=1;i[l[k].b2]=n[l[k].d]}if(i.B>n.H){i.B=n.H}d.vml.image.shape.style.clip="rect("+i.T+"px "+(i.R+a)+"px "+i.B+"px "+(i.L+a)+"px)"}else{d.vml.image.shape.style.clip="rect("+f.T+"px "+f.R+"px "+f.B+"px "+f.L+"px)"}},figurePercentage:function(d,c,f,a){var b,e;e=true;b=(f=="X");switch(a){case"left":case"top":d[f]=0;break;case"center":d[f]=0.5;break;case"right":case"bottom":d[f]=1;break;default:if(a.search("%")!=-1){d[f]=parseInt(a,10)/100}else{e=false}}d[f]=Math.ceil(e?((c[b?"W":"H"]*d[f])-(c[b?"w":"h"]*d[f])):parseInt(a,10));if(d[f]%2===0){d[f]++}return d[f]},fixPng:function(c){c.style.behavior="none";var g,b,f,a,d;if(c.nodeName=="BODY"||c.nodeName=="TD"||c.nodeName=="TR"){return}c.isImg=false;if(c.nodeName=="IMG"){if(c.src.toLowerCase().search(/\.png$/)!=-1){c.isImg=true;c.style.visibility="hidden"}else{return}}else{if(c.currentStyle.backgroundImage.toLowerCase().search(".png")==-1){return}}g=DD_belatedPNG;c.vml={color:{},image:{}};b={shape:{},fill:{}};for(a in c.vml){if(c.vml.hasOwnProperty(a)){for(d in b){if(b.hasOwnProperty(d)){f=g.ns+":"+d;c.vml[a][d]=document.createElement(f)}}c.vml[a].shape.stroked=false;c.vml[a].shape.appendChild(c.vml[a].fill);c.parentNode.insertBefore(c.vml[a].shape,c)}}c.vml.image.shape.fillcolor="none";c.vml.image.fill.type="tile";c.vml.color.fill.on=false;g.attachHandlers(c);g.giveLayout(c);g.giveLayout(c.offsetParent);c.vmlInitiated=true;g.applyVML(c)}};try{document.execCommand("BackgroundImageCache",false,true)}catch(r){}DD_belatedPNG.createVmlNameSpace();DD_belatedPNG.createVmlStyleSheet();
