﻿var name = "S.C.P DENOYELLE, BOUCHER et WAQUET"

function setBigImg(big_img_class, small_img_class, duration) {
    $(small_img_class).mouseenter(function () {
        var selected = $(this).parent('a');
        if ($(big_img_class).attr('src') != selected.attr('href')) {
            $(big_img_class).stop().fadeOut(duration, function () {
                $(big_img_class).attr('src', selected.attr('href'));
                $(big_img_class).attr('title', selected.parent('a').attr('title'));
                $(big_img_class).attr('alt', selected.attr('alt'));
                $(big_img_class).parent('a').attr('href', selected.attr('src'));
                $(big_img_class).parent('a').attr('title', selected.parent('a').attr('title'));
                $(this).fadeTo(duration, 1, function () {
                    GLO_active = false;
                });
            });
        }
    });
}

function keyPressedEnter(id, url_redirect) {
    $(id).keypress(function (e) {
        if (e.keyCode == '13') {
            location.href = url_redirect + $(id).val();
            return false;
        }
    });
}

function keyPressedEnterLogin(id, btnId) {
    $(id).keypress(function (e) {
        if (e.keyCode == '13') {
            $(btnId).click();
            return false;
        }
    });
}

function getPage() {
    var url = window.location.toString();
    //alert(typeof(url));
    var urlparts = url.split('/');
    var url_get = urlparts[urlparts.length - 1].split('?')
    return url_get[0];
}

function favoris() {
    if (navigator.appName != 'Microsoft Internet Explorer') {
        window.sidebar.addPanel(name, "http://www.denoyelle-immobilier.fr", "");
    } else {
        window.external.AddFavorite("http://www.denoyelle-immobilier.fr", name); 
    }
}

function imprime_zone(commande, obj, name) {
    var zi = " <style type=\"text/css\">a, img{border:none;} ";
    zi = zi + "#tabPanier{border: #801418 solid 1px;border-collapse: collapse;width: 560px;background-color:White;color:Black;}";
    zi = zi + "#tabPanier tr{";
    zi = zi + "border-collapse: collapse;";
    zi = zi + "text-align: center;";
    zi = zi + "border-right: none;";
    zi = zi + "border-left: none;";
    zi = zi + "}";
    zi = zi + "#tabPanier th";
    zi = zi + "{";
    zi = zi + "border: solid 1px #801418;";
    zi = zi + "border-collapse: collapse;";
    zi = zi + "border-top: none;";
    zi = zi + "}";
    zi = zi + "#tabPanier td";
    zi = zi + "{";
    zi = zi + "border: solid 1px #801418;";
    zi = zi + "border-collapse: collapse;";
    zi = zi + "border-bottom: none;";
    zi = zi + "}";
    zi = zi + "#tabPanier .cellCoteDroit";
    zi = zi + "{";
    zi = zi + "border: solid 1px #801418;";
    zi = zi + "border-collapse: collapse;";
    zi = zi + "border-bottom: none;";
    zi = zi + "border-right: none;";
    zi = zi + "}";
    zi = zi + "#tabPanier .cellCoteGoche";
    zi = zi + "{";
    zi = zi + "border: solid 1px #801418;";
    zi = zi + "border-collapse: collapse;";
    zi = zi + "border-bottom: none;";
    zi = zi + "border-left: none;";
    zi = zi + "}";
    zi = zi + ".textetitre2";
    zi = zi + "{";
    zi = zi + "font-size: 14px;";
    zi = zi + "}";
    zi = zi + ".textedescriptif";
    zi = zi + "{";
    zi = zi + "font-size: 14px;";
    zi = zi + "}";
    zi = zi + "</style><center><img src=\"<%=getUrlImgVideGrande %>\" alt=\"Logo " + name + "\" /></center>"
    zi = zi + document.getElementById(obj).innerHTML;

    var f = window.open("", "ZoneImpr", " width=600,toolbar=0, menubar=0, scrollbars=1, resizable=1,status=0, location=0, left=10, top=10");
    f.document.body.style.color = '#000000';
    f.document.body.style.backgroundColor = '#FFFFFF';
    f.document.body.style.padding = "10px";
    f.document.title = commande;
    f.document.body.innerHTML += zi;
    f.window.print();
    f.window.close();
    return true;
}

function redirect() {

    var currentLocation = document.location.href;
    var oldLocation = 'http://www.gruwez-denoyelle-notaires.fr/';
    var newLocation = 'http://www.denoyelle-boucher-waquet.notaires.fr';
    if (currentLocation.indexOf(oldLocation) > -1) {
        window.location = currentLocation.replace(oldLocation, newLocation)
    }
}

$(document).ready(function () {
    var page = getPage().toLowerCase();
    var index = 'default.aspx';
    var recherche = "resultats.aspx";
    var fiche = 'details.aspx';
    var desinscription = 'desinscription-alerte-email-agence-denoyelle-immobilier.aspx';
    var login = 'login.aspx';
    //$('.lienBasSite').html(page);
    if (page == index) {

    } else if (page == fiche) {
        setBigImg('.big_image_detail', '.small_image_detail', 300);
        $("a.big_image_lien").fancybox()
        $("a.small_image_lien").fancybox()
        $('.fiche_details_lien_tel').fancybox();
        $('.fiche_details_lien_financement').fancybox();
        $('.fiche_details').fadeIn();
        $('.big-loader').fadeOut();
    } else if (page == recherche) {

    } else if (page == desinscription) {

    } else if (page == login) {

    }

})
