function parentExists(){
	return (parent.location == window.location)? false : true;
}

var urll=window.location.href;
	
if(urll.indexOf("ifema.es")!=-1)
	document.domain = "ifema.es";
			
// Funcion que llama a funciones al iniciar la primera carga de la web
$(document).ready(function(){
	inicia();
});

// funcion que se ejecuta al inicio de la carga de la pagina
function inicia(){
	var p = $("#contenido");
	var posicion = p.position();
	//alert(posicion.top-10);
	$('.ancla').click(function(){
		var donde=$(this).attr("href");
		var p = $(donde);
		var offset = p.offset();
		var posicion=offset.top;
		parent.mueve((posicion+340)+'px');
    });
	
	if(parentExists()){
		parent.mueve('0px');
		parent.doIframe();
	}
	
	 var css = '@font-face {            '+
	'    font-family: Folio;      '+
	'    src: url(\'css/Folio.eot\'); '+   
	'    src: local(\'Folio\'), url(\'css/Folio.ttf\') format("truetype");'+
	'}                                  '+
	'.mi_fuente {                     '+
	'  font-family:Folio,Verdana, Arial, Helvetica, sans-serif;  '+
	'  font-weight:normal;  '+
	'  text-rendering:optimizelegibility;  '+
	'  text-transform:uppercase;  '+
	'}';
	addDeclaration(css);
}

function addDeclaration(css){
    if (document.createStyleSheet){
        var st = document.createStyleSheet();
        st.cssText = css;
    } else {
        var st = document.createElement('style');
        st.textContent = css;
        document.getElementsByTagName('head')[0].appendChild(st);    
    }
	$("h2").addClass("mi_fuente");
	$("h2").css("display","block");
}


/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
 */
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=$.extend({},options);options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};



