function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
    }
  }

function changeImages(state_id) {
  if (document.images && (preloadFlag == true)) {
    //alert('_common/templates/default/images/harta/state_'+state_id+'.png');
    document.getElementById('judet-evidentiat').style.backgroundImage = 'url(_common/templates/default/images/harta/state_empty_'+state_id+'.png)';
    //document.judet-evidentiat.style.backgroundImage='url(http://www.remcoromania.ro/_common/templates/default/images/harta/state_empty_'+state_id+'.png)';
    }
  }

var preloadFlag = true;
function preloadImages() {
  if (document.images) {
    {$buttons_over}
    buttons = newImage('_common/templates/default/images/harta/harta-ro.gif');
    preloadFlag = true;
    }
  }


$(function() {
	// Options for SuperBGImage
	$.fn.superbgimage.options = {
    z_index: 0, // z-index for the container
    transition: 1, // 0-none, 1-fade, 2-slide down, 3-slide left, 4-slide top, 5-slide right, 6-blind horizontal, 7-blind vertical, 90-slide right/left, 91-slide top/down  
		slideshow: 1, // 0-none, 1-autostart slideshow
		slide_interval: 6000, // interval for the slideshow
		randomimage: 1, // 0-none, 1-random image
		speed: 'slow' // animation speed
	};
	// initialize SuperBGImage
	$('#thumbs').superbgimage().hide();
});
$(document).ready(function(){
  $("#header_area").animate({top:'+=140px'}, 1000);
});


