// ==================
// Advanced controls.
// ==================
/*
plugins : "layer,table,save,advimage,advlink,iespell,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras",
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "pasteword,|,search,replace,|,bullist,numlist,|,link,unlink,image,cleanup,code,|,forecolor,backcolor",
	*/
//base_path = "/ALT/";
//d_php = base_path+"ajax.php";

// ===============================
//	COMMON VARIABLES.
// ===============================
//my_url 		= 'http://www.pixelhivedesign.com/alt/';
//bpath 		= '/alt/';
// bpath & my_url are set in common.js, drawing from hidden var in interface.tpl
dynamicLoad = false;
d_php 		= bpath + 'ajax.php';
ajax_options = {
	url: d_php
};
// ===============================
//	TINY MCE SETUP.
// ===============================
tinyMCE.init({
	mode : "specific_textareas",
	theme : "advanced",
	editor_selector: "mceEditor",
	plugins : "layer,table,advimage,advlink,iespell,searchreplace,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras",
	theme_advanced_buttons1 : "pasteword,|,undo,redo,|,bold,italic,underline,forecolor,|,bullist,numlist,table,|,link,unlink,|,justifyleft,justifycenter,justifyright,justifyfull,|,image,|,code",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	height : "400",

	relative_urls : false,
	document_base_url : bpath,
	
	content_css : bpath + "style_mce.css",
	
	file_browser_callback: "fileBrowserCallBack"
	
	//save_callback : "saveEditorContent"
	//setupcontent_callback : "setupEditorContent"
});

