function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
$.fn.centerInClient = function(options) {
 var opt = { forceAbsolute: false,
			container: window,    // selector of element to center in
			completeHandler: null
		  };
$.extend(opt, options);
return this.each(function(i) {
	var el = $(this);
	var jWin = $(opt.container);
	var isWin = opt.container == window;

	// force to the top of document to ENSURE that 
	// document absolute positioning is available
	if (opt.forceAbsolute) {
		if (isWin)
			el.remove().appendTo("body");
		else
			el.remove().appendTo(jWin.get(0));
	}

	// have to make absolute
	el.css("position", "absolute");

	// height is off a bit so fudge it
	var heightFudge = isWin ? 2.0 : 1.8;

	var x = (isWin ? jWin.width() : jWin.outerWidth()) / 2 - el.outerWidth() / 2;
	var y = (isWin ? jWin.height() : jWin.outerHeight()) / heightFudge - el.outerHeight() / 2;

	el.css("left", x + jWin.scrollLeft());
	el.css("top", y + jWin.scrollTop());

	// if specified make callback and pass element
	if (opt.completeHandler)
		opt.completeHandler(this);
});
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=310,height=270,left = 490,top = 250');");
}

$(document).ready(function(){ 
	$("img").pngfix();
	$('.login-text').focus(function(){
			$(this).val('');
	});
	if($('.login-pass').val()!='password'){
		$('.login-pass').replaceWith('<input type="password" name="password" class="login-pass"/>');
	}

	$('.login-pass').focus(function(){
			if($(this).val()=='password'){
				$(this).replaceWith('<input type="password" name="password" class="login-pass"/>');
				$('input[name=password]').focus();
			}
	});
	$('.searchText').focus(function(){
				$(this).val('');
	});
	$("#ul_menu_top li").hover(function(){
			var pos = $(this).offset();
			$(this).find('ul:first').css('left',pos.left);
			$(this).find('ul:first').css('top',pos.top+37);
			 
			$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(500);
			},function(){
				$(this).find('ul:first').css({visibility: "hidden"});
	});
   	$('#slideshowHolder').cycle({
		fx: 'fade'
	}); 
	$('#picCrew').cycle({ 
		fx: 'scrollDown' ,
		speed:    500, 
        timeout:  5000
	});
	$('.link_stream').click(function(){
		popUp('http://cassanovabalifm.com/live/');return false;
	}); 
 	  FLIR.init();  
      FLIR.auto([ 'h1', 'h2', 'div.hederBoxLeft', 'div.hederBoxRight' ]); 
	$('.containercharts').jCarouselLite({
		vertical: true,
		visible: 10,  
		auto:2000,  
		speed:1000
	});
	$('.event').jCarouselLite({
		vertical: true,
		visible: 3,  
		auto:2000,  
		speed:1000
	});
	$(".topMenuAction").click( function() {
 		if ($("#openCloseIdentifier").is(":hidden")) {
			$("#slider").animate({ 
				marginTop: "-141px"
				}, 500,function(){$("#topMenuImage").html('Login');} );
			$("#openCloseIdentifier").show();
		} else {
			$("#slider").animate({ 
				marginTop: "0px"
				}, 500,function(){$("#topMenuImage").html('Close');});
			$("#openCloseIdentifier").hide();
			
		}return false;
	});
}); 
 
