(function(){
    var _al_tmp = {};
    var d = document;
    var _locale = 'es';
	var _seduce_img = 'http://adlemons.com/s3/adlemons/'+'sample_ad_125x125.gif';
    var _seduce = '';//Patrocíname';
    var _zone = '124';
    var _slots = [
					 ['http://adlemons.com','http://adlemons.resplandor.net/banners/default/sample_ad_125x125.gif', 'Publicidad en blogs', '30 &euro;', '01-010-2010'],
				
	 ];
 	    var _AL_REFERER_CODE = '';
    var _AL_STARTING_ON = 'a partir del';
    var _AL_ADS_VIA = '<img src="http://adlemons.com/s3/adlemons/Ads-by-AdLemons.gif" border="0" alt="Anuncios vía AdLemons">';//'Anuncios vía AdLemons';

    function select_slot(slot_id){
        if(odivs()){
            var url = 'http://adlemons.resplandor.net/index.php/order/zone/'+124;
            _al$('__adlemons_order_frame').innerHTML = "<iframe width='100%' height='40000px' frameborder='0' hspace='0' vspace='0' src='"+url+"' id='adlemons_order' name='adlemons_order' style='overflow:hidden;overflow-x:hidden;overflow-y:hidden;'><ilayer name='adlemons_order_2' id='adlemons_order_2' src='"+url+"' width='100%' height='4000px' top='0' left='0'  style='overflow:hidden;overflow-x:hidden;overflow-y:hidden;'> </ilayer></iframe>";
        }
        _al$('__adlemons_order_frame').style.display='block';
        _al$('_adlemons_fd').style.display='block';
    }
    function _al$(id){
        if(!d.all && d.getElementById){
            return d.getElementById(id);
        }else{
            return d.all(id);
        }
    }
    function order_height(height){
        _al$('__adlemons_order_frame').style.height=height;
    }
    // creates order divs
    function odivs(){
        if(!_al_tmp['order_layer']){
            div('__adlemons_order_frame','','display:none;position:absolute;top:0;left:0;width:100%;height:142px;background-color:#fff;z-index:100002;overflow:hidden;');
            div('_adlemons_fd','','display: none;position:absolute;top:0%;left:0%;width:100%;height:500%;background-color:#000;z-index:100001;-moz-opacity:0.8;opacity:.80;filter:alpha(opacity=80);');
            _al_tmp['order_layer'] = true;
            return true;
        }
        return false;
    }
    function div(id, content, style){
        e = d.createElement('div');
        e.id=id;
        e.setAttribute('style', style);
        e.innerHTML = content;
        d.body.appendChild(e);
    }
    function dw(content){
        d.write(content);
    }
    function _al_ad(url,img,slot_id,title){
        dw('<a id="'+_zone+'_'+slot_id+'" class="adlemons_ad" href="'+url+'" title="'+title+'" style="float:left;display:block;border:0px;padding:3px;background-color:#fff;border:1px solid #ededed;border-bottom:1px solid #ccc;border-right:1px solid #cdcdcd;margin:4px;width:125px;height:125px;"><img src="'+img+'" alt="'+title+'" style="border:0px;width:125px;height:125px;" /></a>');
    }

    function _al_show_lemons(){
        _al_tmp[_zone] = _al$(_zone).innerHTML;
        if(!_al_tmp[_zone+'_lemons']){
            var _al_lemons = '';
            for(var i=0; i<_slots.length; i++){

                var ad_offset = '';
                if(_slots[i][4].length > 0 ){
                    ad_offset = '<strong style="font-weight:normal;font-size:80%;padding:0 0 0 10px;">'+_AL_STARTING_ON+'</strong><strong style="padding:0 0 0 10px;display:block;">'+_slots[i][4]+'</strong>';
                }
                _al_lemons += '<a  id="'+_zone+'_'+i+'_lemon" href="javascript:void(0);" style="border-style:solid;border-color:#ededed #cdcdcd #ccc #ededed;border-width:1px;margin:4px;padding:3px;background:#fff url(http://adlemons.s3.amazonaws.com/slot.gif) no-repeat scroll 3px;background-position:3px 5%;float:left;width:125px;height:125px;text-decoration:none;color:#333;"><strong style="display:block;text-align:left;font-size:160%;padding:60px 30px 10px 0;">'+_slots[i][3]+'</strong>'+ad_offset+'</a>';
            }
            _al_tmp[_zone+'_lemons'] = _al_lemons;
            _al$(_zone).innerHTML = _al_tmp[_zone+'_lemons'];

            for(var i=0; i<_slots.length; i++){
                _al$(_zone+'_'+i+'_lemon').onclick = function(){select_slot('')};
            }
            _al$('al_seduce_'+_zone).onclick = _al_hide_lemons;
        }else{
            _al$(_zone).innerHTML = _al_tmp[_zone+'_lemons'];
        }

        _al$('al_seduce_'+_zone).innerHTML = _AL_ADS_VIA;
        _al$('al_seduce_'+_zone).onclick = function(){window.location.href='http://adlemons.com/r/'+_AL_REFERER_CODE};
    }


    function _al_hide_lemons(){
        _al$(_zone).innerHTML = _al_tmp[_zone];
        _al$('al_seduce_'+_zone).onclick = _al_show_lemons;
        _al$('al_seduce_'+_zone).innerHTML = _seduce;
    }

    function _al_show_ads(){
        dw('<p id="'+_zone+'" class="adlemons_ads">');
        for(var i=0; i<_slots.length; i++){
            _al_ad(_slots[i][0],_slots[i][1],i,_slots[i][2]);
        }
        dw('</p>');
        dw('');
		//dw('<div style="clear:both;">&nbsp;</div>');
        dw('<p class="seducible_lemon"><a href="javascript:void(0);" id="al_seduce_'+_zone+'">'+_seduce+'</a></p>');
        _al$('al_seduce_'+_zone).onclick = _al_show_lemons;
    }

    function _al_track_ad_click(ad_id){
        var i = new Image();
        i.src = 'http://adlemons.com/t/'+ad_id;
    }

    _al_show_ads();

})();


function __adlemons_resize_order_frame(height){
    if(!document.all && document.getElementById){
        return document.getElementById('__adlemons_order_frame').style.height = height;
    }else{
        return document.all('__adlemons_order_frame').style.height = height;
    }
}