/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3 w={};w.1J=K(h){3 f=h.14||A;3 b=h.1f||A;3 e=h.Q||"#17";3 a=h.13||"#G";3 g=h.20||"#1W";3 d="L://z.N.S.P/z?O=1A";3 j=d+"&T="+f+"x"+b+"&V="+g.4("#","")+","+e.4("#","")+","+a.4("#","")+"&F=.E";3 c=u Z(X);c.W=j;c.10=u B(f,b);c.15=u B(y.1d(f*1.6),b);c.1a=u H(f/2,b);c.19=u H(f/2,y.1d(b/12));c.18=j+"&I=J";c.1j=j+"&C=M,s,1g"+"&I=J";j=d+"&T="+f+"x"+b+"&V="+g.4("#","")+","+e.4("#","")+","+a.4("#","");c.1l=j+"&C=a,s,1o&F=.E";c.v=[f/2,b,(7/16)*f,(5/8)*b,(5/16)*f,(7/16)*b,(7/A)*f,(5/16)*b,(5/16)*f,(1/8)*b,(1/2)*f,0,(11/16)*f,(1/8)*b,(25/A)*f,(5/16)*b,(11/16)*f,(7/16)*b,(9/16)*f,(5/8)*b];1k(3 i=0;i<c.v.1Z;i++){c.v[i]=Y(c.v[i])}D c};w.1V=K(k){3 h=k.14||A;3 j=k.1f||A;3 d=k.Q||"#17";3 i=k.1T||"#G";3 m=w.U(k.1i)||"";3 c=k.1h||"#G";3 l=k.1S||0;3 s=k.1R||"1e";3 f=(s==="1e")?"1Q":"1P";3 t="L://z.N.S.P/z?O="+f;3 n=t+"&T="+h+"x"+j+"&V="+d.4("#","")+","+i.4("#","")+"1O,1c"+"&1b="+m+"&1M="+c.4("#","")+","+l;3 e=u Z(X);e.W=n+"&C=M,s,1K"+"&F=.E";e.10=u B(h,j);e.15=u B(0,0);e.1a=u H(h/2,j/2);e.19=u H(h/2,j/2);e.18=n+"&I=J";e.1j=n+"&C=M,s,1g"+"&I=J";e.1l=n+"&C=a,s,1c&F=.E";e.v=[];R(f==="1I"){e.v=[0,0,h,0,h,j,0,j]}1H{3 o=8;3 r=1G/o;3 b=y.1F(h,j)/2;1k(3 a=0;a<(o+1);a++){3 g=r*a*(y.1E/1D);3 p=b+b*y.1B(g);3 q=b+b*y.1z(g);e.v.1L(Y(p),Y(q))}}D e};w.1y=K(k){3 j=k.Q||"#1N";3 b=k.13||"#G";3 f=k.1x||"#1w";3 a=k.1v||"#1u";3 e=w.U(k.1i)||"";3 d=k.1h||"#G";3 i=k.1t||1s;3 c=(i)?"1r":"1U";3 h="L://z.N.S.P/z?O=d&1q=1p&1b=";3 l=h+c+"\'i\\\\"+"\'["+e+"\'-2\'f\\\\"+"1X\'a\\\\]"+"h\\\\]o\\\\"+j.4("#","")+"\'1Y\\\\"+d.4("#","")+"\'1n\\\\"+b.4("#","")+"\'1m\\\\";R(i){l+=f.4("#","")+"\'1C\\\\"+a.4("#","")+"\'22\\\\"}l+="2a\'f\\\\";3 g=u Z(X);g.W=l+"&F=.E";g.10=(i)?u B(23,28):u B(21,27);D g};w.U=K(a){R(a===26){D 24}a=a.4(/@/,"@@");a=a.4(/\\\\/,"@\\\\");a=a.4(/\'/,"@\'");a=a.4(/\\[/,"@[");a=a.4(/\\]/,"@]");D 29(a)};',62,135,'|||var|replace||||||||||||||||||||||||||new|imageMap|MapIconMaker||Math|chart|32|GSize|chf|return|png|ext|000000|GPoint|chof|gif|function|http|bg|apis|cht|com|primaryColor|if|google|chs|escapeUserText_|chco|image|G_DEFAULT_ICON|parseInt|GIcon|iconSize|||strokeColor|width|shadowSize||ff0000|printImage|infoWindowAnchor|iconAnchor|chl|ffffff01|floor|circle|height|ECECD8|labelColor|label|mozPrintImage|for|transparent|eC|tC|ffffff11|mapsapi|chdp|pin_star|false|addStar|0000FF|starStrokeColor|FFFF00|starPrimaryColor|createLabeledMarkerIcon|sin|mm|cos||180|PI|min|360|else|roundrect|createMarkerIcon|00000000|push|chx|DA7187|ff|itr|it|shape|labelSize|shadowColor|pin|createFlatIcon|ffffff|hv|fC|length|cornerColor||0C||null||undefined|34|39|encodeURIComponent|Lauto'.split('|'),0,{}))
var tb_pathToImage = "ajax-loader.gif";

