
// JavaScript Document
$(document).ready(function(){ 
						   
		if ($('#ck').length != 0){
		CKEDITOR.replace( 'ck',
			{
				toolbar : 'Custom',
				filebrowserBrowseUrl: '/ckeditor/simogeo-Filemanager/index.html'
			});
		}					   
      
	
		$('#window').cycle({
		timeout: 6000 ,	
		delay:  0, 
		speed:  1500,
		pause:	1,
		autostop: 1,
		autostop: 1
		//next:   '.next', 
		//prev:   '.prev'
		});
		
		$('.pics2').cycle({
		timeout: 6000 ,	
		delay:  6000, 
		speed: 1500, 
		pause:	1
		});
	
		$('#goto1').click(function() {
			$('#window').cycle(1);
			$('#window').cycle('stop');
			$('.pics2').cycle(0);  
			return false; 
		}); 
		 
		$('#goto2').click(function() {  
			$('#window').cycle(1);
			$('#window').cycle('stop');
			$('.pics2').cycle(1);  
			return false;  
		}); 
		
		$('#goto3').click(function() {  
			$('#window').cycle(1);
			$('#window').cycle('stop');
			$('.pics2').cycle(2);  
			return false;  
		}); 
		
		$('.quotes').cycle({
		timeout: 8000 ,	
		delay:  0, 
		speed:  2000,
		pause:	1,
		random: 1
	});
		
		$(document).pngFix(); 
		Cufon.set('fontFamily', 'proxima');
		
		
		$('.loginbox').click(function() {
	      if($(this).val() == "username" || $(this).val() == "password"){			  	
			  $(this).val("");
		  }
		});
		dotree();
}); 

function switch_view(id){
	var view = $("#view_proposed").html();
	if(view == "View Proposed") {
		$("#ok"+id).css("display","none");
		$("#proposed"+id).css("display","block");
		$("#view_proposed").html("View Live");
	} else {
		$("#ok"+id).css("display","block");
		$("#proposed"+id).css("display","none");
		$("#view_proposed").html("View Proposed");
	}
}

function dotree(){
	$("#tree").treeview({
			collapsed: true
			,animated: "medium"
			,control:"#sidetreecontrol"
			,persist: "cookie"
			,unique: true
		});
}	

function edit_node(nid,action){
	$('#nodes').html("");
	$('#nodes').load("nodes.php?nid="+nid+"&mode="+action,function(){
																	
	 });
}

function edit_myvbnode(nid,action){
	$('#nodes').html("");
	$('#nodes').load("myvb.php?nid="+nid+"&mode="+action,function(){
																	
	 });
}

function show_msg(msg){
		$('#show_msg').html(msg);
		$('#show_msg').slideDown();
}

function toggleP(me,target) {
	$("#"+me).hide();	
	$("#"+target).fadeIn("slow");	
}

function show_approval(){
	$("#approval").load("admin/approval_list.php").slideDown();
	//$("#approval").;
}

function show_reject(id){
	$("#"+id).slideDown();
	//$("#approval").;
}

function edit_form(fid,action,id){
	$('#nodes').html("");
	$('#nodes').load("forms.php?fid="+fid+"&mode="+action+"&frmid="+id,function(){															
	 });
}

function fbs_click() {
	u=location.href;
	t=document.title;
	window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(u)+"&t="+encodeURIComponent(t),"sharer","toolbar=0,status=0,width=626,height=436");
	return false;
}
