//
// is.js
//
var m_isAnCtr = null;
var m_isAnDiv = null;
var m_isAnFin = null;
var m_isAnShd = null;
var m_isCtDiv = null;
var m_isBgDiv = null;
var m_isSmDiv = null;
var m_isImage = null;
var m_isTlImg = null;
var m_isTlTxt = null;
var m_isDesc  = null;
var m_isIntro = null;
var m_isUrl   = null;
var m_isEmail = null;
var m_isCaption = null;
var m_isCount = 0;
var m_isMode  = "inline";
var m_isSecs  = 7;
var m_isWidth = 728;
var m_isExpnd = false;
var m_isParaFix = /para/;
var m_isStart;
var m_isFinish;
var newBgcolor ="#f2f6ff";
var m_isImageOnly = false;

function isShow()
{
	var dhtml = isCSS && ( isIE4 || isGecko || isOpera );

	if( !dhtml || ( isOpera && readOperaVer() < 4 ) )
	{
		return;
	}
	
	isInit();

	if( m_isExpnd )
	{
		setTimeout( "isShow2()", 1000 );
	}
	else
	{
		isCollapse();
		m_isCtDiv.style.display = "block";
	}
}

function isShow2()
{
	isAnimate( 20, 110, m_isSmDiv, m_isBgDiv );
	
	setTimeout( "isAnimClose()", m_isSecs * 1000 );
}

function isWinCheck()
{
	if( typeof(lastPopup) == "undefined" || !lastPopup || !("parent" in lastPopup) )
	{
		setTimeout( "isShow2()", 200 );
	}
}



