/*
 * ROUNDED CONTAINER
 * 
 * @description: created rounded wrapper around image
 * @author: Pavarti (David Ivanuša s.p.)
 * @
 */

/* CSS
 * 
	.color_body .image_rounded{background-color: #d93d81; }
	.color_body .image_rounded .topleft{ background-image: url(/static/img/content/kozmetika_img_topleft.jpg); background-repeat: no-repeat;background-position: top left; }
	.color_body .image_rounded .topright{ background-image: url(/static/img/content/kozmetika_img_topright.jpg); background-repeat: no-repeat; background-position: top right; }
	.color_body .image_rounded .bottomleft{ background-image: url(/static/img/content/kozmetika_img_bottomleft.jpg); background-repeat: no-repeat;background-position: bottom left; }
	.color_body .image_rounded .bottomright{ background-image: url(/static/img/content/kozmetika_img_bottomright.jpg); background-repeat: no-repeat; background-position: bottom right; }
	.color_body .image_rounded .container{ padding: 7px;}
 * 
 */
function rounded_corner(selector){
		//$( ".slika" ).each( function( intIndex ){
		$( selector).each( function( intIndex ){
        						 	
			 	var width  = $(this).width();
				var height = $(this).height();
				var float  = 'none';
				var marginLeft = "0px";
				var marginBottom = "0px";
				var marginRight = "0px";

				if($(this).attr('align') == 'right'){
					$(this).attr('align', '');
					float = 'right';
					marginLeft = "20px";
					marginBottom = "5px";
				}else if($(this).attr('align') == 'left'){
					marginRight = "20px";
					marginBottom = "5px";
    			}else if($(this).attr('align') == 'middle'){
    				marginLeft = "auto";
    				marginRight = "auto";
    			}
    			
    			
    			$(this).wrap('<div class="image_rounded" style="float:' + float + ';width:' + (width + 10) + 'px; margin-left: ' + marginLeft +'; margin-right: ' + marginRight +'; margin-bottom: ' + marginBottom +'px" ><div class="topleft" ><div class="topright" ><div class="bottomleft" ><div class="bottomright" ><div class="container"  style="width:' + (width) + 'px;height:' + (height) + 'px;"></div></div></div></div></div></div>');
    			if($(this).attr('align') == 'middle'){    				
    				//$(this).wrap('<div style="text-align: center;margin: 0px auto 0px auto;"></div>');
     			} 
		
		});
}



function image_margin(selector){
		//$( ".slika" ).each( function( intIndex ){
		$( selector).each( function( intIndex ){
        						 	
			 	var width  = $(this).width();
				var height = $(this).height() + 10;
				var float  = 'none';
				var marginLeft = "0px";
				var marginBottom = "0px";
				var marginRight = "0px";

				if($(this).attr('align') == 'right'){
					$(this).attr('align', '');
					float = 'right';
					marginLeft = "20px";
					//marginBottom = "20px";
				}else if($(this).attr('align') == 'left'){
					marginRight = "20px";
					//marginBottom = "20px";
    			}else if($(this).attr('align') == 'middle'){
    				marginLeft = "auto";
    				marginRight = "auto";
    			}
    			//alert(marginBottom);
    			
    			$(this).wrap('<div style="float:' + float + ';width:' + (width) + 'px; margin-left: ' + marginLeft +'; margin-right: ' + marginRight +'; margin-bottom: ' + marginBottom +'px;height:' + height + 'px" ></div>');
    			if($(this).attr('align') == 'middle'){    				
    				//$(this).wrap('<div style="text-align: center;margin: 0px auto 0px auto;"></div>');
     			} 
		
		});
}
