function adjustHeights() {
	//Get the screen height and width
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();	
	//Set height and width to mask to fill up the whole screen
	$('#mask').css({'width':maskWidth,'height':maskHeight});
	//Get the window height and width
	var winH2 = $(window).height();
	var winW2 = $(window).width();              
	//Set the popup window to center
	$('#dialog').css('top',  winH2/2-$('#dialog').height()/2);
	$('#dialog').css('left', winW2/2-$('#dialog').width()/2);
}
function clearText(id,defaultValue) {
	valueTxt = document.getElementById(id).value;
	if (valueTxt == defaultValue)
	{
	  document.getElementById(id).value = '';
	  document.getElementById(id).style.color= '#333333';
	}
}
/*
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
<input type="text" value="Search this site" onFocus="clearText(this)">
*/
$(document).ready(function() {
	$(".openCloseDiv").click(function () {
      	$(".extraInfoHide").slideToggle("slow");
	});
	$('#toggle').toggle( 
	    function() { 
	        $('#toggleText').slideDown(); 
	        $(this).html('&laquo; chiudi');
	    }, 
	    function() { 
	        $('#toggleText').slideUp();
	        $(this).html('...altro &raquo;');
	    } 
	);
	$('#toggle2').toggle( 
	    function() { 
	        $('#toggleText2').slideDown(); 
	        $(this).html('Chiudi');
	    }, 
	    function() { 
	        $('#toggleText2').slideUp();
	        $(this).html('Personalizza');
	    } 
	);
	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set height and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(300);
		$('#mask').fadeTo("fast",0.7);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(300); 
	
	});	
	//if close button is clicked
	$('.boxModal .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		$('#mask, .boxModal').hide();
	});	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.boxModal').hide();
	});
	$("#tabuser").tabs();
	$("#tabnews").tabs();
	var data = "Core,Selectors,Attributes,Traversing,Manipulation,CSS,Events,Effects,Ajax,Utilities,Limewire 5.3,Limewire Plug-in,Limewire 4.2,Limewire ads-on,Limewire Plug-in,Limewire 4.2,Limewire ads-on,Limewire Limewire Limewire Limewire Limewire Limewire Limewire ".split(",");
	$("#searchText").autocomplete(data);
});	
$(window).resize(function() {
	adjustHeights();  // Set the heights once more
});

