var NS3=((navigator.appName=='Netscape')&&parseInt(navigator.appVersion)>=3&&parseInt(navigator.appVersion)<4);
var NS4=(document.layers)?1:0; var IE=(document.all)?1:0;
var IE4=(document.all&&!document.getElementById)?1:0;
var IE5=(document.all&&document.getElementById)?1:0;
var NS6=(document.getElementById&&!document.all)?1:0;
var DHTML=(IE||NS4||NS6)?1:0;
var DOM=(IE5||NS6)?1:0;
var MAC=(navigator.userAgent.indexOf('Mac')!=-1)?1:0;
var IEMAC=(MAC&&IE)?1:0;
var IE4MAC=(IEMAC&&(navigator.appVersion.indexOf('4.',4)!=-1))?1:0;
var IE5MAC=(IEMAC&&(navigator.appVersion.indexOf('5.')!=-1))?1:0;
var cacheArray=new Array(0);
function imageGroup() {  if (this.total==null) { this.add=imageGroup; if (!document.images) return; this.total=this.cached=this.rollovers=0; this.names=new Array(0); this.urls=new Array(0); this.count=new Array(0); this.i=new Object(); this.index=cacheArray.length; cacheArray[this.index]=this; this.defURL=''; } var a,j,k,args=arguments; for (j=0; j< args.length; j++) { k=this.total; a=args[j].split('|'); this.names[k]=a[0]; this.urls[k]=this.defURL+a[1]; this.total++; } }
function loadImages() { if (document.images) { var j,c=cacheArray; for (j=0; j< c.length; j++) loadGroup(c[j]); } }
var menuCount=0; var cSig=0; var selectorON=0; var scrollTicks=0; var st=0; var scrollTop=0; var rate=20; var dragt=0; var distYt=0; var thumbTop=0;
function blurOut(anc) { anc.blur(); }
layers = new Object(); layers.EQ=new Array();
hidden=(NS4)?'hide':'hidden'; visible=(NS4)?'show':'visible';
function getLayer(spec,base) { if (!NS4) return getIt(spec); var j=0,temp=null; if (!base) base=document; if (base.layers[spec]) return base.layers[spec]; for (j=0; j< base.layers.length; j++) { temp=getLayer(spec,base.layers[j].document); if (temp) return temp; } return null; }
function equalizeLayers(n) { var k,l; var list=(n==null)?layers.EQ:arguments; for (k=0; k < list.length; k++) {l=getLayer(list[k]); if(l) equalize(l); } if (n==null) layers.EQ=new Array(); }
function getIt(id) { if (IE) return document.all[id]; if (NS6) return document.getElementById(id); }
function equalize(layer) { if (layers[layer.id]) return;
  layer.vis = new Function("n","if (n!=null) { this.style.visibility=(n)?visible:hidden; if (NS6) {this.style.zIndex=(n)?this.z:eval(this.z)-1;} } return((this.style.visibility==visible)?1:0);");
  layers[layer.id]=layer; if (NS4)layer.style=layer; if (NS6) { layer.z=layer.style.zIndex; if(layer.style.visibility==hidden)layer.vis(0); } }
function layerTag(id,content,vis,z,l,t,w,h,extra,es) { if (!DHTML) return(''); layers.EQ[layers.EQ.length]=id; if(w==0)w=1; if(!t)t=0; if(!l)l=0; if ((vis==null)||(vis==1))vis=visible; if(vis==0)vis=hidden; if(!z)z=10; if(!extra)extra=''; if(!es)es='';
  if (!NS4) {var stuff = '<DIV ID="'+id+'" STYLE="position:absolute; left:'+l+'px; top:'+t+'px;'+((w)?(' width:'+w+((isNaN(w))?'':'px')+';'):'')+((h)?(' height:'+h+((isNaN(h))?'':'px')+';'):'')+' visibility:'+vis+'; z-index:'+z+'; '+es+'" ' + extra + '>'; }
  if (NS4)  {var stuff = '<LAYER NAME="'+id+'" left="'+l+'" top="'+t+'"'+((w)?(' width="'+w+'"'):'')+((h)?(' height="'+h+'"'):'')+' visibility="'+vis+'" z-index="'+z+'" '+extra+'>'; } return (stuff+content+((NS4)?'</LAYER>':'</DIV>')); }
