var monalisa = {src: SITE_PATH+'templates/media/fonts/monalisa.swf'};

sIFR.activate(monalisa);

sIFR.replace(monalisa, {
	selector: 'h1.heading',
	thickness: -50,
	sharpness: 50,
	fitExactly: true,
	css: [
		'.sIFR-root { font-size: 50px; color: #504e50; }',
		'strong { font-weight: bold; }',
		'em { font-style: italic; }'
		],
	wmode: 'transparent'
});

sIFR.replace(monalisa, {
	selector: 'h2.heading',
	fitExactly: true,
	css: [
		'.sIFR-root { font-size: 30px; color: #b80205; letter-spacing: 3; }',
		'strong { font-weight: bold; }',
		'em { font-style: italic; }'
		],
	wmode: 'transparent'
});

sIFR.replace(monalisa, {
	selector: 'h3.heading',
	fitExactly: true,
	css: [
		'.sIFR-root { font-size: 30px; color: #b80205; letter-spacing: 3; }',
		'strong { font-weight: bold; }',
		'em { font-style: italic; }'
		],
	wmode: 'transparent'
});

$(document).ready(function() {
	Shadowbox.init();
	$(".sig a").tooltip({
		extraClass: "pla_sig",
	    track: true,
	    delay: 0,
	    showURL: true,
	    showBody: " :: "
	});
	$("input[type=text],input[type=password],textarea").each(function() {  
		$(this).focus(function() { 
			if($(this).val()==this.defaultValue) $(this).val(""); 
		});
		$(this).blur(function() { 
			if($(this).val()=="") $(this).val(this.defaultValue); 
		});
	});
});

$.listen("click","a.shadowbox",function() {
	Shadowbox.open({
		player: "img",
		title: $(this).attr("title"),
		content: $(this).attr("href")
	});
	return false;
});

function GoogleMaps(lat,lng,zoom,title) {
	if(zoom==null) zoom = 13;
	if(title==null) title = "Plan d'Accès Google Maps";
    Shadowbox.open({
        player: "html",
        title: title,
        content: "",
        width: 750,
        height: 500,
        options: {
            onFinish: function(item){
                if(GBrowserIsCompatible()){
                    var map = new GMap2(document.getElementById("shadowbox_content"));
                    map.setCenter(new GLatLng(lat,lng),zoom);
                    var point = new GLatLng(lat,lng);
                    map.addOverlay(new GMarker(point));     
                    map.addControl(new GSmallMapControl());
                    map.addControl(new GMapTypeControl());
                }
            }
        }
    });
}

function VisiteVirtuelle(src,title) {
	Shadowbox.open({
        player: "iframe",
        title: "Visite Virtuelle - "+title,
        content: "templates/media/"+src,
        width: 800,
        height: 440
    });
}

function ZoomDrag(img,title) {
	Shadowbox.open({
        player: "img",
        title: title+" - déplacer la carte avec votre souris",
        content: "templates/media/"+img,
        options: { handleOversize: "drag" }
    });
}

function OpenFlipbookPage(imgsrc) {
	Shadowbox.open({
        player: "img",
        title: "La Carte - déplacer la carte avec votre souris",
        content: imgsrc,
        options: { handleOversize: "drag" }
    });
}

function Include(js) {
	document.write('\n<script type="text/javascript" src="'+SITE_PATH+"content/javascript/"+js+'"></scr'+'ipt>');
}

function PngFix(items) {
	if($.browser.msie&&(parseInt($.browser.version)==6)) DD_belatedPNG.fix(items);
}

function Bookmark() {
	if(document.all) window.external.AddFavorite(window.location.href,document.title)
	else if(window.sidebar) window.sidebar.addPanel(document.title,window.location.href,"");
}

function Print() {
	window.print();
}

function Login() {
	var Login = $("input[name=Login]");
	var Password = $("input[name=Password]");
	if(Login.val()=="") { Login.blink(); return; }
	else if(Password.val()=="") { Password.blink(); return; }
	$.ajax({
		type: "POST",
		url: SITE_PATH+"content/ajax/ajax_inscription.php",
		data: "Action=Login&Login="+Login.val()+"&Password="+Password.val(),
		success: function(data) {
			if(data==0) Message("Désolé, votre identifiant ou votre mot de passe est invalide, veuillez réessayer");
			else if(data==-1) Message("Par mesure de sécurité, seulement les caractères alphanumeriques sont autorisés");
			else { Message(data); document.location.reload(); }
		}
	});
}

function Logout() {
	$.ajax({
		type: "POST",
		url: SITE_PATH+"content/ajax/ajax_inscription.php",
		data: "Action=Logout",
		success: function(result) { document.location.reload(); }
	});
}

function Message(str) {
	alert(str);
}

// jPlayer
function jToggle(id,play,pause) { 
	if($("#"+id).attr("class")=="playing") { jPause(id); $(".jtoggle").html(play); }
	else { jPlay(id); $(".jtoggle").html(pause); }
}
function jPause(id) { $("#"+id).pause().removeClass("playing"); } 
function jPlay(id) { $("#"+id).play().addClass("playing"); }