var myfeeddata="";
var myTabArray1=new Array();
function str_replace(search, replace, subject) {
    var f = search, r = replace, s = subject;
    var ra = r instanceof Array, sa = s instanceof Array, f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
        }
    };
    return sa ? s : s[0];
}
myTabArray1 = {"inpics.php" : "Top News","slideshow.php" : "Photo Galleries","ibnlive.php" : "IBNLive","1101" : "Buzz18","361":"Tech2","51" : "CricketNext","5434" : "Moneycontrol","5555" : "Times_of_India","5645" : "Rediff","5711":"Hindustan_Times","5683" : "Ibnlive","5713" : "NY_Times","1101" : "Buzz18","5714" : "BollywoodHu..","1781" : "People","5715" : "SantaBanta","5716" : "Bollywoodsa..","361" : "Tech2","5451" : "Engadget","5718" : "Gamespot","4021" : "Cnet","3841" : "Techmeme","51" : "Cricketnext","1891" : "Cricinfo","5719" : "Cric_Nirvana","1431" : "Sky","5721" : "Fox_Sport","5434" : "Moneycontrol","1161" : "Economic_Times","2421" : "Forbes","5426" : "Financial_times","5723" : "Navbharat_times","5725" : "Askmen.com","5726" : "Indiwo","5727" : "Asylum","5729" : "PopSugar","971" : "Ayushveda"};
var myTabArray=new Array();
myTabArray = {"5555" : "Times_of_India","5645" : "Rediff","5711":"Hindustan_Times","5683" : "Ibnlive","5713" : "NY_Times","1101" : "Buzz18","5714" : "BollywoodHu..","1781" : "People","5715" : "SantaBanta","5716" : "Bollywoodsa..","361" : "Tech2","5451" : "Engadget","5718" : "Gamespot","4021" : "Cnet","3841" : "Techmeme","51" : "Cricketnext","1891" : "Cricinfo","5719" : "Cric_Nirvana","1431" : "Sky","5721" : "Fox_Sport","5434" : "Moneycontrol","1161" : "Economic_Times","2421" : "Forbes","5426" : "Financial_times","5723" : "Navbharat_times","5725" : "Askmen.com","5726" : "Indiwo","5727" : "Asylum","5729" : "PopSugar","971" : "Ayushveda"};

function getmovie(loc) {
	if(loc.value == "") {
		loc.value = "0";
		return;
	}
	$("#mov").html("<option value='0'>Loading...</option>");
	$("#date").html("<option value='0'>Select date</option>");	
	var type = '';
	if(document.getElementById('movie').checked)
		type = "1";
	else if(document.getElementById('cinema').checked)
		type = "2";
	$.post("/active18/newhome/getdata.php", { loc:loc.value, type:type }, 
		function(data) {

			$("#mov").html(data);
			
		});
	
}
	
function getdate(mov) {
	if(mov.value == "") {
		mov.value = "0";
		return;
	}
	var type = '';
	$("#date").html("<option value='0' class='oIBS'>Loading...</option>");
	if(document.getElementById('movie').checked)
		type = "1";
	else if(document.getElementById('cinema').checked)
		type = "2";

	var cineloc = document.getElementById('loc').value;

	$.post("/active18/newhome/getdata.php", { mov:mov.value, type:type, cineloc:cineloc }, 
		function(data) {
			var moviedata = "<option value='0' class='oIBS'>Select date</option>"; 
			if(data != "") {
				var currdate = new Date();
				var today = getcurrday(currdate.getDay());
				var tomorrow = getcurrday(currdate.getDay()+1);
				data = data.replace(today, "Today");
				data = data.replace(tomorrow, "Tomorrow");
				$("#date").html(data);
			}
		});
}
	