function fileBrowserCallBack(field_name, url, type, win) {
	var connector = "../../filemanager/browser.html?Connector=connectors/php/connector.php";
	var enableAutoTypeSelection = true;
	
	var cType;
	tinyfck_field = field_name;
	tinyfck = win;
	
	switch (type) {
		case "image":
			cType = "Image";
			break;
		case "flash":
			cType = "Flash";
			break;
		case "file":
			cType = "File";
			break;
	}
	
	if (enableAutoTypeSelection && cType) {
		connector += "&Type=" + cType;
	}
	
	window.open(connector, "tinyfck", "modal,width=600,height=400");
}
// ====================
// UNLOAD ADMIN PAGE
// ====================
$(window).unload(function(){

	// Clean any unfilled multi-dates.
	$("input[name='multi_date']").each(function(){
		if($(this).val() == '') {
			var id = $(this).attr('id');
			id = id.split('_');
			ajax_options.type = "POST";
			ajax_options.async = false;
			ajax_options.data = "ajax_module=multi_date&action=remove_date&id="+ id[1];
			$.ajax(ajax_options);
		}
	})
});
$(document).ready(function(){
       //$('#is_tabs').tabs({ fxFade: true, fxSpeed: 'fast'});
       //$('#is_tabs').triggerTab(2);
       
	// Add datepicker to all inputs identified as "is_datepicker".
	$('.is_datepicker').datepicker();
	
	// Submit data_form.  (Save button is outside of the form)
        //$("#data_form").submit(function(){
           //$(".save_item").click();
         //  return false;
       // });
	$(".save_item").bind("click", save_form_item);
        function save_form_item(){
                var skip_val = false;
                var validated = true;
                var location_only = false;
                if($(this).is(".check_nominate") && !skip_val){
                   
                    // Nominate Site, Required Fields.
                    var req_fields = [{'input':'title','value':$("input[name='title']").val(),'invalid':'','msg':'Site Name.'},
                                        {'input':'category_id','value':$("#category_id").val(),'invalid':'-', 'msg':'Site Category. (Select "Other", if none are appropriate)'},
                                        {'input':'description','value':$("textarea[name='content']").val(),'invalid':'','msg':'Site Description.'}];

                    for(i in req_fields){
                        var field = req_fields[i];
                        if(field['value'] == field['invalid']){
                            if(validated) var txt = "<div class='notice_box'><p><b>The following information is required:</b></p><ul>"
                            validated = false;
                            txt += "<li>"+field['msg']+"</li>";
                        }
                    }
                    if(!validated) txt += "</ul><p>Please double check the form and try again.</p></div>";

                    if(validated && !$(this).is('.no_location')){
                        // Nominate Site, Recommended Fill.
                        var req_fields = [{'input':'latitude', 'value':$("input[name='latitude']").val(),'invalid':'','msg':'You did not specify a location.'}
                                            ];

                        for(i in req_fields){
                            var field = req_fields[i];
                            if(field['value'] == field['invalid']){
                                if(validated) var txt = "<div class='notice_box'><p><b>Please note:</b></p><ul>"
                                validated = false;
                                location_only = true;
                                txt += "<li>"+field['msg']+"</li>";
                            }
                        }
                        if(!validated) txt += "</ul><p>Nominate the site without marking a location?</p></div>";
                    }
                }
		if(validated) {
                    

                    $('#data_form').submit();
                }
                else {
                    if(!location_only){
                       $.prompt(txt,{
                          callback: return_to_form,
                          buttons: { 'Ok': 'Ok'},
                              opacity: 0.6
                        });
                    } else {
                         $.prompt(txt,{
                          callback: return_to_form2,
                          buttons: { 'Nominate Site': 'ok', 'Cancel':'cancel'},
                              opacity: 0.6
                        });
                    }
                }
		return false;
	};
	function return_to_form(v,m){
            
        }
        function return_to_form2(v,m){
            switch(v){
                case 'ok':
                    $(".save_item").addClass('no_location');
                    $(".save_item").click();
                break;
                case 'cancel':
                break;
            }
        }
	// Delete Record Prompt.
	$(".delete_item").click(function(){
		var txt = '<p>Are you sure you want to delete? The item will be permantly removed from the database.</p>';
		$.prompt(txt,{
		      callback: delete_record,
		      buttons: { 'Delete': 'Ok', 'Cancel': 'Cancel'},
			  opacity: 0.6
		});
		return false;
	});
	
	function delete_record(v,m){
		  //$.prompt(v +' ' + m.children('#alertName').val());
		  switch(v){
			case 'Ok':
				$.get(d_php,{	'action':'delete',
							'ajax_module': $("#ajax_module").text(),
							'id':$("input[name='connect_id']").val()
							},
						function(data){
							// Remove item from quick list.
							$(".nav_item_"+$("input[name='connect_id']").val()).remove();
							
							// Empty page content.
							$(".content").empty();
							
							// Display Message.
							$(".content").append(data);
							
						});
			break;
		}
	}
	$(".close_item").click(function(){
		
	});
	
	// Automatically Hide Temporary Elements after 3 seconds.
	if($(".temporary_display").length > 0){
		search_timeout = setTimeout(function() {
                search_timeout = undefined;
                // do stuff with $this here
                $(".temporary_display").fadeOut('slow');
        }, 5000);
     }
     
     $(".transfer-item",$(".land_shape_list")).click(function(){
     	var land_id = $("input[name='connect_id']").val();
    	 var shape_id = $("input",this).val();
     	if($(":checkbox",this).attr('checked')){
     		// Item is currently checked, we are unchecking / removing.
     		// Remove land shape from the map.
     		
     		Mapifies.RemovePolygon($("#map_canvas"), map_polygons["l_"+land_id]["s_"+shape_id]);
     		
     	} else {
     		// Item currently uncheck, we are checking / adding.
     		// Add land shape to the map.
     		var map_key = $('#map_key').text();
			var options = {		'ajax_module':'map',		
								'action':'get_map',
								'list_key': map_key,
								'map_type': 'shape_data',
								'map_db_id': shape_id
							};
			$(".land_shape_list").display_loader("loading_shape","<br/>Loading Boundry Shape...");
     		$.getJSON(d_php,options,function(data){
     			if(map_polygons["l_"+land_id] == null) map_polygons["l_"+land_id] = [];
     			var shape = data;
     			var gpoints = [];
				var points = shape['p'];
				$.each(points,function(j,point){
					gpoints.push([parseFloat(point['x']),parseFloat(point['y'])]);
				});
				gpoints.push([parseFloat(points[0]['x']),parseFloat(points[0]['y'])]);
				var color = shape['c'];
				var title = unescape(String(shape['n']).replace(/\+/g," "));
				//var polygon = new GPolygon(gpoints, "#f8f36b", 1, 1, color, 0.5,{'tooltip':title});
				
				$("#map_canvas").jmap('AddPolygon', {
								'polygonPoints': gpoints,
								'polygonFillColor':color,
								'polygonFillOpacity':0.5,
								'polygonStrokeWeight':1,
								'polygonStrokeColor': "#f8f36b"
								}, function(polygon){
							map_polygons["l_"+land_id]["s_"+shape['id']] = polygon;	
						});
				$("#loading_shape").remove();
			});
     	}
     	return false;
     });
     $(".transfer-item",$(".land_project_list")).click(function(){
    	 var land_id = $("input",this).val();
     	if($(":checkbox",this).attr('checked')){
     		// Item is currently checked, we are unchecking / removing.
     		// Remove land shape from the map.
     		for(var i in map_polygons["l_"+land_id]){
     			Mapifies.RemovePolygon($("#map_canvas"), map_polygons["l_"+land_id][i]);
     		}
     	} else {
     		// Item currently uncheck, we are checking / adding.
     		// Add land shape to the map.
     		var map_key = $('#map_key').text();
			var options = {		'ajax_module':'map',		
								'action':'get_map',
								'list_key': map_key,
								'map_type': 'land_data',
								'map_db_id': land_id
							};
			$(".land_shape_list").display_loader("loading_shape","<br/>Loading Boundry Shape...");
     		$.getJSON(d_php,options,function(data){
     				var shapes = data['shapes'];
     				
				$.each(shapes,function(i,shape){
	     			if(map_polygons["l_"+shape['l_id']] == null) map_polygons["l_"+shape['l_id']] = [];
	     			var gpoints = [];
					var points = shape['p'];
					$.each(points,function(j,point){
						gpoints.push([parseFloat(point['x']),parseFloat(point['y'])]);
					});
					gpoints.push([parseFloat(points[0]['x']),parseFloat(points[0]['y'])]);
					var color = shape['c'];
					var title = unescape(String(shape['n']).replace(/\+/g," "));
					//var polygon = new GPolygon(gpoints, "#f8f36b", 1, 1, color, 0.5,{'tooltip':title});
					
					$("#map_canvas").jmap('AddPolygon', {
									'polygonPoints': gpoints,
									'polygonFillColor':color,
									'polygonFillOpacity':0.5,
									'polygonStrokeWeight':1,
									'polygonStrokeColor': "#f8f36b"
									}, function(polygon){
									
									map_polygons["l_"+shape['l_id']]["s_"+shape['id']] = polygon;	
							});
				});
				$("#loading_shape").remove();
			});
     	}
     	return false;
     });
     // Map View.
     $("#set_map_view").click(function(){
     	var cntr = Mapifies.getCenter($("#map_canvas"));
     	$("input[name='latitude']").val(cntr.lat());
     	$("input[name='longitude']").val(cntr.lng());
     	$("input[name='zoom']").val(Mapifies.MapObjects.Get($("#map_canvas")).getZoom());
     	return false;
     });

});
// =====================
//  Multiple Dates
// =====================
$(document).ready(function(){
	//$('.multi_date').datepicker();
	$('.multi_date').bind('change',save_date);
	$('.remove_multi_date').bind('click',remove_date);
	
	var date_options = {
				ajax_module: 'multi_date',
				event_id:$("input[name='connect_id']").val(),
				url: d_php,
				user_id: $("#user_id").text()
				}

	$('#add_multi_date').click(function(){
		date_options.action = 'create_date';
		$.get(d_php,date_options,function(data){
			$('#multi_dates').append(data);
			$('.multi_date').datepicker();
			$('.multi_date').bind('change',save_date);
			$('.remove_multi_date').bind('click',remove_date);
		});
		return false;
	});
	function save_date(){
		var id = $(this).attr('id');
		id = id.split('_');
		date_options.id = id[1];
		date_options.date = $(this).val();
		date_options.action = 'save_date';
		$.post(d_php,date_options);
	}
	
	function remove_date(){
		var id = $(this).parent().find('.multi_date').attr('id');
		id = id.split('_');
		date_options.id = id[1];
		
		date_options.action = 'remove_date';
		$.getJSON(d_php,date_options,function(data){
			$("#db_"+data.id).parent().remove();
			
		});
		return false;
	}
});




