var lastProv = '0';
var lastReg  = '0';
var currentZIndex=4000;
$(document).ready(function(){
	if($.browser.msie==true && $.browser.version==6){
		window.attachEvent('onload',pngfix);
	}
	
	$('div#sideCol-hab ul li').mouseover(function(){
		$(this).addClass('roll');
	})
	
	$('div#sideCol-hab ul li').mouseout(function(){
		$(this).removeClass('roll');
	})
	
	$('.ajaxloader').hide();
	
	$('.tabs h4').each(function(){
		if($(this).height()>39){
			$(this).parent().css('line-height','1em');
			$(this).parent().css('height','25px');
			$(this).parent().css('padding-top','10px');
		};
	});
	
	init_alerts();
	
	init_search_tabs();
	
	changeSelect();
	
	//tabs action
	$('div.temp').show();
	$('ul.anim').hide();
	
	//Gestion des pubs pour les alignés comme il faut
	$('div##borderLeft a img').each(function(){
		if(typeof($(this).parent().parent().attr('rel')) != 'undefined'){
			imagewith = parseInt($(this).parent().parent().attr('rel'));
		}else{
			imagewith = $(this).width();
		};
		 
		newmargin = (460+imagewith)*-1;
		$(this).parent().parent().css('marginLeft',newmargin+'px');
	});
	
	//$('input.prix').hover(function(){$(this).css('cursor','n-resize')},function(){$(this).css('cursor','default')})
	
	// btn rechercher sur la carte
	$('#onmap').click(function(e,data){
		
		if ($("#mymap").length == 1){
			
			if ( $("#mymap").html() == "" ){
				// effacer l'overmap
				$('#overmap').remove();
				// initialise la map
				init_map();
				show_tabs_link();
			}
		
			if(typeof(data)!='undefined'){
				if(data.session==true){
					moveEndCallback('session');
				}else{
					moveEndCallback('reload');
				}
			}else{
				moveEndCallback('reload');
			}
			
			return false;	
		}else{
			
			$('#id_critere').attr('action',"index.php?topic=recherche.execute&map=1");
			$('#id_critere').submit();
		}
	});
	
	
	
	$('input.prix').bind('keypress',function(){
		if($(this).val().length>=8){
			$(this).val($(this).val().substr(0,8));
		}
	});
	
	//analyze de la pub
	/*
	$('#leaderboard-top script:last').next().each(function(){
		if(this.tagName.toLowerCase()=='noscript'){
			$('#leaderboard-top').css('height','20px');
		}
	})
	*/
	
	//sélection rapide
	$('#selectionrapide li a').mouseover(
		function(){
			$(this).animate({ backgroundColor: "white" }, 150);
		}
	);
	$('#selectionrapide li a').mouseout(	
		function(){
			$(this).animate({ backgroundColor: "lightGrey" }, 150);
		}
	);
	
	// correction du css pour les champs de prix dans Safari mac
	if ( $.browser.safari == true){
		$('div#search-box input.prix').css('width','70px');
	}
})

function show_tabs_link(){
	//hide all link
	$('ul.anim a, ul.anim h5').hide();
	$('.find-logement').removeClass('empty')
	//ok now we show the ul
	$('div.anim').hide();
	$('ul.anim').show(1,function(){
		//show the h5
		refUL = $(this);
		$(this).find('h5').show(1,function(){
			//show the next link
			refUL.find('a.resize[rel=300]').show('slide',{direction:'down'},100,function(){
				$(this).effect('bounce',{times:2,distance:5},100,function(){
					$(this).css('display','block');
					//next link
					refUL.find('a.resize[rel=535]').show('slide',{direction:'down'},100,function(){
						$(this).effect('bounce',{times:2,distance:5},100,function(){
							//next link
							refUL.find('a.resize[rel=full]').show('slide',{direction:'down'},100,function(){
								$(this).effect('bounce',{times:2,distance:5},100)
							});
						});
					});
				});
			});
		});
	});
}

