var alto = new Number();
var ancho = new Number();
var botWidth = 20;
var botSep = 1;
var botBorder = 2;
var listBots = new Array('bot_1','bot_2','bot_3');
var listSection = new Array('section_1','section_2','section_3');
var currentSection = 'section_1';
var errorFields = new Array('firstname', 'lastname', 'address', 'city', 'zip', 'country', 'phone', 'comments');
var errorValues = new Array('First Name', 'Last Name', 'Permanent address', 'City', 'Zip Code', 'Country', 'Phone', 'Comments');

/*/ MENU SECTION 1*/
var listBG_1 = new Array('Mbot_1_1_bg','Mbot_1_2_bg','Mbot_1_3_bg','Mbot_1_4_bg','Mbot_1_5_bg','Mbot_1_6_bg','Mbot_1_7_bg','Mbot_1_8_bg', 'Mbot_1_9_bg', 'Mbot_1_10_bg','Mbot_1_11_bg');
var list_1 = new Array('Mbot_1_1','Mbot_1_2','Mbot_1_3','Mbot_1_4','Mbot_1_5','Mbot_1_6','Mbot_1_7','Mbot_1_8','Mbot_1_9', 'Mbot_1_10','Mbot_1_11');
var ClassList_1 = new Array('Mbot_1_1_Click','Mbot_1_2_Click','Mbot_1_3_Click','Mbot_1_4_Click','Mbot_1_5_Click','Mbot_1_6_Click','Mbot_1_7_Click','Mbot_1_8_Click','Mbot_1_9_Click','Mbot_1_10_Click','Mbot_1_11_Click');
var url_1 = new Array('Life_Location.html','Life_Acqua_Gallery.html','Life_Residences_Gallery.html','Life_Acquatic.html','Life_Villas.html','Life_Gallery_Shop.html','Life_Amenities_Buda.html','Life_Gallery.html','Life_Contact.html', 'Life_Picture.html','');
var backgrounds = new Array('','acquavallarta.jpg','acquaresidences.jpg','tower.jpg','villas.jpg','shop.jpg','buda.jpg','gallery.jpg','','events.jpg');

/*/ MENU SECTION 2*/
var listBG_2 = new Array('Mbot_2_1_bg','Mbot_2_2_bg','Mbot_2_3_bg','Mbot_2_4_bg','Mbot_2_5_bg','Mbot_2_6_bg');
var list_2 = new Array('Mbot_2_1','Mbot_2_2','Mbot_2_3','Mbot_2_4','Mbot_2_5','Mbot_2_6');
var ClassList_2 = new Array('Mbot_2_1_Click','Mbot_2_2_Click','Mbot_2_3_Click','Mbot_2_4_Click','Mbot_2_5_Click','Mbot_2_6_Click');
var url_2 = new Array('Play_LifeStyle.html','Play_beachClub.html','Play_garden.html','Play_Exclusive.html','Play_restaurant.html','Play_clubDanzatoria.html');

/*/ MENU SECTION 3*/
var listBG_3 = new Array('Mbot_3_1_bg','Mbot_3_2_bg','Mbot_3_3_bg');
var list_3 = new Array('Mbot_3_1','Mbot_3_2','Mbot_3_3');
var ClassList_3 = new Array('Mbot_3_1_Click','Mbot_3_2_Click','Mbot_3_3_Click');
var url_3 = new Array('Invest_Prices.html','Invest_Finance_Finance.html','Invest_Investment.html');

