var c=0;
var t;
var r;
var first_rt_category = '1114'; //production values
var first_wp_category = '1115';
//var first_games_category = '1117';
var first_games_category = '1426'; //in production
//item ids for Boost Navigator. Please do not add any space after ',' when adding item id. 
var item_id= '138614,138977,138979,138981,141500,141613,142876,146744,154996,158903,159847,166704,186374,208042';



//Problem is OnCreate it is common to all Ajax requests .. can't write specific to a request
/*var myGlobalHandlers = {
		onCreate: function(){
			alert("Event create");
			Element.show('systemWorking');
		},

		onComplete: function() {
			if(Ajax.activeRequestCount == 0){
				Element.hide('systemWorking');
			}
		}
	};

Ajax.Responders.register(myGlobalHandlers);*/

function ajaxLoader(url,id) {
  if (document.getElementById) {
  	document.getElementById(id).innerHTML= "";
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
        //alert(x.responseText);
      }
    }
    x.open("GET", url, true);
    x.send(null);
  }
}

function toggle_element(id){
	var el = document.getElementById(id);
	var header = document.getElementById(id+'Head');
	if (el.className == "hide") {
		el.className = "";
		header.parentNode.className = "close";
		//alert(header.parentNode.className);
	} else {
		el.className = "hide";
		header.parentNode.className = "";
	}			
}

//Fired when you click the collapsed main genre while sub genre is being shown .. both in bucket II
function toggleGenre(contenttype,maincategoryvalue){
	//alert(maincategoryvalue);
	var subGenre = document.getElementById('subGenre');
	var mainGenre = document.getElementById('mainGenre');
	if (mainGenre.className != "container") {
	
	
			var bucket_2_url = $('txtbucketII_top_Url').value;
		  	//var bucket_3_url = $('txtbucketIIIUrl').value;
		  	//var content_url = $('txtContentUrl').value;
		  	var bucket_3_query = '';
			var bucket_3_url_base = '';
			
			var content_query = '';
			var content_url_base = '';
		  	//alert(bucket_2_url);
			
			var bucket_2_query = fleegix.uri.getQuery(bucket_2_url);
			var bucket_2_url_base = fleegix.uri.getBase(bucket_2_url); //portion before the question mark
			
			/*var bucket_3_query = fleegix.uri.getQuery(bucket_3_url);
			var bucket_3_url_base = fleegix.uri.getBase(bucket_3_url); //portion before the question mark
			
			var content_query = fleegix.uri.getQuery(content_url);
			var content_url_base = fleegix.uri.getBase(content_url); *///portion before the question mark
			
			var sync_var_content = 0;
			var sync_var_bucket2 = 0;
			var sync_var_bucket3 = 0;
			
			
			switch(contenttype) {
				  case 'rt':
				  		$('clickeditemtype').value = 'rt';
					  	//ajaxpage('ringtones.do?command=rtcategory','buckets_containerII','1');
					  	bucket_3_query = "command=rtbanner";
					  	bucket_3_url_base = 'ringtones.do';
					  	//ajaxpage('ringtones.do?command=rtbanner','buckets_containerIII','1');
					  	$('txtcategoryid').value = '';
					  	$('txtsubcategoryid').value = '';

						content_query = "command=viewallrt";
						content_url_base = "ringtones.do";
						//ajaxpage('ringtones.do?command=viewallrt','content','1');
						//ajaxLoader('WEB-INF/jsp/'+contenttype+'.jsp','content');
						$('command').value = "viewallrt";

					  	break;
				  /*case 'wp':
				  		$('clickeditemtype').value = 'wp';
				  		//ajaxpage('wallpapers.do?command=wpcategory','buckets_containerII','1');
					  	//ajaxpage('wallpapers.do?command=wpbanner','buckets_containerIII','1');
					  	$('txtcategoryid').value = '';
					  	$('txtsubcategoryid').value = '';
 	
					  	bucket_3_query = "command=wpbanner";
					  	bucket_3_url_base = 'wallpapers.do';
					  	//ajaxpage('ringtones.do?command=rtbanner','buckets_containerIII','1');
					  	//ajaxpage('wallpapers.do?command=viewallwp','content','1');
					  	
						content_query = "command=viewallwp";
						content_url_base = "wallpapers.do";
											
						//Command value is always what action is performed on the results page i,e content div tag
						$('command').value = "viewallwp";
					  	break;
				  case 'game':
				  		$('clickeditemtype').value = 'game';
				  		//ajaxpage('games.do?command=gamescategory','buckets_containerII','1');
					  	//ajaxpage('games.do?command=gamesbanner','buckets_containerIII','1');
					  	$('txtcategoryid').value = '';
					  	$('txtsubcategoryid').value = '';
					  	//ajaxpage('games.do?command=viewallgames','content','1');
					  	
					  	bucket_3_query = "command=gamesbanner";
					  	bucket_3_url_base = 'games.do';
					  	//ajaxpage('ringtones.do?command=rtbanner','buckets_containerIII','1');
					  	//ajaxpage('wallpapers.do?command=viewallwp','content','1');
					  	
						content_query = "command=viewallgames";
						content_url_base = "games.do";
											
						//Command value is always what action is performed on the results page i,e content div tag
						$('command').value = "viewallgames";
					  	break;
				 case 'theme':
				  		$('clickeditemtype').value = 'theme';
				  		ajaxpage('theme.do?command=themecategory','buckets_containerII','1');
					  	ajaxpage('theme.do?command=themebanner','buckets_containerIII','1');
					  	$('txtcategoryid').value = '';
					  	$('txtsubcategoryid').value = '';
					  	ajaxpage('theme.do?command=viewalltheme','content','1');
											
						//Command value is always what action is performed on the results page i,e content div tag
						$('command').value = "viewalltheme";
					  	break;*/
			}
			
			var bucket_2_opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: bucket_2_query,
			    
			     onCreate: function() {
			    	//alert('loading');
			    	if (sync_var_bucket2 == 0)
		       			$('buckets_containerII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	var resp = t.responseText;
			        //alert(resp);
			        sync_var_bucket2 = 1;
			       	$('buckets_containerII').innerHTML = resp;
			       
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('txtbucketIIUrl').value = bucket_2_url;
			    }
			}

		
			var bucket_3_opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: bucket_3_query,
			    
			     onCreate: function() {
			    	//alert('loading');
			    	if (sync_var_bucket3 == 0)
		       			$('buckets_containerIII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	var resp = t.responseText; //getting the disbaled array from here
			        //alert(resp);
			        sync_var_bucket3 = 1;
			       	$('buckets_containerIII').innerHTML = resp;
			       
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('txtbucketIIIUrl').value = bucket_3_url_base + "?"+bucket_3_query;
			    }
			}
		
			var content_opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: content_query, 
			    onCreate: function() {
			    	if (sync_var_content == 0)
			       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
			    },
			     // Handle successful response
			    onSuccess: function(t) {
			    	sync_var_content = 1;
			    	var resp = t.responseText; //getting the disbaled array from here
			        //alert(resp);
			        $('content').innerHTML = resp;
			        
			    },
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('txtContentUrl').value = content_url_base + "?"+content_query;
			    	
			    }
	    	}
	    	
	    	new Ajax.Request(bucket_2_url_base, bucket_2_opt);
		    new Ajax.Request(bucket_3_url_base, bucket_3_opt);
		    new Ajax.Request(content_url_base, content_opt);
	
	}
}


function selectMe(el,x){
	for( var i = 0; el.parentNode.childNodes[i]; i++ ){
		el.parentNode.childNodes[i].className = '';
	}
	el.className = 'selected';

	var header = document.getElementById(el.parentNode.parentNode.id+'Head');
	//alert(header);
	if (x != null){
		header.innerHTML = x;
	}
	else {
		header.innerHTML = el.innerHTML;
	}

	el.parentNode.parentNode.className = "hide";
	header.parentNode.className = "";

}

function hlMe(el){

	for( var i = 0; el.parentNode.parentNode.childNodes[i]; i++ ){
		for( var j = 0; el.parentNode.parentNode.childNodes[i].childNodes[j]; j++ ){
			el.parentNode.parentNode.childNodes[i].childNodes[j].className = '';
		}
	}
	el.className = 'hl';
}

//function disableMe(el){
function disableMe(elArray){
	//var elArray = new Array();
	//elArray = el.split(", ");
	//alert(elArray.length);
	for (var i=0; i<elArray.length; i++){
		//alert(elArray[i]);
		elId = document.getElementById(elArray[i]+'Btn');
		if (elId.className == 'hl'){
			//ajaxLoader('WEB-INF/jsp/no.jsp','content');
			ajaxpage('nocontent.do','content','1');
		}
		elId.className = 'ro';
		document.getElementById('buckets_containerI_value').innerHTML = '&nbsp';
		roll('up');
	}
}


//function enableMe(el){
function enableMe(elArray){
	//var elArray = new Array();
	//elArray = el.split(", ");
	
	//alert(elArray.length);
	for (i=0; i<elArray.length; i++){
		elId = document.getElementById(elArray[i]+'Btn');
		
	
		if (elId.className != 'hl'){
			//alert("enable"+elId.id);
			elId.className = '';
		}
		if (elId.className == 'hl'){
			//transitI(elId.firstChild, elArray[i]);
		}
	}
}

function showCompatPhones(phones){

	getPreviewObjnostyle().innerHTML = '<div id="PreviewLayer_innercontainer" class="phone"><div class="phones">'+phones+'</div></div>';
	getPreviewObj().display="block";
	/*toggle('compatPhones');
	//compatPhonesHeadTxt = document.getElementById('compatPhonesHead').innerHTML;
	
	//if (compatPhonesHeadTxt != 'Compatible Phones'){
		document.getElementById('compatPhonesHead').innerHTML = 'Compatible Phones';
	}
	else{
		document.getElementById('compatPhonesHead').innerHTML = 'See all compatible phones';
	}*/
}