function isInit()
{
	// build the animation container
	if( m_isMode != "inline" )
	{
		extra = "; position:absolute;z-index: 1";
		
		if( m_isImageOnly && m_isMode != "globalpromo")
		{
			centerPosition = (m_isWidth/2) - (m_imageWidth/2);
			// add the left margin
			if(document.body && document.body.leftMargin)
			{
				centerPosition +=  parseInt(document.body.leftMargin) + 1;
			}
			else
			{
				centerPosition +=  11;
			}
			
			extra += "; left:" + centerPosition + "px";
		}
		
		if( m_isMode == "globalpromo" )
		{
			m_isWidth = 362;
		}
	}
	else
	{
		extra = "";
	}
	
	if( m_isUrl && m_isUrl.toLowerCase().indexOf( "javascript:" ) == 0 )
	{
		// ok.. its a js call... insert the autoclose...
		m_isUrl += ";isAutoClose()";
	}
	
	document.write ( "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"" + m_isWidth + "\"><tr><td>" );
	document.writeln( "<div id=\"is_animctr\" style=\"display:none" + extra + "\">" );
	
	// Correct the width and copy image content in case of imageonly interstitial
	if(m_isImageOnly)
	{
		m_isWidth = m_imageWidth;

		imageContainer = getRawObject("imageHolderDiv");
		s = isStripFlashRenderingScripts(imageContainer);
	}
	
	// build the smaller window
	if( m_isMode == "inline" )
	{
		initSmall( "none" );
	}
	
	if(m_isUrl)
		linkWrapper = "<a href=\"" + m_isUrl + "\">";
	else
		linkWrapper = "<a>";
		
	var s;
	// build the larger window
	if( m_isMode == "globalpromo" )
	{

		if(m_isImageOnly)
		{
			document.writeln( "<table id=\"is_large\" cellpadding=\"0\" cellspacing=\"0\" width=\"362\" style=\"border:1px solid #cccccc; background-color:"+ newBgcolor + "; display:none\">" );
			document.write( "<tr><td>" );

			document.write( linkWrapper );
			document.write( s );
			document.write( "</a>" );
			document.write( "</td></tr><tr><td style=\"PADDING-RIGHT: 6px; PADDING-LEFT: 6px; background-color:"+ newBgcolor + "\">" );
			writeLink( );
			document.write ( "</td></tr><tr><td valign=\"bottom\">" );
			writeBottomBar ( true );
		}
		else
		{
			document.writeln( "<table id=\"is_large\" cellpadding=\"6\" cellspacing=\"0\" width=\"362\" style=\"border:1px solid #cccccc; background-color:"+ newBgcolor + "; display:none\">" );
			document.write( "<tr><td valign=\"top\" width=\"70\">" );

			if( !m_isEmail )
			{
				document.write( linkWrapper );
			}
			
			if( m_isImage )
			{
				document.write( "<img src=\"" + m_isImage + "\" border=\"0\">" );
			}
			
			if( !m_isEmail )
			{
				document.write( "</a>" );
			}

			document.write( "</td><td valign=\"top\" width=\"268\">" );
		
			if( !m_isEmail )
			{
				document.write( linkWrapper );
			}

			document.write( "<div><img src=\"" + m_isTlImg + "\" border=\"0\" alt=\"" + m_isTlTxt + "\"></div>" );

			if( !m_isEmail )
			{
				document.write( "</a>" );
			}

			if( m_isDesc )
			{
				document.write( "<span>" + m_isDesc + "</span>" );
				document.write ( "<img src=\"" + m_imgPfx + "/images/global/general/spacer.gif\" height=\"1\" width=\"10\" alt=\"\" />" );
			}
			
			writeLink ();
			document.write( "</td></tr>" );

			if( m_isIntro )
			{
				document.write( "<tr><td colspan=\"2\" class=\"para\">" + m_isIntro + "</td></tr>" );
			}

			//document.write( "<tr><td colspan=\"2\" valign=\"bottom\">" );
			//writeLink( 350 );
			document.write( "<tr><td colspan=\"2\" style=\"padding:0px\" valign=\"bottom\">" );
			writeBottomBar ( true );
		}		
		document.write ( "</td></tr>" );
	}
	else
	{
		if(m_isImageOnly)
		{
			document.writeln( "<table id=\"is_large\" align=\"center\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"" + m_isWidth + "\" style=\"border:1px solid #cccccc; background-color:"+ newBgcolor + "; display:none\">" );
			document.write( "<tr><td>" );
			document.write( linkWrapper );
			document.write( s );
			document.write( "</a>" );
			document.write( "</td></tr><tr><td valign=\"bottom\" style=\"PADDING-RIGHT: 6px; PADDING-LEFT: 6px; background-color:"+ newBgcolor + "\">" );

			writeLink(  );
			document.write( "</td></tr><tr><td style=\"padding:0\" valign=\"bottom\">" );
			writeBottomBar ( true );	
			document.write ( "</td></tr>" );
		}
		else
		{

			document.writeln( "<table id=\"is_large\" cellpadding=\"6\" cellspacing=\"0\" border=\"0\" width=\"" + m_isWidth + "\" style=\"border:1px solid #cccccc; background-color:"+ newBgcolor + "; display:none\">" );
			document.write( "<tr><td valign=\"top\" align=\"left\">" );

			
			if( !m_isEmail )
			{
				document.write( linkWrapper );
			}
									
			
			
			if( !m_isEmail )
			{
				document.write( "</a>" );
			}

			document.write( "</td><td align=\"left\" valign=\"top\" width=\"728\">" );
			
			if( !m_isEmail )
			{
				document.write( linkWrapper );
			}

			
			
			
			
			//Write Link for entire banner here
			
			document.write( "<table border=\"0\" width=\"690\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#DDF0FE\" height=\"223\"><tr><td style=\"font-family:Tahoma\"><p style=\"color:#f60;font-size:11pt;line-height:16pt;font-weight:bold\">The premier web site for previously leased Dell Notebooks, Dell Desktops and Dell Flat Panel Monitors!</p><p style=\"font-size:9pt\"><b>Why buy from Dell Financial Services?<br><br>&nbsp;&nbsp;&nbsp;&nbsp; &bull; Systems typically ship the next business day  <a href=\"http://www.dfsdirectsales.com/edealinv/servlet/ExecMacro?nurl=control/faq.vm&ctl_nbr=641#Shipping\">see details</a><br>&nbsp;&nbsp;&nbsp;&nbsp; &bull; Wide selection of Dell Notebooks, Dell Desktops and Dell Workstations<br>&nbsp;&nbsp;&nbsp;&nbsp; &bull; Refurbished by Dell, from Dell in Austin, TX<br>&nbsp;&nbsp;&nbsp;&nbsp; &bull; Outstanding quality and reliability<br>&nbsp;&nbsp;&nbsp;&nbsp; &bull; 100 Day Limited Warranty</b></p><blockquote style=\"margin-left:20px\"><p style=\"color:#900;font-size:8pt;font-weight:bold;margin-bottom:0px\">System drivers included on all latitude notebooks and Optiplex desktops preloaded with Windows XP Pro+. Dimension Desktops, Inspiron Notebooks, Precision Workstations and systems sold without Windows XP Pro+ may require drivers to be downloaded, free of charge, from <a href=\"http://www.support.dell.com\">www.support.dell.com</a>.</p></blockquote></td></tr></table>" );

			//End
			
			
			
			
			if( !m_isEmail )
			{
				document.write( "</a>" );
			}

			if( m_isDesc )
			{
				document.write( "<div>" + m_isDesc + "</div>" );
			}

			if( m_isIntro )
			{
				document.write( "<div class=\"para\">" + m_isIntro + "</div>" );
			}

			//document.write( "</td></tr>" );

			//document.write( "</td></tr><tr><td valign=\"bottom\">" );

			writeLink(  );

			//document.write( "<tr><td colspan=\"2\" bgcolor=\"#ff6600\" style=\"padding:0\">&nbsp;</td></tr>" );
			document.write ( "<tr><td colspan=\"2\" style=\"padding:0\" valign=\"bottom\">" );
			writeBottomBar ( true );
			document.write ( "</td></tr>" );
		}
	}
	
	document.writeln( "</table>" );

	// build the animation window
	document.writeln( "<table id=\"is_anim\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\" width=\"" + m_isWidth + "\" style=\"border:1px solid #cccccc; background-color:"+ newBgcolor + "; display:none\">" );
	document.write( "<tr><td valign=\"top\" class=\"para_small\">&nbsp;</td></tr>" );
	document.writeln( "</table>" );

	if( isIE4 && m_isMode != "inline" )
	{
		document.writeln( "<div id=\"is_shade\" style=\"display:none\">" );
		for( op = 40; op > 4; op -= 6 )
		{
			document.writeln( "<table cellpadding=\"0\" align=\"center\" cellspacing=\"0\" width=\"" + m_isWidth + "\" style=\"background-color:#000000; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=" + op + ")\"><tr><td><img src=\"" + m_imgPfx + "/images/global/general/spacer.gif\" height=\"1\" width=\"1\" alt=\"\" /></td></tr></table>" );
		}
		document.writeln( "</div>" );
		m_isAnShd = getRawObject( "is_shade" );
	}

	// close the animation container

	if( m_isMode != "hover" )
	{
		document.writeln( "<div><img src=\"" + m_imgPfx + "/images/global/general/spacer.gif\" height=\"4\" width=\"1\" alt=\"\" /></div>" );
	}

	document.writeln( "</div>" );

	if( m_isMode == "hover" )
	{
		initSmall( "block" );
	}
	document.write("</td></tr></table>");

	// get them back DOM style
	m_isBgDiv = getRawObject( "is_large" );
	m_isAnDiv = getRawObject( "is_anim" );
	m_isCtDiv = getRawObject( "is_animctr" );
	
}


