﻿/******************
 * coups de coeur *
 ******************/
var cdc_crossfadeduration = 3;
var cdc_timeout;
var i_gauche = 1;
var i_droite = 2;
var cdc_i    = new Array();
var cdc_img  = new Array();
var cdc_href = new Array();
var cdc_prix = new Array();
var cdc_i_img_dern = 0;
var cdc_preload = new Array();
function cdc_load()
	{
	cdc_i_img_dern = cdc_img.length - 1;
	for (i = 1; i <= cdc_i_img_dern; i++)
		{
		cdc_preload[i] = new Image();
		cdc_preload[i].src = cdc_img[i];
		cdc_i[i] = i;
		}
	}
function cdc_slideshow()
	{
	if (cdc_i_img_dern > cdc_aff) // moins de 2 images, on ne fait rien
		{
		if (document.all)
			{
			for (i = 1; i <= cdc_aff; i++)
				{
				document.getElementById("cdc_img_" + i).style.filter="blendTrans(duration=2)";
				document.getElementById("cdc_img_" + i).style.filter="blendTrans(duration=cdc_crossfadeduration)";
				document.getElementById("cdc_img_" + i).filters.blendTrans.Apply();
				}
			}
		for (i = 1; i <= cdc_aff; i++)
			{
			iii = cdc_i[i];
			document.getElementById("cdc_img_" + i).src = cdc_preload[iii].src;
			document.getElementById('cdc_img_href_' + i).href = cdc_href[iii];
			document.getElementById('cdc_prix_href_' + i).href = cdc_href[iii];
			document.getElementById('cdc_prix_href_' + i).innerHTML = cdc_prix[iii];
			}
		if (document.all)
			{
			for (i = 1; i <= cdc_aff; i++)
				{
				document.getElementById("cdc_img_" + i).filters.blendTrans.Play();
				}
			}
		for (i = 1; i <= cdc_aff; i++)
			{
			cdc_i[i] = cdc_i[i] + 1;
			if (cdc_i[i] > cdc_i_img_dern)
				{cdc_i[i] = 1;}
			}
		cdc_timeout = setTimeout('cdc_slideshow()', cdc_speed);
		}
	}

/********************
 * location - vente *
 ********************/
function testerRadio(name_rech_form) {
if (name_rech_form.avl[0].checked)
	{
// alert(name_rech_form.avl[0].value) 
	document.getElementById("left_form_vente").className = "left_form_visible";
	document.getElementById("left_form_location").className = "left_form_hidden";
	};
if (name_rech_form.avl[1].checked)
	{
// alert(name_rech_form.avl[1].value)
	document.getElementById("left_form_vente").className = "left_form_hidden";
	document.getElementById("left_form_location").className = "left_form_visible";
	};
}
/*************
 * recherche *
 *************/
function rech_det_over(id)
	{
	var d = document.getElementById('rech_det_' + id);
	if (d)
		{
		d.className = 'rech_det_contenu rech_det_contenu_cl_over';
		d.style.cursor='pointer';
		}
	}
function rech_det_out(id, cl)
	{
	var d = document.getElementById('rech_det_' + id);
	if (d)
		{
		d.className = 'rech_det_contenu rech_det_contenu_cl_' + cl;
		d.style.cursor='normal';
		}
	}

/**********************************************
 * --- BoxOver ---                            *
 * --- v 2.1 17th June 2006                   *
 * By Oliver Bryant with help of Matthew Tagg *
 * http://boxover.swazz.org                   *
 **********************************************/
if (typeof document.attachEvent!='undefined') {
 window.attachEvent('onload',init);
 document.attachEvent('onmousemove',moveMouse);
 document.attachEvent('onclick',checkMove); }
else {
 window.addEventListener('load',init,false);
 document.addEventListener('mousemove',moveMouse,false);
 document.addEventListener('click',checkMove,false);
}

var oDv=document.createElement("div");
var dvHdr=document.createElement("div");
var dvBdy=document.createElement("div");
var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;
boxOpen=false;
ox=10;
oy=10;
lockX=0;
lockY=0;

function init() {
 oDv.appendChild(dvHdr);
 oDv.appendChild(dvBdy);
 oDv.style.position="absolute";
 oDv.style.visibility='hidden';
 oDv.style.zIndex='103';
 document.body.appendChild(oDv);
}