function getcurrday(day) {
	
	if(day == 7) day = 0;
	var weekday=new Array(7);
	weekday[0]="Sunday";
	weekday[1]="Monday";
	weekday[2]="Tuesday";
	weekday[3]="Wednesday";
	weekday[4]="Thursday";
	weekday[5]="Friday";
	weekday[6]="Saturday";
	
	return weekday[day];
}
function clearall(type) {
	document.getElementById('loc').value = "0";
	$("#date").html("<option value='0'>Select date</option>");
	if(type == "1") {
		$("#mov").html("<option value='0'>Select movie</option>");
		document.getElementById("bmsmovie").style.display = "";
		document.getElementById("bmscinema").style.display = "none";
	} else {
		$("#mov").html("<option value='0'>Select cinema</option>");
		document.getElementById("bmsmovie").style.display = "none";
		document.getElementById("bmscinema").style.display = "";			
	}
}
function getwindow() {

	var srid = document.getElementById("loc").value;
	var did = document.getElementById("date").value;

	if(document.getElementById("movie").checked && srid!="0" && did!="0") {
	
		var eid = document.getElementById("mov").value;
		window.open("http://www.bookmyshow.com/go.aspx?ref=IN&type=1&srid="+srid+"&eid="+eid+"&did="+did)
		
	} else if(document.getElementById("cinema").checked && srid!="0" && did!="0") {
	
		var cid = document.getElementById("mov").value;
		window.open("http://www.bookmyshow.com/go.aspx?ref=IN&type=1&cid="+cid+"&did="+did);
		
	} else {
		
		alert("All the fields are compulsory");
			
	}
}
stepcarousel.setup({
	galleryid: 'scroll1', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	panelbehavior: {speed:500, wraparound:true, persist:false},
	defaultbuttons: {enable: false, moveby: 1},
	statusvars: ['statusA1', 'statusB1', 'statusC1'], //register 3 variables that contain current panel (start), current panel (last), and total panels
	contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})
stepcarousel.setup({
	galleryid: 'scroll2', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	panelbehavior: {speed:500, wraparound:true, persist:false},
	defaultbuttons: {enable: false, moveby: 1},
	statusvars: ['statusA2', 'statusB2', 'statusC2'], //register 3 variables that contain current panel (start), current panel (last), and total panels
	contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})
stepcarousel.setup({
	galleryid: 'scroll3', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	autostep: {enable:true, moveby:1, pause:3000},
	panelbehavior: {speed:500, wraparound:false, persist:true},
	defaultbuttons: {enable: false, moveby: 1},
	statusvars: ['statusA3', 'statusB3', 'statusC3'], //register 3 variables that contain current panel (start), current panel (last), and total panels
	contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})
var listenright=0;
var watchright=0;
var listenleft=1;
var watchleft=1;
$(document).ready(function(){
	$("#right11").click(function(){
	  if(listenright==0){
	  	return;
	  }else{
		  listenleft=1;
		  listenright=0;
		  var leftVal = $(".r_block1").css("left");
		  $(".r_block1").animate({"left": "+=315px"}, "slow");
	  }
	});
	$("#right12").click(function(){
	if(listenright==0){
		return;
	}else{
		listenleft=1;
		listenright=0;
		var leftVal = $(".r_block1").css("left");
		$(".r_block1").animate({"left": "+=315px"}, "slow");
	}
	});
	for(var i=1;i<=3;i++){
		for(var j=1;j<=5;j++){
			$("#left1"+i+""+j).click(function(){
				if(listenleft==0){
					return;
				}else{
					listenright=1;
					listenleft=0;
					var leftVal = $(".r_block1").css("left");
					$(".r_block1").animate({"left": "-=315px"}, "slow");
				}
			});
		}
	}
});
$(document).ready(function(){
	$("#right21").click(function(){
	if(watchright==0){
		return;
	}else{
		watchleft=1;
		watchright=0;
		var leftVal = $(".r_block2").css("left");
		$(".r_block2").animate({"left": "+=315px"}, "slow");
	}
	});
	$("#right22").click(function(){
		if(watchright==0){
			return;
		}else{
			watchleft=1;
			watchright=0;
			var leftVal = $(".r_block2").css("left");
			$(".r_block2").animate({"left": "+=315px"}, "slow");
		}
	});
	for(var i=1;i<=2;i++){
		for(var j=1;j<=5;j++){
			$("#left2"+i+""+j).click(function(){
				if(watchleft==0){
					return;
				}else{
					watchright=1;
					watchleft=0;
					var leftVal = $(".r_block2").css("left");
					$(".r_block2").animate({"left": "-=315px"}, "slow");
				}
			});
		}
	}
});
function pause(millisecondi){
	var now = new Date();
	var exitTime = now.getTime() + millisecondi;
	while(true){
		now = new Date();
		if(now.getTime() > exitTime) return;
	}
}

