	window.onload = function(){
			var locationValue='';
			var locationLayer = document.getElementById('locationdropdowndiv');
			var ads,r;
			var locationAnchor = locationLayer.getElementsByTagName('a');
			var seeAllJSONObject = {"bindings": [
		    {"title": "Rock, pop, & hip-hop",	"anchor": "oll1", "divlayer": "artistlayer_rockpop"},
			{"title": "Country & folk",			"anchor": "oll2", "divlayer": "artistlayer_countryfolk"},
			{"title": "Jazz, blues, & R&B",		"anchor": "oll3", "divlayer": "artistlayer_jazzblues"},
			{"title": "Classical & vocal",		"anchor": "oll4", "divlayer": "artistlayer_classical"},
			{"title": "Dance & electronica",	"anchor": "oll5", "divlayer": "artistlayer_dance"},
			{"title": "World & new age",		"anchor": "oll6", "divlayer": "artistlayer_world"},
			{"title": "Clubs, bars & theaters", "anchor": "vll1", "divlayer": "venuelayer_clubsbars"},
			{"title": "Arenas",					"anchor": "vll2", "divlayer": "venuelayer_Arenas"},
			{"title": "Outdoor",				"anchor": "vll3", "divlayer": "venuelayer_Outdoor"},
			{"title": "Stadiums",				"anchor": "vll4", "divlayer": "venuelayer_Stadiums"},
			{"title": "Other",					"anchor": "vll5", "divlayer": "venuelayer_Other"}
				    ]
				};

			if (pageTypeRef== 'searchresults' && window.location.href.match('locationsdropown'))
			{
				locationValue = parseQueryString(window.location.href,'selectedGeo');
				geoDetected = locationValue;
				geoLocation = locationValue;
			}
			if (pageTypeRef== 'concertslandingpage')
				if(readCookie('STUB_PERSISTENT')!= null && readCookie('STUB_PERSISTENT').match('geography_id'))
						geoDetected = readCookie('STUB_PERSISTENT').split('~^~')[1];
			
			if (geoDetected != '')				
				{				
					geo_id = geoDetected;
					ads = [		
							{location:'root/browse/genre',
							name:'CLP_Render_Chunk_Context_Document_UI',
							params:'param1=' + geo_id ,t:0}    		
            				]
            		targetContainer = 'venuesCheckBoxContainer';
            		r = new adRotator(ads);
					r.rotate();			
			}
			for (var i=0; i < locationAnchor.length; i++)
				locationAnchor[i].onclick = function(){
				geo_id = this.id;
				ads = [		
					    {location:'root/browse/genre',
					    name:'CLP_Render_Chunk_Context_Document_UI',
					    params:'param1=' + geo_id,t:0}    		
            			]
				targetContainer = 'venuesCheckBoxContainer';
            	r = new adRotator(ads);
				r.rotate();
			}	
			if (pageTypeRef== 'concertslandingpage')
				for (var i in seeAllJSONObject.bindings) 
					seeAllLinkClickFunc(seeAllJSONObject.bindings[i].anchor, seeAllJSONObject.bindings[i].divlayer);		
		}
		
		function seeAllLinkClickFunc(anchor, targetId)
		{
			if(document.getElementById(anchor))
				document.getElementById(anchor).onclick = function()
				{
					geo_id = geoDetected;
					ads = [		
							{location:'root/browse/genre',
							name:'CLP_Render_Chunk_Context_Document_UI_See_All_Layer',
							params:'param1=' + geo_id + '&param2=' + anchor,
							t:0}    		
            			]
					targetContainer = targetId;
					r = new adRotator(ads);
					r.rotate();
				}
		}

		
		function adRotator(oConfig){
		 this.cfg = oConfig;
		 this.idx = Math.floor(Math.random()*(oConfig.length));
		 this.rotate = function(){
		  var a = this.cfg[this.idx];
		  this.idx = (this.idx+1 >= this.cfg.length) ? 0 : ++this.idx;
		  this.time = ((a.t) ? a.t : 10) * 1000;
		  this.httpReq = null;
		  makeRequest(buildUrl(a), this);
		 };
		 this.render = function(){
		  var req = this.httpReq;
		  if (req.readyState == 4){
		   if (req.status ==200){
		    if (req.responseText.length>0){
		     var d = document.getElementById(targetContainer);
		     if (d)
		      d.innerHTML = req.responseText;
		     return;
		    }
		   }
		   this.rotate();
		  }
		 };
		 
		 function buildUrl(oAd){
		  var s = '/content/renderChunk?';
		  s+= 'chunkLocation=' + oAd.location;
		  s+= '&chunkName=' + escape(oAd.name);
		  s+= '&' + oAd.params;
		  return s;
		 };
		 
		 function makeRequest(url, adRotator){
		  var o = adRotator;
		  o.httpReq = null;
		  try{
		   o.httpReq = new XMLHttpRequest();
		  }
		  catch(e){
		   try{
		    o.httpReq = new ActiveXObject("Msxml2.XMLHTTP");
		   }
		   catch(e){
		    o.httpReq = new ActiveXObject("Microsoft.XMLHTTP");
		   }
		  }
		  o.httpReq.onreadystatechange = function(obj){return function(){obj.render();}}(o);
		  o.httpReq.open("GET", url, true);
		  o.httpReq.send(null);
		 };

        }

	function parseQueryString(query,variable) 
	{
		var query = query;
		query = query.substring(query.indexOf('?') + 1); // remove everything up to the ?
		query = query.replace(/\&$/, ''); // remove the trailing &
		var vars = query.split("&");
		for (var i=0;i<vars.length;i++) {
			var pair = vars[i].split("=");
			if (pair[0] == variable) {
			return pair[1];
			}
		}
	} 
	function getElementsByClassName(className, tag, elm){
			var testClass = new RegExp("(^|\\\\s)" + className + "(\\\\s|$)");
			var tag = tag || "*";
			var elm = elm || document;
			var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
			var returnElements = [];
			var current;
			var length = elements.length;
			for(var i=0; i<length; i++){
				current = elements[i];
				if(testClass.test(current.className)){
					returnElements.push(current);
				}
			}
			return returnElements;
		}
	function readCookie(name)
	{
		var ca = document.cookie.split(';');
		var nameEQ = name + "=";
		for(var i=0; i < ca.length; i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
			}
		return null;
	}