/*/ DOMREADY ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
$(window).ready(
    function (){
        $('.videofancy').fancybox({
            'type':'iframe'
        });
        /*/ INIT /////////////////////////////////////////////////////////////////////*/
        alto = $(window).height();
        ancho = $(window).width();

        document.body.style.overflow='hidden';

        GetData("content_1", "Life_Home.html", "");
        GetData("content_2", "Play_Home.html", "");
        GetData("content_3", "Invest_Home.html", "");


        $('#PreContent_1')[0].style.display="none";
        $('#PreContent_2')[0].style.display="none";
        $('#PreContent_3')[0].style.display="none";
	
        $("#section_1")[0].style.width = ancho + 'px';
        $("#section_1")[0].style.height = alto + 'px';
        $("#section_2")[0].style.width = ancho + 'px';
        $("#section_2")[0].style.height = alto + 'px';
        $("#section_3")[0].style.width = ancho + 'px';
        $("#section_3")[0].style.height = alto + 'px';
	
        $("#bot_1")[0].style.height = alto + 'px';
        $("#bot_2")[0].style.height = alto + 'px';
        $("#bot_3")[0].style.height = alto + 'px';
	
        $("#prebot_1")[0].style.height = alto + 'px';
        $("#prebot_2")[0].style.height = alto + 'px';
        $("#prebot_3")[0].style.height = alto + 'px';

        $("#container_1")[0].style.top = alto/2 + 'px';
        $("#container_2")[0].style.top = alto/2 + 'px';
        $("#container_3")[0].style.top = alto/2 + 'px';
	
        $("#section_1")[0].style.left = '0px';
        $("#section_2")[0].style.left = ancho + 'px';
        $("#section_3")[0].style.left = ancho + 'px';
	
        $("#bot_1")[0].style.left = '0px';
        $("#bot_2")[0].style.left = ancho - (botWidth*2) - botSep - botBorder + 'px';
        $("#bot_3")[0].style.left = ancho - botWidth - botBorder + 'px';
	
        $('#bot_1')[0].style.width = '0px';
	
        $("#prebot_1")[0].style.left = '0px';
        $("#prebot_2")[0].style.left = ancho - (botWidth*2) - botSep - botBorder + 'px';
        $("#prebot_3")[0].style.left = ancho - botWidth - botBorder + 'px';
	
        $('#prebot_1')[0].style.width = '0px';
	
        /*/ BOTS ////////////////////////////////////////////////////////////////////*/
        /*var slide_container_1 = new Fx.Styles($('#container_1'), {duration:200, wait:false});
	var slide_container_2 = new Fx.Styles($('#container_2'), {duration:200, wait:false});
	var slide_container_3 = new Fx.Styles($('#container_3'), {duration:200, wait:false});*/
	
        //$('#logo_1').style.left = ancho-100-$('#logo_1').offsetWidth + 'px';
        //$('#logo_2').style.left = ancho-100-$('#logo_2').offsetWidth + 'px';
        //$('#logo_3').style.left = ancho-100-$('#logo_3').offsetWidth + 'px';
        Resize();
        /*/ BOT 1 //////////////////*/
        /*/ ROLL OVER */
        $('#prebot_1').mouseenter(function(){
            if (currentSection=='section_2') {
                $('#bot_1').animate({
                    'width': (botWidth*2)+'px'
                });
                $('#prebot_1').animate({
                    'width': (botWidth*2)+'px'
                });
            } else if (currentSection=='section_3') {
                $('#bot_1').animate({
                    'width': (botWidth*2)+'px',
                    'left': botBorder + 'px'
                });
                $('#bot_2').animate({
                    'width': botWidth+'px',
                    'left': (botWidth*2) + botSep + botBorder + 'px'
                });
                $('#prebot_1').animate({
                    'width': (botWidth*2)+'px',
                    'left': botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'width': botWidth+'px',
                    'left': (botWidth*2) + botSep + botBorder + 'px'
                });
            }
        });
	
 	
        /*/ ROLL OUT*/
        $('#prebot_1').mouseleave(function(){
            if (currentSection=='section_2') {
                $('#bot_1').animate({
                    'width': botWidth+'px'
                });
                $('#prebot_1').animate({
                    'width': botWidth+'px'
                });
            } else if (currentSection=='section_3') {
                $('#bot_1').animate({
                    'width': botWidth+'px',
                    'left': botBorder + 'px'
                });
                $('#bot_2').animate({
                    'width': botWidth+'px',
                    'left': botWidth + botSep + botBorder + 'px'
                });
                $('#prebot_1').animate({
                    'width': botWidth+'px',
                    'left': botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'width': botWidth+'px',
                    'left': botWidth + botSep + botBorder + 'px'
                });
            }
        });
	
        /*/ PRESS */
        $('#prebot_1').mousedown(function(){
            if (currentSection=='section_2') {
                $('#bot_2').animate({
                    'width': botWidth+'px',
                    'left': ancho - (botWidth*2) - botSep - botBorder + 'px'
                });
                $('#bot_3').animate({
                    'left': ancho - botWidth - botBorder + 'px'
                });
                $('#bot_1').animate({
                    'width': '0px',
                    'left': botWidth + botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'width': botWidth+'px',
                    'left': ancho - (botWidth*2) - botSep - botBorder + 'px'
                });
                $('#prebot_3').animate({
                    'left': ancho - botWidth - botBorder + 'px'
                });
                $('#prebot_1').animate({
                    'width': '0px',
                    'left': botWidth + botBorder + 'px'
                });
                $('#section_2').animate({
                    'left': ancho + 'px'
                });
                $('#section_3').animate({
                    'left': ancho + 'px'
                });
			
                currentSection='section_1';
			
            } else if (currentSection=='section_3') {
                $('#bot_3').animate({
                    'width': botWidth+'px',
                    'left': ancho - botWidth - botBorder + 'px'
                });
                $('#bot_2').animate({
                    'left': ancho - (botWidth*2) - botSep - botBorder + 'px'
                });
                $('#bot_1').animate({
                    'width': '0px',
                    'left': botWidth + botBorder + 'px'
                });
                $('#prebot_3').animate({
                    'width': botWidth+'px',
                    'left': ancho - botWidth - botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'left': ancho - (botWidth*2) - botSep - botBorder + 'px'
                });
                $('#prebot_1').animate({
                    'width': '0px',
                    'left': botWidth + botBorder + 'px'
                });
                $('#section_2').animate({
                    'left': ancho + 'px'
                });
                $('#section_3').animate({
                    'left': ancho + 'px'
                });
		
                currentSection='section_1';
            }
        });
	
        /*/ BOT 2 //////////////*/
        /*/ ROLL OVER */
        $('#prebot_2').mouseenter(function(){
            if (currentSection=='section_1') {
                $('#bot_2').animate({
                    'width': (botWidth*2)+'px',
                    'left': ancho - (botWidth*3) - botSep - botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'width': (botWidth*2)+'px',
                    'left': ancho - (botWidth*3) - botSep - botBorder + 'px'
                });
            } else if (currentSection=='section_3') {
                $('#bot_2').animate({
                    'width': (botWidth*2)+'px',
                    'left': botWidth + botSep + botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'width': (botWidth*2)+'px',
                    'left': botWidth + botSep + botBorder + 'px'
                });
            }
        });
 	
        /*/ ROLL OUT*/
        $('#prebot_2').mouseleave(function(){
            if (currentSection=='section_1') {
                $('#bot_2').animate({
                    'width': botWidth+'px',
                    'left': ancho - (botWidth*2) - botSep - botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'width': botWidth+'px',
                    'left': ancho - (botWidth*2) - botSep - botBorder + 'px'
                });
            } else if (currentSection=='section_3') {
                $('#bot_2').animate({
                    'width': botWidth+'px',
                    'left': botWidth + botSep + botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'width': botWidth+'px',
                    'left': botWidth + botSep + botBorder + 'px'
                });
            }
        });
	
        /*/ PRESS*/
        $('#prebot_2').mousedown(function(){
            if (currentSection=='section_1') {
                $('#bot_1').animate({
                    'width': botWidth + 'px',
                    'left': botBorder + 'px'
                });
                $('#bot_2').animate({
                    'left': botWidth + botSep + botBorder + 'px',
                    'width': '0px'
                });
                $('#prebot_1').animate({
                    'width': botWidth + 'px',
                    'left': botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'left': botWidth + botSep + botBorder + 'px',
                    'width': '0px'
                });
                $('#section_2').animate({
                    'left': '0px'
                });
		
                currentSection='section_2';
			
            } else if (currentSection=='section_3') {
                $('#bot_3').animate({
                    'left':  ancho - botWidth - botBorder + 'px',
                    'width': botWidth+'px'
                });
                $('#bot_2').animate({
                    'width': '0px'
                });
                $('#prebot_3').animate({
                    'left':  ancho - botWidth - botBorder + 'px',
                    'width': botWidth+'px'
                });
                $('#prebot_2').animate({
                    'width': '0px'
                });
                $('#section_3').animate({
                    'left': ancho + 'px'
                });
                $('#section_2').animate({
                    'left': '0px'
                });
		
                currentSection='section_2';
            }
        });
	
        /*/ BOT 3 ///////////*/
        /*/ ROLL OVER	*/
        $('#prebot_3').mouseenter(function(){
            if (currentSection=='section_1') {
                $('#bot_3').animate({
                    'width': (botWidth*2)+'px',
                    'left': ancho - (botWidth*2) - botBorder + 'px'
                });
                $('#bot_2').animate({
                    'left': ancho - (botWidth*3) - botSep - botBorder + 'px',
                    'width': botWidth+'px'
                });
                $('#prebot_3').animate({
                    'width': (botWidth*2)+'px',
                    'left': ancho - (botWidth*2) - botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'left': ancho - (botWidth*3) - botSep - botBorder + 'px',
                    'width': botWidth+'px'
                });
            } else if (currentSection=='section_2') {
                $('#bot_3').animate({
                    'width': (botWidth*2)+'px',
                    'left': ancho - (botWidth*2) - botBorder + 'px'
                });
                $('#prebot_3').animate({
                    'width': (botWidth*2)+'px',
                    'left': ancho - (botWidth*2) - botBorder + 'px'
                });
            }
        });
	
        /*/ ROLL OUT*/
        $('#prebot_3').mouseleave(function(){
            if (currentSection=='section_1') {
                $('#bot_3').animate({
                    'width': botWidth+'px',
                    'left': ancho - botWidth - botBorder + 'px'
                });
                $('#bot_2').animate({
                    'left': ancho - (botWidth*2) - botSep - botBorder + 'px',
                    'width': botWidth+'px'
                });
                $('#prebot_3').animate({
                    'width': botWidth+'px',
                    'left': ancho - botWidth - botBorder + 'px'
                });
                $('#prebot_2').animate({
                    'left': ancho - (botWidth*2) - botSep - botBorder + 'px',
                    'width': botWidth+'px'
                });
            } else if (currentSection=='section_2') {
                $('#bot_3').animate({
                    'width': botWidth+'px',
                    'left': ancho - botWidth - botBorder + 'px'
                });
                $('#prebot_3').animate({
                    'width': botWidth+'px',
                    'left': ancho - botWidth - botBorder + 'px'
                });
            }
        });
	
        /*/ PRESS*/
        $('#prebot_3').mousedown(function(){
            if (currentSection=='section_1') {
                $('#bot_1').animate({
                    'width': botWidth + 'px',
                    'left': botBorder +'px'
                });
                $('#bot_3').animate({
                    'left': (botWidth*2) + botSep + botBorder + 'px',
                    'width': '0px'
                });
                $('#bot_2').animate({
                    'left': botWidth + botSep + botBorder +'px'
                });
                $('#prebot_1').animate({
                    'width': botWidth + 'px',
                    'left': botBorder +'px'
                });
                $('#prebot_3').animate({
                    'left': (botWidth*2) + botSep + botBorder + 'px',
                    'width': '0px'
                });
                $('#prebot_2').animate({
                    'left': botWidth + botSep + botBorder +'px'
                });
                $('#section_2').animate({
                    'left': botWidth + botSep + botBorder + 'px'
                });
                $('#section_3').animate({
                    'left': '0px'
                });
		
                currentSection='section_3';
			
            } else if (currentSection=='section_2') {
                $('#bot_2').animate({
                    'width': botWidth+'px'
                });
                $('#bot_3').animate({
                    'left': (botWidth*2) + botSep + botBorder + 'px',
                    'width': '0px'
                });
                $('#prebot_2').animate({
                    'width': botWidth+'px'
                });
                $('#prebot_3').animate({
                    'left': (botWidth*2) + botSep + botBorder + 'px',
                    'width': '0px'
                });
                $('#section_3').animate({
                    'left': '0px'
                });
		
                currentSection='section_3';
            }
        });
	
	
        /*/ MENU BOTTOM /////////////////////////////////////////////////////////////*/
	
        /*/MENU SECTION 1*/
        var botsH_1 = $("#bots_1")[0].offsetHeight;

        var botsPos_1 = Math.ceil(alto-botsH_1);
        $("#bots_1")[0].style.top = botsPos_1+"px";
	
        for (i=0; i<listBG_1.length; i++)
        {
            fncBots_1(i);
        }
	
        /*/MENU SECTION 2*/
        var botsH_2 = $("#bots_2")[0].offsetHeight;

        var botsPos_2 = Math.ceil(alto-botsH_2);
        $("#bots_2")[0].style.top = botsPos_2+"px";
	
        for (i=0; i<listBG_2.length; i++)
        {
            fncBots_2(i);
        }
	
        /*/MENU SECTION 2*/
        var botsH_3 = $("#bots_3")[0].offsetHeight;

        var botsPos_3 = Math.ceil(alto-botsH_3);
        $("#bots_3")[0].style.top = botsPos_3+"px";
	
        for (i=0; i<listBG_3.length; i++)
        {
            fncBots_3(i);
        }
	

    }
    );
