if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){
	HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode) {
		switch (where){
			case 'beforeBegin':
				this.parentNode.insertBefore(parsedNode,this)
				break;
			case 'afterBegin':
				this.insertBefore(parsedNode,this.firstChild);
				break;
			case 'beforeEnd':
				this.appendChild(parsedNode);
				break;
			case 'afterEnd':
				if (this.nextSibling) 
					this.parentNode.insertBefore(parsedNode,this.nextSibling);
				else this.parentNode.appendChild(parsedNode);
				break;
			}
		}

	HTMLElement.prototype.insertAdjacentHTML = function (where,htmlStr)	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	}

	HTMLElement.prototype.insertAdjacentText = function (where,txtStr) {
		var parsedText = document.createTextNode(txtStr)
		this.insertAdjacentElement(where,parsedText)
	}
}

function getCookie(cValue) {
	if (document.cookie.length>0) {
		
		c_start=document.cookie.indexOf(cValue + "=");
		
		if (c_start!=-1) { 
	   		c_start=c_start + cValue.length+1; 
	   		c_end=document.cookie.indexOf(";",c_start);
	   		if (c_end==-1) c_end=document.cookie.length;
	   		return unescape(document.cookie.substring(c_start,c_end));
	   	} 
	
	}
	return "";	
}

function setCookie(cValue, value, expireDays) {
	var expiryDate = new Date();
	expiryDate.setDate(expiryDate.getDate() + expireDays);
	document.cookie = cValue + "=" + escape(value) +
	((expireDays==null) ? "" : ";expires=" + expiryDate.toGMTString());
}

function checkCookie(cValue) {
	seenAdvert=getCookie('seenAdvert');
	if (seenAdvert == null || seenAdvert == "") {
		document.body.insertAdjacentHTML('beforeEnd','<object width="1000" height="700">');
		document.body.insertAdjacentHTML('beforeEnd','<param name="movie" value="/Dillards/dillards.swf">');
		document.body.insertAdjacentHTML('beforeEnd','<param name="quality" value="high">');
		document.body.insertAdjacentHTML('beforeEnd','<div class="adDillards"><embed src="/Dillards/dillards.swf" wmode="transparent" width="1000" height="700" type="application/x-shockwave-flash" pluginspage="http: //www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></div>');
		document.body.insertAdjacentHTML('beforeEnd','</embed>');
		document.body.insertAdjacentHTML('beforeEnd','</object>');
		setCookie('seenAdvert','true',1);
	}
}