function update_counter(){
	dataToSend = get_criteres_recherche();
	
	$.ajax({
		data:dataToSend,
		type:'POST',
		url: '/pages/ajax/ajax.update.counter.php',
		dataType: 'json',
		success:function(data){
			if(typeof(data)!='object'){
				return;
			}
			$('p.total span.bignumber').text(data.counter);
		}
	});
}

function set_ajax_validation(myform){
	//set form error message
	$('#'+myform+' input.text, #'+myform+' textarea').each(function(){
		currentZIndex++;
		$(this).after('<span class="error hide" style="z-index:'+currentZIndex+'"><span class="text"></span><span class="bottombox"></span></span><span class="ajaxloader grey" style="display: none;"></span><span class="valid"></span>');
	});
	$('#'+myform+' .withlist').each(function(){
		currentZIndex++;
		$(this).append('<span class="errorwithlist"><span class="error hide" style="z-index:'+currentZIndex+'"><span class="text"></span><span class="bottombox"></span></span><span class="ajaxloader grey" style="display: none;"></span><span class="valid"></span></span>');
	});
	
	set_validation_action(myform);
};

function blur_focus_action(referenceThis,myform){

	
	//si le box est déja présent, on ne fait rien, pour éviter les duplications d'erreur
	refInput = referenceThis;
	
	//show ajax loader
	refInput.parent().find('span.ajaxloader').show();
	
	//on placerait ici la validation
	name  = referenceThis.attr('name');
	value = referenceThis.val();
	if(value==''){
		value = referenceThis.text();
	} 
	if(typeof(name)=='undefined' || name=='undefined'){	
		if(refInput.parent().find('span.errorwithlist').length==1){
			name = refInput.parent().find('input:hidden').attr('name');
			value = refInput.parent().find('input:hidden').val();
		}else{
			return false;
		}
	}	
	

	$.ajax({
		type: "POST",
		url: '/pages/ajax/ajax.validate.php',
		dataType: 'json',
		data: name+'='+value+'&page='+myform,
		success: function(msg){
			if(typeof(msg)=='undefined'){
				return;
			}
			//show ajax loader
			msg = msg[0];
			refInput.parent().find('span.ajaxloader').hide();

			//remove all element first
			bigParentError = $('span.error');
			if (!msg.valid) {
				//scrollTo(msg.gotothis,50);
				refInput.parent().find('span.error span.text').html(msg.message);
				
				refInput.addClass('validation_error');
				
				if (bigParentError.length == 0) {
					currentZIndex++;
					refInput.parent().find('span.error').css('z-index',currentZIndex);
					refInput.parent().find('span.error').fadeIn('slow');
				}
				else {
					//show the error
					bigParentError.hide();
					
					currentZIndex++;
					refInput.parent().find('span.valid').fadeOut('slow');
					refInput.parent().find('span.error').css('z-index',currentZIndex);
					refInput.parent().find('span.error').fadeIn('slow');
				}
			}else{
				bigParentError.hide();
				//afficher le message de validation
				refInput.removeClass('validation_error');
				
				//show the icon
				refInput.parent().find('span.valid').fadeIn('slow');
			};
		}
	});
};