/********************************************************************************
	Sending Message to Phone
	ItemType has numerical values of 1,2,3 etc and not rt,ct or wp etc
**********************************************************************************/
function sendToPhone(itemid,itemtype,itemsubtypeid){
	
	var deviceid = $('txtdeviceid').value;
	//alert(deviceid);
	var sync_var_content = 0;
	var itemprice = "";
	if ($('detail_price_id'))
		itemprice = $('detail_price_id').getAttribute('price');
	
	//if (phoneModel=='ALL'){
	if (isEmptyStr(deviceid) || deviceid == '0'){
		document.getElementById('phoneerrMsg').innerHTML = '<a href="javascript:void(0);" onclick="toggle_element('+'\'selectPhone\''+');return false;">Click</a> here to select a phone in the upper left. Boost wants your phone to work with what you want to buy.';
		return false;
	}
	else{
		var ptn1=$("ptn1").value;
		var ptn2=$("ptn2").value;
		var ptn3=$("ptn3").value;
		var ptn = ""+ptn1+ptn2+ptn3;
		var send_error = 'N';
		//alert(ptn);
		if (CheckPhoneNumber(ptn,'Phone Number')) {
			//alert("Berfore submit");
			//ajaxLoader('WEB-INF/jsp/'+x+'_sent.jsp','content');
			
			var Params = new Array("keys","values");		
			Params["keys"] = Array	("command","itemtype","itemsubtypeid","deviceid","ptn","itemId","itemdesc");
			Params["values"] = Array	("sendtophone",itemtype,itemsubtypeid,deviceid,ptn,itemid,$('txtDetailsItemDesc').value);
			var url_content = "sendtophone.do"+createParams(Params);
			//alert(url_content);
			$('txtContentUrl').value = url_content;
			$('command').value = "sendtophone";
			
			var params = createParams(Params);
			//alert(params);
		  	var opt = {
				    // Use POST
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: params.substr(1), //to get rid of ?
				    onCreate: function(t) {
				    	//alert('loading');
				    	if (sync_var_content == 0)
				       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	sync_var_content = 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        $('content').innerHTML = resp;
				        
				        
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    
				    	var ajax_resp = t.responseText;
						setHistory();  
						var axel = Math.random()+"";
						var a = axel * 10000000000000;
						var itemtypename = "";
						//alert(itemtype);
						//alert(itemsubtypeid);
						switch(itemtype) {
		 					 case '2': //rt
			  					$('floodlight').src = 'http://fls.doubleclick.net/activityi;src=1133265;type=boost541;cat=ringt322;ord='+ a + '?';
			  					//alert('rt');
			  					
			  					//Omniture variables
								s.prop21 = "Download Confirmation > Ringtones";
								s.products = ';ring'+itemid+";1;"+itemprice;
								itemtypename = "RingTones";
			  					break;
		   					 case '3': //wp
			  					$('floodlight').src = 'http://fls.doubleclick.net/activityi;src=1133265;type=boost541;cat=wallp776;ord='+ a + '?';
			  					//Omniture variables
								s.prop21 = "Download Confirmation > Wallpapers";
								s.products = ';wall'+itemid+";1;"+itemprice;
								itemtypename = "Wallpapers";
			  					break;
			  				 case '1': //game and app
			  				 	if (itemsubtypeid == '1') {
			  				 		$('floodlight').src = 'http://fls.doubleclick.net/activityi;src=1133265;type=boost541;cat=games968;ord='+ a + '?';
			  				 		//Omniture variables
									s.prop21 = "Download Confirmation > Games";
									s.products = ';games'+itemid+";1;"+itemprice;
									itemtypename = "Games";
								}
			  				 	else {
			  				 		
			  				 		$('floodlight').src = 'http://fls.doubleclick.net/activityi;src=1133265;type=boost541;cat=appsp651;ord='+ a + '?';
			  				 		//Omniture variables
									s.prop21 = "Download Confirmation > Apps";
									s.products = ';app'+itemid+";1;"+itemprice;
									itemtypename = "Application";
									/*
									* Changes requested by Yoo Daly for Boost Navigator- Yogesh 3/28
									* The following spotlight tags must be executed only if the app 'Boost Navigator' is sent to a mobile device. Iterate
									* to check if the item id of current is device corresponds to one of the Navigator Item Ids (item_ids).
									*/
									
									var inItemIds = item_id.split(",");
									for(i = 0; i < inItemIds.length; i++){
										
										if(itemid == inItemIds[i]) {
											$('floodlight').src = 'http://fls.doubleclick.net/activityi;src=1133265;type=boost818;cat=confi079;ord='+ a + '?';
			  				 				$('floodlight').src = 'http://fls.doubleclick.net/activityi;src=1133265;type=boost818;cat=confi079;ord=1?';
			  				 		
											break;
										}
										
									}
									
									//end of changes
			  				 }
			  				 break;
			  				 
			  			}
			  			
			  			//alert(ajax_resp);
			  			if ((ajax_resp.indexOf("Failed to execute sendMessage") != -1) || (ajax_resp.indexOf("Invalid PTN number") != -1)) {
			  				//alert("Invalid PTN number");
				        	set_omniture_variables_downloadconfirmation(ptn,'Y',itemtypename,itemid,itemprice);
				        	send_error = 'Y';
				        }
						
						if (send_error == 'N') {
							//alert("valid PTN number");
							set_omniture_variables_downloadconfirmation(ptn,'N',itemtypename,itemid,itemprice);
						}
						//document.write('<IFRAME SRC="http://fls.doubleclick.net/activityi;src=1133265;type=boost541;cat=ringt322;ord='+ a + '?" WIDTH=1 HEIGHT=1 FRAMEBORDER=0></IFRAME>');
				    }
			}
			
			new Ajax.Request('sendtophone.do', opt);
		}
	}
}

/*******************************************************************************
	On Change of Phone this is fired
***********************************************************************************/
function transitPhone(deviceid,el,txt,imgSrc){

	selectMe(el,txt);
	$('txtdeviceid').value = deviceid;
	if ($('txtselected_device_name'))
		$('txtselected_device_name').value = txt;
	
	//Set the device id in cookie
	createCookie("deviceidcookie",deviceid,'30');
	
	document.getElementById('phoneImg').src = imgSrc;

	var curr_itemtype = $('clickeditemtype').value;
	
	var Params = new Array("keys","values");		
	Params["keys"] = Array	("current_itemtype","command","deviceid");
	Params["values"] = Array	(curr_itemtype,"getitemtypesbydevice",deviceid);
	var params = createParams(Params);
	var commanvalue = $('command').value;
	
	//alert(params);
	var itemtype = '';
	var itemId = '';
	var showdetails = false;
	if (!isEmptyStr(commanvalue) && commanvalue.indexOf("details") != -1) {
		//alert("commandvalue:" + commanvalue);
		showdetails = true;
		itemId = $('txtDetailsItemid').value;
		itemtype = $('clickeditemtype').value;
	}
	
	var opt = {
	    // Use POST
	    method: 'post',asynchronous:true,
	    // Send this lovely data
	    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
	    postBody: params.substr(1), //to get rid of ?
	   
	    // Handle Loading
	    //onCreate: function() {
	       // alert('Loading');
	    //},
	     // Handle successful response
	    onSuccess: function(t) {
	    	
	    	var resp = stripWhitespace(t.responseText); //getting the disbaled array from here
	        //alert(resp);
	        
	        //var fullarray = ["rt","ct","music","business","wp","theme","game","tv","personal"];
	        var fullarray = ["rt","ct","music","wp","theme","game","tv"];
			fullarray.sort();
			var fulllen = fullarray.length;
			//alert("Full Array:"+fullarray.toString());
			
			//var disablearr = ["rt","ct","music","business"];
			
			//Format from the action class is disblearray="rt","ct","music","business"
			if (!isEmptyStr(resp) && resp.indexOf("enablearray") != -1) {
				var enablearr = eval('['+resp.substr(12)+']');
				//alert("Enable Array:"+enablearr);
				enablearr.sort();
				var enablelen = enablearr.length;
				//alert("enablelen:"+enablelen);
				if (enablelen > 0) {
					for(i=0;i<fulllen;i++){
						for(j=0;j<enablelen;j++){
							if(fullarray[i]==enablearr[j])
							{
								fullarray.splice(i,1);
							}
						}
					}
					var disablearr = fullarray.slice(0);
					//alert("disablearr:"+disablearr.toString());
					
					
					enableMe(enablearr);
					disableMe(disablearr);
				}
			}
			else {
				//alert('in enabling full array');
				enableMe(fullarray);
				
			}
				
	        
	    },
	    // Handle 404
	    on404: function(t) {
	        alert('Error 404: location "' + t.statusText + '" was not found.');
	    },
	    // Handle other errors
	    onFailure: function(t) {
	        alert('Error ' + t.status + ' -- ' + t.statusText);
	    },
	     // Handle other errors
	    onComplete: function(t) {
	        
	        $('floodlight').src = "/boost_floodlight_blank.html";
	        var BtnObj = $(curr_itemtype+'Btn'); //e,g rtBtn,wpBtn
	        if (BtnObj) {
	        	//alert(BtnObj.className);
	        	if (BtnObj.className == 'hl' && showdetails == false) {
	        		//alert("showdetails:"+showdetails);
	        		transitI(BtnObj.firstChild, curr_itemtype);
	        	}
	        	//else not sure what to do if none is selected
	        		
	        }
	        
	        //Fetch the other categories in Applications yet to be decided
	        //alert("before getapps");
			getApps(deviceid,'3','4');
			
			if (!showdetails)
				set_omniture_variables_top("2",txt,'');
	    }
	}

	new Ajax.Request('devices.do', opt);
	
	//For this external list command whena list contains bundle , fire from content url , else fire the 
	//getDetails function
	if (commanvalue == 'bundleinlistdetails') {
			var location_url = $('txtContentUrl').value;
			var query = fleegix.uri.getQuery(location_url);
			var url_base = fleegix.uri.getBase(location_url);
			
			var sync_var_content = 0;
			
			query = fleegix.uri.setParam('deviceid', deviceid, query);
			var urlandparams = url_base + "?" + query;
			//alert(urlandparams);
			var opt_det = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: query, //to get rid of ?
			    onCreate: function(t) {
			    	//alert('loading');
			    	if (sync_var_content == 0)
			       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
			    },
			     // Handle successful response
			    onSuccess: function(t) {
			    	sync_var_content = 1;
			    	var resp = t.responseText; //getting the disbaled array from here
			        //alert(resp);
			        $('content').innerHTML = resp;
			        
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
					setHistory();
			    }
			}
		
			if (!isEmptyStr(urlandparams))
				new Ajax.Request(url_base, opt_det);
	
	} //commanvalue == 'bundleinlistdetails'
	else if (showdetails) {
		getItemDetails(itemtype,itemId,'');
	}
	else {
		//reset omniture variables on change of phone
		//Omniture Bug
		var content_url = $('txtContentUrl').value;
		if (content_url.indexOf("globalsearch.do?") != -1) {
			var query = fleegix.uri.getQuery(content_url);
			var searchval = fleegix.uri.getParam('dlSearchField', query);
			//alert("searchval:"+searchval);
			set_omniture_variables_top("3",searchval,txt)
		}
	}

}
/******************************************************************************************************
 This function is fired when global search is done by typing in a keyword on the serach box above

********************************************************************************************************/
function transitSearch(rowspercolumn,itemtype,offsetvalue){

	var searchfield = $('keysearchfield').value;
	
	if (isEmptyStr(searchfield) || searchfield.length < 3) {
		searchfield = '';
		alert('SearchField should have at least 3 characters');
		return;
	}

	//alert("offsetvalue in transitSearch:x"+offsetvalue+'x');
	document.getElementById('buckets').className = 'buckets_home_short search';

	for( var i = 0; document.getElementById('bucketI_Type').childNodes[i]; i++ ){
		document.getElementById('bucketI_Type').childNodes[i].className = '';
	}

	for( var i = 0; document.getElementById('bucketII_Type').childNodes[i]; i++ ){
		document.getElementById('bucketII_Type').childNodes[i].className = '';
	}

	for( var i = 0; document.getElementById('bucketIII_Type').childNodes[i]; i++ ){
		document.getElementById('bucketIII_Type').childNodes[i].className = '';
	}

	document.getElementById('buckets_containerI_value').innerHTML = '';
	
	//var itemtype = $('clickeditemtype').value;
	var deviceid = $('txtdeviceid').value;
	
	
	if (isEmptyStr(deviceid))
		deviceid = '0';
	
	var item_type = itemtype;
	if (isEmptyStr(item_type))
		item_type = '';
		
	var page_offset = offsetvalue;
	if (isEmptyStr(page_offset))
		page_offset = '';
		
	var globallistvalue = $('txtlistNumValue').value;
	if (isEmptyStr(globallistvalue))
		globallistvalue = '5';
	//alert(globallistvalue);
	var sync_var_content = 0;
	var Params = new Array("keys","values");		
	Params["keys"] = Array	("command","itemtype","dlSearchField","deviceid","rowspercolumn","pager.offset");
	//Params["values"] = Array	("globalsearchbykeyword",item_type,searchfield,deviceid,rowspercolumn,page_offset);
	Params["values"] = Array	("globalsearchbykeyword",item_type,searchfield,deviceid,globallistvalue,page_offset);
	
	var url_content = "globalsearch.do"+createParams(Params);
	//alert(url_content);
	$('txtContentUrl').value = url_content;
	$('command').value = "globalsearchbykeyword";
	
	var params = createParams(Params);
	  	//alert(params);
  	var opt = {
		    // Use POST
		    method: 'post',asynchronous:true,
		    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
		    postBody: params.substr(1), //to get rid of ?
		    onCreate: function(t) {
		    	//alert('loading');
		    	if (sync_var_content == 0)
		       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
		    },
		     // Handle successful response
		    onSuccess: function(t) {
		    	sync_var_content = 1;
		    	var resp = t.responseText; //getting the disbaled array from here
		        //alert(resp);
		        $('content').innerHTML = resp;
		        
		    },
		   
		     // On Complete acts as a postfunction
		    onComplete: function(t) {
		    	
		    	$('floodlight').src = "/boost_floodlight_blank.html";
		    	globalsearchedValuesArr.splice(0,0,searchfield);
		    	globalsearchedValuesArr.sort();
		    	var resultscount = Element.readAttribute("globalsearch_totalcount", "totalcount");
		    	//alert(resultscount);
		    	if (resultscount == 1) { //go to details page directly
		    		var itemId = Element.readAttribute("globalsearch_totalcount", "itemId");
		    		var contenttype = Element.readAttribute("globalsearch_totalcount", "contenttype");
		    		var advisoryflag = Element.readAttribute("globalsearch_totalcount", "advisoryflag");
		    		//alert(itemId);
		    		//alert(contenttype);
		    		getItemDetails(contenttype,itemId,'','',advisoryflag);
		    	}
		    	else
					setHistory();  
				
				
				set_omniture_variables_top("3",searchfield,$('txtselected_device_name').value);
		    }
	}
	
	new Ajax.Request('globalsearch.do', opt);
	
	//ajaxpage(url_content,'content','1');
}