function writeLink(  )
{
	//document.write( "<table cellpadding=\"0\" cellspacing=\"0\" width=\"" + width + "\"><tr><td>" );
	document.write ( "<span class=\"nowrap\">" );
	
	if( m_isEmail )
	{
		document.write( m_isEmail );
	}
	else
	{
		if(m_isUrl)
		{
			if ( m_isCaption != null )
			{
				document.write( "<a href=\"" + m_isUrl + "\" class=\"lnk_promodetails\"><img src=\"" + m_imgPfx + "/ctlimg/dell/secondinline.gif\" alt=\"\" border=\"0\">" + m_isCaption + "</a>" );
			}
			else
			{
				document.write( "<a href=\"" + m_isUrl + "\" class=\"lnk_promodetails\"><img src=\"" + m_imgPfx + "/ctlimg/dell/secondinline.gif\" alt=\"\" border=\"0\">" + m_offerdetail + "</a>" );
			}
		}
	}
	document.write ( "</span>" );
	
	//document.write( "</td><td>" );
	//document.write( "<div align=\"right\"><a onclick=\"javascript:isCollapse()\" href=\"#\" class=\"para_small\"><img src=\"" + m_imgPfx + "/ctlimg/dell/secondinline.gif\" width=\"10\" height=\"13\" alt=\"\" border=\"0\">" + m_popClose + "</a></div>" );
	//document.write( "</td></tr></table>" );
}