function populatewatchdata(urlid){
	$.get('/active18/newhome/watchhtml/watchscrolldata'+urlid+'.html',{},function(data){
		var tempdata=data.split('###&&&###');
		$("#videotitle").html("<b>"+tempdata[0]+"</b>");	
		$("#embedcode").html(tempdata[1]);
	});
}
function populatelistendata(urlid){
	$.get('/active18/newhome/albumhtml/listenscrolldata'+urlid+'.html',{},function(data){
		var tempdata=data.split('###&&&###');
		$("#listenalbumimage").html(tempdata[0]);	
		$("#listenalbumtitle").html(tempdata[1]);
		$("#listentrack").html(tempdata[2]);

	});
}
function clearlistendata(){
	$("#listenalbumimage").html('');	
	$("#listenalbumtitle").html('');	
	$("#listentrack").html('');
}
function clearwatchdata(){
	$("#videotitle").html('');	
	$("#embedcode").html('');
}
function displaytopwallaper(pg){
	var total=3;
	for(var i=1;i<=total;i++){
		if(i==pg){
			document.getElementById("plane9"+pg).style.display = "block";
			document.getElementById("scrollplane9"+pg).style.display = "block";
			if($("#plane9"+pg).html()== '' || $("#plane9"+pg).html()==null){
				$.get('/active18/newhome/wallpaperscroll.html','',function(data){
					var tempdata=data.split('###&&&###');
					$("#plane92").html(tempdata[0]);	
					$("#plane93").html(tempdata[1]);
				});
			}
		}else{
			document.getElementById("plane9"+i).style.display = "none";
			document.getElementById("scrollplane9"+i).style.display = "none";
		}
	}
}
function displaytopnews(pg){
	document.getElementById("currentnews").value=pg;
}
function displaytopplay(pg){
	var total=3;
	for(var i=1;i<=total;i++){
		if(i==pg){
			document.getElementById("plane2"+pg).style.display = "block";
			document.getElementById("scrollplane2"+pg).style.display = "block";
			if($("#plane2"+pg).html()== '' || $("#plane2"+pg).html()==null){
				$.get('/active18/newhome/playscroll.html','',function(data){
					var tempdata=data.split('###&&&###');
					$("#plane22").html(tempdata[0]);	
					$("#plane23").html(tempdata[1]);
				});
			}
		}else{
			if($("#plane2"+i).html()!= '' && $("#plane2"+i).html()!=null){
				document.getElementById("plane2"+i).style.display = "none";
				document.getElementById("scrollplane2"+i).style.display = "none";
			}
		}
	}
}
var watchdatatocome=0;
function displaytopwatch(pg){
	$("#videotitle").html('');	
	$("#embedcode").html('');
	var total=2;
	for(var i=1;i<=total;i++){
		if(i==pg){
			document.getElementById("plane4"+pg).style.display = "block";
			document.getElementById("scrollplane4"+pg).style.display = "block";
			if(watchdatatocome==0){
				watchdatatocome=1;
				$.get('/active18/newhome/watchhtml/watchscrollinnerdata.html','',function(data){
					var tempdata=data.split('###&&&###');
					for(var j=0;j<tempdata.length;j++){
						var temmpinnerdata=tempdata[j].split("&&&$$$&&&");
						$("#watchimageid"+temmpinnerdata[0]).html(temmpinnerdata[1]);
					}
				});
			}
		}else{
			document.getElementById("plane4"+i).style.display = "none";
			document.getElementById("scrollplane4"+i).style.display = "none";
		}
	}
}
var listeninnerdata=0;
function displaytopalbum(pg){
	$("#listenalbumimage").html('');
	$("#listenalbumtitle").html('');	
	$("#listentrack").html('');
	var total=3;
	for(var i=1;i<=total;i++){
		if(i==pg){
			document.getElementById("plane1"+pg).style.display = "block";
			document.getElementById("scrollplane1"+pg).style.display = "block";
			if(listeninnerdata==0){
				listeninnerdata=1;
				$.get('/active18/newhome/albumhtml/listenscrollinnerdata.html','',function(data){
					var tempdata=data.split('###&&&###');
					for(var j=0;j<tempdata.length;j++){
						var temmpinnerdata=tempdata[j].split("&&&$$$&&&");
						$("#listenimageid"+temmpinnerdata[0]).html(temmpinnerdata[1]);
					}
				});
			}
		}else{
			document.getElementById("plane1"+i).style.display = "none";
			document.getElementById("scrollplane1"+i).style.display = "none";
		}
	}
}
function displaytopshop(pg, total_div){
	var total=parseInt(total_div);
	for(var i=1;i<=total;i++){
		if(i==pg){
			document.getElementById("plane5"+pg).style.display = "block";
			document.getElementById("scrollplane5"+pg).style.display = "block";
			if($("#plane5"+pg).html()== '' || $("#plane5"+pg).html()==null){
				$.get('/active18/newhome/shopscroll.html','',function(data){
					var k=0;
					var tempdata=data.split('###&&&###');
					for(var j=0;j<tempdata.length;j++){
						k=j+2;
						$("#plane5"+k).html(tempdata[j]);	
					}
				});
			}
		}else{
			document.getElementById("plane5"+i).style.display = "none";
			document.getElementById("scrollplane5"+i).style.display = "none";
		}
	}
}
function displaytopdownload(pg){
	var total=3;
	for(var i=1;i<=total;i++){
		if(i==pg){
			document.getElementById("plane6"+pg).style.display = "block";
			document.getElementById("scrollplane6"+pg).style.display = "block";
			if($("#plane6"+pg).html()== '' || $("#plane6"+pg).html()==null){
				$.get('/active18/newhome/downloadscroll.html','',function(data){
					var tempdata=data.split('###&&&###');
					$("#plane62").html(tempdata[0]);	
					$("#plane63").html(tempdata[1]);
				});
			}
		}else{
			document.getElementById("plane6"+i).style.display = "none";
			document.getElementById("scrollplane6"+i).style.display = "none";
		}
	}
}
function htab_ournetwork(a,b,c,d,e){
	document.getElementById('addstuff').style.display='none';
	var currenttab=parseInt(document.getElementById("currenttab").value);
	if(a==-1){
		a=currenttab+1;
		if(a>5){
			return;
		}
	}else if(a==0){
		a=currenttab-1;
		if(a<1){
			return;
		}
	}
	document.getElementById("currenttab").value=a;
	for(var i=1; i<=b; i++){
		if(i == a){
			document.getElementById(c+a).className = "htabact";
			document.getElementById(d+a).style.display = "block";
			if(($('#'+d+a).html()=='') || ($('#'+d+a).html()==null)){
				switch(a){
					case 1:
						targeturl="/active18/newhome/addstuff/inpics.html";
						break; 
					case 2:
						targeturl="/active18/newhome/addstuff/slideshow.html";
						break;
					case 3:
						targeturl="/active18/newhome/addstuff/ibnlive.html";
						break;    
					/*case 3:
						targeturl="/active18/newhome/addstuff/buzz18.html";
						break;
					case 4:
						targeturl="/active18/newhome/addstuff/tech2.html";
						break;    
					case 5:
						targeturl="/active18/newhome/addstuff/cricket.html";
						break;
					case 6:
						targeturl="/active18/newhome/addstuff/moneycontrol.html";
						break;*/
					default :
						targeturl="/active18/newhome/addstuff/"+e+".html";
						break;
				}
				var search_data=myTabArray1[e];
				$.get(targeturl,'',
					function(data){
					document.getElementById(d+a).innerHTML=data;
					$.post("/active18/newhome/tablog.php",{search_data:search_data},function(data){});
				});
			}
		}else{
			if($('#'+c+i).html()!=null){
			document.getElementById(c+i).className = "htabnact";
			}
			if($('#'+d+i).html()!=null){
			document.getElementById(d+i).style.display = "none"
			}
		}
	}
}
function displayeventnews(pg){
	var currenteventnews=parseInt(document.getElementById("currenteventnews").value);
	if(pg==-1){
		pg=currenteventnews+1;
		if(pg>7){
			return;
		}
	}else if(pg==0){
		pg=currenteventnews-1;
		if(pg<1){
			return;
		}
	}
				if(pg==1){				
				$("#eventtitle").html('Mumbai');
				$("#eventtitle1").html('Mumbai');
				$("#eventurl").html('<a href=http://mumbai.burrp.com/ class=bl_10 target=_blank><b>More in Events &raquo;</b></a>');
				}
				if(pg==8){				
				$("#eventtitle").html('Pune');
				$("#eventtitle1").html('Pune');
				$("#eventurl").html('<a href=http://pune.burrp.com/ class=bl_10 target=_blank><b>More in Events &raquo;</b></a>');
				}
				if(pg==2){				
				$("#eventtitle").html('Bangalore');
				$("#eventtitle1").html('Bangalore');
				$("#eventurl").html('<a href=http://bangalore.burrp.com/ class=bl_10 target=_blank><b>More in Events &raquo;</b></a>');
				}
				if(pg==3){				
				$("#eventtitle").html('Chennai');
				$("#eventtitle1").html('Chennai');
				$("#eventurl").html('<a href=http://chennai.burrp.com/ class=bl_10 target=_blank><b>More in Events &raquo;</b></a>');
				}
				if(pg==4){				
				$("#eventtitle").html('Delhi');
				$("#eventtitle1").html('Delhi');
				$("#eventurl").html('<a href=http://delhi.burrp.com/ class=bl_10 target=_blank><b>More in Events &raquo;</b></a>');
				}
				if(pg==5){				
				$("#eventtitle").html('Ahmedabad');
				$("#eventtitle1").html('Ahmedabad');
				$("#eventurl").html('<a href=http://ahmedabad.burrp.com/ class=bl_10 target=_blank><b>More in Events &raquo;</b></a>');
				}
				if(pg==6){				
				$("#eventtitle").html('Hyderabad');
				$("#eventtitle1").html('Hyderabad');
				$("#eventurl").html('<a href=http://hyderabad.burrp.com/ class=bl_10 target=_blank><b>More in Events &raquo;</b></a>');
				}
				if(pg==7){				
				$("#eventtitle").html('Kolkata');
				$("#eventtitle1").html('Kolkata');
				$("#eventurl").html('<a href=http://kolkata.burrp.com/ class=bl_10 target=_blank><b>More in Events &raquo;</b></a>');
				}
	document.getElementById("currenteventnews").value=pg;
	var total=8;
	for(var i=1;i<=total;i++){
			if(i==pg){
					
						document.getElementById("eventname"+pg).style.display = "block";
						if($("#eventname"+pg).html()== '' || $("#eventname"+pg).html()==null){
							$.get("/active18/newhome/event/alleventdata.html",'',function(data){											
							var tempdata=data.split('###&&&###');
							$("#eventname2").html(tempdata[0]);
							$("#eventname3").html(tempdata[1]);
							$("#eventname4").html(tempdata[2]);
							$("#eventname5").html(tempdata[3]);
							$("#eventname6").html(tempdata[4]);
							$("#eventname7").html(tempdata[5]);
							$("#eventname8").html(tempdata[6]);
							});
						
							}
			}else{
						
							if($("#eventname"+i).html()!= '' && $("#eventname"+i).html()!=null){
							document.getElementById("eventname"+i).style.display = "none";
							}
						}
		}
	
}
function htab_event(a, b, c, d, e){
	j=0;
	for(var i=1; i<=b; i++)
	{
		if(i == a){
			document.getElementById(c+i).className = "hcitylinkh";
			document.getElementById(e+i).className = "hicons eicon"+(i+a);
			document.getElementById(d+i).style.display = "block"
		}
		else{
			document.getElementById(c+i).className = "hcitylinkn";
			document.getElementById(e+i).className = "hicons eicon"+(j+1);
			document.getElementById(d+i).style.display = "none"
		}
		j=j+2;
	}
}
function in_array(value, arr){
	var key;
	for (key in arr){
		if (arr[key] === value){return value; }
	}
	return null; //false
}
function displaytopmenu(){
	var str="";
	var i=1;
	var tempdata=myfeeddata;
	temp=tempdata.split(',');
	for(key in myTabArray1){
		if(i==1){
			str+='<div class="htabact" id="tab'+i+'" onclick=htab_ournetwork('+i+',37,"tab","tabdata","'+key+'")>'+myTabArray1[key]+'</div>';
		}else{
			str+='<div class="htabnact" id="tab'+i+'" onclick=htab_ournetwork('+i+',37,"tab","tabdata","'+key+'")>'+myTabArray1[key]+'</div>';
		}
		if(i==3){i++;break;};
		i++;
		str+='<div class="FL gL2_10 PT3">|</div>';
	}
	for(var j=0;j<temp.length;j++){
		tempinnerdata=temp[j].split(':');
		checkdata=tempinnerdata[1];
		if(in_array(checkdata,myTabArray)){
			str+='<div class="FL gL2_10 PT3">|</div>';
			str+='<div class="htabnact" id="tab'+i+'" onclick=htab_ournetwork('+i+',37,"tab","tabdata","'+tempinnerdata[0]+'")>'+str_replace("_"," ",tempinnerdata[1])+'</div>';
			i++;
		}
	}
	document.getElementById("displaytopmenuid").innerHTML=str;
}
function populatefeeddata(){
	if(readCookie("ui")){
		document.getElementById('addstuff').style.display='block';
		var temppop=myfeeddata;
		var mycat_Array=new Array();
		mycat_Array[1] = "Current Affairs";
		mycat_Array[2] = "Entertaintment";
		mycat_Array[3] = "Tech";
		mycat_Array[4] = "Sports";
		mycat_Array[5] = "Business";
		mycat_Array[6] = "Lifestyle";
		var myfeeddataarr=new Array();
		temppoparr=temppop.split(',');
		for(k=0;k<temppoparr.length;k++){
			temppoparr2=temppoparr[k].split(':');
			myfeeddataarr[k]=temppoparr2[0];
		}
		var str="";
		var j=1;
		var i=0;
		var d=0;
		var k=1;
		for(key in myTabArray){
			if(i==0){
				i++;
				str +='<div style="background:url(http://im.in.com/active18/homepage17dec/images/h_gradimg1.gif) repeat-x bottom; padding-bottom:15px; margin-bottom:15px;">';
				str +='<table width="100%" cellpadding="0" cellspacing="0" border="0">';
				str +='<tr valign="top">';
			}	
			if(j==1){
				d++;
				str +='<td width="110">';
				str +='<div style="background:url(http://im.in.com/active18/homepage17dec/images/h_gradbg4.jpg) repeat-x; height:16px; padding:0px 15px;" class="gD_11">'+str_replace("_"," ",mycat_Array[d])+'</div>';
			}
			if(in_array(key,myfeeddataarr)){
				if(key == 5683){
					str +='<div id="myfeed'+key+'"><div class="PT5"><div class="FL" style="padding-top:1px;width:16px;"><div class="hicons hicon13"></div></div><div class="FL gD_11"><b>'+str_replace("_"," ",myTabArray[key])+'</b></div><div class="CL"></div></div></div>';
				}else{
					str +='<div id="myfeed'+key+'"><div class="PT5" style="cursor:pointer;" onclick=removefromcookie("'+key+'","'+myTabArray[key]+'")><div class="FL" style="padding-top:1px;width:16px;"><div class="hicons hicon13"></div></div><div class="FL gD_11"><b>'+str_replace("_"," ",myTabArray[key])+'</b></div><div class="CL"></div></div></div>';
				}
			}else{
				if(key == 5683){
					str +='<div id="myfeed'+key+'"><div class="PT5"><div class="FL" style="padding-top:1px;width:16px;"><div class="hicons hicon13"></div></div><div class="FL gD_11"><b>'+str_replace("_"," ",myTabArray[key])+'</b></div><div class="CL"></div></div></div>';
				}else{
					str +='<div id="myfeed'+key+'"><div class="PT5" style="cursor:pointer;" onclick=addtocookie("'+key+'","'+myTabArray[key]+'")><div class="FL" style="padding-top:1px;width:16px;"></div><div class="FL gD_11">'+str_replace("_"," ",myTabArray[key])+'</div><div class="CL"></div></div></div>';
				}
			}
			if(j== 5){
				j=0;
				str +='</td>';
				str +='<td width="10"></td>';
			}
			if(k==15 || k==30){
				i=0;
				str +='</tr>';
				str +='</table>';
				str +='</div>';
			}
			j++;
			k++;
		}
		document.getElementById("defaultfeeddata").innerHTML=str;
	}else{
		addsignin('home','','');
	}
}
function getcookie(cookiename) {
	var cookiestring=document.cookie;
	var i=0;
	var index1=cookiestring.indexOf(cookiename);
	if (index1==-1 || cookiename=="") return ""; 
	var index2=cookiestring.indexOf(';',index1);
	if (index2==-1) index2=cookiestring.length; 
	return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value,duration){
	cookiestring=name+"="+escape(value)+";EXPIRES=(int)''";
	document.cookie=cookiestring;
	if(!getcookie(name))
		return false;
	else
		return true;
}
function addtocookie(id,name){
	var temp=myfeeddata;
	if(temp=="" || temp == null){
		temp=id+":"+name;
	}else{
		temp=myfeeddata+","+id+":"+name;
	}
	var str='<div class="PT5" style="cursor:pointer;" onclick=removefromcookie("'+id+'","'+name+'")><div class="FL" style="padding-top:1px;width:16px;"><div class="hicons hicon13"></div></div><div class="FL gD_11"><b>'+str_replace("_"," ",name)+'</b></div><div class="CL"></div></div>';
	document.getElementById("myfeed"+id).innerHTML=str;
	myfeeddata=temp;
	savemyfeedcookie();
	displaytopmenu();
}
function removefromcookie(id,name){
	var tempremove=myfeeddata;
	temp=tempremove.replace(","+id+":"+name, "");
	if(tempremove==temp){
		temp=tempremove.replace(id+":"+name, "");
	}
	var str='<div class="PT5"  style="cursor:pointer;" onclick=addtocookie("'+id+'","'+name+'")><div class="FL" style="padding-top:1px;width:16px;"></div><div class="FL gD_11">'+str_replace("_"," ",name)+'</div><div class="CL"></div></div>';
	document.getElementById("myfeed"+id).innerHTML=str;
	myfeeddata=temp;
	savemyfeedcookie();
	displaytopmenu();
}
function setmyfeedcookie(){
	$.get('/active18/newhome/user_login_cookie.php','',function(data){if(data!=""){myfeeddata=data;displaytopmenu();}});
}
function savemyfeedcookie(){
	if(readCookie("ui")){
		var tempmyfeeddata=myfeeddata;
		$.post('/active18/newhome/update_user_feed.php',{myfeeddata : tempmyfeeddata},function(data){});
		//document.getElementById('addstuff').style.display='none';
	}else{
		addsignin('home','','');
	}
}
function cityover(){document.getElementById('cityd').style.display='block';document.getElementById('cityl').className='FL hicons hicon20';document.getElementById('citybg').className='FL hgradbg2';document.getElementById('cityr').className='FL hicons hicon21';}
function cityout(){document.getElementById('cityd').style.display='none';document.getElementById('cityl').className='FL hicons hicon18';document.getElementById('citybg').className='FL hgradbg';document.getElementById('cityr').className='FL hicons hicon19';}