hs.graphicsDir='http://cookie.szenprogs.ru/highslide/graphics/';
hs.wrapperClassName='rounded-white';
hs.numberOfImagesToPreload=0;
hs.showCredits=false;
hs.lang={
	loadingText: 'Загрузка...',
	fullExpandTitle: 'Развернуть до полного размера',
	restoreTitle: 'Кликните для закрытия картинки, нажмите и удерживайте для перемещения',
	focusTitle: 'Сфокусировать',
	loadingTitle: 'Нажмите для отмены'
};
hs.allowSizeReduction=false;

//======================================================================
//	Cookie site object for site
//	Created by szenprogs.ru
//	For working needed jQuery script
//======================================================================

$spcookie={
	recipe: {
		name: function(){
			var s='';
			if($('.hrecipe .fn').length!=0){
				s=$('.hrecipe .fn').html();
			}
			s=s.replace(/\'/g,'&quot;');
			s=s.replace(/\"/g,'&quot;');
			return s;
		},
		ingridients: function(dot,odd,even){
			var res='';
			var oe=odd;
			$('.hrecipe .ingredient').each(function(){
				var iname=$(this).find('.name').html();
				iname=iname.replace(/\'/g,'&quot;');
				iname=iname.replace(/\"/g,'&quot;');
				if($(this).find('.amount').length!=0){
					var iamount=$(this).find('.amount').html(); 
					iamount=iamount.replace(/\'/g,'&quot;');
					iamount=iamount.replace(/\"/g,'&quot;');
				}else var iamount='&nbsp;';
				var res2=dot.replace(/\%name\%/gi,iname);
				res2=res2.replace(/\%amount\%/gi,iamount);
				res+=res2.replace(/\%oe\%/gi,oe);
				if(oe==odd) oe=even; else oe=odd;
			});
			return res;
		},
		instructions: function(maxcount){
			var inst='';
			if($('.hrecipe .instructions').length!=0){
				inst=$('.hrecipe .instructions').html();
				inst=inst.replace(/<p>/gi,'');
				inst=inst.replace(/<\/p>/gi,'');
				inst=inst.replace(/<b>/gi,'');
				inst=inst.replace(/<\/b>/gi,'');
				inst=inst.replace(/<i>/gi,'');
				inst=inst.replace(/<\/i>/gi,'');
				inst=inst.replace(/<br>/gi,' ');
				inst=inst.replace(/<br \/>/gi,' ');
				inst=inst.replace(/\'/g,'&quot;');
				inst=inst.replace(/\"/g,'&quot;');
				if(maxcount!=0){
					if(inst.length>maxcount) inst=inst.substr(0,maxcount)+' ...';
				}
			}
			return inst;
		},
		photo: function(){
			if($('.hrecipe img.photo').length!=0){
				var pic=$('.hrecipe img.photo').attr('src');
				if(pic.indexOf('http')==-1){
					if(pic.substr(0,1)!='\/') pic='\/'+pic;
					pic='http://cookie.szenprogs.ru'+pic;
				}
				return pic;
			}else{
				return '';
			}
		},
		url: function(){
			return document.location.href;
		}
	},

	openwindow: function(htm){
		var win=window.open('','','toolbar=0,location=0,directories=0,menubar=0,status=0');
		win.document.open();
		win.document.write(htm);
		win.document.close();
	},
	
	codeforblog: function(typ){
		var s='';
		if(typ=='html'){
			var nm=this.recipe.name();			
			var ing='<table width="100%" border="0" cellspacing="0" cellpadding="2">';
			ing+=this.recipe.ingridients('<tr><td width="210" style="background-color:%oe%;">%name%<\/td><td style="background-color:%oe%;">%amount%<\/td><\/tr>','#eeeeee','#ffffff');
			ing+='<\/table>';			
			var inst=this.recipe.instructions(200);			
			var img=this.recipe.photo();		
			var url=this.recipe.url();
			
			s+='<div style="background-color:#ffffff;border:1px solid #000000;color:#000000;font-size:1em">'
			s+='<div style="font-size:1.3em;padding:5px;">'+nm+'<\/div>';
			s+='<div style="background-color:#eeeeee;padding:10px;">';
			s+='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>';
			if(img!='') s+='<td width="170px"><img src="'+img+'" style="width:150px;border:0;" alt="'+nm+'"><\/td>';
			s+='<td style="font-size:0.8em;">'+ing+'<\/td>';
			s+='<\/tr>'
			s+='<\/table>';
			s+='<div style="padding-top:10pt;">'+inst+'<\/div>';
			s+='<\/div>';
			s+='<div style="text-align:right;padding:10px;font-size:0.8em;"><a href="'+url+'" title="Рецепт приготовления '+nm+'"><b>Рецепт &laquo;'+nm+'&raquo; полностью<\/b><\/a><\/div>';
			s+='<\/div>';
			s=s.replace(/</gi,'&lt;');
			s=s.replace(/>/gi,'&gt;');
		}
		if(typ=='bb'){
			var nm=this.recipe.name();			
			var ing=this.recipe.ingridients('[size=10]%name%: %amount%[\/size]\n','','');
			var inst=this.recipe.instructions(100);			
			var img=this.recipe.photo();	
			var url=this.recipe.url();
			
			s+='[size=14][b]'+nm+'[\/b][\/size][hr]\n';
			if(img!='') s+='[img]'+img+'[\/img]\n\n';
			s+=ing+'\n';
			s+='[size=12]'+inst+'[\/size]\n';
			s+='[r][url='+url+']'+nm+' полностью[\/url][\/r]';
		}
		if(typ=='twitter'){
			var nm=this.recipe.name();			
			var url=this.recipe.url();
			
			s+=nm+' '+url;
		}
		if(typ=='url'){
			var nm=this.recipe.name();			
			var url=this.recipe.url();
			
			s+='[url='+url+']'+nm+'[\/url]';
		}
		if(s!=''){
			var htm=s.replace(/\"/g,'\\"');
			htm=htm.replace(/&lt;/gi,'<');
			htm=htm.replace(/&gt;/gi,'>');
			cont='<center><b>'+typ.toUpperCase()+'-код<\/b> рецепта <b>&laquo;'+nm+'&raquo;<\/b> для вставки в блог.<br><br>Скопируйте код и вставьте его в свой блог:<br><br><textarea cols="50" rows="15" readonly onclick="this.select();this.focus();">'+s+'<\/textarea><br><br><input type="button" value="Закрыть" onclick="_uWnd.close(\'getcodeforblog\');"><\/center>';
			new _uWnd('getcodeforblog','Получение кода',400,500,{align:'center',min:0,max:0,resize:0,modal:0,autosize:1},cont);
		}
	}
}