function defHdrStyle() {
 dvHdr.style.fontWeight='bold';
 dvHdr.style.width='228px'; //234px
 dvHdr.style.fontFamily='arial';
 dvHdr.style.border='1px solid #4F7194'; // #333333
 dvHdr.style.marginTop='10px'; //jmp
 dvHdr.style.padding='1px'; // 3px
 dvHdr.style.fontSize='11px'; //12px
 dvHdr.style.textAlign='left';
 dvHdr.style.zIndex='105';
 dvHdr.style.color='#FFFFFF';
 dvHdr.style.background='#4F7194'; // #666666
 dvHdr.style.filter='alpha(opacity=90)'; // IE
 dvHdr.style.opacity='0.85'; // FF
}

function defBdyStyle() {
 dvBdy.style.borderBottom='1px solid #4F7194'; // #333333
 dvBdy.style.borderLeft='1px solid #4F7194'; // #333333
 dvBdy.style.borderRight='1px solid #4F7194'; // #333333
 dvBdy.style.width='220px'; // 220px
 dvBdy.style.fontFamily='arial';
 dvBdy.style.fontSize='10px'; // 12px
 dvBdy.style.zIndex='106';
 dvBdy.style.padding='5px'; // 10px
 dvBdy.style.color='#000000'; // #000000
 dvBdy.style.background='#ffffff'; // #FFFFFF #A6C2DA
 dvBdy.style.filter='alpha(opacity=90)'; // IE
 dvBdy.style.opacity='1.0'; // FF
}

function checkElemBO(txt) {
if (!txt || typeof(txt) != 'string') return false;
if ((txt.indexOf('boxover_header')>-1)&&(txt.indexOf('boxover_body')>-1)&&(txt.indexOf('[')>-1)&&(txt.indexOf('[')>-1))
 return true;
else
 return false;
}

function scanBO(curNode) {
 if (checkElemBO(curNode.title)) {
 curNode.boHDR=getParam('boxover_header',curNode.title);
 curNode.boBDY=getParam('boxover_body',curNode.title);
 curNode.boCSSBDY=getParam('cssboxover_body',curNode.title);
 curNode.boCSSHDR=getParam('cssboxover_header',curNode.title);
 curNode.IEbugfix=(getParam('hideselects',curNode.title)=='on')?true:false;
 curNode.fixX=parseInt(getParam('fixedrelx',curNode.title));
 curNode.fixY=parseInt(getParam('fixedrely',curNode.title));
 curNode.absX=parseInt(getParam('fixedabsx',curNode.title));
 curNode.absY=parseInt(getParam('fixedabsy',curNode.title));
 curNode.offY=(getParam('offsety',curNode.title)!='')?parseInt(getParam('offsety',curNode.title)):10;
 curNode.offX=(getParam('offsetx',curNode.title)!='')?parseInt(getParam('offsetx',curNode.title)):10;
 curNode.fade=(getParam('fade',curNode.title)=='on')?true:false;
 curNode.fadespeed=(getParam('fadespeed',curNode.title)!='')?getParam('fadespeed',curNode.title):0.04;
 curNode.delay=(getParam('delay',curNode.title)!='')?parseInt(getParam('delay',curNode.title)):0;
 if (getParam('requireclick',curNode.title)=='on') {
 curNode.requireclick=true;
 document.all?curNode.attachEvent('onclick',showHideBox):curNode.addEventListener('click',showHideBox,false);
 document.all?curNode.attachEvent('onmouseover',hideBox):curNode.addEventListener('mouseover',hideBox,false);
 }
 else {// Note : if requireclick is on the stop clicks are ignored
 if (getParam('doubleclickstop',curNode.title)!='off') {
 document.all?curNode.attachEvent('ondblclick',pauseBox):curNode.addEventListener('dblclick',pauseBox,false);
 }
 if (getParam('singleclickstop',curNode.title)=='on') {
 document.all?curNode.attachEvent('onclick',pauseBox):curNode.addEventListener('click',pauseBox,false);
 }
 }
 curNode.windowLock=getParam('windowlock',curNode.title).toLowerCase()=='off'?false:true;
 curNode.title='';
 curNode.hasbox=1;
 }
 else
 curNode.hasbox=2;
}


