﻿////////More///////////////////////////////////////////////////
var server;
var t8mlet = false;

$(document).ready(function(){	
	server = getDomainName();
	
	if ($("#site_nav_local_views ul").length){
		$("#site_nav_local_views").css("display", "block");		
	}
	if ($("#aside_primary .section").length>1){		
		$("#aside_primary").css("display", "block");		
	}	
	
	if ($("#site_nav_local_views a").length){
		$("#site_nav_local_views").css("border-bottom-width", "1px");
	}
	
	NoticeActive();
    
    UpdateStatusActive();
    
    ActivePostTypes();
    
    //select language
    changeLanguage();

	//invite
	$("#checkall").click(function(){	
        	$("input[type='checkbox']").attr('checked', $('#checkall').is(':checked'));
	});
		
	//collapse
	collapseSidebar();	
	
	$("#ecard_item a").click(function(){
		var ecard_lang = $("#ecard_item").attr('lang');
		var ecard_url = server + 'ecard/index.php?key=local&lang='+ecard_lang;
		openGreetingCard(ecard_url);
	});
				
	//theme
	$("#theme_action-preview").click(function(){ 			
		var theme = $("#themelist :radio:checked").val();	
		if (!theme){
			var theme = $("#theme").val();
		}
	   	var background = $("#background").val();
	    var timeline = $("#timeline").val();
	    var dashboard = $("#dashboard").val();	   
	    var url = server+'index.php?action=public&theme='+theme;
	    if (background) url += '&background='+background;
	    if (timeline) url += '&timeline='+timeline;
	    if (dashboard) url += '&dashboard='+dashboard;
	        		        		
	    WindowPopup.launch(url);	    
	});
	$("#theme_bg img").click(function(){    	
     	$("#background").val(this.id);        		
        $("#theme_bg img").removeClass("selected");
        $(this).addClass("selected");        
        
    });    
    $("#theme_tl img").click(function(){ 
     	$("#timeline").val(this.id);        		
        $("#theme_tl img").removeClass("selected");
        $(this).addClass("selected");        
    });
    $("#theme_db img").click(function(){    	
     	$("#dashboard").val(this.id);       		
        $("#theme_db img").removeClass("selected");
        $(this).addClass("selected");        
    });
	
});

function getDomainName(){
	server = '';
	server = $('#header #site_contact a').attr('href');	
	var tpos = server.indexOf("index.php?action=public");
	if (tpos >0) server = server.substr(0, tpos);
	
	return server;
}

//LN_Begin


function UpdateStatusActive(){
	//update status
    if ($("#update_status").length){     	
    	if ($("#update_status div")[0].id == 'update_status_auto'){
    		autoUpdateNotice();
    	}    	
    	
    	$("#update_status div").click(function(){
    		var update_status = $("#update_status div")[0].id;
    		
    		var pause_text = $("#update_status div").attr('pause_text');
    		var auto_text = $("#update_status div").attr('auto_text');
    		
    		if (update_status == 'update_status_pause'){    			
    			$("#update_status div")[0].id = 'update_status_auto';
    			$("#update_status div").attr('title', pause_text);
    			$(".timestamp abbr").each(function(){    				
    				if ($(this).html()){//fix ie
    					$(this).html($(this).attr('viet_date'));
    				}
    			});
    		}
    		else{    			
    			$("#update_status div")[0].id = 'update_status_pause';
    			$("#update_status div").attr('title', auto_text);
    		}
    		
    		var new_status = (update_status == 'update_status_pause') ? 'update_status_auto' : 'update_status_pause';    		
    		$.post(	        			
	        	server+'index.php',
	        		{action: "switchupdatestatus", newstatus: new_status, type: "ajax"},
	        		function(xml){	
	        			
	        			var node = $("p", xml).get(0);				
	        			
	        			if (node.getAttribute('id') == 'update_status_auto'){
	        				$("#update_status div")[0].id = node.getAttribute('id');
	        				$("#update_status div").attr('title', pause_text);
	        				$(".timestamp abbr").each(function(){
	        					if ($(this).html()){
    								$(this).html($(this).attr('viet_date'));
	        					}
    						});
	        				autoUpdateNotice();
	        			}
	        			else{	        				
	        				$("#update_status div")[0].id = node.getAttribute('id');
	        				$("#update_status div").attr('title', auto_text);
	        				clearInterval(mTimer);	        				
	        			}
	        			
	        			
	        		}
	    	);
    	}); 
    }
}