var BTB_GM_MAP;

var colores=["#699124","#699124","#69b2c3","#f7e4be","#d6e1c7","#ffc48c","#effab4","#73626e","#a38a5f","#c75233","#c78933","#effab4","#FFFF00","#FF0000","#0B243B","#868A08","#0000FF","#8A4B08","#F5A9A9","#071910","#BDBDBD","#484848" ];
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
jQuery(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	jQuery(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			jQuery("body","html").css({height: "100%", width: "100%"});
			jQuery("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		jQuery('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Pechar'><b>X</b></a></div>"); 		
			
			jQuery("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				jQuery("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				jQuery("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			jQuery("#TB_load").remove();
			jQuery("#TB_ImageOff").click(tb_remove);
			jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					jQuery("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Pechar'><b>X</b></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					jQuery("#TB_overlay").unbind();
						jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}		  
			}else{// not an iframe, ajax
					if(jQuery("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Pechar'><b>X</b></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						jQuery("#TB_overlay").unbind();
						jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						jQuery("#TB_ajaxContent")[0].scrollTop = 0;
						jQuery("#TB_ajaxWindowTitle").html(caption);
					}
			}
			
					
			jQuery("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
					jQuery("#TB_window").unload(function () {
						jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					jQuery("#TB_load").remove();
					jQuery("#TB_window").css({display:"block"}); 				
				}else if(url.indexOf('TB_googleMap') != -1){
					var mapDiv =  document.createElement('div');
					mapDiv.id = 'googleMap';
					
					jQuery('#TB_ajaxContent').append(mapDiv);
					jQuery('#TB_ajaxContent').css({overflow:"hidden"});
					
					jQuery('#googleMap').css({width:ajaxContentW-12, height:ajaxContentH});
					
					jQuery('#TB_window').unload(function(){
						jQuery("#googleMap").remove();
						BTB_GM_MAP = null;
						GUnload();
					});
					
					tb_position();
					jQuery("#TB_load").remove();
					jQuery("#TB_window").css({display:"block"});
					
					loadGoogleMap(params["lat"], params["lng"], params["zoom"], params["markerText"],params["image"], params);
					
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						jQuery("#TB_load").remove();
						jQuery("#TB_window").css({display:"block"});
					}
				}else{
					jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						jQuery("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						jQuery("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
}


function loadGoogleMap(lat, lon, zoom, html,image, params){
    if(GBrowserIsCompatible()){
                          
			  //get all the points we need to mark
			  var points = new Array();
			  var i=0;
			  alert(params);
			  for(var item in params){
                                        
					if(item.substring(0,3) == 'lat'){
							var point = {};
							//get the numberof marker
							var itemNumber = 0;
							
                                                        if(item.length > 3){
							  
                                                          itemNumber = parseInt(item.substring(3));
                                                          if(itemNumber==0){
                                                            lat = params["lat"+itemNumber];
							     lon = params["lng"+itemNumber];
                                                             //alert("metemos o primeiro");
                                                          }

								point.lat = params["lat"+itemNumber];
								point.lng = params["lng"+itemNumber];
								point.text = params["markerText"+itemNumber];
                                                                point.image= params["image"+itemNumber];

                                                                
							}else{
								point.lat = params["lat"];
								point.lng = params["lng"];
								point.text = params["markerText"];
                                                                point.image= params["image"];
                                                                
							}
                                                        if(params["image"+itemNumber]!=null){
                                                            points[i] = point;
                                                            i++;
                                                        }else{
                                                            alert("#"+itemNumber+"#"+" point.lat =#"+ params["lat"+itemNumber]+"# point.lng =#"+ params["lng"+itemNumber]+"# point.text =#"+ params["markerText"+itemNumber]+"# point.image=#"+ params["image"+itemNumber])+"#";
                                                        }
					}
                                       
			  }

        
        BTB_GM_MAP = new GMap2(document.getElementById("googleMap"));
        
	BTB_GM_MAP.enableScrollWheelZoom();
        
        BTB_GM_MAP.addControl(new GSmallMapControl());
        
        BTB_GM_MAP.addControl(new GMapTypeControl());
        
        BTB_GM_MAP.setMapType( G_HYBRID_MAP );
        
        point = new GLatLng(lat, lon);
        
        BTB_GM_MAP.setCenter(point, 0);
        
        BTB_GM_MAP.clearOverlays();
        
        var bounds = new GLatLngBounds();
        

				for(var j = 0; j < points.length; j++){
                                        
					var markerPoint = new GLatLng(points[j].lat, points[j].lng);
					var marker = createMarker(markerPoint, points[j].text,points[j].image);
					
					BTB_GM_MAP.addOverlay(marker);
					bounds.extend(markerPoint);
				}
						
				if(zoom != null)
				{
					BTB_GM_MAP.setZoom(parseInt(zoom));
				}
				else
				{		
					BTB_GM_MAP.setZoom(BTB_GM_MAP.getBoundsZoomLevel(bounds));
					BTB_GM_MAP.setCenter(bounds.getCenter());
				}
						
				}
    
        addLeyenda(crearLeyenda(points),BTB_GM_MAP);
    
}
function crearLeyenda(puntos){
    var redes=[];
    var textos=[];
    for(var j = 0; j < puntos.length; j++){

        
        //alert("imagen"+imagen);
        if(redes[puntos[j].image]==null){
            redes[puntos[j].image]=puntos[j].image;
        }
        if(textos[puntos[j].image]==null){
            var texto=puntos[j].text.substring(3);
            var pos=texto.indexOf('</b>');
            textos[puntos[j].image]=texto.substring(0,pos);
        }
    }
    //alert("textos:"+textos);

    var htmlLeyenda="<table style='font-size: 7pt; color: #FFFFFF; background-color:transparent; padding:0px; text-ident:3px;letter-spacing:0px;'>";
    for(var j = 0; j < redes.length; j++){


        //alert("imagen"+imagen);
        if(redes[j]!=null){
            htmlLeyenda+="<tr style='background-color:#698cb4; padding:0px;'><td style='background-color:"+colores[j]+"'>&nbsp;&nbsp;</td><td style='background-color:transparent;padding-left:3px'><b>"+textos[j]+"</b></td></tr>";
        }
        
    }
    htmlLeyenda+="</table>";
    return htmlLeyenda;

}
function addLeyenda(texto,capa){

    function MyPane() {}
        MyPane.prototype = new GControl;
        MyPane.prototype.initialize = function(map) {
          var me = this;
          me.panel = document.createElement("div");
          
          
          me.panel.innerHTML = texto;
          map.getContainer().appendChild(me.panel);
          return me.panel;
        };

        MyPane.prototype.getDefaultPosition = function() {
          return new GControlPosition(
              G_ANCHOR_BOTTOM_RIGHT);
              //Should be _ and not &#95;
        };

        MyPane.prototype.getPanel = function() {
          return me.panel;
        }
        capa.addControl(new MyPane());
}

function createMarker(point, text, image){
  //alert("imagen:"+image);
  var newIcon;
  if(image!=null){
      
      newIcon = MapIconMaker.createMarkerIcon({primaryColor: colores[image],strokeColor:"#000000"});
  }else{

      newIcon = MapIconMaker.createMarkerIcon({primaryColor: colores[0]});
  }
  
  var marker = new GMarker(point,{icon:newIcon});


  if(text && text != ''){
	  GEvent.addListener(marker, "click", function(){
		  marker.openInfoWindowHtml(text);
		});
  }
  
  return marker;
}

//helper functions below
function tb_showIframe(){
	jQuery("#TB_load").remove();
	jQuery("#TB_window").css({display:"block"});
}

function tb_remove() {
 	jQuery("#TB_imageOff").unbind("click");
	jQuery("#TB_closeWindowButton").unbind("click");
	jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	jQuery("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		jQuery("body","html").css({height: "auto", width: "auto"});
		jQuery("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}