/******************************************************************************************************
 This function is fired when category search is done from  from external lists or jump URL's
 The buckets portion is similar to doing globalsearch
 categoryvalue is the category id
 
********************************************************************************************************/
function jumpToCategorySearch(categoryvalue,itemtype){

	//alert("offsetvalue in transitSearch:x"+offsetvalue+'x');
	document.getElementById('buckets').className = 'buckets_home_short search';

	for( var i = 0; document.getElementById('bucketI_Type').childNodes[i]; i++ ){
		document.getElementById('bucketI_Type').childNodes[i].className = '';
	}

	for( var i = 0; document.getElementById('bucketII_Type').childNodes[i]; i++ ){
		document.getElementById('bucketII_Type').childNodes[i].className = '';
	}

	for( var i = 0; document.getElementById('bucketIII_Type').childNodes[i]; i++ ){
		document.getElementById('bucketIII_Type').childNodes[i].className = '';
	}

	document.getElementById('buckets_containerI_value').innerHTML = '';
	
	var sync_var_content = 0;
	setListNum();
	var rowspercol = $('txtlistNumValue').value;
	
	var deviceid = $('txtdeviceid').value;
	
	if (isEmptyStr(deviceid))
		deviceid = '0';
	
	var item_type = itemtype;
	if (isEmptyStr(item_type))
		item_type = '';
		
	
	var ContentParams = new Array("keys","values");		
	ContentParams["keys"] = Array	("deviceid","command","categorysearchvalue","rowspercolumn");
	
	switch(itemtype) {
		  case 'rt':
			  	ContentParams["values"] = Array	(deviceid,"rtsearchbycategory",categoryvalue,$('txtlistNumValue').value);
			  	var params = createParams(ContentParams);
				var url_content = "ringtones.do"+ params;
				$('txtContentUrl').value = url_content;
				$('command').value = "rtsearchbycategory";
			  	break;
		   case 'wp':
			  	ContentParams["values"] = Array	(deviceid,"wpsearchbycategory",categoryvalue,$('txtlistNumValue').value);
			  	var params = createParams(ContentParams);
				var url_content = "wallpapers.do"+ params;
				$('txtContentUrl').value = url_content;
				$('command').value = "wpsearchbycategory";
			  	break;
		   case 'game':
			  	ContentParams["values"] = Array	(deviceid,"gamesbycategory",categoryvalue,$('txtlistNumValue').value);
			  	var params = createParams(ContentParams);
				var url_content = "games.do"+ params;
				$('txtContentUrl').value = url_content;
				$('command').value = "gamesbycategory";
			  	break;
		  case 'app':
			  	ContentParams["values"] = Array	(deviceid,"appbycategory",categoryvalue,$('txtlistNumValue').value);
			  	var params = createParams(ContentParams);
				var url_content = "applications.do"+ params;
				$('txtContentUrl').value = url_content;
				$('command').value = "appbycategory";
			  	break;
		  case 'theme':
			  	ContentParams["values"] = Array	(deviceid,"themesearchbycategory",categoryvalue,$('txtlistNumValue').value);
			  	var params = createParams(ContentParams);
				var url_content = "theme.do"+ params;
				$('txtContentUrl').value = url_content;
				$('command').value = "themesearchbycategory";
			  	break;
	}
	
	
	//alert(params);
  	var opt = {
		    // Use POST
		    method: 'post',asynchronous:true,
		    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
		    postBody: params.substr(1), //to get rid of ?
		    onCreate: function(t) {
		    	//alert('loading');
		    	if (sync_var_content == 0)
		       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
		    },
		     // Handle successful response
		    onSuccess: function(t) {
		    	sync_var_content = 1;
		    	var resp = t.responseText; //getting the disbaled array from here
		        //alert(resp);
		        $('content').innerHTML = resp;
		        
		    },
		   
		     // On Complete acts as a postfunction
		    onComplete: function(t) {
				setHistory();  
		    }
	}
	var url_base = fleegix.uri.getBase(url_content);
	new Ajax.Request(url_base, opt);
	
}

/*****************************************************
This function is fired only from transitI when they doa search by the first category when they
click on an application type the first time
***********************************************************/
function searchbycategory(deviceid,command,categoryvalue,url) {

	var sync_var_content = 0;
	var sync_var_bucketII = 0;
	var sync_var_bucketIII = 0;
	
	var rowspercol = $('txtlistNumValue').value;
	
	if (isEmptyStr(rowspercol))
		rowspercol = '3';
	
	var ContentParams = new Array("keys","values");		
	ContentParams["keys"] = Array	("deviceid","command","categorysearchvalue","rowspercolumn");
 		ContentParams["values"] = Array	(deviceid,command,categoryvalue,rowspercol);
 		var params = createParams(ContentParams);
 		var url_content = url + params;
 		$('txtContentUrl').value = url_content;
 		//alert(url_content);
 		
 		var opt = {
	    // Use POST
	    method: 'post',asynchronous:true,
	    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
	    postBody: params.substr(1), //to get rid of ?
	    
	     onCreate: function(t) {
	    	if (sync_var_content == 0)
       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
    	},
	     // Handle successful response
	    onSuccess: function(t) {
	    	sync_var_content = 1;
	    	var resp = t.responseText; //getting the disbaled array from here
	        //alert(resp);
	        $('content').innerHTML = resp;
	        
	    },
	   
	     // On Complete acts as a postfunction
	    onComplete: function(t) {
	    	$('floodlight').src = "/boost_floodlight_blank.html";
			setHistory();
	    }
	}
	
	new Ajax.Request(url, opt);
	$('command').value = command;
}

