	var chemin_site = 'http://localhost/stopandgo/';
$(document).ready(function() { 
	var margin_left = calcul_centre();
	$("#content").animate
	(
		{
			"margin-left": margin_left
		}, 2000, "easeOutCirc"
	);
	
	Cufon.replace('.stopandgo_police',{ fontFamily: 'Aero' });
	Cufon.replace('.menu_horizontal',{ fontFamily: 'Aero' });
	Cufon.replace('.cotc_police',{ fontFamily: 'AvantGarde Bk BT' });
	Shadowbox.init();
	
	oTable = $('#tableau_client').dataTable({
		"bJQueryUI": true,
		"bPaginate": false
	//	"sPaginationType": "full_numbers"
	});	
	
	tinyMCE.init({
        // General options
        editor_selector :"news_editor",
        mode : "specific_textareas",
        theme : "advanced",
        plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,

        // Skin options
        skin : "o2k7",
        skin_variant : "silver",
        
        //file_browser
        file_browser_callback: 'openKCFinder',

        // Example content CSS (should be your site CSS)
        content_css : chemin_site+"css/example.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url : chemin_site+"js/tiny_mce/js/template_list.js",
        external_link_list_url : chemin_site+"js/tiny_mce/js/link_list.js",
        external_image_list_url : chemin_site+"js/tiny_mce/js/image_list.js",
        media_external_list_url : chemin_site+"js/tiny_mce/js/media_list.js",

        // Replace values for the template plugin
        template_replace_values : {
                username : "Some User",
                staffid : "991234"
        }
});	
		
		//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
});


function calcul_centre()
{
	//taille de l'écran -960/2	
	var margin_left = (screen.width -960)/2;
	return margin_left;
}
function move(cible)
{
	var margin_left = calcul_centre();
	if(cible == 'cotc')
	{
		$("#content").animate
		(
			{
				"margin-left": margin_left+(-1660)+"px"
			}, 2000, "easeOutCirc"	
		);
	} else if(cible == 'sng')
	{
		$("#content").animate
		(
			{
				"margin-left": margin_left
			}, 2000, "easeOutCirc"
		);
	}
}

function openKCFinder(field_name, url, type, win) {
    tinyMCE.activeEditor.windowManager.open({
        file: chemin_site+'js/kcfinder/browse.php?opener=tinymce&type=' + type,
        title: 'KCFinder',
        width: 700,
        height: 500,
        resizable: "yes",
        inline: true,
        close_previous: "no",
        popup_css: false
    }, {
        window: win,
        input: field_name
    });
    return false;
}