function set_validation_action(myform){
	//test de blur sur le field label
	$('#'+myform+' .ajaxvalidate input.text, #'+myform+' .ajaxvalidate textarea').bind('blur',function(){
		blur_focus_action($(this),myform);
	});
	
	//validate all the form
	var options = { 
		url: '/pages/ajax/ajax.validate.php',
		dataType: 'json', 
	    success: function(data) {
			//alert(data);
			//return false;
			$('#'+myform).find('.ajaxloader').hide();
			$('.validation_error').removeClass('validation_error');
			$('.inline_error').hide();
			
			var formisvalid = true;
			for(var x=0;x<data.length;x++){
				if(formisvalid){
					if(!data[x].valid){
						formisvalid=false;
						//on déplace la page en plus d'afficher le message d'erreur
						
						currentZIndex++;
						if(data[x].type=='bulle'){
							scrollTo(data[x].gotothis,50);
							$('input[name='+data[x].gotothis+'], textarea[name='+data[x].gotothis+'], div#'+data[x].gotothis).parent().find('span.error span.text').css('z-index',currentZIndex).html(data[x].message).parent().fadeIn('slow');
							$('input[name='+data[x].gotothis+'], textarea[name='+data[x].gotothis+'], div#'+data[x].gotothis).addClass('validation_error');
						}else{
							scrollTo('map',50); //******* HARDCODÉ ***********/
							$('input[name='+data[x].gotothis+'], textarea[name='+data[x].gotothis+'], div#'+data[x].gotothis).parent().find('.inline_error').html(data[x].message).fadeIn('slow');
						}
					}else{
						$('input[name='+data[x].gotothis+'], textarea[name='+data[x].gotothis+'], div#'+data[x].gotothis).parent().find('span.valid').show();
					};
				};	
			};
			
			if(formisvalid){
				$('#'+myform).ajaxFormUnbind();
				myrel = $('#'+myform).attr('rel');
				if(myrel=='send_password'){
					send_password();
				}else{
					$('#'+myform).submit();	
				}
					
			};
	    },
		error:function(XMLHttpRequest, ajaxOptions, thrownError){alert(ajaxOptions+' : '+thrownError)},
		beforeSubmit:function(){
			//alert('oh yeah before')
			//remove all the error field
			$('span.error').hide();
			$('.validation_error').removeClass('validation_error');
			
			$('#'+myform).find('#create-listing').parent().find('.ajaxloader').show();
			//alert('there you go send the form')
		}
	}; 
	$('#'+myform).ajaxForm(options);
};

function scrollTo(target, ecart){
	$target = $('[id=' + target +']');
	
	if(typeof(ecart)=='undefined'){
		ecart=0;
	}
	
	$('html,body').animate({ scrollTop: $target.offset().top-ecart }, 1000);
}

function send_password(){
	$('#formforget').fadeOut('slow');
	
	dataToSend={
		email:$('#forget-courriel').val()
	}
	$.ajax({
		type: "POST",
		url: "/pages/ajax/ajax.resend.password.php",
		data: dataToSend,
		dataType: 'json',
		success: function(data){
			if(data.complete==true){
				$('#resend_Before').fadeOut('slow',function(){
					$('#resend_After').fadeIn('slow')
				})
			}
		}
	})
}

function show_tab(mytab){
	$('.tri-recherche').hide();
	$('#block-'+mytab).show();
	$('input[name=type_etablissement]').val(mytab);
};
function init_search_tabs(){
	show_tab($('div.sideCol ul.tabs li.currentTab a').attr('rel'));
	$('div.sideCol ul.tabs a').click(function(){
		show_tab($(this).attr('rel'));
		
		//switch the active button
		$(this).parent().parent().find('li').removeClass('currentTab');
		$(this).parent().addClass('currentTab');
		
		update_counter();
		
		return false;
	});
};

function changeSelect(){
	/*
	 * Gestion des select box
	 */
	$('select:not(.notimprove)').each(function(){
		//alert($(this).attr('class'));
		classsplit = $(this).attr('class').split('_');
		if($(this).hasClass('lastword')){
			lastword=true;
		}else{
			lastword=false;
		};
		if(classsplit[0]=='next'){
			data = {
				fx:'slideFade',
				theme:'sitelocation',
				afterSelect:changeSortSetting,
				associateSelect:classsplit[1],
				lastword:lastword,
				rows:6,
				width:280
			};
		}else{
			if ($.browser.safari || ($.browser.msie && $.browser.version==6)) {
				paddingright = $(this).css('padding-right').split('px')[0]
				if (paddingright == 0) {
					paddingright = 10;
				};
			}else{
				paddingright=0;
			};
			if ($(this).find('option').length > 6) {
				maxrows = 6;
			}else if($(this).find('option').length > 1){
				maxrows = $(this).find('option').length;
			}else{
				maxrows = 6;
			};
			data = {
				fx:'slideFade',
				lastword:lastword,
				rows:maxrows,
				theme:'sitelocation'
			};
		};
		
		$(this).jcombox(data);
	});
	
	//wrap un bold autour du dernier mot
	$('div.lastword').each(function(){
		mytext = $(this).find('span')
		//mytext = mytext.text();
		defaulttext = $(this).find('.menu a:first');
		//defaulttext = defaulttext.text();
		
		wordlist = defaulttext.text().split(' ');
		
		wrap = '<strong>'+wordlist.pop()+'</strong>';
		wrap = wordlist.join(' ')+' '+wrap;
		if(mytext.text()==defaulttext.text()){
			mytext.html(wrap);
		};
		defaulttext.html(wrap);
	});
};

