function add_to_favorite(ins_id){	$('#add_toother').hide();	$.ajax({	   type: "GET",	   url: "/ajax/add_to_favorite/"+ins_id,	   success: function(msg){	     alert( msg );	   }	 });}function violation_rules(ins_id){    $("select, embed, object").hide();    $('#add_toother').hide();    $("#dialogViolationRules").show();	$("#dialogViolationRules").dialog({         modal: true,        title: 'Zgłoś naruszenie regulaminu',        height: 260,        width:  540,         overlay: {             opacity: 0.5,             background: "black"         },        buttons: {                 "Wyślij": function(){                     $.post("/ajax/violation_rules/"+ins_id, 							{problem: $('#ViolationRulesMsg').val()}, 							function(data){							  alert(data);							  $("#dialogViolationRules").dialog("close"); 							}						);                },                "Anuluj": function() {                     $(this).dialog("close");                 }             },        close: function(){$("select, embed, object").show();}							    });}function incomplete(ins_id){    $("select, embed, object").hide();    $('#add_toother').hide();    $("#dialogViolationRules").show();	$("#dialogViolationRules").dialog({         modal: true,        title: 'Instrukcja niekompletna',        height: 260,        width:  540,         overlay: {             opacity: 0.5,             background: "black"         },        buttons: {                 "Wyślij": function(){                     $.post("/ajax_instruction/incomplete/"+ins_id, 							{problem: $('#ViolationRulesMsg').val()}, 							function(data){							  alert(data);							  $("#dialogViolationRules").dialog("close"); 							}						);                },                "Anuluj": function() {                     $(this).dialog("close");                 }             },        close: function(){$("select, embed, object").show();}							    });}function openPopup(url,name,height,width,opt_show_scrollbars){	var scrollbar_param=opt_show_scrollbars?",scrollbars=1":"";	var newwindow=window.open(url,name,'height='+height+',width='+width+scrollbar_param);	if(newwindow&&!newwindow.opener){newwindow.opener=window;}	if(window.focus){newwindow.focus()}	return false;}function add_to_delicious(){	var title = 'title='+delicious_title	var url = 'http://del.icio.us/post?noui&v=4&jump=close&url='+location.href+'&amp;'+title+'&amp';	openPopup(url, 'instrukcja.pl', 480,640, true);}function show_more_photos(all_photos){	  all_photos = parseInt(all_photos);	  var height = $("#ins_photos_thumb").css('height');	  var resize_to = 162;	  	  if(height=='162px') {		if(all_photos>4){						if (all_photos > 48) {resize_to = 2109;}			else if(all_photos > 44) {resize_to = 1944;}			else if(all_photos > 40) {resize_to = 1782;}			else if(all_photos > 36) {resize_to = 1620;}			else if(all_photos > 32) {resize_to = 1458;}			else if(all_photos > 28) {resize_to = 1296;}			else if(all_photos > 24) {resize_to = 1134;}			else if(all_photos > 20) {resize_to = 976;}			else if(all_photos > 16) {resize_to = 810;}			else if(all_photos > 12) {resize_to = 648;}			else if(all_photos > 8)  {resize_to = 486;}			else {resize_to = 324;}						$("#ins_photos_thumb").animate({		  		height: resize_to+'px'		  	}, 1500);			}			  } else{	  	$("#ins_photos_thumb").animate({	  		height: "162px"	  	}, 1500);	  }}function load_big_photo(photo_id){	$('#photo_loader').show();	$('#ins_photo_big').hide();		$('#ins_photo_big').load(				'/ajax/load_big_photo/'+photo_id,				function(){					$('#photo_loader').hide();					$('#ins_photo_big').show();				}	);}function load_pdf(path,redir){	var myPDF = new PDFObject({	  url: path,	  id: "myPDF",	  width: "960px",	  height: "600px",	  pdfOpenParams: {		    navpanes: 1,		    statusbar: 0,		    view: "FitH"		  }	}).embed("pdf_window");			if(!myPDF){		 $('#pdf_window').html('<h3>Aby zobaczyć instrukcje na tej stronie zainstaluj program Adobe Reader.</h3><p><a class="dyn-tooltip panePos-l" id="acrobat-reader-tip" href="http://www.adobe.com/products/acrobat/readstep2.html"><img alt="Get Adobe Reader" src="http://www.adobe.com/images/shared/download_buttons/get_adobe_reader.png"/></a></p>');		 document.location = path;	} 	}function boxes_down(obj,obj2, fun_static){		obj.show();		obj2.show();			obj.animate({ 	        top: "360px"	      }, 		  2000,		  function(){			obj.hide();	  			  }	);		obj2.animate({ 	        top: "0px"	      },		  2000,		  function (){		  	fun_static.block = false;		  }	  	);}function boxes_up(obj, obj2, fun_static){	obj.show();	obj.animate({ 	        top: "-360px"	      }, 		  2000,		  function(){			obj.hide();	  			  }	);		obj2.show();	obj2.css('top','360px');	obj2.animate({ 	        top: "0px"	      }, 		  2000,		  function (){		  	fun_static.block = false;		  }		);		  	fun_static.page++;}function show_prev_ins(){	if (show_next_ins.block == false) {				if (show_next_ins.page > 2) {			show_next_ins.block = true;			show_next_ins.page--;			boxes_down($("#other_user_ins .ins_others_list_page_" + show_next_ins.page), $("#other_user_ins .ins_others_list_page_" + (show_next_ins.page - 1)),show_next_ins);		}	}}function show_next_ins(ind_id){	if (show_next_ins.block == false) {				if ($("#other_user_ins .ins_others_list_page_" + show_next_ins.page).html()) {			show_next_ins.block = true;			boxes_up($("#other_user_ins .ins_others_list_page_" + (show_next_ins.page - 1)), $("#other_user_ins .ins_others_list_page_" + show_next_ins.page),show_next_ins);		//alert(show_next_ins.page);				}		else {			show_next_ins.block = true;			$('#other_user_ins .other_ins_loader').show();						$.ajax({				url: "/ajax/load_other_cards/" + show_next_ins.page + "/"+ind_id+"/1",				cache: false,				success: function(html){									if (html) {						$("#other_user_ins").append(html);						boxes_up($("#other_user_ins .ins_others_list_page_" + (show_next_ins.page - 1)), $("#other_user_ins .ins_others_list_page_" + show_next_ins.page),show_next_ins);					} else {						show_next_ins.block = false;					}										$('#other_user_ins .other_ins_loader').hide();									}			});					}	}}show_next_ins.page  = 2;show_next_ins.block = false;function boxes_left(obj,obj2, fun_static){		obj.show();		obj2.show();			obj.animate({ 	        left: "900px",	      }, 		  2000,		  function(){			obj.hide();	  			  }	);		obj2.animate({ 	        left: "0px",	      },		  2000,		  function (){		  	fun_static.block = false;		  }	  	);}function boxes_right(obj, obj2, fun_static){	obj.show();	obj.animate({ 	        left: "-900px"	      }, 		  2000,		  function(){			obj.hide();	  			  }	);		obj2.show();	obj2.css('left','900px');	obj2.animate({ 	        left: "0px"	      }, 		  2000,		  function (){		  	fun_static.block = false;		  }		);		  	fun_static.page++;}function show_prev_ins_similar(){	if (show_next_ins_similar.block == false) {				if (show_next_ins_similar.page > 2) {			show_next_ins_similar.block = true;			show_next_ins_similar.page--;			boxes_left($("#other_similar_ins .ins_others_list_width_page_" + show_next_ins_similar.page), $("#other_similar_ins .ins_others_list_width_page_" + (show_next_ins_similar.page - 1)),show_next_ins_similar);		}	}}function show_next_ins_similar(ind_id){	if (show_next_ins_similar.block == false) {				if ($("#other_similar_ins .ins_others_list_width_page_" + show_next_ins_similar.page).html()) {			show_next_ins_similar.block = true;			boxes_right($("#other_similar_ins .ins_others_list_width_page_" + (show_next_ins_similar.page - 1)), $("#other_similar_ins .ins_others_list_width_page_" + show_next_ins_similar.page),show_next_ins_similar);		}		else {			show_next_ins_similar.block = true;			$('#other_similar_ins .other_ins_width_loader').show();			$.ajax({  //instrukcje.pl/				url: "/ajax/load_other_cards/" + show_next_ins_similar.page + "/"+ind_id+"/2",				cache: false,				success: function(html){									if (html) {						$("#other_similar_ins").append(html);						boxes_right($("#other_similar_ins .ins_others_list_width_page_" + (show_next_ins_similar.page - 1)), $("#other_similar_ins .ins_others_list_width_page_" + show_next_ins_similar.page),show_next_ins_similar);					} else {						show_next_ins_similar.block = false;					}					$('#other_similar_ins .other_ins_width_loader').hide();									}			});					}	}}show_next_ins_similar.page  = 2;show_next_ins_similar.block = false;