function initSmall( mode )
{
	document.writeln( "<table id=\"is_small\" align=\"center\" cellpadding=\"6\" cellspacing=\"0\" width=\"" + m_isWidth + "\" style=\"border:1px solid #cccccc; background-color:"+ newBgcolor + "; display:" + mode  +"\">" );
	document.write( "<tr><td width=\"" + m_isWidth + "\" style=\"padding-left:9px;padding-right:9px\" valign=\"top\" align=\"left\">" ); 
	
	if ( m_isUrl )
	{
		document.write( "<a href=\"" + m_isUrl + "\" class=\"lnk_promo\">" + m_isTlTxt + "</a>" );
	}
	else
	{
		document.write( "<span class=\"lnk_promo\">" + m_isTlTxt + "</span>" );
	}
	
	if( m_isDesc )
	{
		document.write( "<img src=\"" + m_imgPfx + "/images/global/general/spacer.gif\" height=\"1\" width=\"10\" alt=\"\"/>" );
		document.write( "<span class=\"para_small\">&nbsp;" + m_isDesc.replace( m_isParaFix, "para_small" ) + "</span>" );
	}

	//document.write( "</td><td align=\"right\"><a onclick=\"javascript:isExpand()\" href=\"#\" class=\"para_small\">" + m_popExpand + "</a>" );
	document.write ( "</td></tr><tr><td style=\"margin:0px;padding:0px\" valign=\"bottom\">" );
	writeBottomBar ( false );
	document.write( "</td></tr></table>" );

	if( m_isMode == "hover" )
	{
		document.writeln( "<div><img src=\"" + m_imgPfx + "/images/global/general/spacer.gif\" height=\"4\" width=\"1\" alt=\"\" /></div>" );
	}

	m_isSmDiv = getRawObject( "is_small" );
}

function isExpand()
{
	m_isAnDiv.style.display = "none";

	if( m_isMode == "inline" )
	{
		m_isSmDiv.style.display = "none";
	}
	
	m_isBgDiv.style.display = "block";

	if( m_isAnShd )
	{
		m_isAnShd.style.display = "block";
	}
}

function isAutoClose()
{
	if( m_isBgDiv.style.display == "block" )
	{
		isCollapse();
	}
}

function isCollapse()
{
	m_isAnDiv.style.display = "none";
	m_isBgDiv.style.display = "none";

	if( m_isAnShd )
	{
		m_isAnShd.style.display = "none";
	}

	if( m_isSmDiv )
	{
		m_isSmDiv.style.display = "block";
	}
}

