(function(){
    var _al_tmp = {};
    var d = document;
    var _locale = 'es';
    var _seduce = 'Patrociname';//Patrocíname';
     
    var _zone = '469';
    var _slots =[ 		 'http://adlemons.com','http://defaults.adlemons.com/sample_ad_125x125.gif', 'Publicidad en blogs', '29.5 &euro;', '01-08-2010','0','0'
				];
 	
    var _seduce_img = 'http://defaults.adlemons.com/sample_ad_125x125.gif';
    var _AL_REFERER_CODE = '';
    var _AL_STARTING_ON = 'a partir del';
    var _AL_ADS_VIA = '';

 	function checkForMessages(){

		if(location.hash == '#close'){
			 
			//document.getElementById('__adlemons_order_frame').style.display = 'none';
			//document.getElementById('_adlemons_fd').style.display = 'none';
			var el = document.getElementById('__adlemons_order_frame'); 
			var padre = el.parentNode;
			padre.removeChild(el);
			var el = document.getElementById('_adlemons_fd'); 
			var padre = el.parentNode;
			padre.removeChild(el);
			document.location.hash='';
		}
	}

	setInterval(checkForMessages, 500);


    function select_slot(slot_id){
        if(odivs()){
            var url = 'http://adlemons.com/index.php/order/zone/'+469;
        
          _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;z-index:1;'><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;
    }
  
    function div(id, content, style){
        e = d.createElement('div');
        e.id=id;       
        e.style.cssText=style;        
        e.innerHTML = content;
        d.body.appendChild(e);
    }
   function closeslide(){

	window.parent.document.getElementById('__adlemons_order_frame').style.display='none';
	window.parent.document.getElementById('_adlemons_fd').style.display='none';
}
    
      // 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','','z-index:100001;-moz-opacity:0.8;opacity:.80;display:none;position:absolute;top:0;left:0;width:100%;height:500%;background-color:#000;background:rgba(0,0,0,80);filter: alpha(opacity=50);');
             
            _al_tmp['order_layer'] = true;
            return true;
        }
        return false;
    }
    function dw(content){
        d.write(content);
    }
    function _al_ad(url,img,slot_id,title){
     if('0'==0){
	      dw('<div id="al_seduce_'+_zone+'"><a href="javascript:void(0);" class="adlemons_ad" href="'+url+'" rel="nofollow" title="'+title+'" style="display:block;border:0px;padding:0px;background-color:#fff;border:0px solid #ededed;border-bottom:0px solid #ccc;border-right:0px solid #cdcdcd;width:125px;height:125px;"><img src="'+img+'" alt="'+title+'" style="border:0px;width:125px;height:125px;" /></a></div>');
	    }else{
	      dw('<div id="al_no_seduce_'+_zone+'"><a href="http://adlemons.com" target="_black" class="adlemons_ad" href="'+url+'" rel="nofollow" title="'+title+'" style="float:left;display:block;border:0px;padding:0px;background-color:#fff;border:0px solid #ededed;border-bottom:0px solid #ccc;border-right:0px solid #cdcdcd;width:125px;height:125px;"><img src="'+img+'" alt="'+title+'" style="border:0px;width:125px;height:125px;" /></a></div>');
	    }
    }

    function _al_show_lemons(){
    
        _al_tmp[_zone] = _al$(_zone).innerHTML;
        if(!_al_tmp[_zone+'_lemons']){
            var _al_lemons = '';
            

                var ad_offset = '';
              
                _al_lemons += '<a  id="'+_zone+'_0'+'_lemon" href="javascript:void(0);" style="border-style:solid;background-color:#ffffff;border-color:#ededed #cdcdcd #ccc #ededed;border-width:0px;margin:0px;padding:0px;background-position:3px 5%;width:125px;height:125px;text-decoration:none;color:#333;"><img border="0" src="http://adlemons.com/index.php/bannerdefault/index/125x125a01-08-2010a29.5" width="125" height="125" ></img></a>';
             
            _al_tmp[_zone+'_lemons'] = _al_lemons;
            _al$(_zone).innerHTML = _al_tmp[_zone+'_lemons'];

            
                _al$(_zone+'_0'+'_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('<div id="'+_zone+'" class="adlemons_ads" style="padding:0px;margin:0px;">');
         
         
            _al_ad(_slots[0],_slots[1],0,_slots[2]);
          
         
        dw('</div>');
        
		//dw('<div style="clear:both;">&nbsp;</div>');
        //dw('<p class="seducible_lemon"><a href="javascript:void(0);" id="al_seduce_'+_zone+'">'+_seduce+'</a></p>');
        
       if('0'==0){ 
       _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;
    }
}
