

var rosgranstroy_lightbox = {
	
	vars : {
		popup_html				: '<div id=\"rosgranstroy_photo_popup\" class=\"photo_popup\" style=\"width:882px; position: absolute; display: none; left:50%; margin:30px 0px 0px -441px; z-index: 10001;\">\r\n    						<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n        						<tr>\r\n            						<td class=\"lt\"><img src=\"/img/popup_img/st.gif\" width=\"10\" height=\"10\"></td>\r\n                					<td class=\"t\"><img src=\"/img/popup_img/st.gif\" width=\"1\" height=\"10\"></td>\r\n                					<td class=\"rt\"><img src=\"/img/popup_img/st.gif\" width=\"10\" height=\"10\"></td>\r\n            					</tr>\r\n            					<tr>\r\n            						<td class=\"l\"><img src=\"/img/popup_img/st.gif\" width=\"10\" height=\"1\"></td>\r\n            						<td class=\"main\">\r\n            							<div class=\"x_button\">\r\n                							<a href=\"javascript: rosgranstroy_lightbox.hide.popup();\"><img src=\"/img/popup_img/st.gif\" width=\"20\" height=\"18\"></a>\r\n                						</div>\r\n										<div style=\"top: 275px;\" id=\"rosgranstroy_photo_popup_left\" class=\"l_button\">\r\n											<a href=\"javascript: rosgranstroy_lightbox.show.sprev()\"><img src=\"/img/lb-left.gif\"></a>\r\n										</div>\r\n										<div style=\"top: 275px;\" id=\"rosgranstroy_photo_popup_right\" class=\"r_button\">\r\n											<a href=\"javascript: rosgranstroy_lightbox.show.snext()\"><img src=\"/img/lb-right.gif\"></a>\r\n										</div>\r\n                						<div class=\"big_photo\">\r\n                							<img id=\"rosgranstroy_photo_popup_bigphoto\" src=\"\" width=\"833\" height=\"533\">\r\n                						</div>\r\n                						<div class=\"text_block\">\r\n                							<h3 id=\"rosgranstroy_photo_popup_name\"></h3>\r\n                						</div>                \r\n            						</td>\r\n            						<td class=\"r\"><img src=\"/img/popup_img/st.gif\" width=\"10\" height=\"1\"></td>\r\n        						</tr>\r\n        						<tr>\r\n            						<td class=\"bl\"><img src=\"/img/popup_img/st.gif\" width=\"10\" height=\"10\"></td>\r\n                					<td class=\"b\"><img src=\"/img/popup_img/st.gif\" width=\"1\" height=\"10\"></td>\r\n                					<td class=\"br\"><img src=\"/img/popup_img/st.gif\" width=\"10\" height=\"10\"></td>\r\n            					</tr>\r\n        					</table>\r\n    					</div>',
		dark_html				: '<div id=\"rosgranstroy_darkening\" style=\"display: none; position: absolute; top: 0; left: 0; width: 100%; background:#000000 none repeat scroll 0 0; opacity: 0.5; -moz-opacity: 0.5; filter:alpha(opacity=50); z-index:1000;\"></div>',
		pupup_data				: [],
		pupup_data_count		: 0,
		pupup_images_current	: 0
	},
	
	show : {
		popup : function(popup_id) {
			if($('#rosgranstroy_darkening').html() == null) {
				$('body').prepend(rosgranstroy_lightbox.vars.dark_html);
			}
			if($('#rosgranstroy_photo_popup').html() == null) {
				$('body').prepend(rosgranstroy_lightbox.vars.popup_html);
			}
			
			rosgranstroy_lightbox.vars.pupup_images_current = popup_id;
			
			if(popup_id == rosgranstroy_lightbox.vars.pupup_data_count - 1) {
				$('#rosgranstroy_photo_popup_right').hide();
			}
			
			if(popup_id == 0) {
				$('#rosgranstroy_photo_popup_left').hide();
			}
			
			$('#rosgranstroy_photo_popup').find('#rosgranstroy_photo_popup_name').html(rosgranstroy_lightbox.vars.popup_data[popup_id]['name']);
			$('#rosgranstroy_photo_popup').find('#rosgranstroy_photo_popup_bigphoto').attr('src',rosgranstroy_lightbox.vars.popup_data[popup_id]['photo']);
			$('#rosgranstroy_darkening').height($(document).height()).show();
			$('#rosgranstroy_photo_popup').css('top',$(window).scrollTop() + ($(window).height()/2) - 340);
			$('#rosgranstroy_photo_popup').show();
			
		},
		
		snext : function() {
			if(rosgranstroy_lightbox.vars.pupup_images_current != rosgranstroy_lightbox.vars.pupup_data_count - 1) {
				rosgranstroy_lightbox.vars.pupup_images_current++;
				rosgranstroy_lightbox.show.popup(rosgranstroy_lightbox.vars.pupup_images_current);
				$('#rosgranstroy_photo_popup_left').show();
			} else {
				$('#rosgranstroy_photo_popup_right').hide();
			}
		},
		
		sprev : function() {
			if(rosgranstroy_lightbox.vars.pupup_images_current != 0) {
				rosgranstroy_lightbox.vars.pupup_images_current--;
				rosgranstroy_lightbox.show.popup(rosgranstroy_lightbox.vars.pupup_images_current);
				$('#rosgranstroy_photo_popup_right').show();
			} else {
				$('#rosgranstroy_photo_popup_left').hide();
			}
		}
	},
	
	hide : {
		popup : function() {
			$('#rosgranstroy_photo_popup').hide();
			$('#rosgranstroy_darkening').hide();
		}
	},
	
	def : {
		data : function(popup_data) {
			rosgranstroy_lightbox.vars.popup_data = popup_data;
		},
		data_count : function(cont) {
			rosgranstroy_lightbox.vars.pupup_data_count = cont;
		}
	}
	
}