/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/* tancament de capa emergent comunicat ----------------------- */
function tancaemergent() {
$('#emergent').html('');
$('#emergent').css('display','none');
$('#cos').fadeIn("fast");
};

$(document).ready(function(){  

/* crea capçalera i peu ----------------------- */
var capcont = "\
<div id=\"menu\" class=\"menu\">\
<div id=\"menu1\" class=\"menu1\">\
<table width=\"955\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"menutext\">\
<tr>\
<td height=\"60\"></td>\
</tr>\
<tr valign=\"top\">\
<td width=\"140\"></td>\
<td width=\"188\" align=\"left\">\
<span class=\"blanc\">Seguretat</span><br>\
<a href=\"prevencio.html\">Prevenció general</a><br>\
<a href=\"drogues.html\">Prevenció de drogues</a><br>\
<a href=\"menors.html\">Protecció de Menors</a><br>\
<a href=\"internet.html\">Seguretat a Internet</a><br>\
</td>\
<td width=\"189\" align=\"left\">\
<span class=\"blanc\">La Policia</span><br>\
<a href=\"estructura.html\">Estructura organitzativa</a><br>\
<a href=\"despatxcentral.html\">Despatx Central</a><br>\
<a href=\"despatxos.html\">Despatxos de Policia</a><br>\
<a href=\"historia.html\">Història i identitat</a><br>\
<a href=\"ingres.html\">Ingrés i formació</a><br>\
<a href=\"cooperacio.html\">Cooperació internacional</a><br>\
</td>\
<td width=\"189\" align=\"left\">\
<span class=\"blanc\">Serveis</span><br>\
<a href=\"contacte.html\">Contacte directe</a><br>\
<a href=\"tramits.html\">Tràmits policíacs</a><br>\
<a href=\"documentacio.html\">Documentació i legislació</a><br>\
<a href=\"desapareguts.html\">Persones desaparegudes</a><br>\
<a href=\"radars.html\">Radars fixes</a><br>\
<a href=\"telefons.html\">Telèfons d\'interès</a><br>\
</td>\
<td width=\"189\" align=\"left\">\
<span class=\"blanc\">Especials</span><br>\
<a href=\"historial.html\">Historial de comunicats</a><br>\
<a href=\"media/media.html\">Vídeos</a><br>\
<a href=\"links.html\">Enllaços</a><br><br><br><br>\
<a href=\"index.html\">Inici</a>\
</td>\
<td width=\"60\"></td>\
</tr>\
<tr>\
<td height=\"50\"></td>\
</tr>\
</table>\
</div>\
<div id=\"menu2\"></div>\
</div>\
<div id=\"cap1\"><img src=\"imatges/principal1.jpg\" alt=\"\" width=\"955\" height=\"130\"></div>\
<div id=\"cap2\"><img src=\"imatges/principal2.jpg\" alt=\"\" width=\"955\" height=\"30\">\
<div style=\"position:absolute;top:0px;left:0px;width:955px;height:30px;\">\
<table width=\"955\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"menutext\">\
<tr>\
<td width=\"493\" height=\"30\"></td>\
<td id=\"openmenu\" class=\"openmenu\" width=\"70\" height=\"30\" align=\"center\" valign=\"middle\" style=\"font-weight:bold;cursor:pointer;color:#FFFFFF;\"onmouseover=\"this.style.backgroundColor=\'#3399CC\';\" onmouseout=\"this.style.backgroundColor=\'\';\">menú</td>\
<td width=\"332\" height=\"30\"></td>\
<td width=\"50\" height=\"30\" align=\"center\" valign=\"middle\" style=\"font-weight:bold;cursor:pointer;color:#3399CC\" onClick=\"javascript:window.location.href=\'index.html\';\" onmouseover=\"this.style.backgroundColor=\'#3399CC\';this.style.color=\'#FFFFFF\';\" onmouseout=\"this.style.backgroundColor=\'\';this.style.color=\'#3399CC\';\"><strong>inici</strong></td>\
<td width=\"50\" height=\"30\"></td>\
</tr>\
</table>\
</div>\
</div>";
var peucont = "\
<table width=\"954\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr class=\"petita\" style=\"vertical-align:middle;color:#666666;\">\
<td width=\"654\" height=\"50\" align=\"left\" style=\"padding-left:30px;\">\
Despatx Central de Policia : Tel. +376-872000, fax +376-872004, e-mail:&nbsp;<a href=\"mailto:policia\@andorra.ad\">policia\@andorra.ad</a>\
</td>\
<td width=\"260\" align=\"right\" valign=\"middle\" height=\"50\" style=\"padding-right:30px;\">\
&copy; Policia d\'Andorra&nbsp;&nbsp;|&nbsp;&nbsp;<a href=\"avislegal.html\">Avís legal&nbsp;</a>\
</td>\
</tr>\
</table>";
$("#cap").html(capcont);
$("#peu").html(peucont);

/* menu ----------------------- 
utilitzar amb plug-in anterior hoverIntent.js (To delay or prevent the accidental firing of animations or ajax calls) 
*/
var IE6 = $.browser.msie && $.browser.version.substr(0,1) == 6 && !window.XMLHttpRequest, oldIE = IE6 || ($.browser.msie && $.browser.version.substr(0,1) == 7);
$("#openmenu").hoverIntent( makeTall, makeShort );
function makeTall(){
if (IE6) {$('embed, object, select').css('visibility', 'hidden');} // Hide elements for IE6
$("#menu").stop().animate({top:"130px"},{queue:false,duration:300});		
}
function makeShort(){ }
$("#menu").mouseleave(function(){
if (IE6) {$('embed, object, select').css('visibility', 'visible');} // Show hidden elements for IE6
$("#menu").stop().animate({top:"-200px"},{queue:false,duration:200});
});
$("#cap1").click(function(){
if (IE6) {$('embed, object, select').css('visibility', 'visible');} // Show hidden elements for IE6
$("#menu").stop().animate({top:"-200px"},{queue:false,duration:200});
});
$("#cos").click(function(){
if (IE6) {$('embed, object, select').css('visibility', 'visible');} // Show hidden elements for IE6
$("#menu").stop().animate({top:"-200px"},{queue:false,duration:200});
});

/* capa emergent de comunicat ----------------------- */
if ($("a").is('.iframe')) {
$('a.iframe').click(function(){  
var desti = $(this).attr('href');
$('#emergent').append('<div style="text-align:right;width:925px;"><a href="#" id="tancaemergent" onClick="tancaemergent();"><strong>Tancar comunicat</strong></a></div><div><iframe id="emergentcont" name="emergentcont" frameborder="0" scrolling="no" src="'+desti+'" onLoad="this.style.height = this.contentWindow.document.body.offsetHeight + \'px\';this.style.height = this.contentWindow.document.body.scrollHeight + \'px\';"></iframe></div>');
$('#cos').css('display','none');
$('#emergent').fadeIn("fast");
return false;  
});
} 

/* no blur ----------------------- */
$('.blur').click(function(){  
$(this).blur();  
return false;  
});

/* transparència PNG  IE----------------------- */
/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.1, 11.09.2007
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 */
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'([237-9n-zA-Z]|1\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(s(m){3.fn.pngFix=s(c){c=3.extend({P:\'blank.gif\'},c);8 e=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 5.5")!=-1);8 f=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 6.0")!=-1);p(3.browser.msie&&(e||f)){3(2).B("img[n$=.C]").D(s(){3(2).7(\'q\',3(2).q());3(2).7(\'r\',3(2).r());8 a=\'\';8 b=\'\';8 g=(3(2).7(\'E\'))?\'E="\'+3(2).7(\'E\')+\'" \':\'\';8 h=(3(2).7(\'F\'))?\'F="\'+3(2).7(\'F\')+\'" \':\'\';8 i=(3(2).7(\'G\'))?\'G="\'+3(2).7(\'G\')+\'" \':\'\';8 j=(3(2).7(\'H\'))?\'H="\'+3(2).7(\'H\')+\'" \':\'\';8 k=(3(2).7(\'V\'))?\'float:\'+3(2).7(\'V\')+\';\':\'\';8 d=(3(2).parent().7(\'href\'))?\'cursor:hand;\':\'\';p(2.9.v){a+=\'v:\'+2.9.v+\';\';2.9.v=\'\'}p(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}p(2.9.x){a+=\'x:\'+2.9.x+\';\';2.9.x=\'\'}8 l=(2.9.cssText);b+=\'<y \'+g+h+i+j;b+=\'9="W:X;white-space:pre-line;Y:Z-10;I:transparent;\'+k+d;b+=\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;\';b+=\'J:K:L.t.M(n=\\\'\'+3(2).7(\'n\')+\'\\\', N=\\\'O\\\');\';b+=l+\'"></y>\';p(a!=\'\'){b=\'<y 9="W:X;Y:Z-10;\'+a+d+\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;">\'+b+\'</y>\'}3(2).hide();3(2).after(b)});3(2).B("*").D(s(){8 a=3(2).11(\'I-12\');p(a.A(".C")!=-1){8 b=a.13(\'url("\')[1].13(\'")\')[0];3(2).11(\'I-12\',\'none\');3(2).14(0).15.J="K:L.t.M(n=\'"+b+"\',N=\'O\')"}});3(2).B("input[n$=.C]").D(s(){8 a=3(2).7(\'n\');3(2).14(0).15.J=\'K:L.t.M(n=\\\'\'+a+\'\\\', N=\\\'O\\\');\';3(2).7(\'n\',c.P)})}return 3}})(3);',[],68,'||this|jQuery||||attr|var|style||||||||||||||src|navigator|if|width|height|function|Microsoft|appVersion|border|padding|margin|span|px|indexOf|find|png|each|id|class|title|alt|background|filter|progid|DXImageTransform|AlphaImageLoader|sizingMethod|scale|blankgif|appName|Internet|Explorer|parseInt|MSIE|align|position|relative|display|inline|block|css|image|split|get|runtimeStyle'.split('|'),0,{}))
$(document).pngFix();

});  

/* menu out en sortir de pàgina ----------------------- */
$(window).unload(function() {
var IE6 = $.browser.msie && $.browser.version.substr(0,1) == 6 && !window.XMLHttpRequest, oldIE = IE6 || ($.browser.msie && $.browser.version.substr(0,1) == 7);
if (IE6) {$('embed, object, select').css('visibility', 'visible');} // Show hidden elements for IE6
$("#menu").stop().animate({top:"-500px"},{queue:false,duration:100});
});

$(window).load(function() {
/* fa visible contingut ----------------------- */
$('#esquema').fadeIn("fast"); 
});