/******************************************************
	Fired when any menu in the first bucket is clicked
********************************************************************/
function transitI(el,contenttype){

	c=0;
	$('keysearchfield').value = ''; //clear the value off
	
	for( var i = 0; document.getElementById('bucketI_Type').childNodes[i]; i++ ){
		if (document.getElementById('bucketI_Type').childNodes[i].className != 'ro'){
			document.getElementById('bucketI_Type').childNodes[i].className = '';
		}
	}

	for( var i = 0; document.getElementById('bucketII_Type').childNodes[i]; i++ ){
		if (document.getElementById('bucketII_Type').childNodes[i].className != 'ro'){
			document.getElementById('bucketII_Type').childNodes[i].className = '';
		}
	}

	for( var i = 0; document.getElementById('bucketIII_Type').childNodes[i]; i++ ){
		if (document.getElementById('bucketIII_Type').childNodes[i].className != 'ro'){
			document.getElementById('bucketIII_Type').childNodes[i].className = '';
		}
	}

	el.parentNode.className = 'hl';
	el.parentNode.parentNode.parentNode.parentNode.parentNode.className = 'buckets_collapsed';

	bkId = el.parentNode.parentNode.parentNode.id;
	document.getElementById('buckets_containerII').className = 'bg_'+bkId;
	document.getElementById('buckets_containerIII').className = 'bg_'+bkId;

	document.getElementById('buckets_containerI_value').innerHTML = el.innerHTML;
	
	var deviceid = $('txtdeviceid').value;
	
	if (isEmptyStr(deviceid))
		deviceid = '0';
	
	var sync_var_content = 0;
	var sync_var_bucketII = 0;
	var sync_var_bucketIII = 0;
	
	//List id of the contentlist to be displayed in the content section
	var contentlistid = el.parentNode.getAttribute("contentlistid");
	//alert(contentlistid);
	switch(contenttype) {
		  case 'rt':
		  		
		  		$('clickeditemtype').value = 'rt';
		  		var Params = new Array("keys","values");		
				Params["keys"] = Array	("deviceid","command");
		  		Params["values"] = Array	(deviceid,"rtcategory");
		  		var url_1 = "ringtones.do"+createParams(Params);
		  		
		  		var catparams = createParams(Params);
		  		var optcategory = {
				    // Use GET
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: catparams.substr(1), //to get rid of ?
				    onCreate: function(t) {
				    	if (sync_var_bucketII == 0)
				       		$('buckets_containerII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	sync_var_bucketII = 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        $('buckets_containerII').innerHTML = resp;
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    
				    	$('floodlight').src = "/boost_floodlight_blank.html";
				    	//to make the category shown in content hilited
				    	if ($('catlisting')) {
				    		//var first_category = $('catlisting').childNodes[0].childNodes[0];
				    		//alert($('cat_'+first_games_category).id);
				    		$('cat_'+first_rt_category).className = 'hl';
				    	}
				    }
				}
			
				new Ajax.Request('ringtones.do', optcategory);
		  		
			  	//ajaxpage(url_1,'buckets_containerII','1');
			  	$('txtbucketIIUrl').value = url_1;
			  	$('txtbucketII_top_Url').value = url_1; //applicable for contents which have subcategories also in same bucket
			  	
			  	ajaxpage('ringtones.do?command=rtbanner','buckets_containerIII','1');
			  	$('txtbucketIIIUrl').value = 'ringtones.do?command=rtbanner';
			  	
			  	searchbycategory(deviceid,"rtsearchbycategory",first_rt_category,'ringtones.do');
			  	
			  	/*var ContentParams = new Array("keys","values");		
				ContentParams["keys"] = Array	("deviceid","command","listid","itemtype","rowspercolumn");
		  		ContentParams["values"] = Array	(deviceid,"contenttypelists",contentlistid,"rt",$('txtlistNumValue').value);
		  		var url_content = "lists.do"+createParams(ContentParams);
			  	var params = createParams(ContentParams);
			  	 
			  	//alert(params);
		  		$('txtContentUrl').value = url_content;
		  		var opt = {
				    // Use POST
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: params.substr(1), //to get rid of ?
				    onLoading: function(t) {
				    	if (sync_var_content == 0)
				       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	sync_var_content = 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        $('content').innerHTML = resp;
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
						setHistory();
				    }
				}
			
				new Ajax.Request('lists.do', opt);
				$('command').value = "contenttypelists";*/
				
			  	break;
		  case 'wp':
		  		var sync_var = 0;
		  		$('clickeditemtype').value = 'wp';
		  		var Params = new Array("keys","values");		
				Params["keys"] = Array	("deviceid","command");
		  		Params["values"] = Array	(deviceid,"wpcategory");
		  		var url_1 = "wallpapers.do"+createParams(Params);
		  		//alert(url_1);
		  		$('txtbucketIIUrl').value = url_1;
		  		var catparams = createParams(Params);
		  		var optcategory = {
				    // Use GET
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: catparams.substr(1), //to get rid of ?
				    onLoading: function(t) {
				    	//alert('loading');
				    	if (sync_var_bucketII == 0)
				       		$('buckets_containerII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	sync_var_bucketII = 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        $('buckets_containerII').innerHTML = resp;
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    
				    	$('floodlight').src = "/boost_floodlight_blank.html";
				    	//to make the category shwon in the content hilited
				    	if ($('catlisting')) {
				    		//var first_category = $('catlisting').childNodes[0].childNodes[0];
				    		//alert(first_category .id);
				    		//first_category.className = 'hl'
				    		$('cat_'+first_wp_category).className = 'hl';
				    	}
				    }
				}
			
				new Ajax.Request('wallpapers.do', optcategory);
			  	
			  	ajaxpage('wallpapers.do?command=wpbanner','buckets_containerIII','1');
			  	$('txtbucketIIIUrl').value = 'wallpapers.do?command=wpbanner';
			  	
			  	searchbycategory(deviceid,"wpsearchbycategory",first_wp_category,'wallpapers.do');
			  	
		  		/*var ContentParams = new Array("keys","values");		
				ContentParams["keys"] = Array	("deviceid","command","listid","itemtype","rowspercolumn");
		  		ContentParams["values"] = Array	(deviceid,"contenttypelists",contentlistid,"wp",$('txtlistNumValue').value);
		  		var url_content = "lists.do"+createParams(ContentParams);
		  		//var url_content = "wallpapers.do"+createParams(ContentParams);
			  	var params = createParams(ContentParams);
			  	//alert(params);
		  		$('txtContentUrl').value = url_content;
		  		var opt = {
				    // Use POST
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: params.substr(1), //to get rid of ?
				    onCreate: function(t) {
				       	if (sync_var_content == 0)
				       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	sync_var_content = 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        $('content').innerHTML = resp;
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
						setHistory();
				    }
				}
			
				new Ajax.Request('lists.do', opt);
			  	//ajaxpage('wallpapers.do?command=viewallwp','content','1');
				$('command').value = "contenttypelists";*/
			  	break;
		  case 'app':
		  		$('clickeditemtype').value = 'app';
		  		var p = el.parentNode;
		  		//alert(p.getAttribute("topgenre"));
		  		var top_genre_id = p.getAttribute("topgenre");
		  		
		  		var Params = new Array("keys","values");		
				Params["keys"] = Array	("deviceid","command","categorysearchvalue");
		  		Params["values"] = Array	(deviceid,"appcategory",top_genre_id);
		  		var url_1 = "applications.do"+createParams(Params);
		  		$('txtbucketIIUrl').value = url_1;
		  		//alert(url_1);
		  		var catparams = createParams(Params);
		  		var optcategory = {
				    // Use GET
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: catparams.substr(1), //to get rid of ?
				    onCreate: function(t) {
				    	//alert('loading');
				    	if (sync_var_bucketII == 0)
				       		$('buckets_containerII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	sync_var_bucketII = 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        //$('buckets_containerII').innerHTML = resp;
				        
				        if (resp.indexOf("No Data Found") == -1)
				        	$('buckets_containerII').innerHTML = resp;
				        else
				        	ajaxpage('applications.do?command=appbanner&bucket_no=2','buckets_containerII','1');
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    
				    	$('floodlight').src = "/boost_floodlight_blank.html";
				    }
				}
			
				new Ajax.Request('applications.do', optcategory);
			  
			  	ajaxpage('applications.do?command=appbanner&bucket_no=3','buckets_containerIII','1');
			  	$('txtbucketIIIUrl').value = 'applications.do?command=appbanner';
			  	
			  	var ContentParams = new Array("keys","values");		
				ContentParams["keys"] = Array	("deviceid","command","categorysearchvalue","rowspercolumn");
		  		ContentParams["values"] = Array	(deviceid,"appbycategory",top_genre_id,$('txtlistNumValue').value);
			  	
			  	//var ContentParams = new Array("keys","values");		
				//ContentParams["keys"] = Array	("deviceid","command","rowspercolumn");
		  		//ContentParams["values"] = Array	(deviceid,"viewallapps",$('txtlistNumValue').value);
		  		var url_content = "applications.do"+createParams(ContentParams);
			  	var params = createParams(ContentParams);
			  	//alert(params);
		  		$('txtContentUrl').value = url_content;
		  		var opt = {
				    // Use POST
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: params.substr(1), //to get rid of ?
				    onLoading: function(t) {
				    	//alert('loading');
				    	if (sync_var_content == 0)
				       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				        sync_var_content = 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        $('content').innerHTML = resp;
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    
				    	$('floodlight').src = "/boost_floodlight_blank.html";
						setHistory();
				    }
				}
			
				new Ajax.Request('applications.do', opt);
				$('command').value = "appbycategory";
				
			  	break;
		  case 'game':
		  		var sync_var = 0;
		  		$('clickeditemtype').value = 'game';
		  		var Params = new Array("keys","values");		
				Params["keys"] = Array	("deviceid","command");
		  		Params["values"] = Array	(deviceid,"gamescategory");
		  		var url_1 = "games.do"+createParams(Params);
		  		//alert(url_1);
		  		$('txtbucketIIUrl').value = url_1;
		  		var catparams = createParams(Params);
		  		var optcategory = {
				    // Use GET
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: catparams.substr(1), //to get rid of ?
				    onCreate: function(t) {
				    	//alert('loading');
				    	if (sync_var_bucketII == 0)
				       		$('buckets_containerII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	sync_var_bucketII == 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        $('buckets_containerII').innerHTML = resp;
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    
				    	$('floodlight').src = "/boost_floodlight_blank.html";
				    	//to make the category shown in content hilited
				    	if ($('catlisting')) {
				    		//var first_category = $('catlisting').childNodes[0].childNodes[0];
				    		//alert($('cat_'+first_games_category).id);
				    		$('cat_'+first_games_category).className = 'hl';
				    	}
				    }
				}
			
				new Ajax.Request('games.do', optcategory);
			  	//ajaxpage(url_1,'buckets_containerII','1');
			  	ajaxpage('games.do?command=gamesbanner','buckets_containerIII','1');
			  	$('txtbucketIIIUrl').value = 'games.do?command=gamesbanner';
			  	
			  	searchbycategory(deviceid,"gamesbycategory",first_games_category,'games.do');
			  	
		  		/*var ContentParams = new Array("keys","values");		
				ContentParams["keys"] = Array	("deviceid","command","listid","itemtype","rowspercolumn");
		  		ContentParams["values"] = Array	(deviceid,"contenttypelists",contentlistid,"game",$('txtlistNumValue').value);
		  		var url_content = "lists.do"+createParams(ContentParams);
		  		//var url_content = "games.do"+createParams(ContentParams);
			  	var params = createParams(ContentParams);
			  	//alert(params);
		  		$('txtContentUrl').value = url_content;
		  		var opt = {
				    // Use POST
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: params.substr(1), //to get rid of ?
				     onLoading: function(t) {
				       	//if (sync_var_content == 0)
				       		//$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	sync_var_content = 1;
				    	var resp = t.responseText; //getting the disbaled array from here
				        //alert(resp);
				        $('content').innerHTML = resp;
				       
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    	
				    	//Element.setStyle("container", {position:'relative',textAlign:'center',margin:'14px auto 0'});
				    	//alert(Element.getStyle("container","textAlign"));
				        
						setHistory();
				    }
				}
			
				new Ajax.Request('lists.do', opt);
			  	//ajaxpage('games.do?command=viewallgames','content','1');
				$('command').value = "contenttypelists";*/
			  	break;
		  case 'theme':
		  		$('clickeditemtype').value = 'theme';
		  		var Params = new Array("keys","values");		
				Params["keys"] = Array	("deviceid","command");
		  		Params["values"] = Array	(deviceid,"themecategory");
		  		var url_1 = "theme.do"+createParams(Params);
		  		//alert(url_1);
		  		$('txtbucketIIUrl').value = url_1;
		  		var catparams = createParams(Params);
		  		var optcategory = {
				    // Use GET
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: catparams.substr(1), //to get rid of ?
				    onCreate: function() {
				    	if (sync_var_bucketII == 0)
				       		$('buckets_containerII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	var resp = t.responseText; //getting the disbaled array from here
				        sync_var_bucketII = 1;
				        $('buckets_containerII').innerHTML = resp;
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    
				    	$('floodlight').src = "/boost_floodlight_blank.html";
				    }
				}
			
				new Ajax.Request('theme.do', optcategory);
			  	//ajaxpage(url_1,'buckets_containerII','1');
			  	
			  	ajaxpage('theme.do?command=themebanner','buckets_containerIII','1');
			  	$('txtbucketIIIUrl').value = 'theme.do?command=themebanner';
			  	
			  	var ContentParams = new Array("keys","values");		
				ContentParams["keys"] = Array	("deviceid","command","rowspercolumn");
		  		ContentParams["values"] = Array	(deviceid,"viewalltheme",$('txtlistNumValue').value);
		  		var url_content = "theme.do"+createParams(ContentParams);
			  	var params = createParams(ContentParams);
			  	//alert(params);
		  		$('txtContentUrl').value = url_content;
		  		var opt = {
				    // Use POST
				    method: 'post',asynchronous:true,
				    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
				    postBody: params.substr(1), //to get rid of ?
				    onCreate: function() {
				    	if (sync_var_content == 0)
				       		$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    },
				     // Handle successful response
				    onSuccess: function(t) {
				    	var resp = t.responseText; //getting the disbaled array from here
				    	sync_var_content = 1;
				        //alert(resp);
				        $('content').innerHTML = resp;
				        
				    },
				   
				     // On Complete acts as a postfunction
				    onComplete: function(t) {
				    
				    	$('floodlight').src = "/boost_floodlight_blank.html";
						setHistory();
				    }
				}
			
				new Ajax.Request('theme.do', opt);
			  	//ajaxpage('wallpapers.do?command=viewallwp','content','1');
				$('command').value = "viewalltheme";
			  	break;
		  default:
		  		break;
		   
	}
	
	$('txtcategoryid').value = ''; //First level of category after ringtones
	$('txtsubcategoryid').value = ''; // Second level after clicking on first category
	
	////setHistory();
	
}

/****************************************************************************************
Advisroy flag plays a role when the category has a content advisory comes from the field 
MATURITY_FLAG  attribute of categoryDTO which has a value of 1 and 0 when fetching categories
**********************************************************************************************/
function transitII(el,contenttype,advisoryflag){

	//alert(el.id);
	hlMe(el); //Here hilite is done from the JSP page because the call for buckets_containerII for getting category/subcategory overrides this hilite from javascript
	document.getElementById('buckets_containerII_value').innerHTML=el.innerHTML;
	
	
	var isArtist = 'no';
	c=0;
	var deviceid = $('txtdeviceid').value;
	
	if (isEmptyStr(deviceid))
		deviceid = '0';
		
	var sync_var_content = 0;
	var sync_var_bucketII = 0;
	var sync_var_bucketIII = 0;
	
	//If Y then already accepted and do no present the Advisory warning .. default value is N
	var advisory_already_accepted = $('txtAcceptContentAdvisory').value;

	if (contenttype != undefined){
	
		var elid = el.id;
		var categoryvalue = elid.substr(4,elid.length); //query for category search is based on nodeid and not node name
		var parentcategorytext = el.getAttribute("cattext");
		
	
		switch(contenttype) {
			  case 'rt':
			  		$('clickeditemtype').value = 'rt';
			  		//$('command').value = "rtartistbycat";
					//alert(categoryvalue);
					var offsetvalue = 0;
					if ($('genre_pageroffset')) 
						offsetvalue = $('genre_pageroffset').value;
						
					var Params = new Array("keys","values");		
					Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext");
			  		Params["values"] = Array	(deviceid,"rtcategory",categoryvalue,parentcategorytext);
			  		var url_bucket_2 = "ringtones.do"+createParams(Params);	
			  		var bucket_2_params = createParams(Params);
			  		var bucket_2 = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: bucket_2_params.substr(1), //to get rid of ?
					     /*onCreate: function(t) {
					     	if (sync_var_bucketII == 0)
					     		$('buckets_containerII').innerHTML = '<div style="padding:0; text-align:center !important; width:222px; height:120px; background:url(images/loading2.gif) center center no-repeat;"></div>';
				    	},*/
					     // Handle successful response
					    onSuccess: function(t) {
					    	sync_var_bucketII = 1;
					    	var resp = t.responseText; //getting the disbaled array from here
					        //alert(resp);
					        if (resp.indexOf("No Data Found") == -1)
					        	$('buckets_containerII').innerHTML = resp;
					        
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							//setHistory();
					    }
					}
			
					new Ajax.Request('ringtones.do', bucket_2);
					$('txtbucketIIUrl').value = url_bucket_2;
					//ajaxpage(url_1,'buckets_containerII','1'); //getting subcategories
					
					var bucket3_Params_Array = new Array("keys","values");		
					bucket3_Params_Array["keys"] = Array	("deviceid","command","categorysearchvalue");
			  		bucket3_Params_Array["values"] = Array	(deviceid,"rtartistbycat",categoryvalue);
			  		var url_bucket_3 = "ringtones.do"+createParams(bucket3_Params_Array);	
			  		var bucket_3_params = createParams(bucket3_Params_Array);
			  		var bucket_3 = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: bucket_3_params.substr(1), //to get rid of ?
					     onCreate: function(t) {
					     	if (sync_var_bucketIII == 0)
					     		$('buckets_containerIII').innerHTML = '<div style="padding:0; text-align:center !important; width:222px; height:120px; background:url(images/loading2.gif) center center no-repeat;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	sync_var_bucketIII = 1;
					    	var resp = t.responseText; //getting the disbaled array from here
					        //alert(resp);
					        if (resp.indexOf("No Data Found") == -1)
					        	$('buckets_containerIII').innerHTML = resp;
					        
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							//setHistory();
					    }
					}
					
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=subcategoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'buckets_containerIII')
					}
					else 
						new Ajax.Request('ringtones.do', bucket_3);
					
			  		
					//var url_bucket_3 = 'ringtones.do?command=rtartistbycat&categorysearchvalue='+categoryvalue;
					//ajaxpage(url_bucket_3,'buckets_containerIII','1');
					$('txtbucketIIIUrl').value = url_bucket_3;
					
					//For paginations and change of col/list dropdown , value of rowspercol is taken from dropdown and also they are implemeneted
					//in other javascript functions ... $('txtlistNumValue').value  is only for initial value
					var ContentParams = new Array("keys","values");		
					ContentParams["keys"] = Array	("deviceid","command","categorysearchvalue","rowspercolumn");
			  		ContentParams["values"] = Array	(deviceid,"rtsearchbycategory",categoryvalue,$('txtlistNumValue').value);
			  		var params = createParams(ContentParams);
			  		var url_content = "ringtones.do"+ params;
			  		$('txtContentUrl').value = url_content;
			  		
			  		var opt = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: params.substr(1), //to get rid of ?
					    
					     onCreate: function(t) {
					    	if (sync_var_content == 0)
				       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	sync_var_content = 1;
					    	var resp = t.responseText; //getting the disbaled array from here
					        //alert(resp);
					        $('content').innerHTML = resp;
					        
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=categoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'content')
					}
					else 
						new Ajax.Request('ringtones.do', opt);
			  		//ajaxpage(url_content,'content','1');
					//ajaxpage('ringtones.do?command=rtsearchbycategory&categorysearchvalue='+categoryvalue+'&deviceid='+deviceid+'&rowspercolumn='+$('txtlistNumValue').value,'content','1');
										
					$('txtcategoryid').value = categoryvalue;
					
					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "rtsearchbycategory";
					isArtist = 'yes'
					
				  	break;
			  case 'wp':
			  		$('clickeditemtype').value = 'wp';
			  		var offsetvalue = 0;
					if ($('genre_pageroffset')) 
						offsetvalue = $('genre_pageroffset').value;
						
			  		//getting subcategories for bucket III as wallpapers have no artists
			  		var Params = new Array("keys","values");		
					Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext");
			  		Params["values"] = Array	(deviceid,"wpcategory",categoryvalue,parentcategorytext);
			  		var url_bucket_3 = "wallpapers.do"+createParams(Params);
			  		var bucket_3_params = createParams(Params);
			  		var bucket_3 = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: bucket_3_params.substr(1), //to get rid of ?
					    
					     onCreate: function(t) {
					    	//alert('loading');
					    	if (sync_var_bucketIII == 0)
				       			$('buckets_containerIII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	var resp = t.responseText; //getting the disbaled array from here
					        //alert(resp);
					        sync_var_bucketIII = 1;
					        if (resp.indexOf("No Data Found") == -1)
					        	$('buckets_containerIII').innerHTML = resp;
					        else
					        	ajaxpage('wallpapers.do?command=wpbanner','buckets_containerIII','1');
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							//setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=subcategoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'buckets_containerIII')
					}
					else 
						new Ajax.Request('wallpapers.do', bucket_3);
					$('txtbucketIIIUrl').value = url_bucket_3;
			  		//alert(url_1);
			  		//ajaxpage(url_1,'buckets_containerIII','1'); 
				  	//ajaxpage('wallpapers.do?command=wpbanner','buckets_containerIII','1');
				  	var ContentParams = new Array("keys","values");		
					ContentParams["keys"] = Array	("deviceid","command","categorysearchvalue","rowspercolumn");
			  		ContentParams["values"] = Array	(deviceid,"wpsearchbycategory",categoryvalue,$('txtlistNumValue').value);
			  		var url_content = "wallpapers.do"+createParams(ContentParams);
			  		var params = createParams(ContentParams);
			  		$('txtContentUrl').value = url_content;
			  		var opt = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: params.substr(1), //to get rid of ?
					     onCreate:function() {
					     	$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
					    	
					    },
					     /*onCreate: function(t) {
					    	//alert('loading');
					    	//if (sync_var_content == 1)
				       			//$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    	},*/
					     // Handle successful response
					    onSuccess: function(t) {
					    	sync_var_content = 0;
					    	var resp = t.responseText; //getting the disbaled array from here
					        //alert(resp);
					        $('content').innerHTML = resp;
					        
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=categoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'content')
					}
					else 
						new Ajax.Request('wallpapers.do', opt);
			  		//ajaxpage(url_content,'content','1');
					//ajaxpage('wallpapers.do?command=wpsearchbycategory&categorysearchvalue='+categoryvalue+'&deviceid='+deviceid+'&rowspercolumn='+$('txtlistNumValue').value,'content','1');
				
					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "wpsearchbycategory";
					$('txtcategoryid').value = categoryvalue;
					isArtist = 'no';
					
				  	break;
			   case 'theme':
			  		$('clickeditemtype').value = 'theme';
			  		var offsetvalue = 0;
					if ($('genre_pageroffset')) 
						offsetvalue = $('genre_pageroffset').value;
						
			  		//getting subcategories for bucket III as wallpapers have no artists
			  		var Params = new Array("keys","values");		
					Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext");
			  		Params["values"] = Array	(deviceid,"themecategory",categoryvalue,parentcategorytext);
			  		var url_bucket_3 = "theme.do"+createParams(Params);
			  		var bucket_3_params = createParams(Params);
			  		var bucket_3 = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: bucket_3_params.substr(1), //to get rid of ?
					     onCreate: function(t) {
					    	//alert('loading');
					    	if (sync_var_bucketIII == 0)
				       			$('buckets_containerIII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	sync_var_bucketIII = 1;
					    	var resp = t.responseText; //getting the disbaled array from here
					        //alert(resp);
					        if (resp.indexOf("No Data Found") == -1)
					        	$('buckets_containerIII').innerHTML = resp;
					        else
					        	ajaxpage('theme.do?command=themebanner','buckets_containerIII','1');
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							//setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=subcategoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'buckets_containerIII')
					}
					else 
						new Ajax.Request('theme.do', bucket_3);
					
					$('txtbucketIIIUrl').value = url_bucket_3;
			  		
				  	var ContentParams = new Array("keys","values");		
					ContentParams["keys"] = Array	("deviceid","command","categorysearchvalue","rowspercolumn");
			  		ContentParams["values"] = Array	(deviceid,"themesearchbycategory",categoryvalue,$('txtlistNumValue').value);
			  		var url_content = "theme.do"+createParams(ContentParams);
			  		var params = createParams(ContentParams);
			  		$('txtContentUrl').value = url_content;
			  		var opt = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: params.substr(1), //to get rid of ?
					     onCreate: function(t) {
					    	//alert('loading');
					    	if (sync_var_content == 0)
				       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	sync_var_content = 1;
					    	var resp = t.responseText; //getting the disbaled array from here
					        //alert(resp);
					        $('content').innerHTML = resp;
					        
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=categoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'content')
					}
					else
						new Ajax.Request('theme.do', opt);
			  		//ajaxpage(url_content,'content','1');
					//ajaxpage('wallpapers.do?command=wpsearchbycategory&categorysearchvalue='+categoryvalue+'&deviceid='+deviceid+'&rowspercolumn='+$('txtlistNumValue').value,'content','1');
				
					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "themesearchbycategory";
					$('txtcategoryid').value = categoryvalue;
					isArtist = 'no';
					
				  	break;
				  	
			   case 'game':
			  		$('clickeditemtype').value = 'game';
			  		var offsetvalue = 0;
					if ($('genre_pageroffset')) 
						offsetvalue = $('genre_pageroffset').value;
						
			  		//getting subcategories for bucket III as wallpapers have no artists
			  		var Params = new Array("keys","values");		
					Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext");
			  		Params["values"] = Array	(deviceid,"gamescategory",categoryvalue,parentcategorytext);
			  		var url_bucket_3 = "games.do"+createParams(Params);
			  		var bucket_3_params = createParams(Params);
			  		var bucket_3 = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: bucket_3_params.substr(1), //to get rid of ?
					     onCreate: function(t) {
					    	//alert('loading');
					    	if (sync_var_bucketIII == 0)
				       			$('buckets_containerIII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	var resp = t.responseText; //getting the disbaled array from here
                            sync_var_bucketIII = 1;
					        if (resp.indexOf("No Data Found") == -1)
					        	$('buckets_containerIII').innerHTML = resp;
					        else
					        	ajaxpage('games.do?command=gamesbanner','buckets_containerIII','1');
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							//setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=subcategoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'buckets_containerIII')
					}
					else 
						new Ajax.Request('games.do', bucket_3);
					
					$('txtbucketIIIUrl').value = url_bucket_3;
			  		
				  	var ContentParams = new Array("keys","values");		
					ContentParams["keys"] = Array	("deviceid","command","categorysearchvalue","rowspercolumn");
			  		ContentParams["values"] = Array	(deviceid,"gamesbycategory",categoryvalue,$('txtlistNumValue').value);
			  		var url_content = "games.do"+createParams(ContentParams);
			  		$('txtContentUrl').value = url_content;
			  		
			  		var params = createParams(ContentParams);
			  		var opt = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: params.substr(1), //to get rid of ?
					    onCreate: function(t) {
					    	//alert('loading');
					    	if (sync_var_content == 0)
				       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	var resp = t.responseText; //getting the disbaled array from here
					        sync_var_content = 1;
					        $('content').innerHTML = resp;
					        
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=categoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'content')
					}
					else
						new Ajax.Request('games.do', opt);
			  		//ajaxpage(url_content,'content','1');
					//ajaxpage('wallpapers.do?command=wpsearchbycategory&categorysearchvalue='+categoryvalue+'&deviceid='+deviceid+'&rowspercolumn='+$('txtlistNumValue').value,'content','1');
				
					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "gamesbycategory";
					$('txtcategoryid').value = categoryvalue;
					isArtist = 'no';
					
				  	break;
			  case 'app':
			  		$('clickeditemtype').value = 'app';
			  		var offsetvalue = 0;
					if ($('genre_pageroffset')) 
						offsetvalue = $('genre_pageroffset').value;
						
			  		//getting subcategories for bucket III as wallpapers have no artists
			  		var Params = new Array("keys","values");	
			  		//subgenre is only required for Apps to get subgenre .. no other content type requires this	
					Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext","subgenre");
			  		Params["values"] = Array	(deviceid,"appcategory",categoryvalue,parentcategorytext,"Y");
			  		var url_bucket_3 = "applications.do"+createParams(Params);
			  		var bucket_3_params = createParams(Params);
			  		//alert(bucket_3_params);
			  		var bucket_3 = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: bucket_3_params.substr(1), //to get rid of ?
					    onCreate: function(t) {
					    	//alert('loading');
					    	if (sync_var_bucketIII == 0)
				       			$('buckets_containerIII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	var resp = t.responseText;
					        sync_var_bucketIII = 1;
					        //alert(resp);
					        if (resp.indexOf("No Data Found") == -1)
					        	$('buckets_containerIII').innerHTML = resp;
					        else
					        	ajaxpage('applications.do?command=appbanner&bucket_no=3','buckets_containerIII','1');
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							//setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=subcategoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'buckets_containerIII')
					}
					else 
						new Ajax.Request('applications.do', bucket_3);
					
					$('txtbucketIIIUrl').value = url_bucket_3;
			  		//alert(url_1);
			  		//ajaxpage(url_1,'buckets_containerIII','1'); 
				  	
				  	var ContentParams = new Array("keys","values");		
					ContentParams["keys"] = Array	("deviceid","command","categorysearchvalue","rowspercolumn");
			  		ContentParams["values"] = Array	(deviceid,"appbycategory",categoryvalue,$('txtlistNumValue').value);
			  		var url_content = "applications.do"+createParams(ContentParams);
			  		$('txtContentUrl').value = url_content;
			  		
			  		var params = createParams(ContentParams);
			  		var opt = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: params.substr(1), //to get rid of ?
					     onCreate: function(t) {
					    	//alert('loading');
					    	if (sync_var_content == 0)
				       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	var resp = t.responseText; //getting the disbaled array from here
					        sync_var_content = 1;
					        $('content').innerHTML = resp;
					        
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							setHistory();
					    }
					}
			
					if (advisoryflag == '1' && advisory_already_accepted == 'N') {
						ajaxLoader('nocontent.do?errortype=categoryadvisory&contenttype='+contenttype+'&categorysearchvalue='+categoryvalue,'content')
					}
					else
					 	new Ajax.Request('applications.do', opt);
			  		
				
					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "appbycategory";
					$('txtcategoryid').value = categoryvalue;
					
					
				  	break;
			
			  default:
			  		break;
		   
		}
		
			//if Artist is there , 3rd bucket should have artists, else it should show subcategories
			/*switch (isArtist){
			case 'yes':
				switch (el.id){
					case 'cat_nodeid1':
						ajaxLoader('WEB-INF/jsp/buckets_'+x+'_subgenre.jsp','buckets_containerII');
						break;
				}
				break;
			case 'no':
				switch (el.id){
					case 'cat_nodeid1':
						ajaxLoader('WEB-INF/jsp/buckets_'+x+'_subgenre.jsp','buckets_containerIII');
						break;
				}
				break;
		}*/
	}

}

