$(document).ready(function() {
	
	window.setTimeout(function() {
		$("#sub").slideDown("slow","easeInQuad");
	},1000);
	
	var open;
	sifr();
	Shadowbox.init();
	
	$('a.preload').preload();
	
    $("a.shadowbox").click(function() {
		Shadowbox.open({
			player:     'img',
			title:      $(this).attr("title"),
			content:    $(this).attr("href")
		});
		return false;
	});
    	
	$(".thumb").tooltip({ 
		track: true, 
		delay: 1, 
		showURL: false, 
		left: 5,
		bottom: 5
	});
});	

function googleMaps() {
    Shadowbox.open({
        player:     'html',
        title:		'Google Maps - Planisweb Showroom',
        content:    '',
        height:     400,
        width:      550,
        options:    {
            onFinish: function(item){
                if(GBrowserIsCompatible()){
                	var lat = 48.1041840;
                	var lan = -1.7389660;
                    var map = new GMap2(document.getElementById('shadowbox_content'));
                    map.setCenter(new GLatLng(lat, lan), 13);
                    var point = new GLatLng(lat,lan);
                    map.addOverlay(new GMarker(point));     
                    map.addControl(new GSmallMapControl());
                    map.addControl(new GMapTypeControl());
                }
            }
        }
    });
}

function Login() {
	var login = $("input[name=login]").val();
	var mdp = $("input[name=mdp]").val();	
	if(login=="") {
		humanMsg.displayMsg("Login ?");
	} else if(mdp=="") {
		humanMsg.displayMsg("Votre mot de passe ?");
	} else {
		$.ajax({
			type: "POST",
			url: SITE_PATH+"content/ajax/Ajax_loginClient.php",
			data: "action=login&user="+login+"&mdp="+mdp,
			success: function(msg){
				if(msg==false) {
					humanMsg.displayMsg("Votre identification n'est pas correcte");
				} else {
					humanMsg.displayMsg(msg);
					window.location = "fiche-client.html";
				}
			}
		});
	}
}

function Deconnexion() {
	$.ajax({
		type: "POST",
		url: SITE_PATH+"ajax/Ajax_loginClient.php",
		data: "action=deconnexion",
		success: function(msg){
			humanMsg.displayMsg(msg);
			window.location = "index.html";
		}
	});
}

function midiMinuit() {
	humanMsg.displayMsg("MidiMinuit est en cours de réalisation...");
}

sifr = function() {
	
	sIFR.replace(helvetica, {
		selector: 'h1.heading',
		css: [
			'.sIFR-root { font-size: 25px; color: #000000; text-transform: uppercase; }',
			'strong { font-style: bold; }',
			'em { font-style: italic; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: 'h2.heading',
		css: [
			'.sIFR-root { font-size: 18px; color: #536403; font-style: italic; }',
			'strong { font-style: bold; }',
			'em { font-style: italic; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: 'h2.accordion',
		css: [
			'.sIFR-root { font-size: 16px; color: #536403; font-style: italic; }',
			'a { color: #536403; text-decoration: none; }',
			'a:hover { color: #000000; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: 'h3.heading',
		css: [
			'.sIFR-root { font-size: 17px; color: #333333; }',
			'a { color: #666666; text-decoration: none; }',
			'a:hover { color: #000000; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: '.refs h3',
		css: [
			'.sIFR-root { font-size: 17px; color: #333333; }',
			'a { color: #666666; text-decoration: none; }',
			'a:hover { color: #000000; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: '#basdepage h1',
		css: [
			'.sIFR-root { font-size: 17px; color: #c2d941; }',
			'strong { font-style: bold; }',
			'em { font-style: italic; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: '.col h1',
		css: [
			'.sIFR-root { font-size: 18px; color: #000000; text-transform: uppercase; }',
			'strong { font-style: bold; }',
			'em { font-style: italic; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: '.col h2',
		css: [
			'.sIFR-root { font-size: 16px; color: #536403; font-style: italic; }',
			'strong { font-style: bold; }',
			'em { font-style: italic; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: '.form label',
		css: [
			'.sIFR-root { font-size: 14px; color: #666666; text-align: right; }',
			'a { color: #666666; text-decoration: none; }',
			'a:hover { color: #000000; }'
			],
		wmode: 'transparent'
	});
	
	sIFR.replace(helvetica, {
		selector: 'h1.title ',
		css: [
			'.sIFR-root { font-size: 15px; color: #c2d941; font-style: italic; text-align: left; letter-spacing: 1.5; }',
			'a { color }',
			'em { font-style: italic; }'
			],
		wmode: 'transparent'
	});
}
