function ie8() { return $.browser.msie && $.browser.version=='8.0' }
function ie7() { return $.browser.msie && $.browser.version=='7.0' }
function ie6() { return $.browser.msie && $.browser.version=='6.0' }
function mozilla() { return $.browser.mozilla }
try {
	DD_roundies.addRule('.actualidad-cine div.pestana', '0 8px 8px 8px', true);
}catch (e) {}
try {
DD_roundies.addRule('.actualidad-cine div.pestana .in', '0px 8px 0 0',true);
}catch (e) {}
try {
DD_roundies.addRule('.actualidad-cine .content-detail,.videotrailer', '8px',true);
}catch (e) {}

// management of .clicable, .external and .window
$(function() {
	var popup = function(url) {
      var aw = screen.availWidth - 10;
      var w = 490;
      var h = 535;
      xc = (aw - w) / 2; // center

      var features = 'status=no,scrollbars=yes,menubar=no,toolbar=no,'
         + 'location=no,directories=no,resizable=yes,copyhistory=no,'
         + 'width=' + w + ',height=' + h + ',' + 'left=' + xc
         + ',top=0,screenX=' + xc + ',screenY=0';
		
      window.open(url, 'popup', features).focus();
	  return false;
	}

	function exclude(e) {
		var el = $(e.target);

		if(el.is('.clicable-exclude') || el.is('.clickable-exclude') ||
				e.target.tagName == 'A' || e.target.tagName == 'INPUT')
					return true;

		return false;
	};

	// all clicable divs can be clicked anywhere
	$(".clicable, .clickable").click(function(event) {
		if (exclude(event)) return true;

		$(this).find("a").each( function() {
				var content = $(this);
				var url = content.attr("href");
				content.is('.external')? window.open(url):document.location = url;
				return false;
		})
	});

	// all clicable divs show pointers when hovered
	$(".clicable, .clickable").hover(
		function(event) {
			if(exclude(event)) return true
			if($(this).find("a").size() > 0)
				$(this).css("cursor", "pointer")
      }, function(event) {
			if(exclude(event)) return true
			if($(this).find("a").size() > 0)
				$(this).css("cursor", "auto")
	});

	// all links with class window, open as a popup
	$('.window').live('click', function() {
		popup($(this).attr('href'));
		return false;
	});

	// all links with class external open in another window
	$('.external').live('click', function(event) {
		window.open($(this).attr('href'));
		return false;
	});

	if(ie6()) {
		$('#trama').css('height', $(window).height() +'px')
		$(window).scroll(function() { 
			var wt=$(window).scrollTop()
			$('#trama').css({top: wt +'px'})
		})
	}
	/*
	 * Modifying Main Menu so that the links work.
	 */

	if(ie6()){
		var $contentLayer = $('#header-contents');
		var content = $contentLayer.html();
		$contentLayer.empty().after('<div id="bg-header">' + content + '</div>');
	}
});

/*
 * Avoid the autocomplete of the passwords by the browser 
 */


$('#block-2').live('click', function(){
	window.open("/elojeador/index.htm", '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=820,left = 340,top = 115');
	return false;
});

function isMac()
{
    var navInfo = window.navigator.appVersion.toLowerCase();
    if(navInfo.indexOf('mac') != -1){
        return true;
    }
    return false;
}

$(function() {
	$('#loginform').attr("autocomplete", "off");
});

