
$(document).ready(function() 
{  
	//$("div.saites").backgroundCanvas(); 
	
	 
});
// Draw the background  on load and resize
$(window).load(function () 
{ 
	DrawBackground(); 
	//$("div.left_side, div.content").equalizeCols();
	izlidzinatBlokus();
});

$(window).resize(function()
{
	DrawBackground(); 

});


function DrawBackground()
{
	$("div.saites").corner({
				  tl: { radius: 6 },
					      tr: { radius: 6 },
					    	      bl: { radius: 6 },
						    	      br: { radius: 6 }});
							      
	

}

function Demo1BackgroundPaintFkt(context, width, height, canvas, $canvas, $canvasDiv, $content, $element ) 
{
		var options = {x:0, height: height, width: width, radius:14,  border: 0 };
		var backgroundGradient = context.createLinearGradient(0, 0, 0, height - 2);
		//backgroundGradient.addColorStop(0 ,'#EEEEFF');
		//backgroundGradient.addColorStop(1, '#AAAAFF');
		context.fillStyle = "#FFFFFF";
		
		// Draw the blue border rectangle 
		$.canvasPaint.roundedRect(context,options);
		
		// Draw the gradient filled inner rectangle
		options.border = 1;
		context.fillStyle = backgroundGradient; 
		$.canvasPaint.roundedRect(context,options);
}


function izlidzinatBlokus()
{	
	
	
	//console.log(kreisais, labais, starpiba,lapvienojums);
	$("div.pr_linija").each(
		function(i) 
		{
			var maxH=0;	
			$(this).find("div.info").each(function(e){
														   
				if($(this).outerHeight() > maxH)
					maxH=$(this).outerHeight();
													  });
			var maxG=0;										  
													  
			$(this).find("div.title").each(function(e){
														   
				if($(this).outerHeight() > maxG)
					maxG=$(this).outerHeight();
													  });
			$(this).find("div.one_produkt").each(function(i){
	
				if(maxH +maxG > 100) 
					$(this).css({"height": (maxH + maxG + 20)+"px"});														  
														  });
			$(this).find("div.linija_ver").each(function(i){
															  
					if(maxH + maxG > 100) 
					$(this).css({"height": (maxH +maxG + 23)+"px"});										  
														  });
	
		}
		);
	var kreisais=$("div.left_side").outerHeight();
	var labais=$("div.right_part").outerHeight();
	var starpiba = 0;//$("#main_baner").outerHeight()  + $("div.enas").outerHeight();
	
//	console.log(kreisais,labais);
	
	var lapvienojums=labais + starpiba;
	
	
	if(lapvienojums > kreisais)
	{
		$("div.left_side").css({"height": lapvienojums+ "px"});
	}
	else 
	{
		$("div.right_part").css({"height": (kreisais - starpiba) +"px"});	
	}
}