$(document).ready(function(){
	$(".gallery a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'light_rounded',slideshow:3000, autoplay_slideshow: false,social_tools: false});

	$("#custom_content a[rel^='prettyPhoto']:first").prettyPhoto({
		custom_markup: '<div id="map_canvas" style="width:600px; height:451px"></div>',
		changepicturecallback: function(){ initialize(); }
	});

	$("#custom_content a[rel^='prettyPhoto']:last").prettyPhoto({
		custom_markup: '<div id="bsap_1259344" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div><div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
		changepicturecallback: function(){ _bsap.exec(); }
	});
});


/*
 * jQuery columnHover plugin
 * Version: 0.1.1
 *
 * Copyright (c) 2007 Roman Weich
 * http://p.sohei.org
 *
 * Dual licensed under the MIT and GPL licenses 
 * (This means that you can choose the license that best suits your project, and use it accordingly):
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Changelog: 
 * v 0.1.1 - 2007-08-05
 *	-change: included new option "ignoreCols", through which columns can be excluded from the highlighting process
 * v 0.1.0 - 2007-05-25
 */

(function($)
{
	/**
	 * Calculates the actual cellIndex value of all cells in the table and stores it in the realCell property of each cell.
	 * Thats done because the cellIndex value isn't correct when colspans or rowspans are used.
	 * Originally created by Matt Kruse for his table library - Big Thanks! (see http://www.javascripttoolbox.com/)
	 * @param {element} table	The table element.
	 */
	var fixCellIndexes = function(table) 
	{
		var rows = table.rows;
		var len = rows.length;
		var matrix = [];
		for ( var i = 0; i < len; i++ )
		{
			var cells = rows[i].cells;
			var clen = cells.length;
			for ( var j = 0; j < clen; j++ )
			{
				var c = cells[j];
				var rowSpan = c.rowSpan || 1;
				var colSpan = c.colSpan || 1;
				var firstAvailCol = -1;
				if ( !matrix[i] )
				{ 
					matrix[i] = []; 
				}
				var m = matrix[i];
				// Find first available column in the first row
				while ( m[++firstAvailCol] ) {}
				c.realIndex = firstAvailCol;
				for ( var k = i; k < i + rowSpan; k++ )
				{
					if ( !matrix[k] )
					{ 
						matrix[k] = []; 
					}
					var matrixrow = matrix[k];
					for ( var l = firstAvailCol; l < firstAvailCol + colSpan; l++ )
					{
						matrixrow[l] = 1;
					}
				}
			}
		}
	};

	/**
	 * Highlight whole table columns when hovering over a table.
	 * Works on tables with rowspans and colspans.
	 *
	 * @param {map} options			An object for optional settings (options described below).
	 *
	 * @option {string} hoverClass		A CSS class that is set on the cells in the column with the mouse over.
	 *							Default value: 'hover'
	 * @option {boolean} eachCell		Allows highlighting the column while hovering over the table body or table footer. When disabled, highlighting is allowed only through the table header.
	 *							Default value: false
	 * @option {boolean} includeSpans		Includes columns with the colspan attribute set in the hover and highlight process.
	 *							Default value: true
	 * @option {array} ignoreCols		An array of numbers. Each column with the matching column index won't be included in the highlighting process.
	 *							Index starting at 1!
	 *							Default value: [] (empty array)
	 *
	 * @example $('#table').columnHover();
	 * @desc Allow column hovering/highlighting for the table using the default settings.
	 *
	 * @example $('#table').columnHover({eachCell:true, hoverClass:'someclass'});
	 * @desc Allow column hovering/highlighting for the whole table (including the body and footer). Set the class "someclass" to the cells in the column with the mouse over.
	 *
	 * @type jQuery
	 *
	 * @name columnHover
	 * @cat Plugins/columnHover
	 * @author Roman Weich (http://p.sohei.org)
	 */
	$.fn.columnHover = function(options)
	{
		var settings = $.extend({
				hoverClass: 'hover',
				eachCell: false,
				includeSpans : true,
				ignoreCols : []
			}, options);

		/**
		 * Adds or removes the hover style on the column.
		 * @param {element} cell	The cell with the mouseover/mouseout event.
		 * @param {array} colIndex	The index with the stored columns.
		 * @param {boolean} on		Defines whether the style will be set or removed.
		 */
		var hover = function(cell, colIndex, on)
		{
			var a = colIndex[cell.realIndex];
			var i = 0;
			if ( $(settings.ignoreCols).index(cell.realIndex + 1) != -1 )
			{
				return; //dont highlight the columns in the ignoreCols array
			}
			while ( ++i < cell.colSpan )
			{
				a = a.concat(colIndex[cell.realIndex + i]);
			}
			if ( on )
			{
				$(a).addClass(settings.hoverClass);
			}
			else
			{
				$(a).removeClass(settings.hoverClass);
			}
		};

		/**
		 * Adds the hover events to the cell.
		 * @param {jQuery result array} $s	The elements to add the events to.
		 * @param {array} colIndex	The index with the stored columns.
		 */
		var addHover = function($s, colIndex)
		{
			$s.bind('mouseover', function(){
				hover(this, colIndex, true);
			}).bind('mouseout', function(){
				hover(this, colIndex, false);
			});
		};
		
		return this.each(function() 
        {
			var colIndex = [];
			var tbl = this;
			var body, row, c, tboI, rowI, cI, rI, s;

			if ( !tbl.tBodies || !tbl.tBodies.length || !tbl.tHead || !settings.hoverClass.length )
			{
				return;
			}
			fixCellIndexes(tbl);
			//create index - loop through the bodies
			for ( tboI = 0; tboI < tbl.tBodies.length; tboI++ )
			{
				body = tbl.tBodies[tboI];
				//loop through the rows
				for ( rowI = 0; rowI < body.rows.length; rowI++ )
				{
					row = body.rows[rowI];
					//each cell
					for ( cI = 0; cI < row.cells.length; cI++ )
					{
						c = row.cells[cI];
						//ignore cells with colspan?
						if ( !settings.includeSpans && c.colSpan > 1 )
						{
							continue;
						}
						s = (settings.includeSpans) ? c.colSpan : 1;
						while ( --s >= 0 )
						{
							rI = c.realIndex + s;
							if ( !colIndex[rI] )
							{
								colIndex[rI] = [];
							}
							colIndex[rI].push(c);
						}
						//add hover event?
						if ( settings.eachCell )
						{
							addHover($(c), colIndex);
						}
					}
				}
			}
			//events
			addHover($('td, th', tbl.tHead), colIndex);
			//add hover event to footer?
			if ( settings.eachCell && tbl.tFoot )
			{
				addHover($('td, th', tbl.tFoot), colIndex);
			}
		});
	};
})(jQuery); 



(function($){ChiliBook={version:"1.8a",automatic:true,automaticSelector:"code",codeLanguage:function(el){var recipeName=$(el).attr("class");return recipeName?recipeName:''},metadataSelector:"object.chili",recipeLoading:true,recipeFolder:"",stylesheetLoading:true,stylesheetFolder:"",defaultReplacement:'<span class="$0">$$</span>',replaceSpace:"&#160;",replaceTab:"&#160;&#160;&#160;&#160;",replaceNewLine:"&#160;<br/>",recipes:{},queue:{},preFixCopy:document.selection&&document.selection.createRange,preContent:"",preElement:null};$.metaobjects=function(options){options=$.extend({context:document,clean:true,selector:'object.metaobject'},options);function jsValue(value){eval('value = '+value+";");return value}return $(options.selector,options.context).each(function(){var settings={target:this.parentNode};$('> param[@name=metaparam]',this).each(function(){$.extend(settings,jsValue(this.value))});$('> param',this).not('[@name=metaparam]').each(function(){var name=this.name,value=jsValue(this.value);$(settings.target).each(function(){this[name]=value})});if(options.clean){$(this).remove()}})};$.fn.chili=function(options){var book=$.extend({},ChiliBook,options||{});function cook(ingredients,recipe){function prepareStep(stepName,step){var exp=(typeof step.exp=="string")?step.exp:step.exp.source;steps.push({stepName:stepName,exp:"("+exp+")",length:1+(exp.replace(/\\./g,"%").replace(/\[.*?\]/g,"%").match(/\((?!\?)/g)||[]).length,replacement:(step.replacement)?step.replacement:book.defaultReplacement})}function knowHow(){var prevLength=0;var exps=new Array;for(var i=0;i<steps.length;i++){var exp=steps[i].exp;exp=exp.replace(/\\\\|\\(\d+)/g,function(m,aNum){return!aNum?m:"\\"+(prevLength+1+parseInt(aNum,10))});exps.push(exp);prevLength+=steps[i].length}var source=exps.join("|");return new RegExp(source,(recipe.ignoreCase)?"gi":"g")}function escapeHTML(str){return str.replace(/&/g,"&amp;").replace(/</g,"&lt;")}function replaceSpaces(str){return str.replace(/ +/g,function(spaces){return spaces.replace(/ /g,replaceSpace)})}function filter(str){str=escapeHTML(str);if(replaceSpace){str=replaceSpaces(str)}return str}function chef(matched){var i=0;var j=1;var step;while(step=steps[i++]){var aux=arguments;if(aux[j]){var pattern=/(\\\$)|(?:\$\$)|(?:\$(\d+))/g;var replacement=step.replacement.replace(pattern,function(m,escaped,K){var bit='';if(escaped){return"$"}else if(!K){return filter(aux[j])}else if(K=="0"){return step.stepName}else{return filter(aux[j+parseInt(K,10)])}});var offset=arguments[arguments.length-2];var input=arguments[arguments.length-1];var unmatched=input.substring(lastIndex,offset);lastIndex=offset+matched.length;perfect+=filter(unmatched)+replacement;return replacement}else{j+=step.length}}}var replaceSpace=book.replaceSpace;var steps=new Array;for(var stepName in recipe.steps){prepareStep(stepName,recipe.steps[stepName])}var perfect="";var lastIndex=0;ingredients.replace(knowHow(),chef);var lastUnmatched=ingredients.substring(lastIndex,ingredients.length);perfect+=filter(lastUnmatched);return perfect}function checkCSS(stylesheetPath){if(!book.queue[stylesheetPath]){var e=document.createElement("link");e.rel="stylesheet";e.type="text/css";e.href=stylesheetPath;document.getElementsByTagName("head")[0].appendChild(e);book.queue[stylesheetPath]=true}}function makeDish(el,recipePath){var recipe=book.recipes[recipePath];if(recipe){var ingredients=el&&el.childNodes&&el.childNodes[0]&&el.childNodes[0].data;if(!ingredients){ingredients=""}ingredients=ingredients.replace(/\r\n?/g,"\n");var dish=cook(ingredients,recipe);if(book.replaceTab){dish=dish.replace(/\t/g,book.replaceTab)}if(book.replaceNewLine){dish=dish.replace(/\n/g,book.replaceNewLine)}$(el).html(dish);if(ChiliBook.preFixCopy){$(el).parents().filter("pre").bind("mousedown",function(){ChiliBook.preElement=this}).bind("mouseup",function(){if(ChiliBook.preElement==this){ChiliBook.preContent=document.selection.createRange().htmlText}})}}}function getPath(recipeName,options){var settingsDef={recipeFolder:book.recipeFolder,recipeFile:recipeName+".js",stylesheetFolder:book.stylesheetFolder,stylesheetFile:recipeName+".css"};var settings;if(options&&typeof options=="object"){settings=$.extend(settingsDef,options)}else{settings=settingsDef}return{recipe:settings.recipeFolder+settings.recipeFile,stylesheet:settings.stylesheetFolder+settings.stylesheetFile}}if(book.metadataSelector){$.metaobjects({context:this,selector:book.metadataSelector})}this.each(function(){var el=this;var recipeName=book.codeLanguage(el);if(''!=recipeName){var path=getPath(recipeName,el.chili);if(book.recipeLoading||el.chili){if(!book.queue[path.recipe]){try{book.queue[path.recipe]=[el];$.getJSON(path.recipe,function(recipeLoaded){recipeLoaded.path=path.recipe;book.recipes[path.recipe]=recipeLoaded;if(book.stylesheetLoading){checkCSS(path.stylesheet)}var q=book.queue[path.recipe];for(var i=0,iTop=q.length;i<iTop;i++){makeDish(q[i],path.recipe)}})}catch(recipeNotAvailable){alert("the recipe for '"+recipeName+"' was not found in '"+path.recipe+"'")}}else{book.queue[path.recipe].push(el)}makeDish(el,path.recipe)}else{makeDish(el,path.recipe)}}});return this};$(function(){if(ChiliBook.automatic){if(ChiliBook.elementPath){ChiliBook.automaticSelector=ChiliBook.elementPath;if(ChiliBook.elementClass){ChiliBook.codeLanguage=function(el){var selectClass=new RegExp("\\b"+ChiliBook.elementClass+"\\b","gi");var elClass=$(el).attr("class");if(!elClass){return''}var recipeName=$.trim(elClass.replace(selectClass,""));return recipeName}}}$(ChiliBook.automaticSelector).chili()}if(ChiliBook.preFixCopy){function preformatted(text){if(''==text){return""}do{var newline_flag=(new Date()).valueOf()}while(text.indexOf(newline_flag)>-1);text=text.replace(/\<br[^>]*?\>/ig,newline_flag);var el=document.createElement('<pre>');el.innerHTML=text;text=el.innerText.replace(new RegExp(newline_flag,"g"),'\r\n');return text}$("body").bind("copy",function(){if(''!=ChiliBook.preContent){window.clipboardData.setData('Text',preformatted(ChiliBook.preContent));event.returnValue=false}}).bind("mousedown",function(){ChiliBook.preContent=""}).bind("mouseup",function(){ChiliBook.preElement=null})}})})(jQuery);

  
  //$('#goluri').columnHover({eachCell:true, hoverClass:'betterhover'}); 
    //$('#usi_electrice').columnHover({eachCell:true, hoverClass:'betterhover'});
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});

