window.onload = function(){
    if(navigator.product=="Gecko" && navigator.userAgent.indexOf("rv:1.7")>=-1){
		var s = document.body.style;
		s.display = "none";
		s.display = "";
    }
}

$(document).ready(function() {
	$.Lightbox.construct({
		"show_linkback": false,
		"show_helper_text": false,
		"show_info": true,
		"show_extended_info": true,
		"download_link": false
	});
	
	$("a.popup").click(function(e){				
		$("div.popup_window").fadeOut();
		var ev=e;
		$.get("ajax.php?popup=1&url="+$(this).attr("href"), function(res){
			closeBTN="<div class='popupclose_wrapper'><a class='popupclose'><img src='css/images/delete_16x16.gif' /></a></div>";
			
			$("<div class='popup_window'></div>").appendTo("body").html(closeBTN+res+closeBTN).css("top", ev.pageY - 250).css("left", ev.clientX + 30).fadeIn();
		});
		return false;
	});
	
	$("a.popupclose").click(function(){
		$("div.popup_window").fadeOut();
	});
	
	$(document).click(function(){
		$("div.popup_window").fadeOut();
	});
	
	if($.isFunction($.fn.button))$('.button').each(function(){
		var c=$(this).attr('class').split(' '),icons=new Array(),j=0;
		for(var i=0;i<c.length;i++){
			if(c[i].indexOf('icon-')!=-1){
				icons[j]=c[i];
				j++;
			}
		}
		if(!icons.length)$(this).button();
		else{
			$(this).button({
				icons:{
					primary: "ui-"+icons[0],
					secondary: (icons.length>=2)?"ui-"+icons[1]:""
				}
			});
		}
	});
});

function AddToFavorite(document_title){
    if(window.sidebar)window.sidebar.addPanel(document_title, document.location, "");
    window.external.AddFavorite(document.location, document_title);
}