function getParam(param,list) {
 var reg = new RegExp('([^a-zA-Z]' + param + '|^' + param + ')\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]');
 var res = reg.exec(list);
 var returnvar;
 if(res)
 return res[2].replace('[[','[').replace(']]',']');
 else
 return '';
}

function Left(elem){
 var x=0;
 if (elem.calcLeft)
 return elem.calcLeft;
 var oElem=elem;
 while(elem){
 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderLeftWidth)))&&(x!=0))
 x+=parseInt(elem.currentStyle.borderLeftWidth);
 x+=elem.offsetLeft;
 elem=elem.offsetParent;
 }
 oElem.calcLeft=x;
 return x;
 }

function Top(elem){
 var x=0;
 if (elem.calcTop)
 return elem.calcTop;
 var oElem=elem;
 while(elem){
 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderTopWidth)))&&(x!=0))
 x+=parseInt(elem.currentStyle.borderTopWidth);
 x+=elem.offsetTop;
 elem=elem.offsetParent;
 }
 oElem.calcTop=x;
 return x;

}

var ah,ab;
function applyStyles() {
 if(ab)
 oDv.removeChild(dvBdy);
 if (ah)
 oDv.removeChild(dvHdr);
 dvHdr=document.createElement("div");
 dvBdy=document.createElement("div");
 CBE.boCSSBDY?dvBdy.className=CBE.boCSSBDY:defBdyStyle();
 CBE.boCSSHDR?dvHdr.className=CBE.boCSSHDR:defHdrStyle();
 dvHdr.innerHTML=CBE.boHDR;
 dvBdy.innerHTML=CBE.boBDY;
 ah=false;
 ab=false;
 if (CBE.boHDR!='') {
 oDv.appendChild(dvHdr);
 ah=true;
 }
 if (CBE.boBDY!=''){
 oDv.appendChild(dvBdy);
 ab=true;
 }
}

var CSE,iterElem,LSE,CBE,LBE, totalScrollLeft, totalScrollTop, width, height ;
var ini=false;

// Customised function for inner window dimension
function SHW() {
 if (document.body && (document.body.clientWidth !=0)) {
 width=document.body.clientWidth;
 height=document.body.clientHeight;
 }
 if (document.documentElement && (document.documentElement.clientWidth!=0) && (document.body.clientWidth + 20 >= document.documentElement.clientWidth)) {
 width=document.documentElement.clientWidth;
 height=document.documentElement.clientHeight;
 }
 return [width,height];
}


