
//[1] => -1*



function CaptureAd(content_type, style, width, height, bgcolor, h_align) { 
	//local private
	var _this = this;
	var ie = (navigator.appVersion.indexOf("MSIE")!=-1);
	
	//VARIABLES
		//parameters
	this.type = null;
	this.style = style;
	this.bgcolor = (bgcolor?bgcolor:'#FFF');
	this.h_align = h_align;
		//DOM objects
	this.underlay = false;
	this.root = document.createElement("div");
	this.content = document.createElement(content_type);
	if(content_type = "iframe") this.content.frameBorder = '0';
	this.body = null;
	this.dragbar = null;
	this.countdown = null;
	this.close = null;
		//interval handle
	this.motionHandle = null;
		//calculated values
	this.contentWidth  = parseInt(width);
	this.contentHeight = parseInt(height);
	this.rootWidth  = parseInt(width);
	this.rootHeight = parseInt(height);
	
	//FUNCTIONS
		//hoverad dependent motions
	this.appear = function() {};
	this.disappear = function() {};
	this.showContent = function() {};
	this.hideContent = function() {};
		//sizing functions
	this.refreshSize = function() {};
	this.setSize = function(width, height) {
		_this.root.style.width = width+'px';
		_this.root.style.height = height+'px';
		_this.refreshSize();
	};
	this.fullSize = function() {
		_this.setSize(this.rootWidth, this.rootHeight);
	};


	
	//STYLE DEPENDENT PROCESSING
	if(this.style == 'rounded') {
		this.type = "hover";
		this.rootWidth  = this.contentWidth+30;
		this.rootHeight = this.contentHeight+50;
		
		//STRUCTURE
		div_tl = document.createElement('div');
		div_tl.style.fontSize = '2px';
		div_tl.style.height = '15px';
		div_tl.style.paddingLeft = '15px';
		if(!ie) {
			div_tl.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/standard_tl.png)';
			div_tl.style.backgroundPosition = 'top left';
			div_tl.style.backgroundRepeat = 'no-repeat';
		} else {
			div_tl.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/standard_tl.png", sizingMethod="crop")';
		}
		this.root.appendChild(div_tl);
		
		div_tr = document.createElement('div');
		div_tr.style.fontSize = '2px';
		div_tr.style.height = '15px';
		if(!ie) {
			div_tr.style.paddingRight = '15px';
			div_tr.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/standard_tr.png)';
			div_tr.style.backgroundPosition = 'top right';
			div_tr.style.backgroundRepeat = 'no-repeat';
		} else {
			div_tr_ie = document.createElement('div');
			div_tr_ie.style.display = 'inline';
			div_tr_ie.style.width = '15px';
			div_tr_ie.style.height = '15px';
			div_tr_ie.style.position = 'relative';
			div_tr_ie.style.left = width+'px';
			div_tr_ie.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/standard_tr.png", sizingMethod="crop")';
			div_tr.appendChild(div_tr_ie);
		}
		div_tl.appendChild(div_tr);
		
		div_t = document.createElement('div');
		div_t.style.fontSize = '2px';
		div_t.style.height = '15px';
		if(!ie) {
			div_t.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/standard_side.png)';
			div_t.style.backgroundRepeat = 'repeat';
		} else {
			div_t.style.display = 'inline';
			div_t.style.position = 'relative';
			div_t.style.width = width+'px';
			div_t.style.left = '-15px';
			div_t.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/standard_side.png", sizingMethod="scale")';
		}
		div_tr.appendChild(div_t);
		
		div_m = document.createElement('div');
		div_m.style.height = (parseInt(height)+20)+'px';
		div_m.style.padding = '0 15px 0 15px';
		if(!ie) {
			div_m.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/standard_side.png)';
			div_m.style.backgroundRepeat = 'repeat';
		} else {
			div_m.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/standard_side.png", sizingMethod="scale")';
		}
		this.root.appendChild(div_m);
		
		this.body = document.createElement('div');
		this.body.style.height = '100%';
		this.body.style.backgroundColor= bgcolor;
		div_m.appendChild(this.body);
		
		div_bl = document.createElement('div');
		div_bl.style.fontSize = '2px';
		div_bl.style.height = '15px';
		div_bl.style.paddingLeft = '15px';
		if(!ie) {
			div_bl.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/standard_bl.png)';
			div_bl.style.backgroundPosition = 'bottom left';
			div_bl.style.backgroundRepeat = 'no-repeat';
		} else {
			div_bl.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/standard_bl.png", sizingMethod="crop")';
		}
		this.root.appendChild(div_bl);
		
		div_br = document.createElement('div');
		div_br.style.fontSize = '2px';
		div_br.style.height = '15px';
		if(!ie) {
			div_br.style.paddingRight = '15px';
			div_br.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/standard_br.png)';
			div_br.style.backgroundPosition = 'bottom right';
			div_br.style.backgroundRepeat = 'no-repeat';
		} else {
			div_br_ie = document.createElement('div');
			div_br_ie.style.display = 'inline';
			div_br_ie.style.width = '15px';
			div_br_ie.style.height = '15px';
			div_br_ie.style.position = 'relative';
			div_br_ie.style.left = width+'px';
			div_br_ie.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/standard_br.png", sizingMethod="crop")';
			div_br.appendChild(div_br_ie);
		}
		div_bl.appendChild(div_br);
		
		div_b = document.createElement('div');
		div_b.style.fontSize = '2px';
		div_b.style.height = '15px';
		if(!ie) {
			div_b.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/standard_side.png)';
			div_b.style.backgroundRepeat = 'repeat';
		} else {
			div_b.style.display = 'inline';
			div_b.style.position = 'relative';
			div_b.style.width = width+'px';
			div_b.style.left = '-15px';
			div_b.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/standard_side.png", sizingMethod="scale")';
		}
		div_br.appendChild(div_b);
		
		this.dragbar = document.createElement('div');
		this.dragbar.style.height = '20px';
		this.body.appendChild(this.dragbar);
		
		this.countdown = document.createElement('input');
		this.countdown.type = 'text';
		this.countdown.readonly = true;
		this.countdown.style.cssFloat = 'left';
		this.countdown.style.styleFloat = 'left';
		this.countdown.style.padding = '0 2px';
		this.countdown.style.fontFamily = 'verdana';
		this.countdown.style.color = 'black';
		this.countdown.style.fontSize = '10px';
		this.countdown.style.textDecoration = 'none';
		this.countdown.style.backgroundColor = 'transparent';
		this.countdown.style.border = '0';
		this.countdown.style.display = 'none';
		this.dragbar.appendChild(this.countdown);

		this.close = document.createElement('a');
		if(!ie) {
			this.close.innerHTML = '<img src="http://capture.ws.xeal.com/images/standard_close.png" height=16 width=16 />';
		} else {
			this.close.innerHTML = "<div style='width:16px;height:16px;margin:0;padding:0;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"http://capture.ws.xeal.com/images/standard_close.png\", sizingMethod=\"crop\");' />";
		}
		this.close.style.cssFloat = 'right';
		this.close.style.styleFloat = 'right';
		this.close.style.padding = '2px';
		this.dragbar.appendChild(this.close);
		
		this.content.style.width = width+'px';
		this.content.style.height = height+'px';
		this.body.appendChild(this.content);
		
		//FUNCTIONS
		this.refreshSize = function() { 
			div_m.style.height = (parseInt(_this.root.style.height)-30)+'px';
			_this.content.style.height = (parseInt(_this.root.style.height)-50)+'px';
			_this.content.style.width = (parseInt(_this.root.style.width)-30)+'px';
			if(ie) {
				div_br_ie.style.left = (parseInt(_this.root.style.width)-30)+'px';
				div_b.style.width = (parseInt(_this.root.style.width)-30)+'px';
				div_tr_ie.style.left = (parseInt(_this.root.style.width)-30)+'px';
				div_t.style.width = (parseInt(_this.root.style.width)-30)+'px';
			}
		};



	
	
	} else if(this.style == 'corner') {
		this.type = "pull";
		if(this.h_align == 'center') {
			this.rootWidth  = this.contentWidth+42;
			this.rootHeight = this.contentHeight+17;
		} else {
			this.rootWidth  = this.contentWidth+21;
			this.rootHeight = this.contentHeight+17;
		}
		
		if(this.h_align == 'center') {
			tabheight = 40;
			tabwidth = this.rootWidth;
		} else {
			tabheight = 90;
			tabwidth = 90;
		}
		
		//STRUCTURE
		contain = document.createElement('div');
		contain.style.position = 'absolute';
		contain.style.height= this.rootHeight+'px';
		contain.style.width= this.rootWidth+'px';
		contain.style.bottom = '0';
		if(this.h_align == 'left')
			contain.style.right = '0';
		else
			contain.style.left = '0';
		this.root.appendChild(contain);
		
		this.root.style.overflow = 'hidden';
		this.root.style.top = '0';
		if(this.h_align == 'left')
			this.root.style.left = '0';
		else if(this.h_align == 'center')
			this.root.style.right = ((document.all ? (document.compatMode!='BackCompat' ? document.documentElement : document.body).clientWidth : window.innerWidth)-this.rootWidth)/2;
		else
			this.root.style.right = '0';

		div_b = document.createElement('div');
		div_b.style.position = 'absolute';
		div_b.style.bottom = '0';
		if(this.h_align == 'left')
			div_b.style.right = '150px';
		else
			div_b.style.left = '150px';
		div_b.style.width = (parseInt(contain.style.width)-(this.h_align!='center'?150:300))+'px';
		div_b.style.height = '17px';
		if(!ie) {
			div_b.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/corner_b.png)';
//			div_b.style.backgroundPosition = 'bottom left';
			div_b.style.backgroundRepeat = 'no-repeat';
		} else {
			div_b.style.bottom = '-2px';
			div_b.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/corner_b.png", sizingMethod="crop")';
		}
		contain.appendChild(div_b);

		div_s = document.createElement('div');
		div_s.style.position = 'absolute';
		div_s.style.bottom = '150px';
		if(this.h_align == 'left')
			div_s.style.right = '0';
		else
			div_s.style.left = '0';
		div_s.style.width = '21px';
		div_s.style.height = (parseInt(contain.style.height)-150)+'px';
		if(!ie) {
			if(this.h_align == 'left')
				div_s.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/corner_r.png)';
			else
				div_s.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/corner_l.png)';