/*/ Pizza=New Que_Sabrosas( function(){ 'Tel1':  4721-0673 , 'Tel2': 4721-0180 }*/
									
/*/ FUNC BOTS SECTION 1		*/
function fncBots_1(cual) {
    var element =  $('#'+list_1[cual]);
	
    var trigger = function(){
        $('.fancy').fancybox({titlePosition:'over'});
        if(backgrounds[cual] && backgrounds[cual].length > 0){
            $('#section_1').css('background','transparent no-repeat url(Images/background/'+backgrounds[cual]+') left top');
        }
    }

    element.click(function (e){
        j=1;
        for(i=0;i<listBG_1.length;i++)
        {
            $('#'+list_1[i])[0].className='Mbot_1_'+j+' btn';
            j++;
        }
        p=cual+1;
        $('#Position_1').removeClass($('#Position_1')[0].className);
        $('#Position_1').addClass('Position_1_'+p);
        //$('#Img_'+list_1[cual])[0].style.display='none';
        element.removeClass(element[0].className);
        element.addClass(ClassList_1[cual]);
        element.addClass('btn');
        if(false)
            $('#PreContent_1')[0].style.display="";
        $('#content_1').load(url_1[cual],null,function(){
            trigger();
        });
    });
    var onPos = (cual+1),
    duration = {
        duration:200
    },
    pico = element.find('.pico'),
    submenu = element.find('.submenu'),
    h = submenu.height();
    /*submenu.find('a').click(function(e){
               e.preventDefault();
           })*/
    element.mouseenter(function(){
        var on = $('#on'+onPos);
        if(on){
            on.css('display','block');
        }
            
        if(pico.length>0){
            pico.css('visibility','visible')
        }
        element.addClass(ClassList_1[cual]);
        element.animate({
            'padding-top':25,
            'margin-top':-25
        },duration)
            
        if(submenu.length>0){
            submenu.css({
                'height':0,
                'display':'block'
            });
            submenu.animate({
                'height':h
            },duration)
        }
    });
	
    element.mouseleave(function(){
        var on = $('#on'+onPos);
        if(on)
            on.css('display','none')
        if(pico.length>0){
            pico.css('visibility','hidden')
        }
        element.removeClass(ClassList_1[cual]);
        element.animate({
            'padding-top':0,
            'margin-top':0
        },duration)

        if(submenu.length>0){
            submenu.animate({
                'height':0
            },{
                duration:200,
                complete:function(){
                    submenu.css('display','none')
                    }
                })
    }
    });
}