function changeSortSetting(mylink,associateSelect){
	currentselect = mylink.parent().parent();
	
	currentid = currentselect.jcSelected();
	
	prefix  = associateSelect.split('-')[0];
	suffixe = associateSelect.split('-')[1].split(' ')[0];
	
	dataToSend = {
		id:currentid,
		type:suffixe
	};

	switch(suffixe){
		case 'regions':
			regionObject = $('#'+prefix+'-regions');
			villesObject = $('#'+prefix+'-villes');
			
			if (parseInt(currentid) == 0) {
				//on doit cacher tous les éléments suivants
				regionObject.jcDisable();
				regionObject.jcSelect('0');
				villesObject.jcDisable();
				villesObject.jcSelect('0');
			} else {
				if(currentid != lastProv){
					lastProv = currentid;
					regionObject.jcSelect('0');
					villesObject.jcDisable();
					villesObject.jcSelect('0');
				};
				modifier_select(regionObject,dataToSend);
			};
			break;
		case 'villes':
			villesObject = $('#'+prefix+'-villes');
			if (parseInt(currentid) == 0) {
				//on doit cacher tous les éléments suivants
				villesObject.jcDisable();
				villesObject.jcSelect('0');
			} else {
				if(currentid != lastReg){
					lastReg = currentid;
					villesObject.jcSelect('0');
				};
				modifier_select(villesObject,dataToSend);
			};
			break;
		case 'type':
			
			villesObject = $('#'+prefix+'-type');
			if (parseInt(currentid) == 0) {
				//on doit cacher tous les éléments suivants
				villesObject.jcDisable();
				villesObject.jcSelect('0');
			} else {
				villesObject.jcSelect('0');
				modifier_select(villesObject,dataToSend);
			};
			break;
	};
};