//			div_s.style.backgroundPosition = 'bottom left';
			div_s.style.backgroundRepeat = 'no-repeat';
		} else {
			if(this.h_align == 'left')
				div_s.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/corner_r.png", sizingMethod="crop")';
			else
				div_s.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/corner_l.png", sizingMethod="crop")';
		}
		contain.appendChild(div_s);
		
		div_s2 = document.createElement('div');
		if(this.h_align == 'center') {
			div_s2.style.position = 'absolute';
			div_s2.style.bottom = '150px';
			div_s2.style.right = '0';
			div_s2.style.width = '21px';
			div_s2.style.height = (parseInt(contain.style.height)-150)+'px';
			if(!ie) {
				div_s2.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/corner_r.png)';
				div_s2.style.backgroundRepeat = 'no-repeat';
			} else {
				div_s2.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/corner_r.png", sizingMethod="crop")';
			}
			contain.appendChild(div_s2);
		}

		div_corner = document.createElement('div');
		div_corner.style.position = 'absolute';
		div_corner.style.bottom = '0';
		if(this.h_align == 'left')
			div_corner.style.right = '0';
		else
			div_corner.style.left = '0';
		div_corner.style.width = '150px';
		div_corner.style.height = '150px';
		if(!ie) {
			if(this.h_align == 'left')
				div_corner.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/corner_br.png)';
			else
				div_corner.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/corner_bl.png)';