/*/ FUNC BOTS SECTION 2		*/							
function fncBots_2(cual) {
    var elementBG =  $('#'+listBG_2[cual]);
    var element =  $('#'+list_2[cual]);
	
    elementBG.click(function (){
        j=1;
        for(i=0;i<listBG_2.length;i++)
        {
            $('#'+list_2[i])[0].className='Mbot_2_'+j;
            $('#Img_'+list_2[i])[0].style.display='';
            j++;
        }
        p=cual+1;
        $('#Position_2').removeClass($('#Position_2')[0].className);
        $('#Position_2').addClass('Position_2_'+p);
        $('#Img_'+list_2[cual])[0].style.display='none';
        $(element).removeClass(element);
        $(element).addClass(ClassList_2[cual]);
        $('#PreContent_2')[0].style.display="";

        $('#content_2').load(url_2[cual]);

    });
	
    element.mouseenter(function(){
        elementBG.animate({
            'height': 163 + 'px',
            'bottom': -40 + 'px'
        },{
            duration:200
        });
	
    });
    elementBG.mouseenter(function(){
        elementBG.animate({
            'height': 163 + 'px',
            'bottom': -40 + 'px'
        },{
            duration:200
        });
	
    });
	
	
    /*element.mouseleave(function(){
		elementBG.animate({
			'height': '0px',
			'bottom': -60 + 'px'
		},{duration:200});
	});*/
    elementBG.mouseleave(function(){
        elementBG.animate({
            'height': '0px',
            'bottom': -60 + 'px'
        },{
            duration:200
        });
    });
}



