$(document).ready(function(){
	
	// ascundem elementele care ar fi inlocuite cu sifr
	//$("h1").css("visibility", "hidden");
	//$("#menu a").css("visibility", "hidden");
	
	// Rounded corners
	$("#menu").corner("round tl bl 10px");
	$("#news").corner("round tr br 10px");
	$("#page-header").corner("round tl bl tr br 10px");
	
	// Product listing
	$(".extra-details").hide();
	
	$("#produse dl").hover(
	      function () {
	        
			var styleValue = $(".extra-details",this).attr("style");
			var styleValueCompatible = styleValue.substr(0,14).toLowerCase(styleValue.substr(0,14));
			
			if(styleValueCompatible!="display: block") {
				$(".open-close",this).css("background","url(images/produse/arrow_det_roll.gif) no-repeat right top");
				$(this).css("background","url(images/produse/bg_dt_roll.jpg) repeat-y right top");
			}
			
			if(styleValueCompatible=="display: block") {
				//$(this).css("background","white");
				$(this).css("background","url(images/common/bg_arrow_close.gif) no-repeat 99.3% top");
				//alert($($(this).parent().get(0).tagName));
			}
			
	      }, 
	      function () {
	       
		   $(this).css("background","white");
		   
		   var styleValue = $(".extra-details",this).attr("style");
		   var styleValueCompatible = styleValue.substr(0,14).toLowerCase(styleValue.substr(0,14));
		   
		   if(styleValueCompatible!="display: block") {
				$('.open-close',this).css("background","url(images/produse/arrow_det_normal.gif) no-repeat right top");
			} else {
				$(this).css("background","url(images/common/bg_arrow_close.gif) no-repeat 99.3% top");
			}
	      }
	    );
		
		
	$("#produse dl").each(function (i) {
		$(".open-close",this).toggle(
			function(){
				$($($(this).parent().get(0)).parent().find('.extra-details').get(0)).slideDown();
				$($($(this).parent().get(0)).parent().get(0)).css("background","url(images/common/bg_arrow_close.gif) no-repeat 99.3% top");
				$(this).css("background","transparent");
			},
			function(){
				$($($(this).parent().get(0)).parent().find('.extra-details').get(0)).slideUp();
				$($($(this).parent().get(0)).parent().get(0)).css("background","white");
				$(this).css("background","url(images/produse/arrow_det_normal.gif) no-repeat right top");
			}
		);
	});
	
	// external links
	$("a[@rel='external']").click(function() {
		return !window.open($(this).attr("href"));
	});
	
});