/*** function fired only for those contenttypes which have artists in the bucket III **/
function transitIII(el,contenttype){
	c=0;
	var sync_var_content = 0;
	var sync_var_bucketII = 0;
	var sync_var_bucketIII = 0;
	
	var deviceid = $('txtdeviceid').value;
	
	if (isEmptyStr(deviceid))
		deviceid = '0';

	hlMe(el);
	document.getElementById('buckets_containerIII_value').innerHTML=el.innerHTML;
	
	var artistvalue = el.getAttribute("artistvalue");
	$('txtArtistValue').value = artistvalue;
	
	if (contenttype != null){
		switch(contenttype) {
			  case 'rt':
			  		var Params = new Array("keys","values");		
					Params["keys"] = Array	("deviceid","command","artistvalue","rowspercolumn");
			  		Params["values"] = Array	(deviceid,"rtsearchbyartist",artistvalue,$('txtlistNumValue').value);
			  		var url_1 = "ringtones.do"+createParams(Params);
			  		var params = createParams(Params);
			  		//alert(url_1);
			  		$('txtContentUrl').value = url_1;
			  		var opt = {
					    // Use POST
					    method: 'post',asynchronous:true,
					    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
					    postBody: params.substr(1), //to get rid of ?
					     onCreate: function() {
					    	//alert('loading');
					    	if (sync_var_content == 0)
				       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
				    	},
					     // Handle successful response
					    onSuccess: function(t) {
					    	sync_var_content = 1;
					    	var resp = t.responseText; //getting the disbaled array from here
					        //alert(resp);
					        $('content').innerHTML = resp;
					        
					    },
					   
					     // On Complete acts as a postfunction
					    onComplete: function(t) {
					    	$('floodlight').src = "/boost_floodlight_blank.html";
							setHistory();
					    }
					}
			
					new Ajax.Request('ringtones.do', opt);
			  		
			  		//ajaxpage(url_1,'content','1');
					$('command').value = "rtsearchbyartist";
			  		break;
			  
		}
	
	
	
		//ajaxLoader('WEB-INF/jsp/'+x+'.jsp','content');
	}
}

