jQuery.log = function(message) { if(window.console) { console.debug(message); } };


$(function(){

	var mas_from_top = $('#page').height() - 715;
	var page_h =$('#page').height();
	if(page_h > 715){	
		$('#mascota').css('margin-top',mas_from_top + 'px');		
	}else{
		$('#page').height('715px');
	}
	//$.log(page_h);



	$("#searchForm label").inFieldLabels({fadeOpacity:0.2});

	if($('#mapSelect').length > 0){
		$('#mapSelect').selectbox({onChangeCallback: function(select){
			if(select.selectedVal != 0){
				window.location.href = baseUrl +'locatii/'+ select.selectedVal;
			}else{
				window.location.href = baseUrl +'locatii/';
			}
		}
		});
	}

	if($('#slideshow').length > 0){
		$('#slideshow').cycle();
	}

	if($('#slider_marci').length > 0){
		$('#slider_marci').cycle({ 
		    fx:     'fade', 
		    speed:  'slow', 
		    timeout: 0, 
		    next:   '#next', 
		    prev:   '#prev' 
		});
	}


});


$('img.rounded').one('load',function () {
	var img = $(this);
	var img_width = img.width();
	var img_height = img.height();
 
	// build wrapper
	var wrapper = $('<div class="rounded_wrapper"></div>');
	wrapper.width(img_width);
	wrapper.height(img_height);
 
	// move CSS properties from img to wrapper
	wrapper.css('float', img.css('float'));
	img.css('float', 'none')
 
	wrapper.css('margin-right', img.css('margin-right'));
	img.css('margin-right', '0')
 
	wrapper.css('margin-left', img.css('margin-left'));
	img.css('margin-left', '0')
 
	wrapper.css('margin-bottom', img.css('margin-bottom'));
	img.css('margin-bottom', '0')
 
	wrapper.css('margin-top', img.css('margin-top'));
	img.css('margin-top', '0')
 
	wrapper.css('display', 'block');
	img.css('display', 'block')
 
	// IE6 fix (when image height or width is odd)
	if ($.browser.msie && $.browser.version == '6.0')
	{
		if(img_width % 2 != 0)
		{
			wrapper.addClass('ie6_width')
		}
		if(img_height % 2 != 0)
		{
			wrapper.addClass('ie6_height')			
		}
	}
 
	// wrap image
	img.wrap(wrapper);
 
	// add rounded corners
	img.after('<div class="tl"></div>');
	img.after('<div class="tr"></div>');
	img.after('<div class="bl"></div>');
	img.after('<div class="br"></div>');
}).each(function(){
	if(this.complete) $(this).trigger("load");
});

function mapFlash(){

	var flashvars = {
		url:"locatii/xml"
	};
	var params = {
		wmode:"transparent",
		menu :"false",
		allowfullscreen:"true",
		allowscriptaccess:"always"

	};
	var attributes = {
		id:"flash_map",
		name:"flash_map"
	};


	swfobject.embedSWF( "flash/harta.swf", "map", "205", "160", "9","flash/expressInstall.swf", flashvars, params, attributes);
}

mapFlash();

function getJudet(judet)
{

	window.location.href = baseUrl + judet;
	//alert(judet);
	/*$('#intro').hide();
	var $place = $('#'+judet,'#main');
	if ($place.length > 0){

	$('.place','#main').hide();
	$place.fadeIn();
	}*/

}