function writeLayer(id,content,vis,z,l,t,w,h,extra,es) { this.writeln(layerTag(id,content,vis,z,l,t,w,h,extra,es)); equalizeLayers(); return(layers[id]); }
function PromptOff(obj){obj.style.backgroundColor="#e1ca6f";}
function PromptOn(obj){obj.style.backgroundColor="#000000";}
if (DHTML) document.newLayer=writeLayer;

var wPopUpWnd = null;
var wFeaturesUpWnd = null;

function jsNewWindow(jsTarget, jsWidth, jsHeight)
{	
	var strRndm = Math.random() * 10000;
	
	if (jsWidth == null)
	{
		jsWidth = 600;
	}
	if (jsHeight == null)
	{
		jsHeight = 400;
	}
	
	
	if (jsTarget.search(/\?/g) == -1)
	{
		jsTarget = jsTarget +  "?dft=" + strRndm;
	}
	else
	{
		if (jsTarget.lastIndexOf("#") != -1){
			if (jsTarget.lastIndexOf("/") == -1){
				var label = jsTarget.substring(jsTarget.lastIndexOf("#"), jsTarget.length);
				jsTarget = label;
			}
			else{
				var url = jsTarget.substring(0, jsTarget.lastIndexOf("?"));
				var params = jsTarget.substring(jsTarget.lastIndexOf("?"), jsTarget.lastIndexOf("#"));
				var label = jsTarget.substring(jsTarget.lastIndexOf("#"), jsTarget.length);
				jsTarget = url + params + label;
			}
		}
		else{
			jsTarget = jsTarget +  "&dft=" + strRndm;
		}	
	}
	window.open(jsTarget ,"","width=" + jsWidth + ",height=" + jsHeight + ",toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");	

}