/*/ FUNC BOTS SECTION 3		*/
function fncBots_3(cual) {
    var elementBG =  $('#'+listBG_3[cual]);
    var element =  $('#'+list_3[cual]);
    //var Class = $(ClassList[cual]);
    elementBG.click(function (){
        j=1;
        for(i=0;i<listBG_3.length;i++)
        {
            $('#'+list_3[i])[0].className='Mbot_3_'+j;
            $('#Img_'+list_3[i])[0].style.display='';
            j++;
        }
        p=cual+1;
        $('#Position_3').removeClass($('#Position_3').className);
        $('#Position_3').addClass('Position_3_'+p);
        $('#Img_'+list_3[cual])[0].style.display='none';
        $(element).removeClass(element);
        $(element).addClass(ClassList_3[cual]);
        $('#PreContent_3')[0].style.display="";

        $('#content_3').load(url_3[cual]);
    });
	
    element.mouseenter(function(){
        elementBG.animate({
            'height': 163 + 'px',
            'bottom': -40 + 'px'
        },{
            duration:200
        });
	
    });
    elementBG.mouseenter(function(){
        elementBG.animate({
            'height': 163 + 'px',
            'bottom': -40 + 'px'
        },{
            duration:200
        });
	
    });
	
	
    /*element.mouseleave(function(){
		elementBG.animate({
			'height': '0px',
			'bottom': -60 + 'px'
		},{duration:200});
	});*/
    elementBG.mouseleave(function(){
        elementBG.animate({
            'height': '0px',
            'bottom': -60 + 'px'
        },{
            duration:200
        });
    });
}


