/*
This code is from Dynamic Web Coding 
www.dyn-web.com 
Copyright 2002 by Sharon Paine 
See Terms of Use at http://www.dyn-web.com/bus/terms.html
Permission granted to use this code 
as long as this entire notice is included.
*/
	// resize fix for ns4
	var origWidth, origHeight;
	if (document.layers) {
		origWidth = window.innerWidth; origHeight = window.innerHeight;
		window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
	}

	var outerLyr, wipeLyr1;
	function initDynLyrs() {

		//////var pos = "";
		var pos = "";
		
		
		if (pos.length > 0)
		{
			eVs=pos.split(',');
			// args: id,left,top,width,height
			outerLyr = new dynObj('outerDiv',eVs[0],eVs[1],eVs[2],eVs[3]);
		}
		else
		{
			// Set to default positino if position is not given
			outerLyr = new dynObj('outerDiv',754,187,null,null);
		}
			
		// eliminate incapable browsers
		if (!outerLyr || !document.layers && typeof outerLyr.el.innerHTML == "undefined") return;
		
		// background color and border
		outerLyr.setBgClr("");
		if (outerLyr.el.style) {	// ns4 can't
			outerLyr.css.border = ""
		}
		wipeLyr1 = new dynObj('wipeDiv1');
		doWipes();
	}
	window.onload=initDynLyrs;

	// put images to preload in this array
	var imgAr = new Array("ad.jpg");

	// preload (Note path to images sub-directory)
	if (document.images) {
		var imgList = new Array();
		for (var i=0; i<imgAr.length; i++) {
		imgList[i] = new Image(); 
			imgList[i].src = "images/" + imgAr[i];	
		}
	}

	// put your items here
	//////////////////var bannerURL ="";/////// not used
	var bannerURL ="http://www.groovyjeans.com";
	// content, time allotted for wipe in
	
	///var wipe_array=new Array('<table width="204" cellpadding="0" cellspacing="0" border="0"><tr><td colspan="2"><a href="javascript:disappear();"><img src="/assets/images2006/hp_banner/Top_Close.gif" width="204" height="25" border="0" /></a></td></tr><tr><td colspan="2"><img src="/assets/images2006/hp_banner/Mid_Text.gif" width="204" height="107" border="0" /></td></tr><tr><td width="154" style="padding: 12px;" align="right" bgcolor="#DA6266"><input style="font-family: Verdana,Arial,Helvetica; font-size: 9px;" onfocus="clearEmailText2();" style="WIDTH: 130px" type="text" maxlength="100" value="Enter Email Address" name="signUpEmail2" id="signUpEmail2"></td><td width="50" align="left" align="center" bgcolor="#DA6266"><a href="javascript:callSignUpURL(\'/utilities/email_control.aspx\')"><img src="/assets/images2006/hp_banner/Arrow.gif" width="16" height="16" border="0" /></a></td></tr></table>',1500 );
	
	var wipe_array=new Array('',1500 );


	var wipe_count=0;	// to keep track
	function doWipes() {
		if (wipe_count<wipe_array.length) {
			
			// in table so width/height of content can be obtained
			var cntnt = '<table id="w1" border="0" cellpadding="0" cellspacing="0"><tr><td class="wipe"><a href="'+bannerURL+'"'+  wipe_array[wipe_count] +'</a></td></tr></table>';
			
			wipePrep(wipeLyr1,cntnt,'w1');
			wipeLyr1.centerIn(outerLyr);
			
			// args: which wipe, delay, wipeTime, what next
			wipeLyr1.wipe("in top",1200,wipe_array[wipe_count+1],"wipeOuts()");
		} else {
			wipe_count=null;
			doWipes();
		}
	}

	// prepare for wipe in (called from doWipes fn)
	function wipePrep(obj,cntnt,id) {
		obj.hide();
		// restore, for ns4, or new content is visible...
		obj.clipTo(0,obj.width,obj.height,0);	
		obj.writeLyr(cntnt);
		obj.width=getWidth(obj.el,id);
		obj.height=getHeight(obj.el,id);
	}

	function wipeOuts() {
		// controls speed of wipe out
		// divide time allotted for item in wipe_array by this number
		var dv = 3;
		// args: which wipe, delay, wipeTime, what next
		wipeLyr1.wipe("out top", 11000, wipe_array[wipe_count+1]/dv,"doWipes()"); //set to 15000 when done
		wipe_count+=1;
	}
	

	function appear()
	{
		wipeDiv1.style.visibility="visible";
		outerDiv.style.visibility="visible";
		
	}		
	
	function disappear()
	{
		wipeDiv1.style.visibility="hidden";
		outerDiv.style.visibility="hidden";
	}		
	

	function showLayer(id) {
	
	var lyr = getElemRefs(id);
	  
	var topImg = document.getElementById("topSecretImg");
	/*
	alert(topImg.height);
	alert(topImg.offsetLeft);
	URLshowLayer.style.position = 'relative';
	lyr.style.left = 103;
	*/
	el = topImg;
	var x = el.offsetLeft; 
	var leftEl = leftEl = el.offsetParent; 
	for( ; leftEl; leftEl = leftEl.offsetParent ) x += parseInt(leftEl.offsetLeft); 
	//Set the layer position from the left of the page.
	document.getElementById(id).style.left = x;
	//URLshowLayer.style.visibility
	if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
	Set_Cookie( 'nnihome', 'false', 90, null, null, 0);
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

			function Set_Cookie( name, value, expires, path, domain, secure ) 
			{
			// set time, it's in milliseconds
			var today = new Date();
			today.setTime( today.getTime() );
			
			/*
			if the expires variable is set, make the correct 
			expires time, the current script below will set 
			it for x number of days, to make it for hours, 
			delete * 24, for minutes, delete * 60 * 24
			*/
			if ( expires )
			{
			expires = expires * 1000 * 60 * 60 * 24;
			}
			var expires_date = new Date( today.getTime() + (expires) );

			document.cookie = name + "=" +escape( value ) +
			( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
			( ( path ) ? ";path=" + path : "" ) + 
			( ( domain ) ? ";domain=" + domain : "" ) +
			( ( secure ) ? ";secure" : "" );
			}
			
			// this function gets the cookie, if it exists
			function Get_Cookie( name ) {
				
			var start = document.cookie.indexOf( name + "=" );
			var len = start + name.length + 1;
			if ( ( !start ) &&
			( name != document.cookie.substring( 0, name.length ) ) )
			{
			return null;
			}
			if ( start == -1 ) return null;
			var end = document.cookie.indexOf( ";", len );
			if ( end == -1 ) end = document.cookie.length;
			return unescape( document.cookie.substring( len, end ) );
			}

// get reference to nested layer for ns4
// from old dhtmllib.js by Mike Hall of www.brainjar.com
function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i<doc.layers.length; i++) {
	  	theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0) 
	    	if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
					return theLyr;
	  }
		return null;
  }
}