function modifier_select(theObject){
	//on vérifie le id des régions présente dans le select régions
	if (typeof(theObject.attr('rel')) != 'undefined') {
		if (theObject.attr('rel') == dataToSend.id && theObject.jcSelected() != '0') {
			return false;
		}
	} else {
		theObject.attr('rel', dataToSend.id);
	};
	$.ajax({
		type: "POST",
		url: "/pages/ajax/ajax.modifier.select.recherche.php",
		data: dataToSend,
		dataType: 'json',
		cache:true,
		success: function(data){
			if (typeof(data) != 'object') {
				return;
			}

			theObject.jcAllClear();
			if (data.length > 0) {
				for (var x = 0; x < data.length; x++) {
					theObject.jcAdd(data[x].id_label, data[x].label);
				};
			}
			theObject.jcEnable();
		}
	});
};
/*
function hideFullScreen(){
	if(isFullScreen) {
		isFullScreen=false;
		
		$('.fullscreen').animate({'top': '-60px'});
		
		$('body').css('overflow','auto');
		
		cssObject = {
			'position': 'relative',
			'top': '0px'
		};
		$('#boxMap').css(cssObject);
		$('#mymap').css('width','538px');
		$('#mymap').css('height','266px');
		
	};
};
*/
/*
function showFullScreen(){
	if (!isFullScreen) {		
		isFullScreen=true;
		/*
		$('#mymap').after('<div id="keepMapPos"></div>');
		$('#keepMapPos').css('width', $('#mymap').width() + 'px')
		$('#keepMapPos').css('height', $('#mymap').height() + 'px')
		//
		$('body').css('overflow','hidden');
		
		cssObject = {
			position: 'absolute'
		};
		
		$('#boxMap').css(cssObject)
			.animate({'left': '0px'})
			.animate({'top': '40px'})
			.queue(function(){
				$('#mymap')
					.animate({'width': $(window).width()- 20 + 'px'})
					.animate({'height': $(window).height()- 60 + 'px'})
					.queue(function(){
						m_Map.checkResize();
						$('.fullscreen').animate({'top': '0px'});
					});
			});
		
	};
};
*/
/*
function adjustFullScreenSize(){
	if (isFullScreen) {
		$('#mymap').css('width', $(window).width()-20 + 'px');
		$('#mymap').css('height', $(window).height()-60 + 'px');
	}
};

function adjustFullScreenPosition(){
	if (isFullScreen) {
		$(document).scrollTop(0);
		$(document).scrollLeft(0);
	}
};
*/	
function init_alerts(){
	$('#box-alertes-courriel, #box-alertes-rss, #box-alertes-courriel-done').hide();
	$('p.alerts a.rss').click(function(){
		create_alert_rss();
		return false;
	});
	$('.alerts a.courriel').click(function(){
		$('p.alerts').slideUp('slow',function(){
			$('#box-alertes-rss,#box-alertes-courriel-done').slideUp('slow',function(){
				$('#box-alertes-courriel').slideDown('slow');
			});
		});
		return false;
	});
	
	$('#box-alertes-courriel a.mini').bind('click',function(){
		create_alert_courriel($('#box-alertes-courriel input[type=text]').val());
		return false;
	})
};

function create_alert_rss(){
	dataToSend = get_criteres_recherche();
	dataToSend.alert = 'rss';
	$.ajax({
		data:dataToSend,
		type:'POST',
		url: '/pages/ajax/ajax.create.alert.php',
		dataType: 'text',
		success:function(data){
			$('#box-alertes-rss p a').attr('href',data);
			if($('body').attr('id')=='lang-fr'){
				$('#box-alertes-rss p a').text('http://location.duproprio.com'+data);
			}else{
				$('#box-alertes-rss p a').text('http://rental.bytheowner.com'+data);
			}
			$('#box-alertes-rss p a').attr('target','_blank');
			$('p.alerts').slideUp('slow',function(){
				$('#box-alertes-courriel, #box-alertes-courriel-done').slideUp('slow', function(){
					$('#box-alertes-rss').slideDown('slow')
				});	
			});
		}
	});
};

function create_alert_courriel(courriel){
	dataToSend = get_criteres_recherche();
	dataToSend.courriel = courriel;
	dataToSend.alert = 'courriel';
	$('#box-alertes-courriel .inline_error').remove();
	
	$.ajax({
		data:dataToSend,
		type:'POST',
		url: '/pages/ajax/ajax.create.alert.php',
		dataType: 'json',
		success:function(data){
			if(data.error!=''){
				$('#box-alertes-courriel p').before('<p class="inline_error hide">'+data.error+'</p>');
				$('#box-alertes-courriel p.inline_error').fadeIn('slow');	
			}else{
				$('#box-alertes-courriel').slideUp('slow',function(){
					$('#box-alertes-courriel-done').slideDown('slow')
					$(this).find('input[type=text]').val('')
				});
			}
		}
	});
};

function get_criteres_recherche(){
	//récupération des critères de recherche
	var province = $('#recherche-provinces').jcSelected();
	var regions  = $('#recherche-regions').jcSelected();
	var villes   = $('#recherche-villes').jcSelected();
	
	var type_etablissement = $('input[name=type_etablissement]').val();
	var type = $('#recherche-types-'+type_etablissement+' input:hidden').val();
	var prix_min = $('#prixmin').val();
	var prix_max = $('#prixmax').val();
	
	data = {
		'pr':province,
		're':regions,
		'vi':villes,
		'cat':type_etablissement,
		'ty':type,
		'minp':prix_min,
		'maxp':prix_max
	};
	
	return data;
};