var ID=null;
function moveMouse(e) {
 //boxMove=true;
 e?evt=e:evt=event;

 CSE=evt.target?evt.target:evt.srcElement;

 if (!CSE.hasbox) {
 // Note we need to scan up DOM here, some elements like TR don't get triggered as srcElement
 iElem=CSE;
 while ((iElem.parentNode) && (!iElem.hasbox)) {
 scanBO(iElem);
 iElem=iElem.parentNode;
 }
 }

 if ((CSE!=LSE)&&(!isChild(CSE,dvHdr))&&(!isChild(CSE,dvBdy))){
 if (!CSE.boxItem) {
 iterElem=CSE;
 while ((iterElem.hasbox==2)&&(iterElem.parentNode))
 iterElem=iterElem.parentNode;
 CSE.boxItem=iterElem;
 }
 iterElem=CSE.boxItem;
 if (CSE.boxItem&&(CSE.boxItem.hasbox==1)) {
 LBE=CBE;
 CBE=iterElem;
 if (CBE!=LBE) {
 applyStyles();
 if (!CBE.requireclick)
 if (CBE.fade) {
 if (ID!=null)
 clearTimeout(ID);
 ID=setTimeout("fadeIn("+CBE.fadespeed+")",CBE.delay);
 }
 else {
 if (ID!=null)
 clearTimeout(ID);
 COL=1;
 ID=setTimeout("oDv.style.visibility='visible';ID=null;",CBE.delay);
 }
 if (CBE.IEbugfix) {hideSelects();}
 fixposx=!isNaN(CBE.fixX)?Left(CBE)+CBE.fixX:CBE.absX;
 fixposy=!isNaN(CBE.fixY)?Top(CBE)+CBE.fixY:CBE.absY;
 lockX=0;
 lockY=0;
 boxMove=true;
 ox=CBE.offX?CBE.offX:10;
 oy=CBE.offY?CBE.offY:10;
 }
 }
 else if (!isChild(CSE,dvHdr) && !isChild(CSE,dvBdy) && (boxMove)) {
 // The conditional here fixes flickering between tables cells.
 if ((!isChild(CBE,CSE)) || (CSE.tagName!='TABLE')) {
 CBE=null;
 if (ID!=null)
 clearTimeout(ID);
 fadeOut();
 showSelects();
 }
 }
 LSE=CSE;
 }
 else if (((isChild(CSE,dvHdr) || isChild(CSE,dvBdy))&&(boxMove))) {
 totalScrollLeft=0;
 totalScrollTop=0;

 iterElem=CSE;
 while(iterElem) {
 if(!isNaN(parseInt(iterElem.scrollTop)))
 totalScrollTop+=parseInt(iterElem.scrollTop);
 if(!isNaN(parseInt(iterElem.scrollLeft)))
 totalScrollLeft+=parseInt(iterElem.scrollLeft);
 iterElem=iterElem.parentNode;
 }
 if (CBE!=null) {
 boxLeft=Left(CBE)-totalScrollLeft;
 boxRight=parseInt(Left(CBE)+CBE.offsetWidth)-totalScrollLeft;
 boxTop=Top(CBE)-totalScrollTop;
 boxBottom=parseInt(Top(CBE)+CBE.offsetHeight)-totalScrollTop;
 doCheck();
 }
 }

 if (boxMove&&CBE) {
 // This added to alleviate bug in IE6 w.r.t DOCTYPE
 bodyScrollTop=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
 bodyScrollLet=document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
 mouseX=evt.pageX?evt.pageX-bodyScrollLet:evt.clientX-document.body.clientLeft;
 mouseY=evt.pageY?evt.pageY-bodyScrollTop:evt.clientY-document.body.clientTop;
 if ((CBE)&&(CBE.windowLock)) {
 mouseY < -oy?lockY=-mouseY-oy:lockY=0;
 mouseX < -ox?lockX=-mouseX-ox:lockX=0;
 mouseY > (SHW()[1]-oDv.offsetHeight-oy)?lockY=-mouseY+SHW()[1]-oDv.offsetHeight-oy:lockY=lockY;
 mouseX > (SHW()[0]-dvBdy.offsetWidth-ox)?lockX=-mouseX-ox+SHW()[0]-dvBdy.offsetWidth:lockX=lockX;
 }
 oDv.style.left=((fixposx)||(fixposx==0))?fixposx:bodyScrollLet+mouseX+ox+lockX+"px";
 oDv.style.top=((fixposy)||(fixposy==0))?fixposy:bodyScrollTop+mouseY+oy+lockY+"px";

 }
}

function doCheck() {
 if ( (mouseX < boxLeft) || (mouseX >boxRight) || (mouseY < boxTop) || (mouseY > boxBottom)) {
 if (!CBE.requireclick)
 fadeOut();
 if (CBE.IEbugfix) {showSelects();}
 CBE=null;
 }
}

function pauseBox(e) {
 e?evt=e:evt=event;
 boxMove=false;
 evt.cancelBubble=true;
}

function showHideBox(e) {
 oDv.style.visibility=(oDv.style.visibility!='visible')?'visible':'hidden';
}

function hideBox(e) {
 oDv.style.visibility='hidden';
}

var COL=0;
var stopfade=false;
function fadeIn(fs) {
 ID=null;
 COL=0;
 oDv.style.visibility='visible';
 fadeIn2(fs);
}

function fadeIn2(fs) {
 COL=COL+fs;
 COL=(COL>1)?1:COL;
 oDv.style.filter='alpha(opacity='+parseInt(100*COL)+')';
 oDv.style.opacity=COL;
 if (COL<1)
 setTimeout("fadeIn2("+fs+")",20);
}


function fadeOut() {
 oDv.style.visibility='hidden';

}

function isChild(s,d) {
 while(s) {
 if (s==d)
 return true;
 s=s.parentNode;
 }
 return false;
}