/*/ WINDOW RESIZE /////////////////////////////////////////////////////////////////////////////////////////////////*/
$(window).resize(function(){
    Resize();
});



function GetData(NameDiv, Page, Values)
{
    $('#'+NameDiv).load(Page,null,function(){
        $('.fancy').fancybox({titlePosition:'over'});
    });    
/*var myAjax = new Ajax(Page, {method: 'get',update: ,evalScripts: true + Values});
 myAjax.request();*/
}

function MM_swapImgRestore() { /*/v3.0*/
    var i,x,a=document.MM_sr;
    for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { /*/v3.0*/
    var d=document;
    if(d.images){
        if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
        for(i=0; i<a.length; i++)
            if (a[i].indexOf("#")!=0){
                d.MM_p[j]=new Image;
                d.MM_p[j++].src=a[i];
            }
        }
}

function MM_findObj(n, d) { /*/v4.01*/
    var p,i,x;
    if(!d) d=document;
    if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document;
        n=n.substring(0,p);
    }
    if(!(x=d[n])&&d.all) x=d.all[n];
    for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n);
    return x;
}

function MM_swapImage() { /*/v3.0*/
    var i,j=0,x,a=MM_swapImage.arguments;
    document.MM_sr=new Array;
    for(i=0;i<(a.length-2);i+=3)
        if ((x=MM_findObj(a[i]))!=null){
            document.MM_sr[j++]=x;
            if(!x.oSrc) x.oSrc=x.src;
            x.src=a[i+2];
        }
}

