// Popup for live events
function popup() {
var live = $('.live');
live.click(function() {
var url = this.href;
window.open(url, "Pepsifoci_popup", 
"status = 1, height = 600, width = 650, resizable = 1, scrollbars = yes")
return false;
});
}

// Image popup for story pages
function image_popup() {
var image_link = $('.popup_image');
image_link.click(function() {
var url = this.href;
window.open(url, "Pepsifoci_image_popup", "status = 1, height = 300, width = 410, resizable = 1");
return false;
});
}

// Bookmark
function bookmark() {
var	favourite = $('#favourite');
favourite.click(function() {
	url = 'http://pepsifoci.hu/';  
  title = 'Pepsifoci.hu | 100% foci';  
	if (window.sidebar) {  
		window.sidebar.addPanel(title, url,'');  
  }  
  if (window.external) {  
		window.external.AddFavorite(url, title);   
  }  
  if(window.opera && window.print) {  
		return true;  
	}
  });
}

// Add to favourites
function fav() {
var fav = $('#fav');
fav.click(function() {
	url = 'http://pepsifoci.hu/';  
  title = 'Pepsifoci.hu | 100% foci';  
	if (window.sidebar) {  
		window.sidebar.addPanel(title, url,'');  
  }  
  if (window.external) {  
		window.external.AddFavorite(url, title);   
  }  
  if(window.opera && window.print) {  
		return true;   
  }
	});
}

// Set as start page
function startpage() {
var	startpage = $('#startpage');
startpage.click(function() {
	if (window.external) {  
		this.style.behavior = 'url(#default#homepage)';  
		this.setHomePage('http://pepsifoci.hu/');  
	}
	});
}

// Add active class to main menu when child in dropdown is active
function activemenu() {
$('#nice-menu-1 > li > ul > li > a.active').parent('li').parent('ul').parent('li').children('a').addClass('active');
}

if (Drupal.jsEnabled) {
  $(document).ready(bookmark);
  $(document).ready(fav);
  $(document).ready(startpage);
	$(document).ready(popup);
	$(document).ready(image_popup);
	$(document).ready(activemenu);
}
