$(function() {
    $('#legal').click(function(){
        $('#dialog').dialog('open');
        return false;
    });

    $('#privacidad').click(function(){
        $('#dialog4').dialog('open');
        return false;
    });

    $('#garantia').click(function(){
        $('#dialog1').dialog('open');
        return false;
    });

    $("#imagen").click(function(){
        $('#dialog3').dialog('open');
        return false;
    });

    $('#trasferencia').click(function(){
        $('#dialog2').dialog('open');
        return false;
    });

    $("#dialog").dialog({
        autoOpen: false,
        width: 500,
        bgiframe: true,
        height: 340,
        modal: true
    });

    $("#dialog1").dialog({
        autoOpen: false,
        width: 500,
        bgiframe: true,
        height: 340,
        modal: true
    });

    $("#dialog2").dialog({
        autoOpen: false,
        width: 700,
        bgiframe: true,
        height: 340,
        modal: true
    });

    $("#dialog3").dialog({
        autoOpen: false,
        width: 700,
        bgiframe: true,
        height: 490,
        modal: true
    });

    $("#dialog4").dialog({
        autoOpen: false,
        width: 700,
        bgiframe: true,
        height: 490,
        modal: true
    });


    $('#mensaje').click(function(){
        $("#mensaje").slideUp();
    });

    //slider
    $('#rotador').cycle({
        fx:     'fade',
        speed:    5000,
        timeout:  3000,
        height:   207
    });

    //acordeon
    $("#accordion").accordion({ active: -1, autoHeight: false , collapsible: true});
    $("#accordion1").accordion({ active: -1, autoHeight: false , collapsible: true });
    $("#accordion2").accordion({ active: -1, autoHeight: false , collapsible: true });
    $("#accordion3").accordion({ active: -1, autoHeight: false , collapsible: true });
    $("#accordion4").accordion({ active: -1, autoHeight: false , collapsible: true });
    $("#accordion5").accordion({ active: -1, autoHeight: false , collapsible: true });
    $("#accordion6").accordion({ active: -1, autoHeight: false , collapsible: true });

    //portfolio
    /*
    $(".thumb a").click(function(){
    var imgHref = $(this).attr('title');  //get the src of the thumbnail
    $(".thumb a").removeClass("selected");  //remove .selected class from all other links
    $(this).addClass("selected");  //add .selected class to current link
    $(".big").stop();
    $(".big").stop().fadeTo(700, 0, function() {  //fade image out
    $('.big').attr('src', imgHref );  //give new image a src attribute

    }).fadeTo("slow", 1);  //fade the image in
    },$(".thumb a").mouseout = function(){    //for onmouseout not used here
    });*/
    $(".thumb a").click(function(){
        var imgHref = $(this).attr('title');  //get the src of the thumbnail
        $(".thumb a").removeClass("selected");  //remove .selected class from all other links
        $(this).addClass("selected");  //add .selected class to current link
        $(".big").stop();
        $(".big").stop().fadeTo(700, 0, function() {  //fade image out
            $('.big').attr('src', imgHref );  //give new image a src attribute
            $('.bighref').attr('href', 'big/' + imgHref );

        }).fadeTo("slow", 1);  //fade the image in
        return false;
    },$(".thumb a").mouseout = function(){    //for onmouseout not used here

    });

    $(".thumb2 a").click(function(){
        var imgHref = $(this).attr('title');  //get the src of the thumbnail
        $(".thumb2 a").removeClass("selected");  //remove .selected class from all other links
        $(this).addClass("selected");  //add .selected class to current link
        $(".big2").stop();
        $(".big2").stop().fadeTo(700, 0, function() {  //fade image out
            $('.big2').attr('src', imgHref );  //give new image a src attribute
            $('.bighref2').attr('href', 'big/' + imgHref );

        }).fadeTo("slow", 1);  //fade the image in
        return false;
    },$(".thumb2 a").mouseout = function(){    //for onmouseout not used here

    });

    $(".thumb3 a").click(function(){
        var imgHref = $(this).attr('title');  //get the src of the thumbnail
        $(".thumb3 a").removeClass("selected");  //remove .selected class from all other links
        $(this).addClass("selected");  //add .selected class to current link
        $(".big3").stop();
        $(".big3").stop().fadeTo(700, 0, function() {  //fade image out
            $('.big3').attr('src', imgHref );  //give new image a src attribute
            $('.bighref3').attr('href', 'big/' + imgHref );

        }).fadeTo("slow", 1);  //fade the image in
        return false;
    },$(".thumb3 a").mouseout = function(){    //for onmouseout not used here

    });

    $(".thumb4 a").click(function(){
        var imgHref = $(this).attr('title');  //get the src of the thumbnail
        $(".thumb4 a").removeClass("selected");  //remove .selected class from all other links
        $(this).addClass("selected");  //add .selected class to current link
        $(".big4").stop();
        $(".big4").stop().fadeTo(700, 0, function() {  //fade image out
            $('.big4').attr('src', imgHref );  //give new image a src attribute
            $('.bighref4').attr('href', 'big/' + imgHref );

        }).fadeTo("slow", 1);  //fade the image in
        return false;
    },$(".thumb4 a").mouseout = function(){    //for onmouseout not used here

    });


    /*$("#slider").easySlider({
    auto: false,
    continuous: false,
    numeric: true
    });*/




    $("a[rel^='prettyPhoto']").prettyPhoto();
});

function initialize() {
    var latlng = new google.maps.LatLng(40.4624230, -3.8096894);

    var settings = {
        zoom: 14,
        center: latlng,
        mapTypeControl: false,
        mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
        navigationControl: true,
        navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
        mapTypeId: google.maps.MapTypeId.ROADMAP

    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), settings);

    var companyPos = new google.maps.LatLng(40.4624230, -3.8096894);

    var companyMarker = new google.maps.Marker({

        position: companyPos,

        map: map,

        title:"Websa100"
    })
}     