// ===============================
//		Collapsible Panes
// ===============================
$(document).ready(function() {
	var default_pane = -1;
	var toggleMinus = bpath + 'images/icons/toggle_minus.png';
	var togglePlus  = bpath + 'images/icons/toggle_plus.png';
	//$('.pane').addClass('pane-open');
	var $pane_trigger = $('.pane h2');
	$pane_trigger.prepend('<img src="' + toggleMinus + '" alt="collapse this section" class="icon"/>');
	$($pane_trigger).addClass('clickable')
		.click(function(){
			var $content = $(this).parent().find('.pane_content');
			var $icon = $('img',this);
			toggleSrc = $icon.attr('src');
			if(toggleSrc == toggleMinus){
				$icon.attr('src',togglePlus);
				$content.slideUp('fast');
				$(this).parent().removeClass('pane-open').addClass('pane-closed');
			} else {
				$icon.attr('src',toggleMinus);
				$content.slideDown('fast');
				$(this).parent().removeClass('pane-closed').addClass('pane-open');
			};
		});
		
	$(".pane").each(function(){
		//alert('hi');
		if($(this).is('.pane-closed')){
			$("h2",$(this)).click();
		} else {
			$(this).addClass('pane-open');
		}
	});	
	$('.folded h2').click();
        
	var $pane_trigger = $('.map_pane');
	$($pane_trigger).addClass('clickable')
		.click(function(){
			if($(this).is('.map_pending') ){
				loadMapJS();
			}
			$(this).addClass('map_loaded').removeClass('map_pending');
			return false;
	});
	
	

	//$(document).find('.pane h2:gt(' + default_pane + ')').click();
});