var cSrc;
function checkMove(e) {
 e?evt=e:evt=event;
 cSrc=evt.target?evt.target:evt.srcElement;
 if ((!boxMove)&&(!isChild(cSrc,oDv))) {
 fadeOut();
 if (CBE&&CBE.IEbugfix) {showSelects();}
 boxMove=true;
 CBE=null;
 }
}

function showSelects(){
 var elements = document.getElementsByTagName("select");
 for (i=0;i< elements.length;i++){
 elements[i].style.visibility='visible';
 }
}

function hideSelects(){
 var elements = document.getElementsByTagName("select");
 for (i=0;i< elements.length;i++){
 elements[i].style.visibility='hidden';
 }
}
/*----------------------------------------------------------------------------\
|                               Tab Pane 1.02                                 |
|-----------------------------------------------------------------------------|
|                         Created by Erik Arvidsson                           |
|                  (http://webfx.eae.net/contact.html#erik)                   |
|                      For WebFX (http://webfx.eae.net/)                      |
|-----------------------------------------------------------------------------|
|                Copyright (c) 2002, 2003, 2006 Erik Arvidsson                |
|-----------------------------------------------------------------------------|
| Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| use this file except in compliance with the License.  You may obtain a copy |
| of the License at http://www.apache.org/licenses/LICENSE-2.0                |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| Unless  required  by  applicable law or  agreed  to  in  writing,  software |
| distributed under the License is distributed on an  "AS IS" BASIS,  WITHOUT |
| WARRANTIES OR  CONDITIONS OF ANY KIND,  either express or implied.  See the |
| License  for the  specific language  governing permissions  and limitations |
| under the License.                                                          |
|-----------------------------------------------------------------------------|
| 2002-01-?? | First working version                                          |
| 2002-02-17 | Cleaned up for 1.0 public version                              |
| 2003-02-18 | Changed from javascript uri for anchors to return false        |
| 2003-03-03 | Added dispose methods to release IE memory                     |
| 2006-05-28 | Changed license to Apache Software License 2.0.                |
|-----------------------------------------------------------------------------|
| Dependencies: *.css           a css file to define the layout               |
|-----------------------------------------------------------------------------|
| Created 2002-01-?? | All changes are in the log above. | Updated 2006-05-28 |
\----------------------------------------------------------------------------*/

// This function is used to define if the browser supports the needed
// features
function hasSupport() {

	if (typeof hasSupport.support != "undefined")
		return hasSupport.support;

	var ie55 = /msie 5\.[56789]/i.test( navigator.userAgent );

	hasSupport.support = ( typeof document.implementation != "undefined" &&
			document.implementation.hasFeature( "html", "1.0" ) || ie55 )

	// IE55 has a serious DOM1 bug... Patch it!
	if ( ie55 ) {
		document._getElementsByTagName = document.getElementsByTagName;
		document.getElementsByTagName = function ( sTagName ) {
			if ( sTagName == "*" )
				return document.all;
			else
				return document._getElementsByTagName( sTagName );
		};
	}

	return hasSupport.support;
}

///////////////////////////////////////////////////////////////////////////////////
// The constructor for tab panes
//
// el : HTMLElement		The html element used to represent the tab pane
// bUseCookie : Boolean	Optional. Default is true. Used to determine whether to us
//						persistance using cookies or not
//
function WebFXTabPane( el, bUseCookie, jmp_index ) {
	if ( !hasSupport() || el == null ) return;

	this.element = el;
	this.element.tabPane = this;
	this.pages = [];
	this.selectedIndex = null;
	this.useCookie = bUseCookie != null ? bUseCookie : true;

	// add class name tag to class name
	this.element.className = this.classNameTag + " " + this.element.className;

	// add tab row
	this.tabRow = document.createElement( "div" );
	this.tabRow.className = "tab-row";
	el.insertBefore( this.tabRow, el.firstChild );

	var tabIndex = 0;
	if ( this.useCookie ) {
		tabIndex = Number( WebFXTabPane.getCookie( "webfxtab_" + this.element.id ) );
		if ( isNaN( tabIndex ) )
			tabIndex = 0;
	}
	if (jmp_index == null)
			{this.selectedIndex = tabIndex;}
		else{this.selectedIndex = jmp_index;}

	// loop through child nodes and add them
	var cs = el.childNodes;
	var n;
	for (var i = 0; i < cs.length; i++) {
		if (cs[i].nodeType == 1 && cs[i].className == "tab-page") {
			this.addTabPage( cs[i] );
		}
	}
}