// repossitionne la map
function moveMap(lati,longi,zoom){
	GEvent.clearListeners(m_Map, "zoomend");
	// repositionner
	currentZoom = parseInt(zoom);
	m_Map.setCenter(new GLatLng(lati, longi), parseInt(zoom));
	toUpdate = {
		latitude:longi,
		longitude:lati,
		zoom:parseInt(zoom)
	};
	if(typeof(update_position)=='function'){
		update_position(toUpdate);
	}
	//
	GEvent.addListener(m_Map, "zoomend",moveEndCallback);
}

/*
 * Plugins jQuery color-animation
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[4-8b-hj-rt-zA-N]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(n(c){c.each([\'C\',\'borderBottomColor\',\'borderLeftColor\',\'borderRightColor\',\'borderTopColor\',\'7\',\'outlineColor\'],n(i,d){c.5.step[d]=n(5){e(5.state==0){5.f=D(5.g,d);5.o=r(5.o)}5.g.style[d]="t("+[j.u(j.v(8((5.w*(5.o[0]-5.f[0]))+5.f[0]),4),0),j.u(j.v(8((5.w*(5.o[1]-5.f[1]))+5.f[1]),4),0),j.u(j.v(8((5.w*(5.o[2]-5.f[2]))+5.f[2]),4),0)].join(",")+")"}});n r(7){x 6;e(7&&7.constructor==Array&&7.length==3)h 7;e(6=/t\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)/.p(7))h[8(6[1]),8(6[2]),8(6[3])];e(6=/t\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)/.p(7))h[y(6[1])*2.z,y(6[2])*2.z,y(6[3])*2.z];e(6=/#([a-k-l-9]{2})([a-k-l-9]{2})([a-k-l-9]{2})/.p(7))h[8(6[1],16),8(6[2],16),8(6[3],16)];e(6=/#([a-k-l-9])([a-k-l-9])([a-k-l-9])/.p(7))h[8(6[1]+6[1],16),8(6[2]+6[2],16),8(6[3]+6[3],16)];h E[c.trim(7).toLowerCase()]}n D(g,d){x 7;do{7=c.curCSS(g,d);e(7!=\'\'&&7!=\'transparent\'||c.nodeName(g,"body"))break;d="C"}while(g=g.parentNode);h r(7)};x E={aqua:[0,4,4],azure:[F,4,4],beige:[G,G,220],black:[0,0,0],blue:[0,0,4],brown:[H,I,I],cyan:[0,4,4],darkblue:[0,0,m],darkcyan:[0,m,m],darkgrey:[A,A,A],darkgreen:[0,100,0],darkkhaki:[189,183,J],darkmagenta:[m,0,m],darkolivegreen:[85,J,47],darkorange:[4,K,0],darkorchid:[153,50,204],darkred:[m,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[4,0,4],gold:[4,215,0],green:[0,b,0],indigo:[75,0,130],khaki:[F,L,K],lightblue:[173,216,L],lightcyan:[M,4,4],lightgreen:[N,238,N],lightgrey:[B,B,B],lightpink:[4,182,193],lightyellow:[4,4,M],lime:[0,4,0],magenta:[4,0,4],maroon:[b,0,0],navy:[0,0,b],olive:[b,b,0],orange:[4,H,0],pink:[4,q,203],purple:[b,0,b],violet:[b,0,b],red:[4,0,0],silver:[q,q,q],white:[4,4,4],yellow:[4,4,0]}})(c);',[],50,'||||255|fx|result|color|parseInt|||128|jQuery|attr|if|start|elem|return||Math|fA|F0|139|function|end|exec|192|getRGB||rgb|max|min|pos|var|parseFloat|55|169|246|backgroundColor|getColor|colors|240|245|165|42|107|140|230|224|144'.split('|'),0,{}))

/*
 * Plugins unitpngfix
 */
var clear="/medias/images/interface/clear.gif" //path to clear.gif

pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}