var lastNotice = 0;
var mTimer;
var npid = '#notices_primary';
function autoUpdateNotice(){		
	var page_action = $("#update_status div").attr('page_action');
    var page_nickname = $("#update_status div").attr('page_nickname');
    var page_notice = $("#update_status div").attr('page_notice');    
    
    var nav_prev = $(".nav .nav_prev").length;    
    var nav_next = $(".nav .nav_next").length;    
    
    if (
    ((page_action != 'shownotice') && nav_prev)
    || ((page_action == 'shownotice') && nav_next)
    ){    	
    	return;
    }
    
    if (page_notice) npid = '#notices_primary_reply';
	
	if ($(npid + " .notices li").length){
		if (page_notice){
			var num_notices = $(npid + " .notices li").length;
			lastNotice = $(npid + " .notices li")[num_notices-1].id.substr(7);			
		}
		else lastNotice = $(npid + " .notices li")[0].id.substr(7);
	}

	if (lastNotice.length && lastNotice.substr(0,1) == '-') lastNotice = lastNotice.substr(1);//if notice is message
	
	$.post(	        			
	        	server+'index.php',
	        		{action: "autoupdate", last: lastNotice, type: "ajax", page_action: page_action, page_nickname: page_nickname, page_notice: page_notice},
	        		function(xml){
	        			for (var i=0; i<$("li", xml).length; i++){		
	        				if (i>0){
	        					//delay ???
	        				}
		        			var node = $("li", xml).get(i);
		        			if (node){	     
			        			//prevent duplicated t8ms
			        			var newLastNotice = node.getAttribute('id').substr(7);
			        			if (newLastNotice.length && newLastNotice.substr(0, 1) == '-') newLastNotice = newLastNotice.substr(1);
			        			
			        			if (newLastNotice > lastNotice){
			        				lastNotice = newLastNotice;	
			        				
			        				//alert('test');
			        				if (!page_notice && $(npid + " .notices li:visible").length ){	
				        				var length = $(npid + " .notices li:visible").length;
				        				
				        				//remove last t8m 
				        				if (length >= 20){
				        					$(npid + " .notices li:visible:last").fadeOut('slow');				        					
				        				}
				        			}
			        								
			        				if (page_notice){
			        					$(npid + " .notices").append(document._importNode(node, true));
			        					$(npid + " .notices li:last").show('slow');		
			        				}
				        			else{
				        				$(npid + " .notices").prepend(document._importNode(node, true));
				        				$(npid + " .notices li:first").show('slow');
				        			}
				        			
									NoticeActive();
			        			}
		        			}		        			
	        			}
	        		}
	    );
	
	if ($("#update_status").length){ 
    	if ($("#update_status div")[0].id == 'update_status_auto'){
    		mTimer = setTimeout("autoUpdateNotice();", 15000); //Refresh the t8m in 10 seconds
    	
    	
    	}
	}
	
	
}



function ActivePostTypes(){
	//post types
	
    $("#post_types ul li a").click(function(){
    	if(document.getElementById("divtopcontent").style.display == 'block')
	
			document.getElementById("divtopcontent").style.display = 'none';
		else if(document.getElementById("divtopcontent").style.display == 'none')
	
			document.getElementById("divtopcontent").style.display = 'block';
		
			
    	if ($(this).hasClass("active")) return;
    	
    	var id = this.id;
    	var textcontent = $(this).attr("guide");
    	
    	$("#post_types ul li a").removeClass('active');
    	$(this).addClass('active');
    	
    	if (id == 'btnvideo'){
 			getSayText('youtube', 'q_youtube'); 		
 		}
 		else if (id == 'btnmusic'){
 			getSayText('music', 'q_music');
 		}
 		else{
 			var q_says =$("#say_dd").attr('q_says');
	    	getSayText(q_says, 'q_says');
 		}
 		
 		$('#notice_data-text').focus();
 		$('#dcontent').html(textcontent); 	
 		$('#divtopcontent').show('slow');
    });
    
   
    
}