WebFXTabPane.prototype.classNameTag = "dynamic-tab-pane-control";

WebFXTabPane.prototype.setSelectedIndex = function ( n ) {
	if (this.selectedIndex != n) {
		if (this.selectedIndex != null && this.pages[ this.selectedIndex ] != null )
			this.pages[ this.selectedIndex ].hide();
		this.selectedIndex = n;
		this.pages[ this.selectedIndex ].show();

		if ( this.useCookie )
			{
			WebFXTabPane.setCookie( "webfxtab_" + this.element.id, n );	// session cookie
			}
	}
};

WebFXTabPane.prototype.getSelectedIndex = function () {
	return this.selectedIndex;
};

WebFXTabPane.prototype.addTabPage = function ( oElement ) {
	if ( !hasSupport() ) return;

	if ( oElement.tabPage == this )	// already added
		return oElement.tabPage;

	var n = this.pages.length;
	var tp = this.pages[n] = new WebFXTabPage( oElement, this, n );
	tp.tabPane = this;

	// move the tab out of the box
	this.tabRow.appendChild( tp.tab );

	if ( n == this.selectedIndex )
		tp.show();
	else
		tp.hide();

	return tp;
};

WebFXTabPane.prototype.dispose = function () {
	this.element.tabPane = null;
	this.element = null;
	this.tabRow = null;

	for (var i = 0; i < this.pages.length; i++) {
		this.pages[i].dispose();
		this.pages[i] = null;
	}
	this.pages = null;
};



// Cookie handling
WebFXTabPane.setCookie = function ( sName, sValue, nDays ) {
	var expires = "";
	if ( nDays ) {
		var d = new Date();
		d.setTime( d.getTime() + nDays * 24 * 60 * 60 * 1000 );
		expires = "; expires=" + d.toGMTString();
	}

	document.cookie = sName + "=" + sValue + expires + "; path=/";
};

WebFXTabPane.getCookie = function (sName) {
	var re = new RegExp( "(\;|^)[^;]*(" + sName + ")\=([^;]*)(;|$)" );
	var res = re.exec( document.cookie );
	return res != null ? res[3] : null;
};

WebFXTabPane.removeCookie = function ( name ) {
	setCookie( name, "", -1 );
};








///////////////////////////////////////////////////////////////////////////////////
// The constructor for tab pages. This one should not be used.
// Use WebFXTabPage.addTabPage instead
//
// el : HTMLElement			The html element used to represent the tab pane
// tabPane : WebFXTabPane	The parent tab pane
// nindex :	Number			The index of the page in the parent pane page array
//
function WebFXTabPage( el, tabPane, nIndex ) {
	if ( !hasSupport() || el == null ) return;

	this.element = el;
	this.element.tabPage = this;
	this.index = nIndex;

	var cs = el.childNodes;
	for (var i = 0; i < cs.length; i++) {
		if (cs[i].nodeType == 1 && cs[i].className == "tab") {
			this.tab = cs[i];
			break;
		}
	}

	// insert a tag around content to support keyboard navigation


	var a = document.createElement( "A" );
	this.aElement = a;
	a.href = "#";
	a.onclick = function () { return false; };
	while ( this.tab.hasChildNodes() )
		a.appendChild( this.tab.firstChild );
	this.tab.appendChild( a );


	// hook up events, using DOM0
	var oThis = this;
	this.tab.onclick = function () { oThis.select(); };
	this.tab.onmouseover = function () { WebFXTabPage.tabOver( oThis ); };
	this.tab.onmouseout = function () {
		WebFXTabPage.tabOut( oThis );

	};
}

WebFXTabPage.prototype.show = function () {
	var el = this.tab;
	var s = el.className + " selected";
	s = s.replace(/ +/g, " ");
	el.className = s;

	this.element.style.display = "block";
};

WebFXTabPage.prototype.hide = function () {
	var el = this.tab;
	var s = el.className;
	s = s.replace(/ selected/g, "");
	el.className = s;

	this.element.style.display = "none";
};