function sendForm(formName, Section, URL){
    var errores = 0;
    for (i=0; i<errorFields.length; i++) {
        if ($('#'+errorFields[i]).val() =='' || $('#'+errorFields[i]).val() == errorValues[i]) {
            errores = 1;
            $('#err_'+errorFields[i])[0].style.display = 'block';
        } else {
            $('#err_'+errorFields[i])[0].style.display = 'none';
        }
    }
	
    if ($('#email').val() =='' || $('#email').val() == 'Email') {
        errores = 1;
        $('#err_email')[0].style.display = 'block';
    } else if ($('#email')[0].value.indexOf('@')==-1 || $('#email')[0].value.indexOf('.')==-1 ) {
        errores = 2;
        $('#err_email')[0].style.display = 'block';
    } else {
        $('#err_email')[0].style.display = 'none';
    }
	
    if (errores == 1) {
        $('#err_msg')[0].innerHTML = 'ERROR: fields with * are required.';
        $('#err_msg')[0].style.display = 'block';
    } else if (errores == 2) {
        $('#err_msg')[0].innerHTML = 'ERROR: a valid Email address is required.';
        $('#err_msg')[0].style.display = 'block';
    } else {
        $('#err_msg')[0].style.display = 'none';
        $(formName).submit(function() {
            GetData(Section, URL, '');
        }
        );

    }
				
}

function Precontent(Id,Action)
{
    if(Action==1)
    {
        $('#PreContent_'+Id)[0].style.display='';
    }
    else
    {
        $('#PreContent_'+Id)[0].style.display='none';
    }
}
function CleanButton(Id,StyleSection){
    j=1;
    for(i=0;i<eval('listBG_'+StyleSection).length;i++) {
        var arr = eval('list_'+StyleSection);
        $('#'+arr[i])[0].className='Mbot_'+StyleSection+'_'+j;
        $('#Img_'+arr[i])[0].style.display='';
        j++;
    }
	
    p=Id+1;
    $('#Position_'+StyleSection).removeClass($('#Position_'+StyleSection).className);
    $('#Position_'+StyleSection).addClass('Position_'+StyleSection+'_'+p);
	
    if (Id!=0) {
        var arr2 = eval('ClassList_'+StyleSection);
        element = $('#'+arr[Id]);
        $('#Img_'+arr[Id])[0].style.display='none';
        element.removeClass(element[0].className);
        element.addClass(arr2[Id]);
    }
}