function jsShowPopUp(jsTarget, wndName, jsWidth, jsHeight)
{
	var strRndm = Math.random() * 10000
	if (jsTarget.search(/\?/g) == -1)
		{
		jsTarget = jsTarget +  "?dft=" + strRndm;
		}
	else
		{
		jsTarget = jsTarget +  "&dft=" + strRndm;
		}
		
	if (wndName == null)
	{
		wndName = "popUpWnd";
	}
	if (jsWidth == null)
	{
		jsWidth = 445;
	}
	if (jsHeight == null)
	{
		jsHeight = 600;
	}

	if (wPopUpWnd == null) {
		wPopUpWnd = window.open(jsTarget ,wndName,"width=" + jsWidth + ",height=" + jsHeight + ",toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
		wPopUpWnd.focus();
	} 
	else 
	{
		if (wPopUpWnd.closed) {
			wPopUpWnd = null;
			wPopUpWnd = window.open(jsTarget ,wndName,"width=" + jsWidth + ",height=" + jsHeight + ",toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
			wPopUpWnd.focus();
		} 
		else 
		{
			wPopUpWnd.navigate(jsTarget );//??
			wPopUpWnd.focus();
		}
	}
}

function wndViewPromotions()
{
	var strRndm = Math.random() * 10000;
	var jsTarget = "http://" + SSLModeAbsoluteHost + "/Common/Order/ViewPromotions.asp";
	
	if (jsTarget.search(/\?/g) == -1)
		{
		jsTarget = jsTarget +  "?dft=" + strRndm;
		}
	else
		{
		jsTarget = jsTarget +  "&dft=" + strRndm;
		}
		
	wndViewPromotions = window.open(jsTarget,"newWnd","width=435,height=455,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
	wndViewPromotions.focus();
	
}

function wndStore()
{
	var strRndm = Math.random() * 10000;
	var jsTarget = "http://" + SSLModeAbsoluteHost + "/Common/Search/FindStore.asp";
	
	if (jsTarget.search(/\?/g) == -1)
		{
		jsTarget = jsTarget +  "?dft=" + strRndm;
		}
	else
		{
		jsTarget = jsTarget +  "&dft=" + strRndm;
		}
	wndStore = window.open(jsTarget,"newWnd","width=435,height=585,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
}

function wndStoreWithItem(aItemID)
{
	var strRndm = Math.random() * 10000;
	var jsTarget = 'http://' + SSLModeAbsoluteHost + 'common/Search/FindStore.asp?ItemID=' + aItemID;
	
	if (jsTarget.search(/\?/g) == -1)
		{
		jsTarget = jsTarget +  "?dft=" + strRndm;
		}
	else
		{
		jsTarget = jsTarget +  "&dft=" + strRndm;
		}
		
	wndStore = window.open(jsTarget,'newWnd','width=385,height=490,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	wndStore.focus();
}

function jsShowPopUp1(jsTarget, wndName, jsWidth, jsHeight)
{
	var strRndm = Math.random() * 10000;
	
	if (jsTarget.search(/\?/g) == -1)
		{
		jsTarget = jsTarget +  "?dft=" + strRndm;
		}
	else
		{
		jsTarget = jsTarget +  "&dft=" + strRndm;
		}
 	window.open(jsTarget,null,"width=" + jsWidth+ ",height=" + jsHeight + ",titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
}

/////////////////////////////////////
	function popUp(url) 
	{
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin";
	}
 
	function Rcertify() 
	{
	popupWin = window.open('http://www.bbbonline.org/cks.asp?id=102043010423276', 'Participant','location=yes,scrollbars=yes,width=450,height=300'); 
	window.name = 'opener';
	} 
	
	function AddSessionToLinks(sessionId)
	{
		for ( aa = 0; aa < document.links.length ; aa++ )
		{
			var linkHREF = document.links[aa].href;
			linkHREF = linkHREF.toLowerCase();
			
			if (linkHREF.lastIndexOf(".asp") > -1 && linkHREF.lastIndexOf("javascript") == -1)
			{
				if (linkHREF.lastIndexOf("?") > -1)
				{
					if (linkHREF.lastIndexOf("#") > -1){
						if (linkHREF.lastIndexOf("/") == -1){
							var label = linkHREF.substring(linkHREF.lastIndexOf("#"), linkHREF.length);
							document.links[aa].href = label;
						}
						else{
							var url = linkHREF.substring(0, linkHREF.lastIndexOf("?"));
							var params = linkHREF.substring(linkHREF.lastIndexOf("?"), linkHREF.lastIndexOf("#"));
							var label = linkHREF.substring(linkHREF.lastIndexOf("#"), linkHREF.length);
							document.links[aa].href = url + params + label;
						}
					}
					else{
						document.links[aa].href = document.links[aa].href + "&xs=" + sessionId; 
					}
				}
				else
				{
					if (linkHREF.lastIndexOf("#") > -1){
						if (linkHREF.lastIndexOf("/") == -1){
							var label = linkHREF.substring(linkHREF.lastIndexOf("#"), linkHREF.length);
							document.links[aa].href = label;
						}
						else{
							var url = linkHREF.substring(0, linkHREF.lastIndexOf("#"));
							var label = linkHREF.substring(linkHREF.lastIndexOf("#"), linkHREF.length);
							document.links[aa].href = url + "?xs=" + sessionId + label;
						}
					}
					else{
						document.links[aa].href = document.links[aa].href + "?xs=" + sessionId;
					}
				}	
			}
		}

		for ( aa = 0; aa < document.forms.length ; aa++ )
		{
			var actionHREF = document.forms[aa].action;
			actionHREF = actionHREF.toUpperCase();
			
			if ( actionHREF.lastIndexOf(".ASP") > -1 )
			{
				
				if ( actionHREF.lastIndexOf("?") > -1 )
				{					
					document.forms[aa].action = document.forms[aa].action + "&xs=" + sessionId; 
				}
				else
				{
					document.forms[aa].action = document.forms[aa].action + "?xs=" + sessionId;
				}	
			}
		}			
	}
	
/////////////////////////////////////////////////////////////////////////////////////
/*
function getCookie(byname)
{
    byname=byname+"=";
    nlen = byname.length;
    fromN = document.cookie.indexOf(byname)+0;
    cookieValue = ""
    
    if((fromN) != -1)
    {
    	fromN +=nlen
        toN=document.cookie.indexOf(";",fromN)+0;
        if(toN == -1) {toN=document.cookie.length;}
        cookieValue = unescape(document.cookie.substring(fromN,toN));
        
        cookieValue = cookieValue.replace("+"," ");
    }
     
    return cookieValue;
}
*/