WebFXTabPage.prototype.select = function () {
	this.tabPane.setSelectedIndex( this.index );
	if (typeof tmaps_listingmap != 'undefined') { tmaps_listingmap.checkResize();tmaps_listingmap.setCenter(new google.maps.LatLng(tmaps_listingmaporiglat,tmaps_listingmaporiglong)); }
		if (typeof tmaps_areamap != 'undefined') { tmaps_areamap.checkResize();tmaps_areamap.setCenter(new google.maps.LatLng(tmaps_areamaporiglat,tmaps_areamaporiglong)); }
		if (typeof tmaps_usermap != 'undefined') { tmaps_usermap.checkResize();tmaps_usermap.setCenter(new google.maps.LatLng(tmaps_usermaporiglat,tmaps_usermaporiglong)); }
		if (typeof tmaps_showall != 'undefined') { tmaps_showall.checkResize();tmaps_showall.setCenter(new google.maps.LatLng(tmaps_showalloriglat,tmaps_showalloriglong)); }
		if (typeof tmaps_search_result != 'undefined') { tmaps_search_result.checkResize();tmaps_search_result.setCenter(new google.maps.LatLng(tmaps_search_resultoriglat,tmaps_search_resultoriglong)); }
		if (typeof map != 'undefined') { map.checkResize(); }
};

WebFXTabPage.prototype.dispose = function () {
	this.aElement.onclick = null;
	this.aElement = null;
	this.element.tabPage = null;
	this.tab.onclick = null;
	this.tab.onmouseover = null;
	this.tab.onmouseout = null;
	this.tab = null;
	this.tabPane = null;
	this.element = null;
};

WebFXTabPage.tabOver = function ( tabpage ) {
	var el = tabpage.tab;
	var s = el.className + " hover";
	s = s.replace(/ +/g, " ");
	el.className = s;
};

WebFXTabPage.tabOut = function ( tabpage ) {
	var el = tabpage.tab;
	var s = el.className;
	s = s.replace(/ hover/g, "");
	el.className = s;
};


// This function initializes all uninitialized tab panes and tab pages
function setupAllTabs() {
	if ( !hasSupport() ) return;

	var all = document.getElementsByTagName( "*" );
	var l = all.length;
	var tabPaneRe = /tab\-pane/;
	var tabPageRe = /tab\-page/;
	var cn, el;
	var parentTabPane;

	for ( var i = 0; i < l; i++ ) {
		el = all[i]
		cn = el.className;

		// no className
		if ( cn == "" ) continue;

		// uninitiated tab pane
		if ( tabPaneRe.test( cn ) && !el.tabPane )
			new WebFXTabPane( el );

		// unitiated tab page wit a valid tab pane parent
		else if ( tabPageRe.test( cn ) && !el.tabPage &&
					tabPaneRe.test( el.parentNode.className ) ) {
			el.parentNode.tabPane.addTabPage( el );
		}
	}
}

function disposeAllTabs() {
	if ( !hasSupport() ) return;

	var all = document.getElementsByTagName( "*" );
	var l = all.length;
	var tabPaneRe = /tab\-pane/;
	var cn, el;
	var tabPanes = [];

	for ( var i = 0; i < l; i++ ) {
		el = all[i]
		cn = el.className;

		// no className
		if ( cn == "" ) continue;

		// tab pane
		if ( tabPaneRe.test( cn ) && el.tabPane )
			tabPanes[tabPanes.length] = el.tabPane;
	}

	for (var i = tabPanes.length - 1; i >= 0; i--) {
		tabPanes[i].dispose();
		tabPanes[i] = null;
	}
}


// initialization hook up

// DOM2
if ( typeof window.addEventListener != "undefined" )
	window.addEventListener( "load", setupAllTabs, false );

// IE
else if ( typeof window.attachEvent != "undefined" ) {
	window.attachEvent( "onload", setupAllTabs );
	window.attachEvent( "onunload", disposeAllTabs );
}

else {
	if ( window.onload != null ) {
		var oldOnload = window.onload;
		window.onload = function ( e ) {
			oldOnload( e );
			setupAllTabs();
		};
	}
	else
		window.onload = setupAllTabs;
}