/*** function fired only for those contenttypes which have artists in the bucket III  as subcategories come in bucket II**/
function transitIIsub(el,x){
	c=0;
	var sync_var_content = 0;
	var sync_var_bucketII = 0;
	var sync_var_bucketIII = 0;

	hlMe(el);
    document.getElementById('buckets_containerIIsub_value').innerHTML = el.innerHTML;
	var deviceid = $('txtdeviceid').value;
	
	if (isEmptyStr(deviceid))
		deviceid = '0';
	
	switch (x){
		case 'rt':
			
			var elid = el.id;
			var categoryvalue = elid.substr(4,elid.length); //query for category search is based on nodeid and not node name
			//alert(categoryvalue);
			var subcategorytext = el.getAttribute("cattext");
			var parentcategorytext = $('subgenre_listing').getAttribute("parentcategorytext");
			var bucket_3_Params = new Array("keys","values");	
	  		//subgenre is only required for Apps to get subgenre .. no other content type requires this	
			bucket_3_Params["keys"] = Array	("deviceid","command","categorysearchvalue");
	  		bucket_3_Params["values"] = Array	(deviceid,"rtartistbycat",categoryvalue);
			
			var bucket_3_params = createParams(bucket_3_Params);
			$('txtbucketIIIUrl').value = 'ringtones.do'+bucket_3_params;
			//alert(bucket_3_params);
	  		var bucket_3 = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: bucket_3_params.substr(1), //to get rid of ?
			    onCreate: function(t) {
			    	//alert('loading');
			    	if (sync_var_bucketIII == 0)
		       			$('buckets_containerIII').innerHTML = '<div style="padding:0 0 0 8px; text-align:center !important; width:222px; height:174px;background:url(images/loading2.gif) center center no-repeat;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	var resp = t.responseText;
			        sync_var_bucketIII = 1;
			        //alert(resp);
			        if (resp.indexOf("No Data Found") == -1)
			        	$('buckets_containerIII').innerHTML = resp;
			        else
			        	ajaxpage('ringtones.do?command=rtbanner','buckets_containerIII','1');
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('floodlight').src = "/boost_floodlight_blank.html";
					//setHistory();
			    }
			}
	
			new Ajax.Request('ringtones.do', bucket_3);
			//ajaxpage('ringtones.do?command=rtartistbycat&categorysearchvalue='+categoryvalue+'&deviceid='+deviceid,'buckets_containerIII','1');	
			
			var Params = new Array("keys","values");		
			Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext","subcategorytext","rowspercolumn");
	  		Params["values"] = Array	(deviceid,"rtsearchbycategory",categoryvalue,parentcategorytext,subcategorytext,$('txtlistNumValue').value);
	  		var url_content = "ringtones.do"+createParams(Params);
	  		//alert(url_content);
	  		$('txtContentUrl').value = url_content;
	  		var params = createParams(Params);
	  		var opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: params.substr(1), //to get rid of ?
			     onCreate: function(t) {
			    	//alert('loading');
			    	if (sync_var_content == 0)
		       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	var resp = t.responseText; //getting the disbaled array from here
			        sync_var_content = 1;
			        $('content').innerHTML = resp;
			        
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('floodlight').src = "/boost_floodlight_blank.html";
					setHistory();
			    }
			}
	
			new Ajax.Request('ringtones.do', opt);
			$('txtsubcategoryid').value = categoryvalue;
				
			//Command value is always what action is performed on the results page i,e content div tag
			$('command').value = "rtsearchbycategory";
					
			break;
			
		
	}
}