/*function sendForm(formName, Section, URL){
			$(formName).addEvent('submit', function(e) {
				new Event(e).stop();
				this.send({
						method: 'post',  
						onComplete: function() {
						GetData(Section, URL, '');
					}
				});
			});
}*/
function Resize()
{
    alto = $(window).height();
    ancho = $(window).width();
    

    $("#section_1")[0].style.width = ancho + 'px';
    $("#section_1")[0].style.height = alto + 'px';
    $("#section_2")[0].style.width = ancho + 'px';
    $("#section_2")[0].style.height = alto + 'px';
    $("#section_3")[0].style.width = ancho + 'px';
    $("#section_3")[0].style.height = alto + 'px';
	
    $("#bot_1")[0].style.height = alto + 'px';
    $("#bot_2")[0].style.height = alto + 'px';
    $("#bot_3")[0].style.height = alto + 'px';
	
    $("#prebot_1")[0].style.height = alto + 'px';
    $("#prebot_2")[0].style.height = alto + 'px';
    $("#prebot_3")[0].style.height = alto + 'px';
	
    $("#container_1")[0].style.top = alto/2 - $("#container_1")[0].offsetHeight/2 + 'px';
    $("#container_2")[0].style.top = alto/2 - $("#container_2")[0].offsetHeight/2 + 'px';
    $("#container_3")[0].style.top = alto/2 - $("#container_3")[0].offsetHeight/2 + 'px';
	
    if (currentSection=='section_1')
    {
        $("#section_1")[0].style.left = '0px';
        $("#section_2")[0].style.left = ancho + 'px';
        $("#section_3")[0].style.left = ancho + 'px';
        $("#bot_1")[0].style.left = botBorder + 'px';
        $("#bot_2")[0].style.left = ancho - (botWidth*2) - botSep - botBorder + 'px';
        $("#bot_3")[0].style.left = ancho - botWidth - botBorder + 'px';
        $("#prebot_1")[0].style.left = botBorder + 'px';
        $("#prebot_2")[0].style.left = ancho - (botWidth*2) - botSep - botBorder + 'px';
        $("#prebot_3")[0].style.left = ancho - botWidth - botBorder + 'px';
    }
    else if (currentSection=='section_2')
    {
        $("#section_1")[0].style.left = '0px';
        $("#section_2")[0].style.left = '0px';
        $("#section_3")[0].style.left = ancho + 'px';
        $("#bot_1")[0].style.left = botBorder + 'px';
        $("#bot_2")[0].style.left = botWidth + botSep + botBorder + 'px';
        $("#bot_3")[0].style.left = ancho - botWidth - botBorder + 'px';
        $("#prebot_1")[0].style.left = botBorder + 'px';
        $("#prebot_2")[0].style.left = botWidth + botSep + botBorder + 'px';
        $("#prebot_3")[0].style.left = ancho - botWidth - botBorder + 'px';
    }
    else if (currentSection=='section_3')
    {
        $("#section_2")[0].style.left = '0px';
        $("#section_1")[0].style.left = '0px';
        $("#section_3")[0].style.left = '0px';
        $("#bot_1")[0].style.left = botBorder + 'px';
        $("#bot_2")[0].style.left = botWidth + botSep + botBorder + 'px';
        $("#bot_3")[0].style.left = (botWidth*2) + botSep  + botBorder + 'px';
        $("#prebot_1")[0].style.left = botBorder + 'px';
        $("#prebot_2")[0].style.left = botWidth + botSep + botBorder + 'px';
        $("#prebot_3")[0].style.left = (botWidth*2) + botSep  + botBorder + 'px';
    }
}
function hidemenu(){
    var amnities = $('#menu_amenites'),
    menu = $('#menu_1');
    menu.hide('slow', function(){
        amnities.show('slow')
    });
}
function showmenu(){
    var amnities = $('#menu_amenites'),
    menu = $('#menu_1');
    if(menu.css('display')=='none'){

        amnities.hide('slow', function(){
            menu.show('slow')
        });
    }
}
//Backgroubnds para amenities
var bgs = new Array('buda.jpg','cafe.jpg','coccon.jpg','danzatorias.jpg','living.jpg','pacha.jpg','segafredo.jpg','sky.jpg','pub.jpg','tahiti.jpg','views.jpg','arquitectura.jpg');
function chgbh(pos){
    if(arguments[1]==true)
        setTimeout(function(){
            $('#section_1').css('background','transparent no-repeat url(Images/background/'+bgs[pos]+') left top');
            //alert('entra');
        }, 300);
    else
        $('#section_1').css('background','transparent no-repeat url(Images/background/'+bgs[pos]+') left top');
    //return false
}