//			div_corner.style.backgroundPosition = 'bottom left';
			div_corner.style.backgroundRepeat = 'no-repeat';
		} else {
			if(this.h_align == 'left')
				div_corner.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/corner_br.png", sizingMethod="crop")';
			else
				div_corner.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/corner_bl.png", sizingMethod="crop")';
		}
		contain.appendChild(div_corner);
		
		div_corner2 = document.createElement('div');
		if(this.h_align == 'center') {
			div_corner2.style.position = 'absolute';
			div_corner2.style.bottom = '0';
			div_corner2.style.right = '0';
			div_corner2.style.width = '150px';
			div_corner2.style.height = '150px';
			if(!ie) {
				div_corner2.style.backgroundImage = 'url(http://capture.ws.xeal.com/images/corner_br.png)';
				div_corner2.style.backgroundRepeat = 'no-repeat';
			} else {
				div_corner2.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://capture.ws.xeal.com/images/corner_br.png", sizingMethod="crop")';
			}
			contain.appendChild(div_corner2);
		}
		
		this.content.style.position = 'absolute';
		this.content.style.top = '0';
		if(this.h_align == 'left')
			this.content.style.left = '0';
		else if(this.h_align == 'center')
			this.content.style.left = (this.rootWidth-this.contentWidth)/2;
		else
			this.content.style.right = '0';
		this.content.style.width = width+'px';
		this.content.style.height = height+'px';
		contain.appendChild(this.content);

		this.countdown = document.createElement('input');
		this.countdown.type = 'text';
		this.countdown.readonly = true;
		this.countdown.style.position = 'absolute';
		this.countdown.style.bottom = '17px';
		if(this.h_align == 'left')
			this.countdown.style.right = '21px';
		else
			this.countdown.style.left = '21px';
		this.countdown.style.padding = '0 2px';
		this.countdown.style.fontFamily = 'verdana';
		this.countdown.style.color = 'black';
		this.countdown.style.fontSize = '10px';
		this.countdown.style.textDecoration = 'none';
		this.countdown.style.backgroundColor = 'transparent';
		this.countdown.style.border = '0';
		this.countdown.style.display = 'none';
		contain.appendChild(this.countdown);
		
		this.body = this.content;
		
		this.dragbar = document.createElement('div');
		this.dragbar.style.display = 'none';
		this.close = document.createElement('div');
		this.close.style.display = 'none';
		
		//FUNCTIONS
		setTrigger = function(type) {
			div_corner.onmousemove = null;
			if(_this.h_align == 'center') {
				div_corner2.onmousemove = null;
				div_b.onmousemove = null;
			}
			if(!ie) window.onmousemove = null;
			   else document.onmousemove = null;
			
			if(type == 'show') {
				div_corner.onmousemove = _this.showContent;
				if(_this.h_align == 'center') {
					div_corner2.onmousemove = _this.showContent;
					div_b.onmousemove = _this.showContent;
				}
				
			} else if(type == 'hide') {
				if(!ie)	window.onmousemove = _this.hideContent;
				   else document.onmousemove = _this.hideContent;
				
			}
		}
		this.appear = function() {
			if(_this.motionHandle) clearInterval(_this.motionHandle);
			var time = 600;
			var interval = 50;
			var num = Math.floor(time/interval);
			var speedtop = tabheight/num;
			if(_this.h_align == 'center') {
				var speedside = 0;
				_this.setSize(_this.rootWidth, 0);
			} else {
				var speedside = tabwidth/num;
				_this.setSize(0, 0);
			}
			contain.removeChild(div_corner);
			contain.appendChild(div_corner);
			if(_this.h_align == 'center') {
				contain.removeChild(div_corner2);
				contain.appendChild(div_corner2);
			}
			contain.removeChild(_this.countdown);
			contain.appendChild(_this.countdown);
			_this.motionHandle = setInterval(function() {
				if(num == 1) {
					_this.setSize(tabwidth, tabheight);
					clearInterval(_this.motionHandle);
					setTrigger('show');
					return;
				}
				_this.setSize(parseInt(_this.root.style.width)+speedside, parseInt(_this.root.style.height)+speedtop);
				num = num-1;
			},interval);
		};
		this.disappear = function(onfinish) {
			setTrigger('delete');
			if(_this.motionHandle) clearInterval(_this.motionHandle);
			var time = 500;
			var interval = 50;
			var num = Math.floor(time/interval);
			var speedtop = (parseInt(contain.style.height)+parseInt(contain.style.top))/num;
			var speedside = (parseInt(contain.style.width)+parseInt(contain.style.right))/num;
			contain.removeChild(div_corner);
			contain.appendChild(div_corner);
			if(_this.h_align == 'center') {
				contain.removeChild(div_corner2);
				contain.appendChild(div_corner2);
			}
			_this.motionHandle = setInterval(function() {
				if(num == 1) {
					_this.setSize(0, 0);
					clearInterval(_this.motionHandle);
					if(onfinish) onfinish();
					return;
				}
				_this.setSize(parseInt(_this.root.style.width)-speedside, parseInt(_this.root.style.height)-speedtop);
				num = num-1;
			},interval);
		};
		this.showContent = function() {
			var time = 300;
			var interval = 50;
			var num = Math.floor(time/interval);
			var speedtop = Math.floor((parseInt(contain.style.height)-tabheight)/num);
			var speedside = Math.floor((parseInt(contain.style.width)-tabwidth)/num);
			setTrigger('delete');
			setTimeout(function() {setTrigger('hide');}, time+250);
			_this.setSize(tabwidth, tabheight);
			contain.removeChild(div_corner);
			contain.insertBefore(div_corner,_this.content);
			if(_this.h_align == 'center') {
				contain.removeChild(div_corner2);
				contain.insertBefore(div_corner2,_this.content);
			}
			_this.motionHandle = setInterval(function() {
				if(num <= 1) {
					_this.fullSize();
					clearInterval(_this.motionHandle);
					return;
				}
//alert("show:"+speedtop+" "+speedside+" "+_this.root.style.height+" "+_this.root.style.width+_this.root.style.top+" "+_this.root.style.right);
				_this.setSize(parseInt(_this.root.style.width)+speedside, parseInt(_this.root.style.height)+speedtop);
				num = num-1;
			},interval);
		};
		this.hideContent = function() {
			var time = 300;
			var interval = 50;
			var num = Math.floor(time/interval);
			var speedtop = Math.floor((parseInt(contain.style.height)-tabheight)/num);
			var speedside = Math.floor((parseInt(contain.style.width)-tabwidth)/num);
			setTrigger('delete');
			setTimeout(function() {setTrigger('show');}, time+250);
			_this.setSize(parseInt(contain.style.width), parseInt(contain.style.height));
			_this.motionHandle = setInterval(function() {
				if(num == 1) {
					_this.setSize(tabwidth, tabheight);
					contain.removeChild(div_corner);
					contain.appendChild(div_corner);
					if(_this.h_align == 'center') {
						contain.removeChild(div_corner2);
						contain.appendChild(div_corner2);
					}
					contain.removeChild(_this.countdown);
					contain.appendChild(_this.countdown);
					clearInterval(_this.motionHandle);
					return;
				}
//alert("hide:"+speedtop+" "+speedside+" "+_this.root.style.height+" "+_this.root.style.width+_this.root.style.top+" "+_this.root.style.right);
				_this.setSize(parseInt(_this.root.style.width)-speedside, parseInt(_this.root.style.height)-speedtop);
				num = num-1;
			},interval);
		};

		this.refreshSize = function() {
			newwidth = (parseInt(_this.root.style.width)-(_this.h_align!='center'?150:300));
			div_b.style.width = (newwidth>0?newwidth:0)+'px';
			newheight = (parseInt(_this.root.style.height)-150);
			div_s.style.height = (newheight>0?newheight:0)+'px';
			div_s2.style.height = (newheight>0?newheight:0)+'px';
			
			this.content.style.width = (parseInt(this.contain.style.width)+this.contentWidth-this.rootWidth)+'px';
			this.content.style.height = (parseInt(this.contain.style.height)+this.contentHeight-this.rootHeight)+'px';
		};
		this.contain = contain;
		



	
	//default to 'basic'
	} else { 
		this.type = "hover";
		if(!ie) {
			this.rootWidth  = this.contentWidth+0;
			this.rootHeight = this.contentHeight+15;
		} else {
			this.rootWidth  = this.contentWidth+2;
			this.rootHeight = this.contentHeight+17;
		}
		
		//STRUCTURE
		this.root.style.border='1px solid #000040';
		this.root.style.backgroundColor= bgcolor;
		
		this.body = this.root;
		
		this.dragbar = this.root;

		this.countdown = document.createElement('input');
		this.countdown.type = 'text';
		this.countdown.readonly = true;
		this.countdown.style.position = 'absolute';
		this.countdown.style.top = '0';
		this.countdown.style.left = '0';
		this.countdown.style.padding = '0 2px';
		this.countdown.style.fontFamily = 'verdana';
		this.countdown.style.color = 'black';
		this.countdown.style.fontSize = '10px';
		this.countdown.style.textDecoration = 'none';
		this.countdown.style.backgroundColor = 'transparent';
		this.countdown.style.border = '0';
		this.countdown.style.display = 'none';
		this.root.appendChild(this.countdown);

		this.close = document.createElement('a');
		this.close.innerHTML = '[Close]';
		this.close.style.position = 'absolute';
		this.close.style.top = '0';
		this.close.style.right = '0';
		this.close.style.padding = '0 2px';
		this.close.style.fontFamily = 'verdana';
		this.close.style.color = 'black';
		this.close.style.fontSize = '10px';
		this.close.style.textDecoration = 'none';
		this.close.style.backgroundColor = 'white';
		this.close.style.opacity='.7';
		this.close.style.filter='alpha(opacity=70)';
		this.root.appendChild(this.close);

		this.content.style.position = 'absolute';
		this.content.style.top = '15px';
		this.content.style.left = '0';
		this.content.style.width = width+'px';
		this.content.style.height = height+'px';
		this.root.appendChild(this.content);
		
		//FUNCTIONS
		

		
		


	} 

	this.fullSize();
	
	if(navigator.userAgent.indexOf("Firefox")!=-1 && navigator.userAgent.indexOf("Ubuntu")!=-1) {
	        this.underlay = document.createElement("iframe");
                this.underlay.src='';
	        this.underlay.style.display = 'none';
	        this.underlay.frameBorder = 0;
	        this.underlay.style.position='absolute';
		this.underlay.style.left='-1px';
		this.underlay.style.top='-1px';
	        this.underlay.style.width='101%';
	        this.underlay.style.height='101%';
		this.underlay.style.zIndex='-2';
	        this.underlay.style.display = 'block';
	        this.root.appendChild(this.underlay);
	}

} 