function isAnimClose()
{
	if( m_isBgDiv.style.display == "block" )
	{
		if( m_isMode != "hover" )
		{
			isAnimate( m_isBgDiv.offsetHeight, 20, m_isBgDiv, m_isSmDiv );
		}
		else
		{
			isAnimate( m_isBgDiv.offsetHeight, 0, m_isBgDiv, m_isSmDiv );
		}
		
		if( m_isAnShd )
		{
			m_isAnShd.style.display = "none";
		}
	}
}

function isAnimate( start, finish, from, obj )
{
	m_isStart	= start;
	m_isFinish	= finish;
	
	if( from && m_isMode != "hover" )
	{
		from.style.display = "none";
	}
	
	m_isBgDiv.style.display = "none";
	m_isAnDiv.style.display = "none";
	m_isAnDiv.style.height= m_isStart;
	m_isAnDiv.style.display = "block";

	if( m_isAnShd )
	{
		m_isAnShd.style.display = "block";
	}
	
	m_isCount = ( m_isStart < m_isFinish ) ? 15 : -50;
	
	if( m_isAnCtr )
	{
		clearTimeout( m_isAnCtr );
	}
	
	m_isAnFin = obj;
	m_isAnCtr = setInterval( "isAdjust()", 40 );
	m_isCtDiv.style.display = "block";
	isAdjust();
}

function isAdjust()
{
	m_isStart += m_isCount;
	
	if( ( m_isCount < 0 && m_isStart < m_isFinish ) || ( m_isCount > 0 && m_isStart > m_isFinish ) )
	{
		m_isStart = m_isFinish;
		clearTimeout( m_isAnCtr );
		m_isAnCtr = null;
	}
	else
	{
		m_isAnDiv.style.height= m_isStart;
	}
	
	if( m_isAnCtr == null )
	{
		m_isAnDiv.style.display = "none";
		if( m_isAnFin )
		{
			m_isAnFin.style.display = "block";
		}
	}
}

// Draws the bottom gradient bar.
function writeBottomBar ( expandMode )
{
	//document.write ( "<table height=\"12\" bgcolor=\"#FF8000\" cellspacing=\"0\" cellpadding=\"0\" width=\"" + width + "\" background=\"/ctlimg/dell/oj_fade12px_bt_vert.gif\"><tr>" );
	document.write ( "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" class=\"isbg\"	><tr>" );
	
	if ( expandMode )
	{
		document.write ( "<td width=\"50%\" valign=\"middle\" align=\"right\" style=\"padding-right:3px\"><a onclick=\"javascript:isCollapse()\" href=\"#\"><img border=\"0\" src=\"" + m_imgPfx + "/ctlimg/dell/is_close_icon.gif\"></a></td>" );
		document.write ( "<td><a onclick=\"javascript:isCollapse()\" href=\"#\" style=\"text-decoration:none\" class=\"lnk_expnd_close\">" + getPopClose() + "</a>" );
	}
	else
	{
		document.write ( "<td width=\"50%\" valign=\"middle\" align=\"right\" style=\"padding-right:3px\"><a onclick=\"javascript:isExpand()\" href=\"#\"><img border=\"0\" src=\"" + m_imgPfx + "/ctlimg/dell/is_expand_icon.gif\"></a></td>" );
		document.write ( "<td><a onclick=\"javascript:isExpand()\" href=\"#\" style=\"text-decoration:none\" class=\"lnk_expnd_close\">" + getPopExpand() + "</a>" );
	}

	document.write ( "</td>" );
	document.write ( "</tr></table>" );
}

function getPopClose()
{
	if ( typeof ( m_popClose ) != "undefined" )
	{
		return m_popClose;
	}
	return "close";
}
function getPopExpand()
{
	if ( typeof ( m_popExpand ) != "undefined" )
	{
		return m_popExpand;
	}
	return "expand";
}

// -------------------------------------------------------------
// end of is.js
// -------------------------------------------------------------