/*** function fired only for those contenttypes which have subcategories in the bucket III **/
function transitIIIsub(el,x){
	c=0;
	var sync_var_content = 0;
	var sync_var_bucketII = 0;
	var sync_var_bucketIII = 0;

	hlMe(el);
	document.getElementById('buckets_containerIII_value').innerHTML = el.innerHTML;
	
	var deviceid = $('txtdeviceid').value;
	
	if (isEmptyStr(deviceid))
		deviceid = '0';
	
	var elid = el.id;
	var categoryvalue = elid.substr(4,elid.length); //query for category search is based on nodeid and not node name
	
	switch (x){
		case 'wp':
			var elid = el.id;
			var categoryvalue = elid.substr(4,elid.length); //query for category search is based on nodeid and not node name
			//alert(categoryvalue);
			var subcategorytext = el.getAttribute("cattext");
			var parentcategorytext = $('subgenre_listing').getAttribute("parentcategorytext");
			
			var Params = new Array("keys","values");		
			Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext","subcategorytext","rowspercolumn");
	  		Params["values"] = Array	(deviceid,"wpsearchbycategory",categoryvalue,parentcategorytext,subcategorytext,$('txtlistNumValue').value);
	  		var url_content = "wallpapers.do"+createParams(Params);
	  		//alert(url_content);
	  		$('txtContentUrl').value = url_content;
	  		var params = createParams(Params);
	  		var opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: params.substr(1), //to get rid of ?
			     onCreate: function(t) {
			    	//alert('loading');
			    	if (sync_var_content == 0)
		       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	var resp = t.responseText; //getting the disbaled array from here
			        sync_var_content = 1;
			        $('content').innerHTML = resp;
			        
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('floodlight').src = "/boost_floodlight_blank.html";
					setHistory();
			    }
			}
	
			new Ajax.Request('wallpapers.do', opt);
			//ajaxpage(url_content,'content','1');
			$('txtsubcategoryid').value = categoryvalue;
				
			//Command value is always what action is performed on the results page i,e content div tag
			$('command').value = "wpsearchbycategory";
					
			
			break;
			
		case 'theme':
			var elid = el.id;
			var categoryvalue = elid.substr(4,elid.length); //query for category search is based on nodeid and not node name
			//alert(categoryvalue);
			var subcategorytext = el.getAttribute("cattext");
			var parentcategorytext = $('subgenre_listing').getAttribute("parentcategorytext");
			
			var Params = new Array("keys","values");		
			Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext","subcategorytext","rowspercolumn");
	  		Params["values"] = Array	(deviceid,"themesearchbycategory",categoryvalue,parentcategorytext,subcategorytext,$('txtlistNumValue').value);
	  		var url_content = "theme.do"+createParams(Params);
	  		//alert(url_content);
	  		$('txtContentUrl').value = url_content;
	  		var params = createParams(Params);
	  		var opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: params.substr(1), //to get rid of ?
			     onCreate: function(t) {
			    	//alert('loading');
			    	if (sync_var_content == 0)
		       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	sync_var_content = 1;
			    	var resp = t.responseText; //getting the disbaled array from here
			        //alert(resp);
			        $('content').innerHTML = resp;
			        
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('floodlight').src = "/boost_floodlight_blank.html";
					setHistory();
			    }
			}
	
			new Ajax.Request('theme.do', opt);
			//ajaxpage(url_content,'content','1');
			$('txtsubcategoryid').value = categoryvalue;
				
			//Command value is always what action is performed on the results page i,e content div tag
			$('command').value = "themesearchbycategory";
					
			
			break;
			
		case 'game':
			var elid = el.id;
			var categoryvalue = elid.substr(4,elid.length); //query for category search is based on nodeid and not node name
			//alert(categoryvalue);
			var subcategorytext = el.getAttribute("cattext");
			var parentcategorytext = $('subgenre_listing').getAttribute("parentcategorytext");
			
			var Params = new Array("keys","values");		
			Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext","subcategorytext","rowspercolumn");
	  		Params["values"] = Array	(deviceid,"gamesbycategory",categoryvalue,parentcategorytext,subcategorytext,$('txtlistNumValue').value);
	  		var url_content = "games.do"+createParams(Params);
	  		//alert(url_content);
	  		$('txtContentUrl').value = url_content;
	  		var params = createParams(Params);
	  		var opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: params.substr(1), //to get rid of ?
			     onCreate: function(t) {
			    	//alert('loading');
			    	if (sync_var_content == 0)
		       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	var resp = t.responseText; //getting the disbaled array from here
			        sync_var_content = 1;
			        $('content').innerHTML = resp;
			        
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('floodlight').src = "/boost_floodlight_blank.html";
					setHistory();
			    }
			}
	
			new Ajax.Request('games.do', opt);
			//ajaxpage(url_content,'content','1');
			$('txtsubcategoryid').value = categoryvalue;
				
			//Command value is always what action is performed on the results page i,e content div tag
			$('command').value = "gamesbycategory";
					
			
			break;
			
		case 'app':
			var elid = el.id;
			var categoryvalue = elid.substr(4,elid.length); //query for category search is based on nodeid and not node name
			//alert(categoryvalue);
			var subcategorytext = el.getAttribute("cattext");
			var parentcategorytext = $('subgenre_listing').getAttribute("parentcategorytext");
			
			var Params = new Array("keys","values");		
			Params["keys"] = Array	("deviceid","command","categorysearchvalue","parentcategorytext","subcategorytext","rowspercolumn");
	  		Params["values"] = Array	(deviceid,"appbycategory",categoryvalue,parentcategorytext,subcategorytext,$('txtlistNumValue').value);
	  		var url_content = "applications.do"+createParams(Params);
	  		//alert(url_content);
	  		$('txtContentUrl').value = url_content;
			
			var params = createParams(Params);
	  		var opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: params.substr(1), //to get rid of ?
			     onCreate: function(t) {
			    	//alert('loading');
			    	if (sync_var_content == 0)
		       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	sync_var_content = 1;
			    	var resp = t.responseText; //getting the disbaled array from here
			        //alert(resp);
			        $('content').innerHTML = resp;
			        
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('floodlight').src = "/boost_floodlight_blank.html";
					setHistory();
			    }
			}
	
			new Ajax.Request('applications.do', opt);
			$('txtsubcategoryid').value = categoryvalue;
			//ajaxpage(url_content,'content','1');
				
			//Command value is always what action is performed on the results page i,e content div tag
			$('command').value = "appbycategory";
					
			
			break;
	}
}

/****************************************************************************
		Getting promotions for the web

*******************************************************************************/
function transitPromo(promotionId,itemtype){
	document.getElementById('buckets').className = 'buckets_home_short search';

	for( var i = 0; document.getElementById('bucketI_Type').childNodes[i]; i++ ){
		document.getElementById('bucketI_Type').childNodes[i].className = '';
	}

	for( var i = 0; document.getElementById('bucketII_Type').childNodes[i]; i++ ){
		document.getElementById('bucketII_Type').childNodes[i].className = '';
	}

	for( var i = 0; document.getElementById('bucketIII_Type').childNodes[i]; i++ ){
		document.getElementById('bucketIII_Type').childNodes[i].className = '';
	}

	document.getElementById('buckets_containerI_value').innerHTML = '';

	//ajaxLoader('WEB-INF/jsp/promotion'+id+'.jsp','content');
	
	var deviceid = $('txtdeviceid').value;
	//alert(deviceid);
	//alert(promotionId);
	
	if (isEmptyStr(deviceid))
		deviceid = '0';
		
	if (isEmptyStr(itemtype) || itemtype == 'undefined')
		itemtype = "";
		
	//alert(itemtype);
	
	var Params = new Array("keys","values");		
			Params["keys"] = Array	("deviceid","command","promotionId","itemtype");
	  		Params["values"] = Array	(deviceid,"getPromotionDetails",promotionId,itemtype);
	  		var url_content = "promotions.do"+createParams(Params);
	  		//alert(url_content);
	  		$('txtContentUrl').value = url_content;
	  		var params = createParams(Params);
	  		//alert(params);
	  		var opt = {
			    // Use POST
			    method: 'post',asynchronous:true,
			    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
			    postBody: params.substr(1), //to get rid of ?
			     onCreate: function(t) {
			    	//alert('loading');
			    
		       			$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
		    	},
			     // Handle successful response
			    onSuccess: function(t) {
			    	var resp = t.responseText; //getting the disbaled array from here
			        $('content').innerHTML = resp;
			        
			    },
			   
			     // On Complete acts as a postfunction
			    onComplete: function(t) {
			    	$('floodlight').src = "/boost_floodlight_blank.html";
					setHistory();
			    }
			}
	
			new Ajax.Request('promotions.do', opt);
}

/*******************************************************

	For Getting item details
	BundleId is not used for the time being, so pass that as an empty parameter

***********************************/
function getItemDetails(contenttype,itemId,where,bundleId,advisoryflag) {

	//alert('in getItemDetails');
	
	var sync_var_content = 0;
	var sync_var_bucketII = 0;
	var sync_var_bucketIII = 0;
	
	var deviceid = $('txtdeviceid').value;
	if (isEmptyStr(deviceid))
		deviceid = '0';
	//alert("after device"+deviceid);
	
	//If Y then already accepted and do no present the Advisory warning .. default value is N
	var advisory_already_accepted = $('txtAcceptContentAdvisory').value;
	
	
	$('txtDetailsItemid').value = itemId;
	$('clickeditemtype').value = contenttype;
	var previtemdesc = '';
	previtemdesc = $('txtDetailsItemDesc').value; //If no items found , then used to diplay the item name in error msg
	
	var url_content = "";
	var url_base = "";
	var url_params = "";
	
	var ContentParams = new Array("keys","values");		
	ContentParams["keys"] = Array	("deviceid","command","itemId","previtemdesc","bundleId");
	
	switch(contenttype) {
			  case 'rt':
			  		$('clickeditemtype').value = 'rt';
			  		//$('command').value = "rtartistbycat";
			  		
			  		ContentParams["values"] = Array	(deviceid,"rtdetails",itemId,previtemdesc,bundleId);
			  		url_content = "ringtones.do"+createParams(ContentParams);
			  		url_base = "ringtones.do";
			  		url_params = createParams(ContentParams);
			  		
			  		//alert(params);
			  		
				  	//ajaxpage('ringtones.do?command=rtdetails&itemId='+itemId,'content','1');				  	
				
					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "rtdetails";
					
					
					
				  	break;
			  case 'wp':
			  		$('clickeditemtype').value = 'wp';
			  		ContentParams["values"] = Array	(deviceid,"wpdetails",itemId,previtemdesc,bundleId);
			  		
			  		url_content = "wallpapers.do"+createParams(ContentParams);
			  		url_base = "wallpapers.do";
			  		url_params = createParams(ContentParams);
			  		
				  	//ajaxpage('wallpapers.do?command=wpdetails&itemId='+itemId,'content','1');				  	
				
					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "wpdetails";
					
					
			  		break;
			  case 'game':
			  		$('clickeditemtype').value = 'game';
			  		
			  		ContentParams["values"] = Array	(deviceid,"gamesdetails",itemId,previtemdesc,bundleId);
			  		
			  		url_content = "games.do"+createParams(ContentParams);
			  		url_base = "games.do";
			  		url_params = createParams(ContentParams);
			  		
			  		
					$('command').value = "gamesdetails";
					
					
			  		break;
			  case 'theme':
			  		$('clickeditemtype').value = 'theme';
			  		
			  		ContentParams["values"] = Array	(deviceid,"themedetails",itemId,previtemdesc,bundleId);
			  		
			  		url_content = "theme.do"+createParams(ContentParams);
			  		url_base = "theme.do";
			  		url_params = createParams(ContentParams);

					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "themedetails";
			  		break;
			  case 'app':
			  		$('clickeditemtype').value = 'app';
			  		
			  		ContentParams["values"] = Array	(deviceid,"appdetails",itemId,previtemdesc,bundleId);
			  		
			  		url_content = "applications.do"+createParams(ContentParams);
			  		url_base = "applications.do";
			  		url_params = createParams(ContentParams);

					//Command value is always what action is performed on the results page i,e content div tag
					$('command').value = "appdetails";
					
					
			  		break;
			  default:
			  		break;
		   
		}
		
		$('txtContentUrl').value=url_content;
		
		var opt = {
		    // Use POST
		    method: 'post',asynchronous:true,
		    //postBody: 'thisvar=true&thatvar=Howdy&theothervar=2112',
		    postBody: url_params.substr(1), //to get rid of ?
		     // Handle successful response
		    onCreate: function(t) {
		    	//alert('loading');
		    	if (sync_var_content == 0)
       				$('content').innerHTML = '<div style="vertical-align:middle; text-align:center; background: url(images/loading.gif) center center no-repeat; padding:150px 0;"></div>';
      			},
		    onSuccess: function(t) {
		    	sync_var_content = 1;
		    	var resp = t.responseText; //getting the disbaled array from here
		        //alert(resp);
		        //if (resp.indexOf("is not supported for this device") == -1)
		        	$('content').innerHTML = resp;

		    },
		   
		     // On Complete acts as a postfunction
		    onComplete: function(t) {
		    	
		    	$('floodlight').src = "/boost_floodlight_blank.html";
		    	if ($('detail_phone_number')) {
		    		$('txtDetailsItemDesc').value = $('detail_phone_number').getAttribute("itemdesc");
		    		
		    	}
		    	
		    	var catttext = "";
		    	if (contenttype == 'app') {
					for (i=1;i<=4;i++) {
						if ($('app'+i+'Btn')) {
							if ( $('app'+i+'Btn').className == "hl") {
								catttext = $('app'+i+'Btn').getAttribute("cattext");
								s.prop21 = 'Applications Product Detail > '+catttext+' >';
								break;
							}
						}
					}
				}
				//alert(s.prop21);
		    	
		    	//Call Omniture variables setting function
				setHistory();
				
				var itemDesc = "";
				if ($('detail_phone_number')) {
					itemDesc = $('detail_phone_number').getAttribute('itemdesc');
					//alert(itemDesc);
				}
				//alert(contenttype);
				switch(contenttype) {
					  case 'rt':
					  		
							
							//Omniture variables
							s.pageName = "Ringtones Product Detail";
							s.channel = "Shop";
							s.prop2 = "Customize Your Phone";
							s.prop21 = 'Ringtones Product Detail >';
							s.products = ';ring';
							
						  	break;
					  case 'wp':
					  		
							
							//Omniture variables
							s.pageName = "Wallpaper Product Detail";
							s.channel = "Shop";
							s.prop2 = "Customize Your Phone";
							s.prop21 = 'Wallpaper Product Detail >';
							s.products = ';wall';
					  		break;
					  case 'game':
					  		
							
							//Omniture variables
							s.pageName = "Games Product Detail";
							s.channel = "Shop";
							s.prop2 = "Get Entertainment";
							s.prop21 = 'Games Product Detail >';
							s.products = ';games';
					  		break;
					  
					  case 'app':
					  		
							
							//Omniture variables
							s.pageName = "Applications Product Detail";
							s.channel = "Shop";
							s.prop2 = "Add Applications";
							s.prop21 = 'Applications Product Detail >';
							s.products = ';app';
					  		break;
					  default:
					  		break;
				   
				}
				set_omniture_variables_itemdetails(itemId,itemDesc);
		    }
		}
		
		if (advisoryflag == '1' && advisory_already_accepted == 'N') {
			ajaxLoader('nocontent.do?errortype=itemadvisory&contenttype='+contenttype+'&itemId='+itemId,'content')
		}
		else 
			new Ajax.Request(url_base, opt);
		
		//if coming from jumpURL this line was having error .. where  parameter is jumpURL in the boostdefault.jsp when called from
		//jump URL's to come directly to item details
		if (where != 'jumpURL')
			hidePreview(contenttype);
			
		if (where == 'home'){
			document.getElementById('buckets').className = 'buckets_home_short search';
		}
		else {
			roll('up');
		}
		

}

