$(document).ready(function() { var tab_actu=5; var pos_start_tab=-710; var pos_tab=0; var bg_pos=0; var tab_content_height=0; var tab_content_top=0; var page_active=5; var img_actu=0; var index_actu=0; var last_img=$('#slide_images_home img:last-child').attr('id'); var img_total=Number(last_img.substring(9,last_img.length)); var home_play=true; clickTabs=function(tab_num, tab_height){ page_active=tab_num; if(tab_actu!=5){ $('#tab'+tab_actu+' .tab_content').fadeOut(500, function(){ move_tabs(tab_num, tab_height); }); }else{ move_tabs(tab_num, tab_height); } } move_tabs=function(tab_num, tab_height){ $('#tab'+tab_actu+' .tab_content').empty(); pos_tab=pos_start_tab+tab_height; tab_content_height=tab_height-110; tab_content_top=$('#tabs .tab').height()-tab_height+5; $('#click'+tab_num).animate({top:(tab_height+150)}, 1000).css({zIndex:185-tab_num}); $('#tab'+tab_num).animate({marginTop:pos_tab},1000, function(){ CallAjaxContent(tab_num); $('#tab'+tab_num+' .tab_box').css({marginTop:tab_content_top, height:tab_content_height}); $('#tab'+tab_num+' .tab_content').fadeIn(500); tab_actu=tab_num; }).css({zIndex:180-tab_num}); for(i=tab_num+1;i<=5;i++){ $('#click'+i).animate({top:(tab_height+150)}, 1000).css({zIndex:185-i}); $('#tab'+i).animate({marginTop:pos_tab},1000).css({zIndex:180-i}); } for(i=tab_num-1;i>=1;i--){ pos_tab=$('#tab'+i).css("marginTop"); $('#click'+i).animate({top:"150px"}, 1000).css({zIndex:228-i}); $('#tab'+i).animate({marginTop:pos_start_tab},1000).css({zIndex:220-i}); } if(tab_height>540){ bg_pos=140+(tab_height-570); $('#slide_images_home').animate({marginTop:bg_pos}, 1000); }else{ $('#slide_images_home').animate({marginTop:"140px"}, 1000); } if(tab_num < 5 && home_play==true){ clearTimeout(int_home); home_play=false; }else if(tab_num == 5 && home_play==false){ home_play=true; int_home = window.setTimeout(function(){slide_home();}, 5000); } $('#jquery-lightbox').fadeOut(function(){ $('#jquery-lightbox').remove(); }); $('#jquery-overlay').fadeOut(function(){ $('#jquery-overlay').remove(); }); if(tab_num==3){ $('#footer_hide').fadeIn(); }else if($('#footer_hide').css('display')!='none'){ $('#footer_hide').fadeOut(); } if(tab_num==5){ $('.tab_box').css({display:"none"}); }else{ $('.tab_box').css({display:"block"}); } if(tab_num!=1){ $('#infos_objects_confidential').fadeOut(); } } CallAjaxContent=function(tab_num){//--------------------------------------------------- DEV PART : call pages with AJAX if (1 <= tab_num <= 4) { var initialPages = new Array('','objects/index?deal=sale','objects/map/','main/presentation/','objects/references/'); LoadContentByAjax(urlPrefix + initialPages[tab_num], tab_num); } } // get, handle and load content in #tab1,2,3,4 LoadContentByAjax=function(urlToLoad, tab_num){ if ('-1'==urlToLoad.search("[?]")) { urlToLoad = urlToLoad + '?'; } urlToLoad = urlToLoad + '&internalLoad=1'; // Miljan requested on 10.12.2010. [do not show map page] //if (2==tab_num) return true; //alert('loading for tab_num ' + tab_num + ' content from ' + urlToLoad); $('#tab' + tab_num + ' .tab_content').load(urlToLoad, function(data,s,t){ $('#tab' + tab_num + ' .tab_content a').click(function(e){ aTagNewBehaviour(e, $(this)); }); adjustForms(); loadScroll(tab_num); loadLightBox(); }); } loadLightBox=function(){ $('#gallery_points .pics').lightBox(); $('.lightbox_link').lightBox(); } loadScroll=function(tab_num){ if(document.getElementById('zoomimage')){ $('#zoomimage img').after('
'); } if(tab_num==2 && document.getElementById('return_to_map')){ $('#return_to_map').css({display:"block"}); //$('.deal_filter').css({display:"none"}); }else if(tab_num==4 && document.getElementById('return_references')){ $('#return_references').css({display:"block"}); } if(tab_num==1 && document.getElementById('object_container')){ $('#infos_objects_confidential').fadeIn(); }else if(tab_num==1 && document.getElementById('info2_container')){ $('#infos_objects_confidential').fadeOut(); } contentAjax_height=$('.content').height(); $('.tab .tab_content').css({height:contentAjax_height}); $('.scroll-pane').jScrollPane( { verticalDragMinHeight: 40, verticalDragMaxHeight: 100 } ); if(contentAjax_height>$('.tab_scroll').height()){ if($('.content').attr('id')=="object_container"){ $('#gradient_top').remove(); $('#gradient_bottom').remove(); $('#tab'+page_active+' .jspContainer .jspVerticalBar').after('
'); $('#tab'+page_active+' #gradient_bottom').css({display:"block"}); }else{ $('#gradient_top').remove(); $('#gradient_bottom').remove(); } } if(tab_num==4){ var slide_width = $('.detail_object .slide_images').width(); var box_width = $('.detail_object .box_images').width(); var difference = slide_width - (box_width-90); var speed = 2.5; var margin_left = $('.detail_object .slide_images').css("marginLeft"); var px_pos = margin_left.indexOf(" px", 0) var number_margin = margin_left.substring(0,px_pos); var speed_left = Math.abs(Number(number_margin))*speed; var speed_right = Math.abs(Number(number_margin)+difference)*speed; $('.detail_object .detail_slide_left').css({opacity:"0.6"}); //$('.detail_object .detail_slide_left').css({filter:"alpha(opacity=60)"}); if(slide_width>box_width){ $('.detail_object .detail_slide').css({display:"inline"}); }else{ $('.detail_object .detail_slide').css({display:"none"}); } $('.detail_object .detail_slide_left').mouseover(function(){ if($(this).css("opacity")=="1"){ $(this).css({cursor:"pointer"}); }else{ $(this).css({cursor:"default"}); } $('.detail_object .slide_images').animate({marginLeft:0}, speed_left); }); $('.detail_object .detail_slide_right').mouseover(function(){ if($(this).css("opacity")=="1"){ $(this).css({cursor:"pointer"}); }else{ $(this).css({cursor:"default"}); } $('.detail_object .slide_images').animate({marginLeft:-difference}, speed_right); }); $('.detail_object .detail_slide').mouseout(function(){ $('.detail_object .slide_images').stop(); margin_left = $('.detail_object .slide_images').css("marginLeft"); px_pos = margin_left.indexOf("px", 0) number_margin = margin_left.substring(0,px_pos); speed_left = Math.abs(Number(number_margin))*speed; speed_right = Math.abs(Number(number_margin)+difference)*speed; if(number_margin!="0" && $('.detail_object .detail_slide_left').css("opacity")=="0.6"){ $('.detail_object .detail_slide_left').animate({opacity:"1"}); //$('.detail_object .detail_slide_left').css({filter:"alpha(opacity=100)"}); }else if(number_margin=="0" && $('.detail_object .detail_slide_left').css("opacity")!="0.6"){ $('.detail_object .detail_slide_left').animate({opacity:"0.6"}); //$('.detail_object .detail_slide_left').css({filter:"alpha(opacity=60)"}); } if(Math.abs(Number(number_margin))!=difference && $('.detail_object .detail_slide_right').css("opacity")=="0.6"){ $('.detail_object .detail_slide_right').animate({opacity:"1"}); //$('.detail_object .detail_slide_right').css({filter:"alpha(opacity=100)"}); }else if(Math.abs(Number(number_margin))==difference && $('.detail_object .detail_slide_right').css("opacity")!="0.6"){ $('.detail_object .detail_slide_right').animate({opacity:"0.6"}); //$('.detail_object .detail_slide_right').css({filter:"alpha(opacity=60)"}); } }); } /*$('.jspDrag').mouseup(function(){ $(this).stop(); });*/ } /*var bigPicHref=''; $('#gallery_points a.pics').hover(function(){ bigPicHref=$(this).attr('href'); $('#mainimage a#zoomimage').attr('href', bigPicHref); $('#mainimage a#zoomimage').attr('onclick', ''); },function(){ });*/ var positionJspPane=0; var bottomMax=0; setInterval(function(){ if($('.content').attr('id')=="object_container"){ positionJspPane=$('#tab'+page_active+' .jspPane').position(); bottomMax=0-$('#tab'+page_active+' .jspPane').height()+$('#tab'+page_active+' .jspContainer').height(); contentAjax_height=$('.content').height(); if(contentAjax_height>$('.tab_scroll').height()){ if(positionJspPane.top!=0 && $('#gradient_top').css("display")=="none"){ $('#gradient_top').fadeIn(500); } if(positionJspPane.top==0 && $('#gradient_top').css("display")=="block"){ $('#gradient_top').fadeOut(500); } if(positionJspPane.top != bottomMax && $('#gradient_bottom').css("display")=="none"){ $('#gradient_bottom').fadeIn(500); } if(positionJspPane.top == bottomMax && $('#gradient_bottom').css("display")=="block"){ $('#gradient_bottom').fadeOut(500); } }else{ $('#gradient_top').css({display:"none"}); $('#gradient_bottom').css({display:"none"}); } }else{ $('#gradient_top').remove(); $('#gradient_bottom').remove(); } }, 200); var slide_home=function(){ index_actu=$('#slide_images_home #home_pic_'+img_actu).css("zIndex"); $('#slide_images_home #home_pic_'+img_actu).fadeOut(1000, function(){ $(this).css({zIndex:index_actu-img_total-1, display:"block"}); if(img_actu==img_total){ img_actu=0; index_actu=img_total+1; for(z=0;z <= img_total;z++){ index_actu--; $('#slide_images_home #home_pic_'+z).css({zIndex:index_actu}); } }else{ img_actu++; } }); clearTimeout(int_home); if(home_play==true){ int_home = window.setTimeout(function(){slide_home();}, 5000); } } int_home = window.setTimeout(function(){slide_home();}, 5000); adjustForms=function() { if ($("#form_contact").length) { alert('executing adjustContactForm'); adjustContactForm(); } if ($("#loginform").length) { alert('executing adjustLoginForm'); adjustLoginForm(); } if ($("#forgotten_login").length) { alert('executing adjustForgottenLoginForm'); adjustForgottenLoginForm(); } } /*$('a#contact').toggle(function(){ alert('test'); $('#contact_visit').slideDown(500); }, function(){ $('#contact_visit').slideUp(500); });*/ }); /* ** main/contact ** */ // Adjusting form behaviour on main/contact page function adjustContactForm() { //validate form $("#form_contact a.button").click(function(){ //process the contact form //data var firstname = $("input#firstname").val(); var lastname = $("input#lastname").val(); var societe = $("input#societe").val(); var street = $("input#street").val(); var postalcode = $("input#postalcode").val(); var city = $("input#city").val(); var telephone = $("input#telephone").val(); var email = $("input#email").val(); var message = $("textarea#texte").val(); var contact = $("input#contact").val(); var form_protector_canary = $("input[name=form_protector_canary]").val(); var know_agency = $("select#know_agency").val(); var know_agency_othertxt = $("input#know_agency_othertxt").val(); var phpfile = $("form#form_contact").attr('action'); var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; //errors? if (firstname == "") { $("input#firstname").focus(); $("span#spanFirstname").addClass('error'); return false; } if (firstname != "") { $("span#spanFirstname").removeClass('error'); } if (lastname == "") { $("input#lastname").focus(); $("span#spanLastname").addClass('error'); return false; } if (lastname != "") { $("span#spanLastname").removeClass('error'); } if (telephone == "") { $("input#telephone").focus(); $("span#spanTelephone").addClass('error'); return false; } if (telephone != "") { $("span#spanTelephone").removeClass('error'); } if (email == "") { $("input#email").focus(); $("span#spanEmail").addClass('error'); return false; } if (email != "") { $("span#spanEmail").removeClass('error'); } if (!emailReg.test(email)) { $("input#email").focus(); $("span#spanEmail").addClass('error'); return false; } if (know_agency == "") { $("input#know_agency").focus(); $("span#spanKnow_agency").addClass('error'); return false; } if (know_agency != "") { $("span#spanKnow_agency").removeClass('error'); } var dataString = 'firstname='+ firstname + '&lastname=' + lastname + '&societe=' + societe + '&street=' + street + '&postalcode=' + postalcode + '&city=' + city + '&telephone=' + telephone + '&email=' + email + '&texte=' + message + '&contact=' + contact + '&form_protector_canary=' + form_protector_canary + '&know_agency=' + know_agency + '&know_agency_othertxt=' + know_agency_othertxt ; //alert (dataString);return false; $.ajax({ type: "POST", url: phpfile, data: dataString, success: function(responseHtml) { $('#contact_container').parent().html(responseHtml); $('#contact_container').parent().find('a').click(function(e){ aTagNewBehaviour(e, $(this)); }); adjustForms(); //$("form#form_contact .tbl").css('display','none'); //$("#contactOK").css('display','block'); } }); return false; }); } /* Hide '#know_agency' element from select value on main/contact page*/ function showknownelement(val){ if ($('#know_agency').val() == 'other'){ displayElement('know_agency_othertxt', 'show'); } else { displayElement('know_agency_othertxt', 'hide'); } } /* ** redir/invite OR main/login ** */ // Adjusting form behaviour on main/login page function adjustLoginForm() { $("#loginform a.button").click(function(){ //data var username = $("input#login_name").val(); var password = $("input#password").val(); var rememberme = '0'; if ($("input#login_remember").attr('checked')) rememberme = '1'; var hiddenForm = $("input#hiddenForm").val(); var hiddenSession_immomigcourtage_web = $("input#hiddenSession_immomigcourtage_web").val(); var hiddenRoute = $("input#hiddenRoute").val(); var hiddenParams = $("input#hiddenParams").val(); var hiddenLogin = $("input#hiddenLogin").val(); var phpfile = $("form#loginform").attr('action'); if ('-1'==phpfile.search("[?]")) { phpfile = phpfile + '?'; } phpfile = phpfile + '&internalLoad=1'; var dataString = 'username='+ username + '&password=' + password + '&rememberme=' + rememberme + '&form=' + hiddenForm + '&session_immomigcourtage_web=' + hiddenSession_immomigcourtage_web + '&route=' + hiddenRoute + '¶ms=' + hiddenParams + '&login=' + hiddenLogin ; //alert (dataString);return false; $.ajax({ type: "POST", url: phpfile, data: dataString, success: function(responseHtml) { $('#redir_container').parent().html(responseHtml); $('#redir_container').parent().find('a').click(function(e){ aTagNewBehaviour(e, $(this)); }); adjustForms(); } }); return false; }); } /* ** main/forgottenlogin ** */ // Adjusting form behaviour on main/forgottenlogin page function adjustForgottenLoginForm() { var submitButton = $("#forgotten_login a.button"); submitButton.click(function(){ //data var email = $("input#email").val(); var hiddenMailform = $("input#hiddenMailform").val(); var hiddenForm = $("input#hiddenForm").val(); var phpfile = $("form#forgotten_login").attr('action'); if ('-1'==phpfile.search("[?]")) { phpfile = phpfile + '?'; } phpfile = phpfile + '&internalLoad=1'; var dataString = 'email='+ email + '&mailform=' + hiddenMailform + '&form=' + hiddenForm ; //alert (dataString);return false; $.ajax({ type: "POST", url: phpfile, data: dataString, success: function(responseHtml) { $('#forgotten_login_container').parent().html(responseHtml); $('#forgotten_login_container').parent().find('a').click(function(e){ aTagNewBehaviour(e, $(this)); }); adjustForms(); } }); return false; }); } /* ** aTagNewBehaviour ** */ function aTagNewBehaviour(e, pLink) { // find the active tab var tabNum = pLink.parents('.tab_box').parent().attr('id'); tabNum = tabNum.replace('tab',''); //get the link to load var targetobject = pLink.attr('href'); var hasHref = 1; if (''==targetobject) hasHref = 0; var isJavaScript = 1; if (targetobject && '-1' == targetobject.search("javascript:")) isJavaScript = 0; var isImage = pLink.hasClass('pics'); var inNewWindow = 0; if ('_blank'==pLink.attr('target')) inNewWindow = 1; if (hasHref && !isJavaScript && !isImage && !inNewWindow) { //load selected section LoadContentByAjax(''+targetobject+'', tabNum); //do NOT act upon the click on the href e.preventDefault(); } }