function DisplayCaptureAd() {
var _this = this;
var _staticName = '_scap'+(new Date()).getTime();
eval('window.'+_staticName+' = this');
this.ad = null;
var startHandle = null;
var countHandle = null;
var tycloseHandle = null;
var ie = (navigator.userAgent.indexOf('MSIE') !=-1);
truebody = function() {	return ((document.compatMode!='BackCompat') ? document.documentElement : document.body); };
pagewidth = function() { return (document.all ? truebody().clientWidth : window.innerWidth); };
pageheight = function() { return (document.all ? truebody().clientHeight : window.innerHeight); };
runExternal = function(tag, domain, path, query) { var script=document.getElementById('_scap_script_'+tag);if(script) script.parentNode.removeChild(script);script=document.createElement('SCRIPT');script.id='_scap_script_'+tag;script.src='http://'+domain+'/'+path+'?'+query+'&amp;stamp='+(new Date()).getTime();var head=document.getElementsByTagName('HEAD')[0];head.appendChild(script); };
tryClose = function() { 
runExternal('tryclose', 'capture.ws.xeal.com', 'external.js.php', 'type=tryclose&func=window.'+_staticName+'.disappear&l=NDErRTQ5MTI5NTcyNTEzNjEuMQ%3D%3D');
 };
tryTyClose = function() { 
runExternal('trytyclose', 'capture.ws.xeal.com', 'external.js.php', 'type=trytyclose&func=window.'+_staticName+'.disappear&dur=60&l=NDErRTQ5MTI5NTcyNTEzNjEuMQ%3D%3D');
 };
logClosed = function() { 
runExternal('closed', 'capture.ws.xeal.com', 'external.js.php', 'type=log&closed=1&l=NDErRTQ5MTI5NTcyNTEzNjEuMQ%3D%3D');
 };
this.dismiss = function() { 
if(hover_entryHandle) clearInterval(hover_entryHandle);
if(hover_blockout) hover_blockout.style.display='none';
if(startHandle) clearInterval(startHandle);
if(countHandle) clearInterval(countHandle);
if(tycloseHandle) clearInterval(tycloseHandle);
_this.ad.root.style.display='none';
logClosed();
 };
this.disappear = function() { 
if(_this.ad.type == 'pull') _this.ad.disappear(_this.dismiss);
                       else _this.dismiss();
 };
start = function() { 
hover_entrySide = hover_side;
hover_entryTop = -350;
hover_entryHandle = setInterval(hover_nextEntry, 50);
_this.ad.countdown.value = 60;
countHandle = setInterval(doCount, 1000);
tycloseHandle = setInterval(tryTyClose, 60000);
 };
showFinal = function() { 
if(hover_entryHandle) clearInterval(hover_entryHandle);
hover_place(hover_top,hover_side);
var expires = new Date();
expires.setTime(expires.getTime()+10800000);
document.cookie='_scap_block=1;expires='+expires.toGMTString();
_this.ad.root.style.display='block';
 };
doCount = function() {
if(_this.ad.countdown.value <= 0) {
tryClose();
if(countHandle) clearInterval(countHandle);
_this.ad.countdown.value = '--';
} else {
_this.ad.countdown.value = _this.ad.countdown.value-1;
}
};
var hover_entryHandle = null;
var hover_entryTop = null;
var hover_entrySide = null;
var hover_entryVar1 = false;
var hover_entryVar2 = false;
var hover_top = null;
var hover_side = null;
var hover_blockout = null;
hover_place = function(top,side) { 
_this.ad.root.style.top=top+'px';
_this.ad.root.style.left=side+'px';
 };
hover_showEntry = function() { 
hover_place(hover_entryTop,hover_entrySide);
_this.ad.root.style.display='block';
 };
hover_nextEntry = function() { 
var diff_top = hover_top-hover_entryTop;
var diff_side = hover_side-hover_entrySide;
var dir_top;
var dir_side;
if(hover_entryVar1 == false) { 
var speed = 25;if(Math.abs(diff_top)<speed && Math.abs(diff_side)<speed) { 
hover_entryVar1 = true;
hover_entryVar2 = 12;
 } 
dir_top = (diff_top==0?0:speed * diff_top / Math.abs(diff_top));
dir_side = (diff_side==0?0:speed * diff_side / Math.abs(diff_side));
hover_entryTop += dir_top;
hover_entrySide += dir_side;
 } 
if(hover_entryVar1 == true) { 
if(hover_entryVar2 == 0) { 
showFinal();
return;
 } 
var change = (hover_entryVar2%2==1?1:-1)*hover_entryVar2/3;
hover_entryTop = hover_top + change;
hover_entrySide = hover_side;
hover_entryVar2 -= 1;
 } 
hover_showEntry();
 };
this.ad = new CaptureAd('iframe', 'basic', '300', '350', '#FFFFFF', 'left');
this.ad.root.style.position = 'absolute';
this.ad.root.style.display = 'none';
this.ad.root.style.zIndex = '51';
document.body.appendChild(this.ad.root);
this.ad.content.src = 'http://capture.ws.xeal.com/content.php?c=iikjkhexbn&n=1&l=NDErRTQ5MTI5NTcyNTEzNjEuMQ%3D%3D';
this.ad.content.scrolling = 'auto';
this.ad.content.style.border = '0';
this.ad.close.style.cursor = 'pointer';
this.ad.close.onmousedown = this.dismiss;
hover_top = 70;
hover_side = 54;
startHandle = setTimeout(start, 4000);
};
var _scap = null;function _scap_setOnLoad() {
var _scap_old_onload = window.onload;
window.onload = function() {
if(_scap_old_onload) _scap_old_onload();
_scap = new DisplayCaptureAd();
};
}
if(document.cookie.indexOf('_scap_block=1') == -1) {
_scap_setOnLoad();}