function roll(x){
	var buckets = document.getElementById('buckets');
	var buckets_containerI = document.getElementById('buckets_containerI');
	var buckets_containerII = document.getElementById('buckets_containerII');
	var buckets_containerIII = document.getElementById('buckets_containerIII');

	if (x == 'up'){
		if ((document.getElementById('buckets_containerI_value').innerHTML == '&nbsp;')||(document.getElementById('buckets_containerI_value').innerHTML == '')){
			if (buckets.className == 'buckets_home'){
				buckets.className = 'buckets_home_short';
			}
		}
		else {
			if (document.getElementById('buckets_containerII_value')){
				if (document.getElementById('buckets_containerII_value').innerHTML == '')
					buckets_containerII.style.display = 'none';
			}

			if (buckets.className != 'buckets_short'){
				buckets.className = 'buckets_short';
				
				buckets_containerI.className=document.getElementById('buckets_containerII').className;

				if (document.getElementById('banner_container') != undefined){
					document.getElementById('banner_container').className = '';
				}
				//if ((document.getElementById('buckets_containerII_value') == undefined)&&(document.getElementById('buckets_containerIIsub_value') == undefined)){
				if ((!document.getElementById('buckets_containerII_value'))&&(!document.getElementById('buckets_containerIIsub_value'))){
					buckets_containerII.style.diaplay = 'none';
				}
				else if ((document.getElementById('buckets_containerII_value').innerHTML == '')&&(document.getElementById('buckets_containerIIsub_value').innerHTML == '')){
					buckets_containerII.style.display = 'none';
				}
				
				if (document.getElementById('buckets_containerIII_value') == undefined){
					buckets_containerIII.style.diaplay = 'none';
				}
				else if (document.getElementById('buckets_containerIII_value').innerHTML == ''){
					buckets_containerIII.style.display = 'none';
				}

				if (document.getElementById('buckets_containerIIsub_value') != undefined){
					if (document.getElementById('buckets_containerIIsub_value').innerHTML != ''){
						document.getElementById('mainGenre').className = 'hide';
						document.getElementById('subGenre').className = 'container collapsed';
					}
				}

				
				
			}
		}
	}
	else if (x == 'down'){
		c=0;
		if (buckets.className == 'buckets_home_short'){
			buckets.className = 'buckets_home';
		}
		else if (buckets.className == 'buckets_short'){
			buckets.className = 'buckets_collapsed';
			buckets_containerII.style.display = 'block';
			buckets_containerIII.style.display = 'block';
			
			if (document.getElementById('banner_container') != undefined){
				document.getElementById('banner_container').className = 'hide';
			}

			if (document.getElementById('buckets_containerIIsub_value') != undefined){
				if (document.getElementById('buckets_containerIIsub_value').innerHTML != ''){
					document.getElementById('mainGenre').className = 'container collapsed';
					document.getElementById('subGenre').className = 'container subgenre';
				}
			}

			
		}
	}
}

function timedCount(){
	c=c+1;
	t=setTimeout("timedCount()",1000);
	r=setTimeout("checkTime()",1000);
}

function checkTime(){
	
	//Denotes the time interval in seconds change it to increase
	if (c==60){
		roll('up');
	}	
}

function updatePreviewImg(el,imgSrc){
	document.getElementById('preview_img').src = imgSrc;
	hlMe(el);
}

function setListNum(){
	var sHeight = screen.height;
	
	var listNum = '';
	if (sHeight <= 768) {
		listNum = 3;
	} else if (sHeight <= 864) {
		listNum = 5;
	} else if (sHeight <= 960) {
		listNum = 7;
	} else if (sHeight <= 1024) {
		listNum = 9;
	} else {
		listNum = 11;
	}
	
	if (isEmptyStr(listNum))
		listNum = 5;
	//return listNum;
	//document.getElementById('listNumValue').value = listNum;
	$('txtlistNumValue').value = listNum;
}

/***********************************/
/* Begin script for preview images */

//	document.write('<div id="PreviewLayer" style="display:none;left:0px;top:0px;"></div>');

	var offsetfrommouse=[15,-120]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
	var displayduration=0; //duration in seconds image should remain visible. 0 for always.
	var currentimageheight = 38;	// maximum image size.
	
	function getPreviewObj(){
		if (document.getElementById)
			return document.getElementById("PreviewLayer").style
		else if (document.all)
			return document.all.PreviewLayer.style
	}
	
	function getPreviewObjnostyle(){
		if (document.getElementById)
			return document.getElementById("PreviewLayer")
		else if (document.all)
			return document.all.PreviewLayer
	}


	function truebody(){
		return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}


	function displayPreview(obj,x,url,price,where){
		if (where == 'home'){
			offsetfrommouse=[75,-120];
		}
		else{
			offsetfrommouse=[15,-120];
		}

		switch (x){
			case 'rt':
			case 'ct':
			case 'music':
				
				startPlayback(url,'lists','111');
				getPreviewObjnostyle().innerHTML = '<div id="PreviewLayer_innercontainer"><img src="images/btn_load.gif" id="btn_stop_lists01" name="btn_stop_lists111" class="playBtn"/><div class="price">Price '+price+'</div></div>';
				break;
			case 'advisory':
				getPreviewObjnostyle().innerHTML = '<div id="PreviewLayer_innercontainer"><p class="msg">Content Advisory! Click on the title to see details.</p></div>';
				break;
				
			default:
				getPreviewObjnostyle().innerHTML = '<div id="PreviewLayer_innercontainer"><div id="preview_img_container"><div id="preview_img_innercontainer"><img src="' + url + '" class="preview_img"/></div></div><div class="price">Price '+price+'</div></div>';
				break;
		}
		
		getPreviewObj().display="block";
	}
	
	
	function hidePreview(x){
		switch (x){
			case 'rt':
			case 'ct':
			case 'music':
				getPreviewObj().display="none";
				document.Player.controls.stop();
				break;
			default:
				getPreviewObj().display="none";
				break;
		}
		offsetfrommouse=[15,-120];
	}

	function followmouse(e){
	
		var xcoord=offsetfrommouse[0]
		var ycoord=offsetfrommouse[1]
	
		var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
		var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)
	
		if (typeof e != "undefined"){ //for Firefox
			xcoord += e.pageX;
			if (docheight - e.pageY < (currentimageheight + 0)){
				ycoord += e.pageY - Math.max(0,(0 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
			} else {
				ycoord += e.pageY;
			}
	
		} else if (typeof window.event != "undefined"){ //for IE
			xcoord += truebody().scrollLeft+event.clientX
			if (docheight - event.clientY < (currentimageheight + 0)){
				ycoord += event.clientY + truebody().scrollTop - Math.max(0,(0 + currentimageheight + event.clientY - docheight));
			} else {
				ycoord += truebody().scrollTop + event.clientY;
			}
		}
	
		if(ycoord < 0) { ycoord = ycoord*-1; }
		getPreviewObj().left=xcoord+"px"
		getPreviewObj().top=ycoord+"px"
	
	}
	
	//document.onmousemove=followmouse;

/* End script for preview images    */
/************************************/

/*********************************/
/* Play Audio                    */

	var player;
	var plugin;
	var playCode;
	var prefImage;
	var etatPlayer = 0;
	var stopImage;
	var playImage;
	try {
	    if(window.ActiveXObject) {
	        player = new ActiveXObject("WMPlayer.OCX.7");
	    }
	     else if (window.GeckoActiveXObject) {
	         player = new GeckoActiveXObject("WMPlayer.OCX.7");
	    }
		//alert(8);
	} catch(oError) { }

	ver=parseInt(navigator.appVersion)
	ie4=(ver>3  && navigator.appName!="Netscape")?1:0
	ns4=(ver>3  && navigator.appName=="Netscape")?1:0
	ns3=(ver==3 && navigator.appName=="Netscape")?1:0

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) 
	x=d.getElementById(n);

  //alert(x.name); 
  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];
		//alert(x.src);
	}
   //alert(6);
}

//Media player currently used
//ext is a parameter to make it unique , like poly , topten, new etc
//id is the id of the item
function startPlayback(url,ext,id,stopimage,playimage){
	
	checkforFireFoxPlugin();
	if (stopimage!=null) document.stopImage = stopimage;
	if (playimage!=null) document.playImage = playimage;
    if (player && (window.ActiveXObject || window.GeckoActiveXObject)) {
    	
        document.etatPlayer = 3;        		
		document.Player.URL = url;
		document.playCode = id;
        document.playExt = ext;
		document.Player.controls.play();
    }  
}

function checkforFireFoxPlugin() {
	//ver=parseInt(navigator.appVersion);
	//alert(ver);
	//alert(navigator.appCodeName);
	//alert(navigator.userAgent);
	var hasActiveX=false; 
	try{ 
		if(window.ActiveXObject) {
		 hasActiveX = true; 
		 player = new ActiveXObject("WMPlayer.OCX.7");
		}
		else 
		if (window.GeckoActiveXObject) {
			hasActiveX = true; 
			player = new GeckoActiveXObject("WMPlayer.OCX.7"); 
		} 
	} catch(oError) { } 
	try{ 
		if(navigator.mimeTypes) { 
		 plugin = navigator.mimeTypes['application/x-mplayer2'].enabledPlugin; 
		} 
	}catch (oError) {} 
	
	
	var message = "Your browser "+ (hasActiveX ? "does" : " does not") +" support ActiveX. \n";
	message += "The WMP ActiveX control is"+ ( player ? "" : " not") +" installed. \n";
	message += "The WMP Plugin "+ (plugin ? "is" : "is not") +" installed. \n"; 
	
	if (hasActiveX && player)
		return;
		
	if(navigator.userAgent.indexOf("Firefox")!=-1){
	    var useragent = navigator.userAgent;
		var versionindex=navigator.userAgent.indexOf("Firefox")+8;
		var versionstr = useragent.substr(versionindex,3);
		var agree = confirm("You are using Mozilla.Do you want to be redirected to the site for downloading the plugin for ActiveX for Mozilla for the RingTone to play?");
		if (agree) {
			top.location.href = "http://www.iol.ie/~locka/mozilla/plugin.htm#download";
			return;
		} else {
			hidePreview();
		}
	}
}

function installAxFF15() { 
	xpi={'Mozilla Firefox 1.5 ActiveX Plug-in':'mozactivex-ff-15.xpi'}; 
	InstallTrigger.install(xpi); 
} 

/* End Play Audio                */
/*********************************/




function setDivID(div_id_name) {
	$(txtdivid).value = $(div_id_name).id;
}

/*********************************/
/* Remove IE flashing            */
try {

 document.execCommand("BackgroundImageCache", false, true);

} catch(err) {}
/* End Remove IE flashing            */
/*********************************/