function changeLanguage(){ 
	if ($("#aside_primary select#language").length){
		$("#aside_primary select#language").change(function(){
	    	var lang = this.options[this.selectedIndex].value;
	    	if (lang){    		
		    	$.post(	        			
			        	server+'index.php',
			        		{action: "changelanguage", lang: lang, type: "ajax"},
			        		function(xml){			        			
			        			location.reload();
			        		}
			    	);
	    }
	    });
	}
    
	if ($("#site_nav_global_primary #lang_combo").length){
	    $("#site_nav_global_primary #lang_combo").css('background-color', $("#site_nav_global_primary").css('background-color'));
	    
	    $("#site_nav_global_primary #nav_lang").click(function(){    	
	    	$("#site_nav_global_primary #lang_combo").slideToggle();
	    	
	    	if ($("#lang-arrow-down:visible").length){
	    		$("#lang-arrow-down").hide();
	    		$("#lang-arrow-up").show();
	    	}
	    	else{
	    		$("#lang-arrow-up").hide();
	    		$("#lang-arrow-down").show();
	    	}
	    });
	    
	    $("#site_nav_global_primary #lang_combo a").click(function(){    	
	    	var lang = $(this).attr('lang');    	
	    	if (lang){    		
		    	$.post(	        			
			        	server+'index.php',
			        		{action: "changelanguage", lang: lang, type: "ajax"},
			        		function(xml){			        			
			        			location.reload();
			        		}
			    	);
	         }	
	    }); 
	}
	    
}

function collapseSidebar(){
	var collapse_section = null;
	var collapsed = false;
	
	//post guide
	$('.aside #postguide div.section_title').click(function(){
		collapse_section = 'postguide';
		if ($('.aside #postguide #mydiv:visible').length>0){
			$('.aside #postguide #mydiv').hide();
			//$(this).removeClass('collapsed');
			$(this).addClass('collapsed');
			collapsed = true;
		}
		else{ 
			$('.aside #postguide #mydiv').show();
			$(this).removeClass('collapsed');		
			collapsed = false;		
		}
		
		ajaxCollapseSidebar(collapse_section, collapsed);
	});
	
	//settings
	$('.aside #entity_settings div.section_title').click(function(){
		collapse_section = 'entity_settings';
		if ($('.aside #entity_settings ul li:visible').length>0){
			$('.aside #entity_settings ul li').hide();
			$('.aside #entity_settings ul hr').hide();
			//$(this).removeClass('collapsed');
			$(this).addClass('collapsed');
			collapsed = true;
		}
		else{ 
			$('.aside #entity_settings ul li').show();		
			$('.aside #entity_settings ul hr').show();		
			$(this).removeClass('collapsed');	
			collapsed = false;			
		}
		
		ajaxCollapseSidebar(collapse_section, collapsed);
	});
	
	$('.aside #entity_4powerusers div.section_title').click(function(){
		collapse_section = 'entity_4powerusers';
		if ($('.aside #entity_4powerusers ul li:visible').length>0){
			$('.aside #entity_4powerusers ul li').hide();
			$('.aside #entity_4powerusers ul hr').hide();
			//$(this).removeClass('collapsed');
			$(this).addClass('collapsed');
			collapsed = true;
		}
		else{ 
			$('.aside #entity_4powerusers ul li').show();		
			$('.aside #entity_4powerusers ul hr').show();		
			$(this).removeClass('collapsed');	
			collapsed = false;			
		}
		
		ajaxCollapseSidebar(collapse_section, collapsed);
	});
	
	//tag cloud
	$('.aside #tagcloud div.section_title').click(function(){
		collapse_section = 'tagcloud';
		if ($('.aside #tagcloud ul').length>0){
			if ($('.aside #tagcloud ul:visible').length>0){
				$('.aside #tagcloud ul').hide();
				//$(this).removeClass('collapsed');
				$(this).addClass('collapsed');
				collapsed = true;
			}
			else{ 			
				$('.aside #tagcloud ul').show();
				$(this).removeClass('collapsed');	
				collapsed = false;						
			}
		}
		else{			
			if ($('.aside #tagcloud p:visible').length>0){
				$('.aside #tagcloud p').hide();
				//$(this).removeClass('collapsed');
				$(this).addClass('collapsed');
				collapsed = true;
			}
			else{ 			
				$('.aside #tagcloud p').show();
				$(this).removeClass('collapsed');	
				collapsed = false;						
			}
		}
		
		ajaxCollapseSidebar(collapse_section, collapsed);
	});	
	
	/*
	//subscriptions		
	if ($('.aside #entity_subscriptions ul a').length>10){		
		if ($('.aside #entity_subscriptions h2').hasClass('prepare_collapsed')){			
			$('.aside #entity_subscriptions h2').addClass('enabled collapsed');
		}
		else $('.aside #entity_subscriptions h2').addClass('enabled');
	}
	$('.aside #entity_subscriptions h2.enabled').click(function(){
		collapse_section = 'entity_subscriptions';
		var num_profiles = $('.aside #entity_subscriptions ul a:visible').length;
		
		if (num_profiles>10){
			$('.aside #entity_subscriptions ul a:gt(9)').hide();
			$(this).removeClass();
			$(this).addClass('enabled collapsed');
			collapsed = true;		
		}
		else if (num_profiles==0){
			$('.aside #entity_subscriptions p').hide();
			$(this).removeClass();
			$(this).addClass('enabled collapsed');
			collapsed = true;	
		}
		else{ 
			$('.aside #entity_subscriptions ul a:gt(9)').show();
			$(this).removeClass();
			$(this).addClass('enabled');
			collapsed = false;	
		}
		
		ajaxCollapseSidebar(collapse_section, collapsed);
	});
	
	//subscribers	
	if ($('.aside #entity_subscribers ul a').length>10){		
		if ($('.aside #entity_subscribers h2').hasClass('prepare_collapsed')){			
			$('.aside #entity_subscribers h2').addClass('enabled collapsed');
		}
		else $('.aside #entity_subscribers h2').addClass('enabled');
	}	
	$('.aside #entity_subscribers h2.enabled').click(function(){
		collapse_section = 'entity_subscribers';
		
		var num_profiles = $('.aside #entity_subscribers ul a:visible').length;
		if (num_profiles>10){
			$('.aside #entity_subscribers ul a:gt(9)').hide();
			$(this).removeClass();
			$(this).addClass('enabled collapsed');
			collapsed = true;	
		}
		else if (num_profiles==0){
			$('.aside #entity_subscribers p').hide();
			$(this).removeClass();
			$(this).addClass('enabled collapsed');
			collapsed = true;	
		}
		else{ 
			$('.aside #entity_subscribers ul a:gt(9)').show();	
			$(this).removeClass();
			$(this).addClass('enabled');	
			collapsed = false;	
		}
		
		ajaxCollapseSidebar(collapse_section, collapsed);
	});	
	
	//public group
	$('.aside .public_groups h2').click(function(){
		collapse_section = 'public_groups';
		if ($('.aside .public_groups #public_grouds_content:visible').length>0){
			$('.aside .public_groups #public_grouds_content').hide();
			$(this).removeClass();
			$(this).addClass('collapsed');
			collapsed = true;
		}
		else{ 
			$('.aside .public_groups #public_grouds_content').show();		
			$(this).removeClass();	
			collapsed = false;		
		}
		
		ajaxCollapseSidebar(collapse_section, collapsed);
	});		
	
	//private group	
	$('.aside .private_groups h2').click(function(){
		collapse_section = 'private_groups';
		
		if ($('.aside .private_groups #private_grouds_content:visible').length>0){
			$('.aside .private_groups #private_grouds_content').hide();
			$(this).removeClass();
			$(this).addClass('collapsed');
			collapsed = true;
		}
		else{ 
			$('.aside .private_groups #private_grouds_content').show();	
			$(this).removeClass();	
			collapsed = false;			
		}
		
		ajaxCollapseSidebar(collapse_section, collapsed);
	});
	*/
}