/**
*
*  Javascript trim, ltrim, rtrim
*  http://www.webtoolkit.info/
*
**/

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
 
// UI Blocker.
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}(';(8($){4(/1\\.(0|1|2)\\.(0|1|2)/.16($.T.M)||/^1.1/.16($.T.M)){27(\'7 28 1k 29.2.3 2a 2b!  2c 2d 2e v\'+$.T.M);G}$.7=8(a){1l(N,a)};$.2f=8(a){17(N,a)};$.T.2g=8(a){G w.18(8(){4($.D(w,\'C\')==\'2h\')w.A.C=\'2i\';4($.O.U)w.A.2j=1;1l(w,a)})};$.T.2k=8(a){G w.18(8(){17(w,a)})};$.7.2l=2.2m;$.7.V={19:\'<1D>2n 1m...</1D>\',D:{1n:0,1o:0,W:\'30%\',P:\'2o%\',X:\'2p%\',2q:\'1p\',2r:\'#1E\',1q:\'2s 2t #2u\',1F:\'#2v\',1G:\'1m\'},Y:{1F:\'#1E\',1H:\'0.6\'},1I:2w,1J:I,1r:I,1K:I,1L:I,Q:2x,1M:I,1N:I,1s:1a};5 q=$.O.U&&/2y 6.0/.16(1O.2z);5 r=1a;5 u=[];8 1l(a,b){5 c=(a==N);5 d=b&&b.19!==1t?b.19:1t;b=$.1b({},$.7.V,b||{});b.Y=$.1b({},$.7.V.Y,b.Y||{});5 e=$.1b({},$.7.V.D,b.D||{});d=d===1t?b.19:d;4(c&&r)17(N,{Q:0});4(d&&1P d!=\'2A\'&&(d.J||d.M)){5 f=d.M?d[0]:d;5 g={};$(a).Z(\'7.1u\',g);g.H=f;g.1v=f.J;g.R=f.A.R;g.C=f.A.C;g.1v.1Q(f)}5 z=b.1I;5 h=($.O.U)?$(\'<1R 11="7" A="z-1c:\'+z++ +\';1q:1d;1o:0;1n:0;C:1e;W:12%;13:12%;P:0;X:0" 2B="2C:1S;"></1R>\'):$(\'<E 11="7" A="R:1d"></E>\');5 j=$(\'<E 11="7" A="z-1c:\'+z++ +\';1G:1m;1q:1d;1o:0;1n:0;W:12%;13:12%;P:0;X:0"></E>\');5 k=c?$(\'<E 11="7 1w 2D" A="z-1c:\'+z+\';C:1T"></E>\'):$(\'<E 11="7 1w 2E" A="z-1c:\'+z+\';R:1d;C:1e"></E>\');4(d)k.D(e);4(!b.1N||!($.O.2F&&/2G/.16(1O.2H)))j.D(b.Y);j.D(\'C\',c?\'1T\':\'1e\');4($.O.U)h.D(\'1H\',\'0.0\');$([h[0],j[0],k[0]]).2I(c?\'F\':a);5 m=$.O.U&&(!$.1f||$(\'2J,2K\',c?1a:a).14>0);4(q||m){4(c&&b.1K&&$.1f)$(\'2L,F\').D(\'13\',\'12%\');4((q||!$.1f)&&!c){5 t=15(a,\'1U\'),l=15(a,\'1V\');5 n=t?\'(0 - \'+t+\')\':0;5 p=l?\'(0 - \'+l+\')\':0}$.18([h,j,k],8(i,o){5 s=o[0].A;s.C=\'1e\';4(i<2){c?s.K(\'13\',\'B.F.1W > B.F.S ? B.F.1W : B.F.S + "L"\'):s.K(\'13\',\'w.J.S + "L"\');c?s.K(\'W\',\'1k.1f && B.1g.1X || B.F.1X + "L"\'):s.K(\'W\',\'w.J.1x + "L"\');4(p)s.K(\'X\',p);4(n)s.K(\'P\',n)}1y 4(b.1r){4(c)s.K(\'P\',\'(B.1g.1Y || B.F.1Y) / 2 - (w.S / 2) + (2M = B.1g.1z ? B.1g.1z : B.F.1z) + "L"\');s.2N=0}})}k.2O(d).1Z();4(d&&(d.M||d.2P))$(d).1Z();1h(1,a,b);4(c){r=k[0];u=$(\':2Q:2R:2S\',r);4(b.1M)1A(1i,20)}1y 1p(k[0],b.1J,b.1r)};8 17(a,b){5 c=a==N;5 d=$(a).Z(\'7.1u\');b=$.1b({},$.7.V,b||{});1h(0,a,b);5 e=c?$(\'F\').21().22(\'.7\'):$(\'.7\',a);4(c)r=u=1a;4(b.Q){e.Q(b.Q);1A(8(){1B(e,d,b,a)},b.Q)}1y 1B(e,d,b,a)};8 1B(a,b,c,d){a.18(8(i,o){4(w.J)w.J.1Q(w)});4(b&&b.H){b.H.A.R=b.R;b.H.A.C=b.C;b.1v.2T(b.H);$(b.H).2U(\'7.1u\')}4(1P c.1s==\'8\')c.1s(d,c)};8 1h(b,a,c){5 d=a==N,$H=$(a);4(!b&&(d&&!r||!d&&!$H.Z(\'7.23\')))G;4(!d)$H.Z(\'7.23\',b);5 e=\'2V 2W 2X 2Y 2Z\';b?$(B).1h(e,c,1C):$(B).31(e,1C)};8 1C(e){4(e.24&&e.24==9){4(r&&e.Z.1L){5 a=u;5 b=!e.25&&e.1j==a[a.14-1];5 c=e.25&&e.1j==a[0];4(b||c){1A(8(){1i(c)},10);G 1S}}}4($(e.1j).26(\'E.1w\').14>0)G I;G $(e.1j).26().21().22(\'E.7\').14==0};8 1i(a){4(!u)G;5 e=u[a===I?u.14-1:0];4(e)e.1i()};8 1p(a,x,y){5 p=a.J,s=a.A;5 l=((p.1x-a.1x)/2)-15(p,\'1V\');5 t=((p.S-a.S)/2)-15(p,\'1U\');4(x)s.X=l>0?(l+\'L\'):\'0\';4(y)s.P=t>0?(t+\'L\'):\'0\'};8 15(a,p){G 32($.D(a,p))||0}})(1k);',62,189,'||||if|var||blockUI|function||||||||||||||||||||||||this||||style|document|position|css|div|body|return|el|true|parentNode|setExpression|px|jquery|window|browser|top|fadeOut|display|offsetHeight|fn|msie|defaults|width|left|overlayCSS|data||class|100|height|length|sz|test|remove|each|message|null|extend|index|none|absolute|boxModel|documentElement|bind|focus|target|jQuery|install|wait|padding|margin|center|border|centerY|onUnblock|undefined|history|parent|blockMsg|offsetWidth|else|scrollTop|setTimeout|reset|handler|h1|000|backgroundColor|cursor|opacity|baseZ|centerX|allowBodyStretch|constrainTabKey|focusInput|applyPlatformOpacityRules|navigator|typeof|removeChild|iframe|false|fixed|borderTopWidth|borderLeftWidth|scrollHeight|clientWidth|clientHeight|show||children|filter|isBlocked|keyCode|shiftKey|parents|alert|requires|v1|or|later|You|are|using|unblockUI|block|static|relative|zoom|unblock|version|08|Please|40|35|textAlign|color|3px|solid|aaa|fff|1000|400|MSIE|userAgent|string|src|javascript|blockPage|blockElement|mozilla|Linux|platform|appendTo|object|embed|html|blah|marginTop|append|nodeType|input|enabled|visible|appendChild|removeData|mousedown|mouseup|keydown|keypress|click||unbind|parseInt'.split('|'),0,{}))
// ScrollTo
;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
// Impromptu.
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}('8.W({O:{3:\'1O\',D:{29:14},1m:5(){},1g:5(){M 14},1h:5(){},11:0.6,J:1X,12:\'1V\',1j:\'1S\',X:\'X\',Z:0,U:1F},1D:5(o){8.O=8.W({},8.O,o)},1x:5(m,o){o=8.W({},8.O,o);4 f=(8.16.1r&&8.16.1Y<7);4 b=8(C.L);4 w=8(y);4 g=\'<9 B="\'+o.3+\'V" F="\'+o.3+\'V">\';A(o.U&&((8.16.1r&&8(\'1L, 1K\').1I>0)||f))g+=\'<1e 1G="1E:;" B="\'+o.3+\'H" F="\'+o.3+\'H"></1e>\';1C{A(f)$(\'1v\').z(\'1i\',\'1w\');g+=\'<9 B="\'+o.3+\'H" F="\'+o.3+\'H"></9>\'}g+=\'<9 B="\'+o.3+\'" F="\'+o.3+\'"><9 B="\'+o.3+\'1a"><9 B="\'+o.3+\'19"></9><9 B="\'+o.3+\'18">\'+m+\'</9><9 B="\'+o.3+\'D" F="\'+o.3+\'D">\';8.28(o.D,5(k,v){g+=\'<G 21="\'+o.3+\'G\'+k+\'" F="\'+o.3+\'G\'+k+\'" 20="\'+v+\'">\'+k+\'</G>\'});g+=\'</9></9></9></9>\';4 h=b.1Z(g).E(\'#\'+o.3+\'V\');4 j=h.E(\'#\'+o.3);4 l=h.E(\'#\'+o.3+\'H\');4 n=5(){M(C.13.1p||C.L.1p)+\'1o\'};4 p=5(){4 a={K:y.1W||(y.C.13.1l||y.C.L.1l),I:y.1U||(y.C.13.1k||y.C.L.1k)};M a};4 q=5(){h.z({Q:n()})};4 r=5(){4 i=0;h.1T(o.3+\'17\');4 a=1R(5(){h.1Q(o.3+\'17\');A(i++>1){1N(a);h.1M(o.3+\'17\')}},R)};4 s=5(e){4 a=(y.S)?S.1f:e.1f;4 b=(y.S)?27:e.1H;A(a==b)x()};4 t=5(){4 a=p();h.z({T:(f)?"Y":"1J",I:a.I,K:"R%",Q:(f)?n():0,10:0,1d:0,1c:0});l.z({T:"Y",I:a.I,K:"R%",Q:0,10:0,1d:0,1c:0});j.z({T:"Y",Q:"1B",10:"1A%",1P:((((j.z("1z").1y("1o")[0]*1)+j.K())/2)*-1)})};4 u=5(){l.z({J:o.J,1b:"1n",11:o.11});j.z({J:o.J+1,1b:"1n"})};4 x=5(a,c,d){j.15();A(f)b.N(\'1q\',q);w.N(\'1u\',t);l.26(o.12,5(){l.N(\'P\',r);l.15();A(a)o.1h(c,d);h.N(\'1t\',s);h.15();A(f&&!o.U)$(\'1v\').z(\'1i\',\'25\')})};t();u();8(\'#\'+o.3+\'D\').E(\'G\').P(5(){4 a=j.E(\'.\'+o.3+\'1a\').E(\'.\'+o.3+\'18\');4 b=o.D[8(24).23()];A(o.1g(b,a))x(14,b,a)});A(f)w.1q(q);l.P(r);w.1u(t);h.1t(s);j.1s(\'.\'+o.3+\'19\').P(x);l.22(o.12);j[o.X](o.1j,o.1m);j.1s(\'#\'+o.3+\'D G:2a(\'+o.Z+\')\').Z();M h}});',62,135,'|||prefix|var|function|||jQuery|div|||||||||||||||||||||||||window|css|if|class|document|buttons|children|id|button|fade|height|zIndex|width|body|return|unbind|ImpromptuDefaults|click|top|100|event|position|useiframe|box|extend|show|absolute|focus|left|opacity|overlayspeed|documentElement|true|remove|browser|warning|message|close|container|display|bottom|right|iframe|keyCode|submit|callback|visibility|promptspeed|clientHeight|clientWidth|loaded|none|px|scrollTop|scroll|msie|find|keypress|resize|select|hidden|prompt|split|paddingLeft|50|100px|else|SetImpromptuDefaults|javascript|false|src|DOM_VK_ESCAPE|length|fixed|applet|object|removeClass|clearInterval|jqi|marginLeft|toggleClass|setInterval|fast|addClass|innerHeight|slow|innerWidth|999|version|append|value|name|fadeIn|text|this|visible|fadeOut||each|Ok|eq'.split('|'),0,{}))
// Dimensions
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}('(5($){$.19={P:\'1.2\'};$.u([\'j\',\'w\'],5(i,d){$.q[\'O\'+d]=5(){p(!3[0])6;g a=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';6 3.B(\':y\')?3[0][\'L\'+d]:4(3,d.x())+4(3,\'n\'+a)+4(3,\'n\'+e)};$.q[\'I\'+d]=5(b){p(!3[0])6;g c=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';b=$.F({t:Z},b||{});g a=3.B(\':y\')?3[0][\'8\'+d]:4(3,d.x())+4(3,\'E\'+c+\'w\')+4(3,\'E\'+e+\'w\')+4(3,\'n\'+c)+4(3,\'n\'+e);6 a+(b.t?(4(3,\'t\'+c)+4(3,\'t\'+e)):0)}});$.u([\'m\',\'s\'],5(i,b){$.q[\'l\'+b]=5(a){p(!3[0])6;6 a!=W?3.u(5(){3==h||3==r?h.V(b==\'m\'?a:$(h)[\'U\'](),b==\'s\'?a:$(h)[\'T\']()):3[\'l\'+b]=a}):3[0]==h||3[0]==r?S[(b==\'m\'?\'R\':\'Q\')]||$.N&&r.M[\'l\'+b]||r.A[\'l\'+b]:3[0][\'l\'+b]}});$.q.F({z:5(){g a=0,f=0,o=3[0],8,9,7,v;p(o){7=3.7();8=3.8();9=7.8();8.f-=4(o,\'K\');8.k-=4(o,\'J\');9.f+=4(7,\'H\');9.k+=4(7,\'Y\');v={f:8.f-9.f,k:8.k-9.k}}6 v},7:5(){g a=3[0].7;G(a&&(!/^A|10$/i.16(a.15)&&$.14(a,\'z\')==\'13\'))a=a.7;6 $(a)}});5 4(a,b){6 12($.11(a.17?a[0]:a,b,18))||0}})(X);',62,72,'|||this|num|function|return|offsetParent|offset|parentOffset|||||borr|top|var|window||Height|left|scroll|Left|padding|elem|if|fn|document|Top|margin|each|results|Width|toLowerCase|visible|position|body|is|Right|Bottom|border|extend|while|borderTopWidth|outer|marginLeft|marginTop|client|documentElement|boxModel|inner|version|pageYOffset|pageXOffset|self|scrollTop|scrollLeft|scrollTo|undefined|jQuery|borderLeftWidth|false|html|curCSS|parseInt|static|css|tagName|test|jquery|true|dimensions'.split('|'),0,{}))

