function getCookie(name)
{ 
	var pos
	var token = name + "=";
	var tnlen = token.length;
	var cklen = document.cookie.length;
	var i = 0;
	var j;
	while (i < cklen)
	{ 
		j = i + tnlen;
		if (document.cookie.substring(i, j) == token)
		{ pos = document.cookie.indexOf (";", j);
		if (pos == -1)
			pos = document.cookie.length;
		return unescape(document.cookie.substring(j, pos));
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	} //End While
	return null;
}

function setCookie(name, value)
{ 
	document.cookie = name + "=" + escape(value)
}

function deleteCookie(name)
{ 
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = getCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function CheckCookies()
{
	var gCookieName;
	var gCookieValueRet;
	gCookieName="AVCOOKIETEST";

	gCookieValue="AV_TESTING_COOKIE";
	gCookieValueRet="???"

	setCookie(gCookieName,gCookieValue,1);
	gCookieValueRet=getCookie(gCookieName);
	
	if (gCookieValueRet == null)
	{
		window.alert("To login, please change your Privacy Level on your browser to accept cookies. To learn how to do that please press OK and follow instructions on the following popup page.");
		window.open("NoCookies.htm","smallwindow","top=20,height=550px,resizable=yes,scrollbars=yes");
		return false;
	}
	return true;
}

function ParentOnUnload()
{
	if (typeof(OnUnloadEvent) == 'function') OnUnloadEvent();
}

function ParentOnLoad()
{
	if (typeof(OnLoadEvent) == 'function') OnLoadEvent();
}

function MM_ReloadPage(init) 
{
	//reloads the window if Nav4 resized
	if (init==true) with (navigator) 
	{
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) 
		{
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; 
		}
	}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) 
		location.reload();
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// function to launch upoc screen
function LaunchMsgr() {
	window.open("http://www.upoc.com/nysale", "upoc", "width=800,height=750, scrollbars, resizable");
}

function checkKey()
{
	if (window.event.keyCode == 13)
	{
		window.event.keyCode = 0;
	}
}
var PayPalCartWindow = null;

function AddtoPayPalCart(Title, Amount)
{
	PayPalCartWindow = window.open("https://www.paypal.com/cart/add=1&business=mike@nysale.com&item_name=" + Title + "&amount=" + Amount + "&return=http%3A//www.topbutton.com&cancel_return=http%3A//www.topbutton.com","CARTWINDOW","dependent,width=750,height=550,scrollbars,location,resizable,status",true);
	if( PayPalCartWindow != null ) setTimeout("PayPalCartWindow.focus();",250);
}

function ShowPayPalCart()
{
	PayPalCartWindow = window.open("https://www.paypal.com/cart/display=1&business=mike@nysale.com&return=http%3A//www.topbutton.com&cancel_return=http%3A//www.topbutton.com","CARTWINDOW","dependent,width=750,height=550,scrollbars,location,resizable,status",true);
	if( PayPalCartWindow != null ) setTimeout("PayPalCartWindow.focus();",250);
}

//////AD SERVING BEGINS
//configuration
OAS_url = 'http://oasc03001.247realmedia.com/RealMedia/ads/';
//OAS_sitepage = window.location.hostname + window.location.pathname;
OAS_sitepage = 'www.topbuttontest.com';
OAS_listpos = 'Top,Right,Bottom';
OAS_query = '';
OAS_target = '_top';
//end of configuration

OAS_version = 10; // The code in Header.ascx changes it to the right version

OAS_rn = new String (Math.random()); 
OAS_rns = OAS_rn.substring (2, 11);

function OAS_NORMAL(pos) 
{
	document.write('<A HREF="../TOPBUTTON_com%20The%20Fashion%20Democracy%20&#8211;%20Reatil%20Detail_files/%27%20+%20OAS_url%20+%20%27click_nx.ads/%27%20+%20OAS_sitepage%20+%20%27/1%27%20+%0A%09OAS_rns%20+%20%27@%27%20+%0A%09OAS_listpos%20+%20%27!%27%20+%20pos%20+%20%27?%27%20+%20OAS_query%20+%20%27" TARGET=' + OAS_target + '>');
	document.write('<IMG SRC="../TOPBUTTON_com%20The%20Fashion%20Democracy%20&#8211;%20Reatil%20Detail_files/%27%20+%20OAS_url%20+%20%27adstream_nx.ads/%27%20+%20OAS_sitepage%20+%20%27/1%27%20+%0A%09OAS_rns%20+%20%27@%27%20+%20OAS_listpos%20+%20%27!%27%20+%20pos%20+%20%27?%27%20+%20OAS_query%20+%20%27" BORDER=0></A>');
}

function OAS_AD(pos) 
{
	if (OAS_version >= 11)
		OAS_RICH(pos);
	else
		OAS_NORMAL(pos);
}

function LOAD_RICH() 
{
	document.write('<SCRIPT LANGUAGE=JavaScript1.1 SRC="../TOPBUTTON_com%20The%20Fashion%20Democracy%20&#8211;%20Reatil%20Detail_files/%27%20+%20OAS_url%20+%0A%09%09%27adstream_mjx.ads/%27%20+%20OAS_sitepage%20+%20%27/1%27%20+%20OAS_rns%20+%20%27@%27%20+%20OAS_listpos%20+%20%27?%27%20+%0A%09%09OAS_query%20+%20%27"><\/SCRIPT>');
}

// MJX		
function LOAD_ADS( Page, Positions ) 
{
	OAS_sitepage = Page;
	OAS_listpos = Positions;
	
	if (OAS_version >= 11)
		LOAD_RICH();
}

//RX
function SHOW_AD( Page, Position ) 
{
	OAS_sitepage = Page;
	OAS_listpos = Position;
	
	if (OAS_version >= 11) 
		document.write ('<SCRIPT LANGUAGE="JavaScript1.1" SRC="' + OAS_url + 'adstream_jx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '?' + OAS_query + '"></SCRIPT>');
	else 
		OAS_NORMAL(Position)
}
//////AD SERVING ENDS