function ajaxCollapseSidebar(collapse_section, collapsed){
	$.post(	        			
		        	server+'index.php',
		        		{action: "collapsesidebar", section: collapse_section, collapsed: collapsed, type: "ajax"},
		        		function(xml){			        			
		        			//do nothing
		        		}
		);
}

//dropdown menu
var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;
function jsddm_open()
{	jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');}

function jsddm_close()
{	if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{	closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{	if(closetimer)
	{	window.clearTimeout(closetimer);
		closetimer = null;}}
$(document).ready(function()
{	$('#jsddm > li').bind('mouseover', jsddm_open);
	$('#jsddm > li').bind('mouseout',  jsddm_timer);
	if ($("#jsddm li ul li.item_more a").length<1){		
		$("#jsddm li ul li#divider").addClass('divider');		
	}	
});
document.onclick = jsddm_close;
//LN_End

//Begin

var click_close=false;
function getSayText(texts,css){
	var spansay   = $("#spansay");
	spansay.text(texts);
	spansay.attr("class", css);
	document.getElementById('saytext').value=texts;
	document.getElementById('sayclass').value=css;	
	click_close=false;
	var textleng=420-(texts.length * 9);
	//document.getElementById("notice_data-text").style.width=textleng +"px";	
	
	}
function display_dd(){
	if(!click_close){
	  var imgObj=document.getElementById("click_img");
	 	 
	  var tmp=imgObj;
	  
	  var curTop=0;
	  if(tmp.offsetParent) {
        do {
        	 curTop += tmp.offsetTop;
   		 } while(tmp = tmp.offsetParent)
       } 
       
	   click_close=true;
	   document.getElementById("say_dd").style.display="block";
	}else{
		document.getElementById("say_dd").style.display="none";
	  	click_close=false;
	}	
	
	}
	
function _display(id){
		var dobj = document.getElementById(id);		
		if(dobj.style.display=="none"){ 
		dobj.style.display="block";}} 
		
function _hide(id){
		var dobj = document.getElementById(id);
		if(dobj.style.display=="block"){ dobj.style.display="none";}} 
		
function popUp(url, title) {
		window.open(url, title, "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=760,height=540,left=" + (screen.width-780)/2 + ",top="+(screen.height-545)/2);
						
	}
function insertSmile(key,area_name){
				var editor = document.getElementById(area_name);
				
				if (editor.value == "Viết t8m ở đây" || editor.value == "Type your t8m here"){
					editor.value = "";
				}
				editor.value += " " + key;
				togleSmile();
			}
function togleSmile(){
			   var curTop=0;
				var style_smile = document.getElementById("smiles").style;
				var togle_smile = document.getElementById("togle_smile");			
				var tmp=	togle_smile;	
				if(style_smile.display == "none"){
				
				  	 if(tmp.offsetParent) {
                     	 do {
                           		
     						 curTop += tmp.offsetTop;
   						 } while(tmp = tmp.offsetParent)
                    }
				    document.getElementById("smiles").style.top=(togle_smile.offsetTop+20)+"px";
	                document.getElementById("smiles").style.left =togle_smile.offsetLeft+"px";
					style_smile.display = "block";
					document.getElementById("uparrow").style.display = "block";
					document.getElementById("downarrow").style.display = "none";
				}
				else{
					style_smile.display = "none";
					document.getElementById("uparrow").style.display = "none";
					document.getElementById("downarrow").style.display = "block";
				}
			}	
	
	document.onmousedown=(function(e){
		var targ;
     	if (!e) var e = window.event;
    	if (e.target){
			targ = e.target;
		}else if (e.srcElement) targ = e.srcElement;
	
    	if (targ.nodeType == 3) // defeat Safari bug
	     	targ = targ.parentNode;
		var node_id=targ.id;
		//alert(targ + node_id);
		if(node_id.substr(0,5)=="dd_td" ){
		   var text=targ.childNodes[0].nodeValue;
		   var css=targ.className;
		   
		   if(text==': (freestyle)')
		     text="";
		   getSayText(text,css);
		   
		}//else if (!targ.id){
/*		if(node_id=="toggle"){
			alert ('aaaaaaaaaaa');
		 // var href=targ.href;	
		 // alert ('aaaaaaaaaaa'+href);
		  //insertSmile(key,area_name);
		}
*/	   

    var posx = 0;
	   if (e.pageX ) 	{
		posx = e.pageX;
	  }	else if (e.clientX ){
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
	 }
	 //alert(posx);
	 screenW = screen.width-20;
	  if(posx<screenW){
		var sayObj=document.getElementById("say_dd");
		if(sayObj){
	      sayObj.style.display="none";
	      click_close=false;
		}
		}
	
});
	



	
//End

//Begin 
function opengift(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }
 
  
  function showhide(divid){
  
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }

  
  var whosOn = '';
function doClick(obj){
	
obj.className='active';
if(whosOn != undefined && obj != whosOn){
whosOn.className = 'off';
}
whosOn = obj;
} 


function openGreetingCard(url){

window.open(url, 
  '_blank',"width=750,height=600,resizable=no,scrollbars=no,menubar=no,location=no,toolbar=no,status=no,titlebar=no,directories=no,addressbar=no, left=" + (screen.width-750)/2 + ",top="+(screen.height-545)/2); 
  window.document.addressbar.enable = false;
}

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
function resetText(thefield){
if (thefield.value=="")
thefield.value = thefield.defaultValue
}


function closeTip(){	
$('#divtopcontent').slideToggle();
 }

//TP_begin
function showgrouplist(url,flag)
{        
		var groups;
		if(flag==0){
	   	   groups =document.getElementById('groups').value;
		   if (groups && groups!='')
				url = url+"&groups="+groups;
			url = url+'&type=special';
			var newWin = window.open (url,'groupshow','height=465, width=300, left=550, top=150, scrollbars=yes');

		}else{
			 
			groups =document.getElementById('groups1').value;
			//alert('fdfdf'+flag);
    		if (groups && groups!='')
				url = url+"&groups="+groups;
			url = url+'&type=regular';
			var newWin = window.open (url,'groupshow1','height=450, width=300, left=550, top=150, scrollbars=yes');

		
		}
		
}
function showmemberlist(url,flag)
{
		var freinds;
		if(flag==0){
			freinds =document.getElementById('freinds').value;
			if (freinds && freinds!='')
				url = url+"&freinds="+freinds;
			url = url+'&type=special';
		}else{
			freinds =document.getElementById('freinds1').value;
			if (freinds && freinds!='')
				url = url+"&freinds="+freinds+'&type=regular';
		 	url = url+'&type=regular';;	
		}
		var newWin = window.open (url,'friendshow','height=450, width=300, left=550, top=150, scrollbars=yes');
		
}
function sgSetValue(id,value){
var txt = document.getElementById(id);
txt.value = value;

}
function sglist_onclick(type)
{
	 var checkboxnum = 0;
	 var checkgroup;
	 var field=document.frmlist.groupname;
	 for (i = 0; i < field.length; i++) {
	 	if(field[i].checked == true){
	 		if(checkgroup){
	 		   checkgroup=checkgroup+','+field[i].value;
	 		}else{
	 			checkgroup=field[i].value;
	 		}
	 		checkboxnum=checkboxnum+1;   
	 	 }
	 }
	  if(!checkboxnum==0)
	 {
		if(type && type=='special') {
			window.opener.sgSetValue('groups',checkgroup);
		}else{
			window.opener.sgSetValue('groups1',checkgroup);
		}	
	 }
	window.close();
   
}

function freindlist_onclick(type)
{    var checkboxnum = 0;
	 var checkgroup;
	 var field=document.frmlist.membername;
	 for (i = 0; i < field.length; i++) {
	 	if(field[i].checked == true){
	 		if(checkgroup){
	 		   checkgroup=checkgroup+','+field[i].value;
	 		}else{
	 			checkgroup=field[i].value;
	 		}   
	 		checkboxnum=checkboxnum+1;
	 	 }
	 }
	 if(!checkboxnum==0)
	 {
	     if(type && type=='special') {
		 	window.opener.sgSetValue('freinds',checkgroup);
		}else{ 	
			window.opener.sgSetValue('freinds1',checkgroup);
		}	
	 }
	window.close();
   
}

function showSGvideo(url){
	window.open (url,'friendshow','height=450, width=600, left=550, top=150, scrollbars=yes');

}

function checkDelete(url,alertstr)	{
			var answer = confirm(alertstr)
			if (answer){
				window.location = url;
			}

}

function collapsibleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
	
	 document.getElementById("colla").innerHTML='<img src="images/sliders/scroll_up.png" border="0"/>';
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
	   document.getElementById("colla").innerHTML='<img src="images/sliders/scroll_down.png" border="0"/>';
    }
  }
  
 function t8mboxText(field) {
var frm = document.form_notice;

if (field.value != "") {
frm.status_textarea.value = '';
}
}




function t8mboxdrClick(text) {
	
	document.getElementById('avatar_reply').style.display = 'block';
	document.getElementById('divpost_types').style.display = 'block';
	if (document.getElementById('notice_data-text').value == text )
	{
		document.getElementById('notice_data-text').value ="";
	}
		  document.getElementById('notice_data-text').style.color="#000000"; 
		 
		   document.getElementById('notice_data-text').style.height="54px";
	
}


function t8mboxClick(text) {
	
		document.getElementById('avatar_reply').style.display = 'block';
	if (document.getElementById('notice_data-text').value == text )
	{
		
		document.getElementById('notice_data-text').value ="";
		
		document.getElementById('notice_data-text').style.color="#000000"; 
		
		
	}
	
	if(document.getElementById('notice_data-text').value != text ){
		  document.getElementById("divpost_types").style.display = 'block';
		  document.getElementById('notice_data-text').style.color="#000000"; 
		 
		   document.getElementById('notice_data-text').style.height="54px";
	}

}



function showhidecb(divid,type){
 var form = document.form_fb_settings;
 	var e = document.getElementsByName("rds");
 	var cb2 = document.getElementsByName("cbog");
    var c = document.getElementById("cbos");

    	
 	if(type == "cb")
 	{
 		
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
 }
  
}


function showFacebookLogin(url){
	window.open (url,'friendshow','height=450, width=850, left=250, top=150, scrollbars=yes');

}